/* AI for Real Estate Agents: companion site.
   Reads like the book: paper, ink, one burnt-orange accent. System fonts,
   no external requests. Light and dark follow the reader's system setting.

   Accent rule: --accent-text is for words and buttons (AA on its
   background); --accent is for rules, borders and highlights only.
   Radius rule: 4px on panels and tiles, full pill on buttons and tabs.
   Motion rule: everything that moves is gated on html.js (set by an inline
   script in the head) and on prefers-reduced-motion: no-preference. The
   method stages also wait for html.motion, which script.js sets, so a
   failed script.js never leaves them hidden. With JS off, the page is
   complete and still. */

:root {
  --paper: #F6F5F2;
  --paper-2: #EDEBE6;
  --surface: #FFFFFF;
  --line: #D6D3CC;
  --ink: #181818;
  --ink-soft: #5F5F5F;
  --accent: #C45224;
  --accent-text: #A8441A;
  --on-accent: #FFFFFF;
  --mark: #FAE6DC;
  --good: #2F6B3E;
  --shadow: 0 1px 2px rgb(60 40 20 / 0.06), 0 14px 36px rgb(60 40 20 / 0.12);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: Charter, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --measure: 64ch;
  --wide: 72rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --r: 4px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --z-bar: 20;
  --z-progress: 30;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #141413;
    --paper-2: #1E1D1B;
    --surface: #23221F;
    --line: #3A3834;
    --ink: #EDEBE6;
    --ink-soft: #ABA79F;
    --accent: #E06A3A;
    --accent-text: #F08A5D;
    --on-accent: #141413;
    --mark: #5A2E1B;
    --good: #7CC08E;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 14px 36px rgb(0 0 0 / 0.45);
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 4.5rem; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  margin: 0;
  overflow-x: clip;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.6;
}

h1, h2, h3, .eyebrow, .btn, .tab, .brand, .navlinks, .node, .ba-label, .ba-verdict,
.scrub-label, .note-phrase, .tile, .wc summary, .panel-h, figcaption, .site-footer,
.pack-meta, .changelog time, .contents summary, .switch button {
  font-family: var(--sans);
}

h2 { font-size: clamp(1.7rem, 3.6vw, 2.5rem); line-height: 1.12; letter-spacing: -0.02em; margin: 0 0 0.75rem; }
h2 em { font-style: normal; color: var(--accent-text); }
h3 { font-size: 1.1rem; line-height: 1.3; margin: 0 0 0.4rem; }
p { margin: 0 0 1rem; }
.lede { font-size: 1.15rem; max-width: var(--measure); color: var(--ink-soft); }

a { color: var(--accent-text); text-underline-offset: 0.15em; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 0; z-index: var(--z-progress); background: var(--ink); color: var(--paper); padding: 0.5rem 1rem; }
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

main > section { max-width: var(--wide); margin: 0 auto; padding: clamp(3.5rem, 8vw, 6rem) var(--gutter); }

/* ---------- reading progress (CSS scroll timeline; absent where unsupported) ---------- */

.progress {
  position: fixed; inset: 0 0 auto 0; height: 3px; z-index: var(--z-progress);
  background: var(--accent); transform-origin: 0 50%; transform: scaleX(0);
}
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .progress { animation: grow linear both; animation-timeline: scroll(root); }
  }
}
@supports not (animation-timeline: scroll()) { .progress { display: none; } }
@keyframes grow { to { transform: scaleX(1); } }

/* ---------- top bar ---------- */

.topbar {
  position: sticky; top: 0; z-index: var(--z-bar);
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease);
}
.topbar.scrolled { border-bottom-color: var(--line); }
@supports not (backdrop-filter: blur(1px)) { .topbar { background: var(--paper); } }
.topbar-inner {
  max-width: var(--wide); margin: 0 auto; height: 60px; padding: 0 var(--gutter);
  display: flex; align-items: center; gap: 1.5rem;
}
.brand { font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; white-space: nowrap; }
.navlinks { display: flex; gap: 1.4rem; list-style: none; margin: 0 0 0 auto; padding: 0; font-size: 0.92rem; }
.navlinks a { color: var(--ink-soft); text-decoration: none; }
.navlinks a:hover, .navlinks a[aria-current="true"] { color: var(--ink); }
.navlinks a[aria-current="true"] { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 0.4em; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.8rem 1.35rem; border-radius: 999px;
  font-weight: 600; font-size: 1rem; line-height: 1.2; white-space: nowrap;
  text-decoration: none; border: 2px solid var(--accent-text); cursor: pointer;
  transition: transform 0.25s var(--ease), background-color 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease);
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn-primary { background: var(--accent-text); color: var(--on-accent); }
.btn-primary:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn-ghost { background: transparent; color: var(--accent-text); }
.btn-ghost:hover { color: var(--ink); border-color: var(--ink); }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.9rem; }

