/* rules — the rules page's own styles, and the RP guide's (the same template); the tokens are tokens.css, the header, footer and buttons site.css */
/* ============ Base ============ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--ink) var(--grain-dark); color: var(--bone); font-family: var(--f-body); font-size: var(--t-body); line-height: 1.7; overflow-x: hidden; }
/* Parchment ground — light mode only */
html:not([data-theme="dark"]) body {
  background-color: var(--ink);
  background-image:
  radial-gradient(125% 90% at 50% -8%, rgba(255,251,238,.28), transparent 58%),
  radial-gradient(110% 120% at 50% 118%, rgba(74,54,22,.045), transparent 55%),
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='600'%3E%3Cfilter id='pm' filterUnits='userSpaceOnUse' x='0' y='0' width='600' height='600'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.01' numOctaves='4' seed='11' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .30 0 0 0 0 .20 0 0 0 0 .08 0 0 0 .08 0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='gamma' amplitude='1.1' exponent='.8'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23pm)'/%3E%3C/svg%3E"),
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='pg' filterUnits='userSpaceOnUse' x='0' y='0' width='200' height='200'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .32 0 0 0 0 .22 0 0 0 0 .10 0 0 0 .022 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23pg)'/%3E%3C/svg%3E");
  background-size: cover, cover, 600px 600px, 200px 200px;
  background-repeat: no-repeat, no-repeat, repeat, repeat;
  background-attachment: fixed, fixed, scroll, scroll;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.12; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
