/* Weekly technical SEO audits. Same order and brand as the Yellow Slate
   experiment: heading, stats, pull line, the problem, before, now, what
   changed, close. The look is a diff: this week's list laid over last week's.
   Every section reads with no scroll effects; page.js adds the motion.
   Loaded after the engine and the site stylesheet, so site tokens win. */

:root {
  --sc-canvas: var(--bg);
  --sc-ink: var(--text);
  --sc-accent: var(--accent);
  --sc-font-display: var(--h-font);
  --sc-font-text: var(--b-font);
  --sc-font-mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, monospace;

  /* Before: a cool near black, like a diff viewer at night. Now: the site's light ground. */
  --wa-dark: #0b0e12;
  --wa-dark-2: #131820;
  --wa-line: #252c36;
  --before-ink: #f2f2f2;
  --before-soft: #9aa3ad;                    /* measured: 7.6:1 on --wa-dark */
  --accent-on-dark: var(--accent);           /* 5.35:1 on --wa-dark, 4.93:1 on --wa-dark-2 */
  --accent-on-light: #c8200f;                /* 5.35:1 on --bg, 5.03:1 on --card-bg */
  --fixed-on-dark: #4cc47c;                  /* 8.05:1 on --wa-dark-2 */
  --fixed-on-light: #17693a;                 /* 5.91:1 on --card-bg */

  --side-pad: clamp(24px, 5vw, 88px);
  --gap: clamp(56px, 8vh, 96px);
}

.tf-header { position: absolute; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------- layout -- */
.wa { background: var(--bg); color: var(--text); }
.wrap { max-width: 76rem; margin-inline: auto; padding-inline: var(--side-pad); }
.wa > .wrap + .wrap, .wa > .wrap + section, .wa > section + .wrap { margin-top: var(--gap); }
.prose > * { max-width: 46rem; }
.prose > * + * { margin-top: 18px; }
.prose p { font-size: 1.1rem; line-height: 1.7; color: var(--muted); }
.prose p strong { color: var(--text); }
.wa h2 { font-size: clamp(1.8rem, 1.3rem + 1.6vw, 2.8rem); letter-spacing: -.02em; }
.wa h3 { font-size: clamp(1.3rem, 1.1rem + .8vw, 1.8rem); letter-spacing: -.01em; }

/* ---------------------------------------------------------------- hero -- */
.wa-hero { position: relative; overflow: clip; padding-top: clamp(150px, 22vh, 220px); padding-bottom: 24px; }
.hero-copy { position: relative; z-index: 2; }
.hero-copy > * + * { margin-top: 20px; }
.eyebrow { margin: 0; font-size: 14px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-on-light); }
.hero-line {
  font-family: var(--h-font); font-weight: 700;
  font-size: clamp(2.2rem, 1.2rem + 3.2vw, 4rem);
  line-height: 1.06; letter-spacing: -.03em; max-width: 16ch; margin: 0;
}
.lead { font-size: clamp(1.1rem, 1rem + .4vw, 1.3rem); line-height: 1.6; max-width: 40ch; color: var(--muted); }