/* ---------- hero ---------- */

.hero {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(2rem, 6vw, 5rem); align-items: center;
  padding-top: clamp(2.5rem, 6vw, 5rem) !important;
  min-height: calc(100dvh - 60px);
}
.eyebrow { color: var(--accent-text); font-weight: 700; font-size: 0.82rem; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 0.9rem; }
h1 { font-size: clamp(2.8rem, 6.4vw, 5rem); line-height: 1.0; letter-spacing: -0.035em; margin: 0 0 1.25rem; }
h1::after { content: ""; display: block; width: 4.5rem; height: 5px; background: var(--accent); margin-top: 1.2rem; }
.subtitle { font-size: 1.15rem; color: var(--ink-soft); max-width: 44ch; margin-bottom: 2rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 0; }

.hero-art { perspective: 1200px; display: flex; justify-content: center; }
.tilt { width: min(100%, 22rem); transform-style: preserve-3d; transition: transform 0.6s var(--ease); }
.cover { display: block; width: 100%; height: auto; border-radius: 2px; box-shadow: var(--shadow), 18px 26px 0 -8px var(--paper-2); }

/* ---------- method / pipeline ---------- */

.pipeline {
  list-style: none; padding: 0; margin: 3rem 0 2rem;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 2.5rem;
  position: relative;
}
/* the rail the three stages sit on; drawn left to right when the section enters */
.pipeline::before {
  content: ""; position: absolute; left: 0; right: 0; top: 1.35rem; height: 2px;
  background: linear-gradient(90deg, var(--ink) 0 66%, var(--accent) 66% 100%);
  transform-origin: 0 50%;
}
.stage { position: relative; padding-top: 4rem; }
.node {
  position: absolute; top: 0; left: 0;
  display: inline-block; padding: 0.55rem 1rem; font-weight: 700; font-size: 0.95rem;
  background: var(--paper); border: 2px solid var(--ink); border-radius: var(--r);
}
.stage-sign .node { border-color: var(--accent); color: var(--accent-text); box-shadow: 0 0 0 4px var(--paper), 0 0 0 6px var(--accent); }
.stage p { color: var(--ink-soft); }
.never {
  max-width: var(--measure); padding: 1rem 1.2rem; margin: 1rem 0 0;
  background: var(--paper-2); border-left: 4px solid var(--accent); border-radius: 0 var(--r) var(--r) 0;
}

/* ---------- demo: prompt vs brief ---------- */

.switch {
  position: relative; grid-template-columns: 1fr 1fr;
  padding: 4px; margin: 1.5rem 0 1.75rem; border-radius: 999px;
  background: var(--paper-2); border: 1px solid var(--line);
}
.switch button {
  position: relative; z-index: 1; border: 0; background: none; cursor: pointer;
  padding: 0.6rem 1.25rem; border-radius: 999px; font-size: 0.95rem; font-weight: 600; color: var(--ink-soft);
  white-space: nowrap; transition: color 0.3s var(--ease);
}
.switch button[aria-selected="true"] { color: var(--on-accent); }
.switch-thumb {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px);
  border-radius: 999px; background: var(--accent-text); transition: transform 0.45s var(--ease);
}
.switch[data-state="1"] .switch-thumb { transform: translateX(100%); }

.ba { display: grid; gap: 1.5rem; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 1.5rem; }
.ba-panel {
  display: grid; grid-template-rows: auto 1fr auto; gap: 1rem;
  padding: 1.5rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
}
.ba-label { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 0.4rem; }
.ba-in pre {
  margin: 0; white-space: pre-wrap; font-family: var(--mono); font-size: 0.84rem; line-height: 1.55;
  padding: 0.9rem 1rem; background: var(--paper-2); border-radius: var(--r);
}
.ba-in .k { color: var(--accent-text); font-weight: 700; }
.ba-out p { margin: 0; }
.ba-verdict { margin: 0; padding-top: 0.9rem; border-top: 2px solid var(--line); font-weight: 700; }
.ba-bad { color: var(--ink-soft); }
.ba-good { color: var(--good); border-top-color: var(--good); }

/* ---------- demo: fair housing scrub ---------- */

