/* ==========================================================================
   LEAK HUNTER · SITE A · css/fig-rules.css — figure "rules" (#rules)
   House rules as a manifesto: four full-width rows on hairlines, no cards,
   no sticky column. Each row carries a giant chrome numeral (the stops of
   the 30–40% band) that sinks into the row's bottom hairline.
   The static CSS is the final composition (no JS, reduced motion);
   js/fig-rules.js adds .is-armed for the entrance pre-roll.
   Everything is scoped under #rules.
   ========================================================================== */

#rules {
  /* colour: --rl-w = the section's text, --rl-f* / --rl-d* / --rl-k = the chrome numerals (face
     stops, extrusion stops, dark reflection edge): neutral steel with a light top, page-surface edge */
  --rl-w: var(--text-rgb);
  --rl-f1: #F9F8F4; --rl-f2: #E2E0DD; --rl-f3: #B4B3B1; --rl-f4: #757574; --rl-f5: #222222;
  --rl-f6: #4C4C4C; --rl-f7: #BEBDBB; --rl-f8: #F2F1ED; --rl-f9: #A7A6A4; --rl-f10: #606060;
  --rl-d1: #797978; --rl-d2: #30302F; --rl-d3: #121212; --rl-d4: #060606;
  --rl-k: var(--bg-rgb);
  --rl-line: rgba(255, 255, 255, .1);
  --rl-text: rgb(var(--rl-w) / .72);
  --rl-cap: rgb(var(--rl-w) / .64);
  --rl-g1: clamp(28px, 2.4vw, 44px);   /* row column gap */
  --rl-g2: clamp(24px, 1.8vw, 36px);   /* title ↔ text gap on wide screens */
  padding-top: var(--sp-l);
  padding-bottom: var(--sp-m);
}
#rules .id { text-transform: none; letter-spacing: 0; }
#rules .nw { white-space: nowrap; }
#rules .tag { /* the shared honesty tag, at the run's spec */
  height: 18px; padding: 0 6px; border-radius: 4px;
  font: 700 11px/1 var(--f-display); letter-spacing: .04em; text-transform: uppercase;
}

/* ---------- opener: accent label · white giant title · lede on its baseline -------- */
#rules .rules__head {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 1fr); row-gap: 14px;
  padding-bottom: clamp(20px, 2vw, 34px);
}
#rules .rules__head::after { /* hairline 0 — the floor the title stands on */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: var(--rl-line);
  transform: scaleX(var(--ln, 1)); transform-origin: 0 50%;
}
#rules .rules__label { font: 600 13px/1.3 var(--f-ui); letter-spacing: 0; color: var(--lime); }
#rules .rules__title {
  margin-left: -.04em; /* optical: the H stem lines up with the numerals below */
  font: 700 clamp(56px, 7.2vw, 132px)/.84 var(--f-display); letter-spacing: -0.05em;
  text-transform: uppercase; color: var(--text);
}
#rules .rules__lede {
  max-width: 34em; margin-top: 4px;
  font: 400 16px/1.5 var(--f-ui); color: var(--rl-text); text-wrap: balance;
}
@media (min-width: 1200px) {
  #rules .rules__head {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "label label" "title lede";
    column-gap: clamp(48px, 4.4vw, 88px);
    align-items: end; align-items: last baseline;
  }
  #rules .rules__label { grid-area: label; }
  #rules .rules__title { grid-area: title; }
  #rules .rules__lede { grid-area: lede; max-width: none; margin-top: 0; font-size: 18px; line-height: 1.45; text-wrap: wrap; }
  #rules .rules__lede-a, #rules .rules__lede-b { display: block; } /* two deliberate lines */
}
/* wide: the lede starts exactly on the rows' text column (same maths as the row grid) */
@media (min-width: 1520px) {
  #rules .rules__head {
    grid-template-columns:
      calc(.3 * (100% - 2 * var(--rl-g1)) + var(--rl-g1) + 11 / 23 * (.46 * (100% - 2 * var(--rl-g1)) - var(--rl-g2)) + var(--rl-g2))
      minmax(0, 1fr);
    column-gap: 0;
  }
}