a { color: inherit; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 3px; border-radius: 2px; }
/* ============ Page hero ============ */
.page-hero { position: relative; isolation: isolate; min-height: 60vh; min-height: 60svh; display: flex; align-items: center; justify-content: center; text-align: center; padding: calc(var(--header-h) + var(--s5)) 0 var(--s5); overflow: hidden; }
.page-hero-art { position: absolute; inset: 0; z-index: -2; }
.page-hero-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 42%; filter: var(--grade); }
/* over the image: the homepage hero's 40% black veil, so the words read clearly */
.page-hero-art::after { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, .4); -webkit-backdrop-filter: blur(1px); backdrop-filter: blur(1px); }
.page-hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--grain-dark); background-color: rgba(11, 10, 9, .5); }
.page-hero-inner { max-width: 820px; margin-inline: auto; display: flex; flex-direction: column; align-items: center; }
.page-hero .sub { font-family: var(--f-title); font-size: clamp(1rem, .9rem + .5vw, 1.25rem); font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-hi); text-shadow: 0 2px 16px rgba(0,0,0,.7); margin-bottom: var(--s2); }
.page-hero h1 { font-family: var(--f-hero); font-size: clamp(2.75rem, 1.6rem + 4.5vw, 5rem); font-weight: 400; line-height: 1; letter-spacing: .01em; color: var(--on-dark); text-shadow: 0 4px 24px rgba(0,0,0,.7); }
.page-hero .lead { margin-top: var(--s3); max-width: 56ch; font-size: clamp(1.125rem, 1rem + .4vw, 1.3125rem); line-height: 1.55; color: var(--on-dark); text-shadow: 0 2px 14px rgba(0,0,0,.7); }
/* Hero divider — gilded rampart with a banner valance hung from it */
.hero-divider { position: relative; z-index: 3; margin-top: -16px; pointer-events: none; }
.hero-divider .merlons {
  height: 16px; background: linear-gradient(180deg, var(--btn-rule-color), var(--gold-hi));
  -webkit-mask: linear-gradient(#000 0 0) bottom / 100% 6px no-repeat, repeating-linear-gradient(90deg, #000 0 16px, transparent 16px 32px) top / 100% 10px no-repeat;
  mask: linear-gradient(#000 0 0) bottom / 100% 6px no-repeat, repeating-linear-gradient(90deg, #000 0 16px, transparent 16px 32px) top / 100% 10px no-repeat;
}
.hero-divider .valance {
  height: 34px; background: var(--grain-dark), linear-gradient(180deg, var(--btn-red), var(--btn-red-deep)); border-top: 2px solid var(--btn-rule-color);
  -webkit-mask: radial-gradient(circle 14px at 16px 100%, transparent 96%, #000 100%) 0 0 / 32px 100% repeat-x;
  mask: radial-gradient(circle 14px at 16px 100%, transparent 96%, #000 100%) 0 0 / 32px 100% repeat-x;
}
/* ============ Section scaffold ============ */
.section { padding-block: clamp(var(--s6), 10vw, var(--s7)); scroll-margin-top: var(--header-h); }
.section-head { max-width: 62ch; }
.section-title { font-family: var(--f-hero); font-weight: 400; font-size: clamp(2.25rem, 1.6rem + 2.6vw, 3.25rem); letter-spacing: .01em; color: var(--bone); }
.section-standfirst { margin-top: var(--s1); font-size: 1.1875rem; line-height: 1.55; color: var(--muted); }
/* ============ Rule sections ============ */
.rules { padding-block: var(--s4) var(--s6); }
.rules-sec { padding-block: var(--s5); border-top: 1px solid var(--border); scroll-margin-top: var(--header-h); }
.rules-sec:first-child { border-top: 0; }
.rules-sec .eyebrow { display: block; font-family: var(--f-title); font-size: var(--t-xs); font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--btn-red); margin-bottom: 10px; }
[data-theme="dark"] .rules-sec .eyebrow { color: var(--gold-hi); }
.rule-list { list-style: none; margin: var(--s4) 0 0; padding: 0; max-width: 880px; display: flex; flex-direction: column; gap: var(--s2); }
.rule { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s2); align-items: start; background: var(--surface); border: 1px solid var(--border); border-top: 2px solid color-mix(in oklab, var(--gold-hi) 55%, transparent); border-radius: 0 0 10px 10px; padding: var(--s3); scroll-margin-top: calc(var(--header-h) + 16px); }
.rule:target { border-color: var(--gold-hi); box-shadow: 0 0 0 1px var(--gold-hi); }
.rule-no { display: inline-flex; align-items: center; justify-content: center; min-width: 52px; height: 44px; padding: 0 8px; font-family: var(--f-title); font-weight: 700; font-size: 1.0625rem; color: var(--btn-on-red); text-decoration: none; text-shadow: 0 1px 2px rgba(20,4,2,.7); background: var(--btn-cloth), linear-gradient(to bottom, var(--btn-red), var(--btn-red-deep)); border-radius: 6px; box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--btn-rule-color) 50%, transparent); white-space: nowrap; transition: filter var(--dur-s) var(--ease-out); }
@media (hover: hover) {
  .rule-no:hover { filter: brightness(1.12); }
}
.rule-title { font-family: var(--f-title); font-weight: 700; font-size: 1.1875rem; line-height: 1.3; color: var(--bone); padding-top: 8px; }
.rule-why { margin-top: 8px; font-size: 1.0625rem; line-height: 1.6; color: var(--muted); max-width: 68ch; }
/* Formatted text (written in the control panel's editor): an item's explanation and examples, a section of text */
.rich > * + * { margin-top: 8px; }
.rich ul, .rich ol { margin: 0; padding-left: 1.5em; }
/* set, not left to the browser: inside a rule card a list is already within the page's list of rules */
.rich ul { list-style: disc; }
.rich ol { list-style: decimal; }
.rich li ul { list-style: circle; }
.rich li + li { margin-top: 4px; }
.rich li > ul, .rich li > ol { margin-top: 4px; }
.rich li::marker { color: color-mix(in oklab, var(--gold-hi) 80%, var(--muted)); }
.rich strong { font-weight: 700; color: var(--bone); }
.rich a { color: var(--btn-red); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
[data-theme="dark"] .rich a { color: var(--gold-hi); }
@media (hover: hover) {
  .rich a:hover { text-decoration-thickness: 2px; }
}
.rich blockquote { margin: 0; padding: 2px 0 2px 16px; border-left: 2px solid color-mix(in oklab, var(--gold-hi) 70%, transparent); font-style: italic; }
.rich h3 { font-family: var(--f-title); font-weight: 700; font-size: 1.3125rem; line-height: 1.3; color: var(--bone); }
.rich * + h3 { margin-top: var(--s1); }
/* A rule's examples — a closed accordion at the foot of its card, only on the rules Management gave examples */
.rule-ex { margin-top: 12px; max-width: 68ch; }
.rule-ex summary { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; list-style: none; font-family: var(--f-title); font-weight: 700; font-size: var(--t-sm); letter-spacing: .12em; text-transform: uppercase; color: var(--btn-red); border-radius: 4px; }
.rule-ex summary::-webkit-details-marker { display: none; }
.rule-ex summary::before { content: ""; width: 8px; height: 8px; margin-inline: 2px 4px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform var(--dur-s) var(--ease-out); }
.rule-ex[open] summary::before { transform: rotate(45deg) translate(-2px, -2px); }
.rule-ex-n { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; font-size: .75rem; letter-spacing: 0; color: var(--bone); background: color-mix(in oklab, var(--gold-hi) 28%, transparent); }
.rule-ex > ul { list-style: none; margin: 8px 0 4px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.rule-ex > ul > li { padding: 10px 14px; border-left: 2px solid color-mix(in oklab, var(--gold-hi) 70%, transparent); background: color-mix(in oklab, var(--gold-hi) 7%, transparent); border-radius: 0 6px 6px 0; font-size: 1rem; line-height: 1.6; color: var(--muted); }
[data-theme="dark"] .rule-ex summary { color: var(--gold-hi); }
@media (hover: hover) {
  .rule-ex summary:hover { filter: brightness(1.15); }
}
/* Contents — a sticky column beside the rules on a wide screen; hidden below that */
.rules-toc { display: none; }
@media (min-width: 1100px) {
  .rules-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: var(--s5); align-items: start; }
  .rules-toc { display: block; position: sticky; top: calc(var(--header-h) + var(--s2)); margin-top: var(--s5); max-height: calc(100vh - var(--header-h) - var(--s4)); overflow-y: auto; overscroll-behavior: contain; padding: var(--s2); background: var(--surface); border: 1px solid var(--border); border-top: 2px solid color-mix(in oklab, var(--gold-hi) 55%, transparent); border-radius: 0 0 10px 10px; }
}
.rules-toc h2 { font-family: var(--f-title); font-size: var(--t-xs); font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--faint); margin-bottom: 10px; }
.rules-toc ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.rules-toc a { display: grid; grid-template-columns: 1.6em minmax(0, 1fr); gap: 6px; padding: 6px 10px 6px 8px; margin-inline: -8px; border-left: 2px solid transparent; border-radius: 0 6px 6px 0; font-size: var(--t-sm); line-height: 1.4; color: var(--muted); text-decoration: none; transition: color var(--dur-s) var(--ease-out), background-color var(--dur-s) var(--ease-out); }
.rules-toc .n { font-family: var(--f-title); font-weight: 700; color: var(--faint); }
.rules-toc a.is-current { color: var(--bone); border-left-color: var(--btn-red); background: color-mix(in oklab, var(--gold-hi) 10%, transparent); }
.rules-toc a.is-current .n { color: var(--btn-red); }
[data-theme="dark"] .rules-toc a.is-current { border-left-color: var(--gold-hi); }
[data-theme="dark"] .rules-toc a.is-current .n { color: var(--gold-hi); }
@media (hover: hover) {
  .rules-toc a:hover { color: var(--bone); background: color-mix(in oklab, var(--gold-hi) 10%, transparent); }
}
/* Moderation — statements, not numbered rules */
.closing { margin-top: var(--s4); max-width: 880px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: var(--s4); display: flex; flex-direction: column; gap: var(--s2); }
.closing p, .closing ul, .closing ol, .closing blockquote { font-size: 1.125rem; line-height: 1.65; color: var(--muted); max-width: 68ch; }
.closing li p, .closing blockquote p { font-size: inherit; }
/* the section's own gap spaces its blocks */
.closing.rich > * + * { margin-top: 0; }
.closing.rich > h3 + * { margin-top: calc(8px - var(--s2)); }
.closing .final { padding-top: var(--s2); border-top: 1px solid var(--border); font-family: var(--f-title); font-weight: 600; font-size: 1.1875rem; line-height: 1.45; color: var(--bone); }
/* ============ Reveal ============ */
.reveal { opacity: 0; transform: translateY(12px); transition: opacity var(--dur-l) var(--ease-out), transform var(--dur-l) var(--ease-out); }
.reveal.is-in { opacity: 1; transform: none; }
/* ============ Responsive ============ */
@media (max-width: 767px) {
  .rules-sec { padding-block: var(--s4); }
  .rule { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: var(--s2); }
  .rule-no { justify-self: start; }
  .rule-title { padding-top: 0; }
  .closing { padding: var(--s3) var(--s2); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after { transition-duration: 1ms !important; animation: none !important; }
}
/* no introduction written in the control panel: no empty line under the title */
.page-hero .lead:empty { display: none; }