.scrub { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr); gap: clamp(2rem, 5vw, 4rem); align-items: start; }
.scrub-draft { margin-top: 1.75rem; padding: 1.5rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.scrub-label { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 0.5rem; }
.scrub-text { font-size: 1.2rem; line-height: 1.65; margin-bottom: 1.25rem; }
.scrub-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.fine { font-size: 0.9rem; color: var(--ink-soft); margin-top: 1rem; max-width: var(--measure); }

mark.flag {
  color: inherit; background: var(--mark); border-bottom: 2px solid var(--accent);
  padding: 0; border-radius: 2px;
}
mark.flag::after {
  content: attr(data-flag); font-family: var(--sans); font-size: 0.65em; font-weight: 700;
  vertical-align: super; color: var(--accent-text); margin-left: 0.15em;
}

.notes { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.9rem; }
.note { padding: 1rem 1.1rem; background: var(--paper-2); border-radius: var(--r); border-left: 4px solid var(--accent); }
.note p { margin: 0 0 0.35rem; font-size: 0.95rem; }
.note-phrase { font-weight: 700; display: flex; gap: 0.6rem; align-items: baseline; }
.note-n {
  flex: none; display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem;
  border-radius: 999px; background: var(--accent-text); color: var(--on-accent); font-size: 0.8rem;
}
.note-why { color: var(--ink-soft); }

/* JS on: the draft starts unmarked, the scrub reveals the flags */
.js .scrub[data-state="draft"] mark.flag { background: transparent; border-bottom-color: transparent; }
.js .scrub[data-state="draft"] mark.flag::after { display: none; }
.js .scrub[data-state="draft"] .note { display: none; }
.js .scrub[data-state="draft"] .notes {
  min-height: 14rem; place-content: center; padding: 1.5rem; text-align: center;
  border: 1px dashed var(--line); border-radius: var(--r); color: var(--ink-soft); font-size: 0.95rem;
}
.js .scrub[data-state="draft"] .notes::before { content: "Run the scrub. Each flag shows up here with the reason and the book's rewrite."; max-width: 26ch; margin: 0 auto; }
.js .scrub[data-state="clean"] .note-phrase { text-decoration: line-through; text-decoration-color: var(--accent); }
.js .scrub[data-state="clean"] .note { border-left-color: var(--line); }
.js mark.flag { transition: background-color 0.4s var(--ease), border-color 0.4s var(--ease); transition-delay: calc(var(--i, 0) * 140ms); }
.js mark.flag::after { transition: opacity 0.3s; }
.js .note { transition: opacity 0.45s var(--ease), transform 0.45s var(--ease); transition-delay: calc(var(--i) * 140ms); }
.js .scrub-clean:not([hidden]) { animation: rise 0.5s var(--ease); }

/* ---------- workflows: tabs + card grid ---------- */

.tabs { display: none; flex-wrap: wrap; gap: 0.5rem; margin: 2rem 0 1.5rem; }
.js .tabs { display: flex; }
.tab {
  flex: none; border: 1px solid var(--line); background: transparent; color: var(--ink-soft);
  padding: 0.55rem 1rem; border-radius: 999px; font-size: 0.92rem; cursor: pointer; white-space: nowrap;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease);
}
.tab:hover { color: var(--ink); border-color: var(--ink-soft); }
.tab[aria-selected="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.tab-part { font-weight: 700; }
.tab-count { display: inline-block; margin-left: 0.35rem; font-size: 0.78rem; }
.panel-h { font-size: 1.25rem; margin: 2rem 0 0.25rem; }
.panel-d { color: var(--ink-soft); max-width: var(--measure); }
.js .tabpanel[hidden] { display: none; }
.js .tabpanel .panel-h { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); margin: 0; }

.wc-grid { list-style: none; padding: 0; margin: 1.25rem 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 0.75rem; align-items: start; }
.wc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); transition: border-color 0.25s var(--ease); }
.wc:hover, .wc[open] { border-color: var(--accent); }
.wc summary { list-style: none; cursor: pointer; padding: 1rem 1.1rem; display: grid; grid-template-columns: auto 1fr; gap: 0.15rem 0.75rem; }
.wc summary::-webkit-details-marker { display: none; }
.wc-id { grid-row: span 2; font-family: var(--mono); font-size: 0.8rem; font-weight: 700; color: var(--accent-text); padding-top: 0.15rem; }
.wc-title { font-weight: 600; line-height: 1.35; }
.wc-time { font-size: 0.82rem; color: var(--ink-soft); }
.wc p { margin: 0; padding: 0 1.1rem 1.1rem; font-size: 0.95rem; color: var(--ink-soft); }