/* ---------- rows ---------------------------------------------------------------- */
#rules .rules__list { list-style: none; margin: 0; padding: 0; }
#rules .rule { position: relative; }
#rules .rule::after { /* the row's floor: its numeral sinks into it, and the line catches the chrome */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, .34) 0%, rgba(255, 255, 255, .2) 13%, var(--rl-line) 26%);
  transform: scaleX(var(--ln, 1)); transform-origin: 0 50%;
}
#rules .rule::before { /* hover glint along the floor (fine pointers) */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; height: 1px;
  background: linear-gradient(90deg, var(--lime), rgb(var(--lime-rgb) / .55) 46%, rgb(var(--lime-rgb) / 0));
  transform: scaleX(0); transform-origin: 0 50%;
  transition: transform .9s var(--ease-io);
  pointer-events: none;
}
#rules .rule__in { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1fr); }

/* chrome numeral, cropped by the floor ------------------------------------------- */
#rules .rule__fig {
  --rl-num: clamp(120px, 15vw, 260px);
  position: relative; overflow: hidden;
  height: .6em; /* ≈ the top 80% of the digits; the rest is under the floor */
  margin-left: -.05em; /* optical: the 0's bearing lines up with the title's H */
  font-size: var(--rl-num); line-height: 0;
}
#rules .rule__lift { display: block; white-space: nowrap; transition: transform 1s var(--ease-out); }
#rules .rule__no {
  position: relative; display: inline-block; vertical-align: top;
  padding: 0 .07em 0 .01em; /* trailing tracking: keeps the last glyph's edge inside the clip box */
  font: 700 1em/.76 var(--f-display); letter-spacing: -0.05em; white-space: nowrap;
  font-variant-numeric: tabular-nums; /* four numerals, one width */
}
#rules .rule__of { /* "/04" — the counter at the numeral's cap line */
  display: inline-block; vertical-align: top;
  margin: calc(var(--rl-num) * .05) 0 0 calc(var(--rl-num) * .03);
  font: 600 13px/1 var(--f-ui); letter-spacing: .02em; font-variant-numeric: tabular-nums;
  color: var(--rl-cap);
}
#rules .rule__face,
#rules .rule__depth {
  display: block;
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
}
#rules .rule__depth { /* extrusion slab: peeks out under every downward edge */
  position: absolute; left: 0; top: 0; right: 0;
  padding: inherit;
  transform: translateY(.03em);
  background-image: linear-gradient(180deg, var(--rl-d1) 0%, var(--rl-d2) 26%, var(--rl-d3) 58%, var(--rl-d4) 100%);
}
#rules .rule__face {
  --sx: 100; --gx: 50;
  position: relative;
  background-image:
    /* specular sweep — a dark reflection edge leads the hot band */
    linear-gradient(114deg, rgb(var(--rl-k) / 0) 40%, rgb(var(--rl-k) / .8) 46.6%, rgba(255, 255, 255, 1) 49.4%, rgba(255, 255, 255, .55) 51.8%, rgba(255, 255, 255, 0) 55.6%),
    /* broad sheen, drifts while the section is on screen */
    radial-gradient(38% 90% at calc(var(--gx) * 1%) 14%, rgba(255, 255, 255, .34), rgba(255, 255, 255, 0) 72%),
    /* the 30–40% chrome stops */
    linear-gradient(180deg,
      var(--rl-f1) 2%, var(--rl-f2) 17%, var(--rl-f3) 32%,
      var(--rl-f4) 46%, var(--rl-f5) 51%, var(--rl-f6) 53.5%,
      var(--rl-f7) 66%, var(--rl-f8) 79%, var(--rl-f9) 90%, var(--rl-f10) 100%);
  background-size: 300% 100%, 100% 100%, 100% 100%;
  background-position: calc(var(--sx) * 1%) 0, 0 0, 0 0;
  background-repeat: no-repeat;
}