.plane { position: absolute; margin: 0; pointer-events: none; }
.plane--grid {
  inset: -340px 0 0 0; z-index: 0;
  --grid-line: color-mix(in oklab, var(--text) 6%, transparent);
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px);
  background-size: 100% 28px;                   /* ruled like a file listing */
  -webkit-mask-image: radial-gradient(80% 70% at 70% 60%, #000 30%, transparent 85%);
          mask-image: radial-gradient(80% 70% at 70% 60%, #000 30%, transparent 85%);
}
.plane--mid { z-index: 1; right: max(var(--side-pad), calc((100% - 76rem) / 2 + var(--side-pad))); bottom: 40px; width: 17rem; }
.diffcard {
  display: flex; flex-direction: column; gap: 8px; padding: 18px 20px;
  background: var(--card-bg); border-radius: var(--card-radius); box-shadow: var(--card-shadow);
}
.diffcard-title { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.dl { position: relative; height: 8px; border-radius: 3px; background: var(--line); margin-left: 18px; }
.dl::before { content: ""; position: absolute; left: -18px; top: 0; width: 8px; height: 8px; border-radius: 2px; background: var(--line); }
.dl--add, .dl--add::before { background: color-mix(in oklab, var(--fixed-on-light) 70%, var(--card-bg)); }
.dl--del, .dl--del::before { background: color-mix(in oklab, var(--accent-on-light) 70%, var(--card-bg)); }
.dl--del { width: 70%; }

/* --------------------------------------------------------------- stats -- */
.wa > .stats { margin-top: 56px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.stat {
  display: flex; flex-direction: column; padding: 26px 26px 28px;
  background: var(--card-bg); border: 1px solid var(--line); border-radius: var(--card-radius);
}
.stat-viz { height: 64px; margin-bottom: 22px; }
.estimated { grid-column: 1 / -1; margin: 0; font-size: 15px; color: var(--muted); }

/* 30 hours across 5 sites: 5 columns of 6 hour blocks. */
.viz-sites { display: grid; grid-template-columns: repeat(5, 1fr); grid-template-rows: repeat(6, 1fr); grid-auto-flow: column; gap: 3px 8px; max-width: 13rem; }
.viz-sites i { border-radius: 2px; background: var(--accent-on-light); }
/* $15,000 a year: about 195 working days, one tick each. */
.viz-days { display: grid; grid-template-columns: repeat(39, 1fr); grid-template-rows: repeat(5, 1fr); gap: 2px; }
.viz-days i { border-radius: 1px; background: var(--accent-on-light); }
/* 35 checks: 35 ticked boxes. */
.viz-checks { display: grid; grid-template-columns: repeat(7, 1fr); grid-template-rows: repeat(5, 1fr); gap: 3px; max-width: 11rem; }
.viz-checks i { position: relative; border-radius: 2px; background: var(--text); }
.viz-checks i::after {
  content: ""; position: absolute; left: 34%; top: 14%; width: 26%; height: 46%;
  border: solid var(--card-bg); border-width: 0 2px 2px 0; transform: rotate(45deg);
}

.wa-motion .stat { transition: opacity .7s var(--sc-ease-out, ease-out), transform .7s var(--sc-ease-out, ease-out); transition-delay: calc(var(--n) * 120ms); }
.wa-motion .stats:not(.is-in) .stat { opacity: 0; transform: translateY(28px); }
.wa-motion .stat-viz i { transition: transform .35s var(--sc-ease-out, ease-out), opacity .35s; transition-delay: calc(.45s + var(--i) * var(--step, 40ms)); transform-origin: bottom; }
.wa-motion .viz-days { --step: 5ms; }
.wa-motion .viz-checks { --step: 30ms; }
.wa-motion .stats:not(.is-in) .stat-viz i { transform: scale(.2); opacity: .15; }

.stat-n {
  margin: 0; font-family: var(--h-font); font-weight: 700; color: var(--text);
  font-size: clamp(2.2rem, 1.6rem + 2vw, 3.4rem); line-height: 1.05; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}
.stat-l { margin: 8px 0 0; font-size: 1rem; color: var(--muted); }

/* ----------------------------------------------------------- pull line -- */
.quote { margin-block: 0; }
.quote p {
  margin: 0; font-family: var(--h-font); font-weight: 600; color: var(--text);
  font-size: clamp(1.7rem, 1.2rem + 2.2vw, 3rem); line-height: 1.2; letter-spacing: -.025em;
  max-width: 24ch; text-wrap: balance;
}

/* -------------------------------------------------------------- before -- */
.before { background: var(--wa-dark); color: var(--before-ink); padding-block: var(--gap); }
.before h2, .before h3 { color: #fff; }
.before .prose p { color: var(--before-soft); }
.before .prose p strong { color: #fff; }
.before .cost { margin-top: var(--gap); }
.before .cost .cost-line { font-size: clamp(1.2rem, 1rem + .6vw, 1.45rem); line-height: 1.5; }

.grind { margin-top: 48px; }
.grind-stage { display: grid; grid-template-columns: 1fr 1.2fr; gap: clamp(32px, 5vw, 80px); align-items: start; }
.steps { margin: 20px 0 0; padding-left: 1.4em; color: var(--before-soft); font-size: 1.1rem; line-height: 1.5; }
.steps li + li { margin-top: 10px; }
.step-cost { display: block; font-weight: 700; color: var(--accent-on-dark); }
.stack { display: none; }

.note { font-size: 14px; color: var(--before-soft); margin: 0 0 10px; }
.panel, .crawl, .speed, .doc { display: none; }

/* The two sheets. Without motion they simply sit side by side, compared. */
.sheets { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.sheet { display: flex; flex-direction: column; min-height: 0; padding: 14px 16px; background: var(--wa-dark-2); border: 1px solid var(--wa-line); border-radius: var(--inner-radius); }
.sheet-h { margin: 0 0 8px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; font-weight: 700; color: #fff; }
.match { font-weight: 600; color: var(--before-soft); font-variant-numeric: tabular-nums; }
.match-n { color: var(--accent-on-dark); }
.rows { list-style: none; margin: 0; padding: 0; font-family: var(--sc-font-mono); font-size: 13px; line-height: 1.3; }
.rows li {
  display: grid; grid-template-columns: 1.2em 1fr auto; gap: 8px;
  padding: 4px 0; border-bottom: 1px solid var(--wa-line); color: #d6dbe0;
}
.rows li::before { content: attr(data-m); color: var(--before-soft); }
.rows li b { font-weight: 400; color: var(--before-soft); }
.rows li span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows li.is-same { color: var(--before-soft); }
.rows li.is-same::before { content: "="; }
.rows li.is-diff { color: #fff; background: color-mix(in oklab, var(--accent-on-dark) 22%, transparent); }
.rows li.is-diff::before { content: "+"; color: var(--accent-on-dark); }
.rows li.is-diff b { color: #fff; }

/* ---- pinned Before, motion only ---- */
.wa-motion .grind { margin-top: 0; }
.wa-motion .grind-stage { align-items: stretch; padding-block: clamp(56px, 10vh, 112px); background: var(--wa-dark); }
.wa-motion .grind-copy { display: flex; flex-direction: column; justify-content: center; }
.wa-motion .scene { display: flex; flex-direction: column; min-height: 0; }
.wa-motion .scene-stack { flex: 1; min-height: 0; display: grid; }
.wa-motion .scene-stack > * { grid-area: 1 / 1; min-height: 0; will-change: transform, opacity; }

.wa-motion .panel {
  display: flex; flex-direction: column; gap: 14px; align-self: center; overflow: hidden;
  padding: 20px 22px; background: var(--wa-dark-2); border: 1px solid var(--wa-line); border-radius: 14px;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .8);
}
.panel-h { margin: 0; font-size: 14px; font-weight: 700; color: #fff; }
.crawl-bar { height: 10px; border-radius: 5px; background: var(--wa-line); overflow: hidden; }
.crawl-bar i { display: block; height: 100%; width: 100%; background: var(--accent-on-dark); transform-origin: left; transform: scaleX(var(--cb, 1)); }
.crawl-kinds { margin: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.crawl-kinds span { padding: 3px 10px; border-radius: 999px; border: 1px solid var(--wa-line); font-size: 13px; color: var(--before-soft); }
.crawl-kinds span.is-on { color: #fff; border-color: var(--before-soft); }
.crawl-rows { display: flex; flex-direction: column; gap: 6px; }
.crawl-rows i { height: 14px; border-radius: 3px; background: #1c232d; }
.crawl-foot { margin: 0; font-size: 13px; color: var(--before-soft); }
.speed-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; font-family: var(--sc-font-mono); font-size: 13px; }
.speed-rows li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; color: #d6dbe0; }
.speed-rows i { height: 8px; border-radius: 4px; background: var(--accent-on-dark); transform-origin: left; transform: scaleX(var(--sb, 1)); }
.speed-rows b { font-weight: 400; color: var(--before-soft); }
.doc { background: #f4f4f5 !important; border-color: transparent !important; }
.doc .panel-h { color: var(--text); padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.doc-label { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.doc-lines { display: flex; flex-direction: column; gap: 8px; }
.doc-lines i { height: 9px; border-radius: 3px; background: #cfd2d6; transform-origin: left; transform: scaleX(var(--dw, 1)); }
.doc-lines i:last-child { width: 62%; }

.wa-motion .sheets { display: grid; grid-template-columns: 1fr; }
.wa-motion .sheets > .sheet { grid-area: 1 / 1; overflow: hidden; }
.wa-motion .sheet--last { margin: 0 64px 56px 0; }
.wa-motion .sheet--this { margin: 56px 0 0 64px; box-shadow: 0 24px 50px -18px rgba(0, 0, 0, .9); }
.wa-motion .sheet .rows { flex: 1; min-height: 0; overflow: hidden; }

/* One step at a time, as in the series. */
.wa-motion .steps { display: grid; list-style: none; padding-left: 0; margin-top: 28px; }
.wa-motion .steps li {
  grid-area: 1 / 1; margin: 0; color: #fff;
  font-family: var(--h-font); font-weight: 600; letter-spacing: -.01em;
  font-size: clamp(1.3rem, 1.05rem + 1vw, 1.9rem); line-height: 1.25;
  will-change: transform, opacity, filter;
}
.wa-motion .steps li::before {
  content: "Step " counter(list-item) " of 4"; display: block; margin-bottom: 10px;
  font-family: var(--b-font); font-size: 14px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent-on-dark);
}
.wa-motion .step-cost { display: none; }   /* the stack below carries the times */
.wa-motion .steps::after {
  content: ""; grid-area: 2 / 1; margin-top: 24px; height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent-on-dark) calc(var(--sp, 0) * 100%), var(--wa-line) 0);
}
/* The time costs stack up as the steps go by. */
.wa-motion .stack { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; }
.tchip {
  padding: 6px 12px; border-radius: 999px; font-size: 14px; font-weight: 700;
  background: var(--wa-dark-2); border: 1px solid var(--accent-on-dark); color: #fff;
  font-variant-numeric: tabular-nums; will-change: transform, opacity;
}
.stack-total {
  flex-basis: 100%; margin: 10px 0 0; font-family: var(--h-font); font-weight: 700; color: #fff;
  font-size: clamp(1.3rem, 1rem + 1vw, 1.8rem); line-height: 1.25;
}
.stack-total span { display: block; font-size: .75em; color: var(--accent-on-dark); }

/* ----------------------------------------------------------------- now -- */
.now { padding-bottom: 0; }
.turn-stage {
  --lit: 1;
  background: color-mix(in oklab, var(--bg) calc(var(--lit) * 100%), var(--wa-dark));
  display: flex; align-items: center; padding-block: var(--gap);
}
.turn-grid { width: 100%; display: grid; grid-template-columns: 1fr 1.1fr; gap: clamp(32px, 5vw, 80px); align-items: center; }
.turn-now > * + * { margin-top: 16px; }
.turn-now h2 { font-size: clamp(3rem, 2rem + 4vw, 5.5rem); line-height: 1; letter-spacing: -.04em; }
.turn-before { display: none; }
.wa-motion .turn-copy { display: grid; }
.wa-motion .turn-copy > * { grid-area: 1 / 1; align-self: center; }
.wa-motion .turn-before {
  display: block; margin: 0; max-width: 17ch; color: #fff;
  font-family: var(--h-font); font-weight: 600; letter-spacing: -.02em;
  font-size: clamp(1.9rem, 1.3rem + 2.4vw, 3.2rem); line-height: 1.15;
}
.time { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-on-light); }
.turn-line { font-size: clamp(1.2rem, 1rem + .6vw, 1.5rem); line-height: 1.5; color: var(--text); max-width: 26ch; }
.now > .prose { margin-top: 8px; }

.turn-objects { display: grid; }
.turn-objects > * { grid-area: 1 / 1; align-self: center; }
.groups-card { background: var(--card-bg); border-radius: var(--card-radius); box-shadow: var(--card-shadow); padding: 26px 30px; max-width: 38rem; }
.groups-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.groups-mark { width: 36px; height: 36px; border-radius: 50%; background: var(--accent-on-light); box-shadow: inset 0 0 0 9px #fbe3df; }
.groups-title { margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--text); }
.groups-time { margin: 0; font-size: 14px; color: var(--muted); }
.groups { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 20px; }
.group { display: flex; flex-direction: column; gap: 4px; padding-top: 12px; border-top: 3px solid currentColor; will-change: transform, opacity; }
.group--new { color: var(--accent-on-light); }
.group--fixed { color: var(--fixed-on-light); }
.group--open { color: var(--muted); }
.g-label { margin: 0; font-size: 14px; font-weight: 700; }
.g-n { margin: 0; font-family: var(--h-font); font-weight: 700; color: var(--text); font-size: clamp(1.8rem, 1.4rem + 1.2vw, 2.6rem); line-height: 1; letter-spacing: -.03em; }
.g-rows { list-style: none; margin: 8px 0 0; padding: 0; font-family: var(--sc-font-mono); font-size: 13px; color: var(--text); }
.g-rows li { padding: 5px 0; border-bottom: 1px dashed var(--line); }
.groups-foot { margin: 18px 0 0; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 14px; font-weight: 600; color: var(--text); }
.groups-foot span { font-weight: 400; color: var(--muted); }

.pile { display: none; }
.wa-motion .turn-stage { height: 100svh; padding-block: 0; }
.wa-motion .pile {
  display: flex; flex-direction: column; overflow: hidden; max-width: 30rem; padding: 16px 20px;
  background: var(--wa-dark-2); border: 1px solid var(--wa-line); border-radius: var(--inner-radius);
  will-change: transform, height, opacity;
}
.wa-motion .pile-rows { flex: 1; min-height: 0; overflow: hidden; }
.wa-motion .pile-rows li { will-change: transform, opacity; }
.pile-rows li.t-new { color: #fff; }
.pile-rows li.t-new::before { content: "+"; color: var(--accent-on-dark); }
.pile-rows li.t-fixed::before { content: "-"; color: var(--fixed-on-dark); }
.pile-rows li.t-open::before { content: "="; }
.wa-motion .turn-stage .groups-card { opacity: 0; }

.receipt { margin: 36px 0 0; max-width: none; }
.receipt img { width: 100%; height: auto; border-radius: var(--inner-radius); }
.receipt figcaption { margin-top: 12px; font-size: 15px; color: var(--muted); }

/* --------------------------------------------------------------- close -- */
.close { display: flex; flex-direction: column; align-items: flex-start; padding-bottom: calc(var(--gap) * 1.5); }
.close > * + * { margin-top: 18px; }
.close p { font-size: 1.1rem; color: var(--muted); max-width: 46rem; }
.close .tf-btn { margin-top: 28px; }
.wa .tf-btn:active { transform: translateY(0) scale(.98); filter: brightness(1.05); }

/* --------------------------------------------------------------- tablet -- */
@media (max-width: 1000px) {
  .plane--mid { display: none; }
}

/* ---------------------------------------------------------------- phone -- */
@media (max-width: 760px) {
  .logo-site { display: inline-block; padding-block: 7px; }
  .menu-toggle { padding: 14px 10px; }
  .wa-hero { padding-top: 130px; }
  .hero-line { font-size: clamp(1.9rem, 1.2rem + 3vw, 2.5rem); max-width: 18ch; }
  .stats { grid-template-columns: 1fr; gap: 16px; }
  .grind-stage, .turn-grid { grid-template-columns: 1fr; }
  .sheets { grid-template-columns: 1fr; }
  .wa-motion .grind-stage { grid-template-rows: auto 1fr; gap: 16px; padding-block: 72px 92px; }
  .wa-motion .steps { margin-top: 14px; }
  .wa-motion .steps li { font-size: 1.15rem; }
  .wa-motion .steps li::before { margin-bottom: 6px; font-size: 12px; }
  .wa-motion .steps::after { margin-top: 12px; }
  .wa-motion .grind-copy h3 { font-size: 1.15rem; }
  .wa-motion .stack { margin-top: 12px; gap: 6px; }
  .tchip { padding: 4px 9px; font-size: 12px; }
  .stack-total { margin-top: 4px; font-size: 1.1rem; }
  .wa-motion .panel { gap: 10px; padding: 14px 16px; }
  .wa-motion .sheet--last { margin: 0 28px 36px 0; }
  .wa-motion .sheet--this { margin: 36px 0 0 28px; }
  .rows { font-size: 12px; }
  .wa-motion .scene-stack > * { align-self: start; }
  .wa-motion .turn-grid { gap: 18px; }
  .turn-now h2 { font-size: 2.6rem; }
  .turn-now > * + * { margin-top: 10px; }
  .turn-line { font-size: 1.1rem; max-width: none; }
  .groups-card { padding: 18px 18px; }
  .groups-head { padding-bottom: 12px; }
  .groups-mark { width: 28px; height: 28px; box-shadow: inset 0 0 0 7px #fbe3df; }
  .groups { gap: 10px; margin-top: 14px; }
  .g-rows { font-size: 12px; }
  .groups-foot { margin-top: 12px; }
}
@media (max-width: 760px) and (max-height: 720px) {
  .wa-motion .turn-before { font-size: 1.7rem; }
  .time, .groups-time { display: none; }
  .g-rows li:nth-child(2) { display: none; }   /* never the illustration note: it must stay with the sample rows */
}