/* ---------- inside: figure gallery ---------- */

.inside-head { display: flex; align-items: end; justify-content: space-between; gap: 1rem; }
.gallery-nav { display: none; gap: 0.5rem; }
.js .gallery-nav { display: flex; }
.round {
  width: 2.75rem; height: 2.75rem; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-size: 1.1rem; cursor: pointer;
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease), opacity 0.25s;
}
.round:hover { border-color: var(--ink); transform: translateY(-2px); }
.round:disabled { opacity: 0.35; cursor: default; transform: none; }
.gallery {
  list-style: none; margin: 1.75rem calc(-1 * var(--gutter)) 0; padding: 0.5rem var(--gutter) 1.5rem;
  display: grid; grid-auto-flow: column; grid-auto-columns: min(80vw, 34rem); gap: 1.25rem;
  overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 var(--gutter);
  overscroll-behavior-x: contain; scrollbar-width: thin;
}
.slide { scroll-snap-align: start; }
.slide figure { margin: 0; }
.plate {
  background: #FFFFFF; border: 1px solid var(--line); border-radius: var(--r);
  padding: 1rem; box-shadow: var(--shadow); aspect-ratio: 4 / 3.3; display: grid; place-items: center;
  transition: transform 0.4s var(--ease);
}
.plate img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.slide:hover .plate { transform: translateY(-4px); }
figcaption { margin-top: 0.8rem; font-size: 0.92rem; color: var(--ink-soft); }
figcaption span { font-weight: 700; color: var(--ink); margin-right: 0.35rem; }

/* ---------- pack: bento ---------- */