/* body ------------------------------------------------------------------------- */
#rules .rule__title {
  font: 700 clamp(32px, 1.6vw + 12px, 44px)/.98 var(--f-display); letter-spacing: -0.035em;
  text-transform: uppercase; color: var(--text);
  transition: color .35s ease;
}
#rules .rule__text {
  max-width: 36em; margin-top: clamp(12px, 1vw, 16px);
  font: 400 17px/1.55 var(--f-ui); color: var(--rl-text);
}

/* meta exhibits ------------------------------------------------------------------- */
#rules .rule__meta { min-width: 0; }
#rules .rule__cap { margin-top: 12px; font: 600 13px/1.35 var(--f-ui); color: var(--rl-cap); }
/* 02 · the way to the record format (#schema in the Leak Index) */
#rules .rule__more {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; margin-top: 4px;
  font: 600 13px/1.2 var(--f-ui); color: var(--lime); text-decoration: none;
  text-underline-offset: 3px; text-decoration-thickness: 1px;
}
#rules .rule__more .i { flex: none; width: 13px; height: 13px; transition: transform .35s var(--ease-out); }
#rules .rule__more:focus-visible { outline-offset: 3px; border-radius: 4px; }
@media (hover: hover) and (pointer: fine) {
  #rules .rule__more:hover { text-decoration-line: underline; }
  #rules .rule__more:hover .i { transform: translateX(3px); }
}

/* 01 · fourteen day-ticks, a ruler of the response window */
#rules .rule__days { display: flex; justify-content: space-between; align-items: flex-end; height: 26px; max-width: 360px; }
#rules .rule__days i {
  display: block; width: 3px; height: 100%; border-radius: 2px;
  background: var(--lime); transform-origin: 50% 100%;
}
#rules .rule__days i:first-child { box-shadow: 0 0 12px rgb(var(--lime-rgb) / .55); }

/* 02 · example signature chip + Sim tag (top-right of the module) */
#rules .rule__proof { display: flex; align-items: center; gap: 10px; max-width: 360px; }
#rules .rule__proof::before { /* chip ··· Sim — the tag sits at the module's top-right end */
  content: ""; order: 1; flex: 1 1 16px; min-width: 16px; height: 0;
  border-bottom: 1px dotted rgba(255, 255, 255, .26);
  transform: scaleX(var(--lead, 1)); transform-origin: 0 50%;
}
#rules .rule__proof .rule__sig { order: 0; }
#rules .rule__proof .tag { order: 2; }
#rules .rule__sig {
  display: inline-flex; align-items: center; height: 34px; padding: 0 12px; border-radius: 8px;
  background: rgba(255, 255, 255, .045); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .13);
  font: 400 14px/1 var(--f-mono); color: rgb(var(--rl-w)); white-space: nowrap; font-variant-numeric: tabular-nums;
}
#rules .rule__sig-v { display: inline-block; }
#rules .rule__sig-v .c { display: inline-block; transition: color .2s ease; }
#rules .rule__sig-v .c.is-scr { color: var(--lime); }

/* 03 · one accent transaction among other people's flow */
#rules .rule__flow { display: flex; gap: 5px; height: 24px; max-width: 360px; }
#rules .rule__flow i { display: block; flex: 1 1 0; min-width: 6px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22); }
#rules .rule__flow i.is-ours { background: var(--lime); box-shadow: 0 0 16px rgb(var(--lime-rgb) / .45); }

/* 04 · the cost of measuring, with dotted leaders */
#rules .rule__cost { display: grid; gap: 9px; max-width: 360px; margin: 0; }
#rules .rule__cost > div { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; }
#rules .rule__cost > div::before {
  content: ""; order: 1; flex: 1 1 16px; min-width: 16px; height: 0;
  border-bottom: 1px dotted rgba(255, 255, 255, .26);
  transform: translateY(-.28em) scaleX(var(--lead, 1)); transform-origin: 0 50%;
}
#rules .rule__cost dt { order: 0; font: 600 13px/1.35 var(--f-ui); color: var(--rl-cap); }
#rules .rule__cost dd { order: 2; margin: 0; font: 500 13px/1.35 var(--f-ui); color: rgb(var(--rl-w) / .86); }
#rules .rule__amt { font: 400 13px/1 var(--f-mono); color: var(--lime); white-space: nowrap; }
#rules .rule__amt--bite { color: var(--pink); }

/* ---------- ≥1024 · numeral | title + text | meta ------------------------------------ */
@media (min-width: 1024px) {
  #rules .rule__in {
    grid-template-columns: minmax(0, 30fr) minmax(0, 46fr) minmax(0, 24fr);
    column-gap: var(--rl-g1);
    padding-top: clamp(30px, 2.8vw, 48px);
  }
  #rules .rule__fig { grid-column: 1; grid-row: 1; align-self: end; }
  #rules .rule__body { grid-column: 2; grid-row: 1; align-self: start; padding-bottom: clamp(28px, 2.6vw, 44px); }
  #rules .rule__meta { grid-column: 3; grid-row: 1; align-self: end; padding-bottom: clamp(26px, 2.4vw, 40px); }
}
/* wide screens: title and text share the body column side by side (first baselines
   aligned), so short rules don't leave a hole between their text and the meta */
@media (min-width: 1520px) {
  #rules .rule__body {
    display: grid; grid-template-columns: minmax(0, 11fr) minmax(0, 12fr);
    column-gap: var(--rl-g2); align-items: first baseline;
  }
  #rules .rule__text { margin-top: 0; }
}

/* ---------- 768–1023 · numeral | body over meta ------------------------------------- */
@media (min-width: 768px) and (max-width: 1023px) {
  #rules .rule__in {
    grid-template-columns: minmax(0, 30fr) minmax(0, 70fr);
    column-gap: 28px; padding-top: 34px;
  }
  #rules .rule__fig { --rl-num: clamp(120px, 19vw, 190px); grid-column: 1; grid-row: 1 / span 2; align-self: end; }
  #rules .rule__body { grid-column: 2; grid-row: 1; }
  #rules .rule__meta { grid-column: 2; grid-row: 2; padding: 22px 0 30px; }
}

/* ---------- phones · numeral above the content, meta below ------------------------- */
@media (max-width: 767px) {
  #rules .rules__head::after { display: none; }
  #rules .rule::before, #rules .rule::after { display: none; }
  #rules .rule__in { padding: 30px 0 18px; }
  #rules .rule__fig { --rl-num: clamp(96px, 28vw, 112px); margin-bottom: 22px; }
  #rules .rule__fig::after { /* phones: each numeral sinks into its own full-width hairline */
    content: ""; position: absolute; left: .05em; right: 0; bottom: 0; z-index: 2; height: 1px; /* .05em undoes the optical shift */
    background: linear-gradient(90deg, rgba(255, 255, 255, .34) 0%, rgba(255, 255, 255, .2) 26%, var(--rl-line) 48%);
    transform: scaleX(var(--ln, 1)); transform-origin: 0 50%;
  }
  #rules .rule__title { font-size: clamp(26px, 7.4vw, 32px); }
  #rules .rule__text { font-size: 16px; }
  #rules .rule__meta { padding-top: 20px; }
}

/* ---------- hover (fine pointers): the title lights, the floor glints, the numeral lifts */
@media (hover: hover) and (pointer: fine) {
  #rules .rule:hover .rule__title { color: var(--lime); }
  #rules .rule:hover::before { transform: scaleX(1); }
  #rules .rule:hover .rule__lift { transform: translateY(-.05em); }
}

/* ---------- entrance pre-roll (js) — never blank: the row waits as a 28% ghost and
   inks in from its floor; .is-in drops the mask once the wipe has landed ----------- */
#rules.is-armed .rule:not(.is-in) .rule__in {
  -webkit-mask-image: linear-gradient(to top, #000 calc(var(--rv, 100%) - 3px), rgba(0, 0, 0, .28) var(--rv, 100%));
  mask-image: linear-gradient(to top, #000 calc(var(--rv, 100%) - 3px), rgba(0, 0, 0, .28) var(--rv, 100%));
}