.pack .lede { margin-bottom: 2rem; }
.bento { display: grid; gap: 1rem; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tile {
  position: relative; display: flex; flex-direction: column; gap: 0.35rem;
  padding: 1.4rem; border-radius: var(--r); text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); overflow: hidden;
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.tile:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: var(--shadow); color: var(--ink); }
.tile:active { transform: translateY(-1px) scale(0.99); }
.tile-type { font-family: var(--mono); font-size: 0.78rem; font-weight: 700; color: var(--accent-text); letter-spacing: 0.04em; }
.tile-title { font-weight: 700; font-size: 1.1rem; line-height: 1.25; }
.tile-body { color: var(--ink-soft); font-size: 0.95rem; }
.tile-meta { margin-top: auto; padding-top: 0.75rem; font-size: 0.85rem; color: var(--ink-soft); }
.tile-main {
  grid-column: span 2; grid-row: span 2; justify-content: flex-end; min-height: 20rem;
  background-color: #181818; color: #F6F5F2; border-color: #181818;
  background-image: repeating-linear-gradient(0deg, transparent 0 31px, rgb(255 255 255 / 0.05) 31px 32px);
}
.tile-main:hover { color: #F6F5F2; }
.tile-main .tile-type { color: #E8875C; }
.tile-main .tile-title { font-size: clamp(1.5rem, 2.6vw, 2.1rem); letter-spacing: -0.02em; }
.tile-main .tile-title { margin-top: auto; }
.tile-main .tile-meta { margin-top: 0; }
.tile-main .tile-body, .tile-main .tile-meta { color: #C9C6BF; }
.tile-main::after {
  content: "\2193" / ""; position: absolute; top: 1.2rem; right: 1.4rem; font-family: var(--sans);
  font-size: 1.6rem; color: #E8875C; transition: transform 0.3s var(--ease);
}
.tile-main:hover::after { transform: translateY(4px); }
@media (prefers-color-scheme: dark) { .tile-main { border-color: var(--accent); } }
.tile-thumb { padding-top: 0; }
.tile-thumb img {
  display: block; width: calc(100% + 2.8rem); max-width: none; margin: 0 -1.4rem 0.9rem; height: 8.5rem;
  object-fit: cover; object-position: top; background: #fff; border-bottom: 1px solid var(--line);
  transition: transform 0.5s var(--ease);
}
.tile-thumb:hover img { transform: scale(1.04); }

.contents { margin-top: 1.5rem; border-top: 1px solid var(--line); }
.contents summary { cursor: pointer; padding: 1rem 0; font-weight: 700; list-style: none; display: flex; justify-content: space-between; }
.contents summary::-webkit-details-marker { display: none; }
.contents summary::after { content: "+"; font-size: 1.3rem; line-height: 1; color: var(--accent-text); transition: transform 0.3s var(--ease); }
.contents[open] summary::after { transform: rotate(45deg); }
.contents ul { margin: 0 0 1rem; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem 2rem; }
.contents li { font-size: 0.95rem; color: var(--ink-soft); }
.contents li strong { color: var(--ink); }
.pack-meta { font-size: 0.9rem; color: var(--ink-soft); margin-top: 0.5rem; }

/* ---------- what changed / author ---------- */

.changelog { list-style: none; padding: 0; margin: 1rem 0 0; border-left: 2px solid var(--line); max-width: var(--measure); }
.changelog li { position: relative; padding: 0 0 0.75rem 1.25rem; display: grid; gap: 0.1rem; }
.changelog li::before { content: ""; position: absolute; left: -6px; top: 0.45rem; width: 10px; height: 10px; border-radius: 999px; background: var(--accent); }
.changelog time { font-weight: 700; font-size: 0.9rem; }
.changes > p { max-width: var(--measure); }

.author-body { columns: 2 22rem; column-gap: 3rem; margin-top: 1.25rem; }
.author-body p { break-inside: avoid; }

/* ---------- footer ---------- */

.site-footer { max-width: var(--wide); margin: 0 auto; padding: 2rem var(--gutter) 3rem; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 0.85rem; line-height: 1.5; }
.site-footer p { max-width: var(--measure); margin-bottom: 0.5rem; }
.notfound { padding: 5rem var(--gutter); max-width: 40rem; }

/* ---------- demo panels: side by side without JS, swapped by the switch with JS ---------- */

.switch { display: none; }
.js .switch { display: inline-grid; }
.js .ba { grid-template-columns: minmax(0, 1fr); }
.js .ba-panel[hidden] { display: none; }
@media (min-width: 900px) {
  .js .ba-panel { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); grid-template-rows: 1fr auto; column-gap: 2rem; }
  .js .ba-verdict { grid-column: 1 / -1; }
}

/* ---------- motion (only with JS and only when the reader allows it) ---------- */

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes drawY { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(0.96); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: no-preference) {
  .js .load { animation: rise 0.8s var(--ease) both; animation-delay: calc(var(--d) * 110ms); }
  .js [data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
  .js [data-reveal].in { opacity: 1; transform: none; }

  .motion .pipeline::before { transform: scaleX(0); }
  .motion .pipeline.in::before { animation: draw 1.2s var(--ease) 0.15s both; }
  .motion .pipeline .stage { opacity: 0; }
  .motion .pipeline.in .stage { animation: pop 0.6s var(--ease) both; animation-delay: calc(0.25s + var(--i) * 0.35s); }

  .js .ba-panel.entering { animation: rise 0.45s var(--ease) both; }
  .js .tabpanel.entering .wc-grid > li { animation: rise 0.45s var(--ease) both; animation-delay: calc(var(--i) * 35ms); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .progress { display: none; }
}

/* ---------- narrow screens ---------- */

@media (max-width: 900px) {
  .navlinks { display: none; }
  .topbar-inner { justify-content: space-between; }
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile-main { grid-row: auto; min-height: 15rem; }
}

@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; min-height: 0; gap: 2.5rem; }
  .hero-art { justify-content: flex-start; }
  .tilt { width: 11rem; }
  .actions .btn { flex: 1 1 100%; }
  .pipeline { grid-template-columns: 1fr; gap: 2.25rem; padding-left: 1.25rem; }
  .pipeline::before {
    left: 0; right: auto; top: 0; bottom: 0; width: 2px; height: auto;
    background: linear-gradient(180deg, var(--ink) 0 66%, var(--accent) 66% 100%); transform-origin: 50% 0;
  }
  .motion .pipeline::before { transform: scaleY(0); }
  .motion .pipeline.in::before { animation-name: drawY; }
  .stage { padding-top: 3.4rem; }
  .ba, .scrub { grid-template-columns: 1fr; }
  .switch button { padding: 0.6rem 0.9rem; }
  .bento { grid-template-columns: 1fr; }
  .tile-main { grid-column: auto; }
  .contents ul { grid-template-columns: 1fr; }
  .brand { font-size: 0.9rem; }
  .topbar-inner { gap: 0.75rem; }
  .topbar .btn-sm { padding: 0.45rem 0.85rem; font-size: 0.85rem; }
}

@media print {
  .topbar, .progress, .actions, .bento, .switch, .scrub-actions, .gallery-nav, .skip-link { display: none; }
  .js .ba-panel[hidden], .js .tabpanel[hidden] { display: grid; }
}
