/* ============================================================
   TraceDeck — design system
   Grayscale only. Dark by default, light via [data-theme="light"].
   Self-hosted fonts, no CDN, no analytics, no cookies.
   ============================================================ */

/* ---------- Fonts (self-hosted, latin subset) ---------- */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('../assets/fonts/inter-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212,
    U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url('../assets/fonts/jetbrains-mono-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212,
    U+2215, U+FEFF, U+FFFD;
}

/* ---------- Tokens ---------- */
:root {
  /* Dark (default) */
  --bg-0: #08080a;
  --bg-1: #0e0e11;
  --bg-2: #141418;
  --bg-3: #1a1a1f;
  --line: #232329;
  --line-2: #303038;
  --ink: #f4f4f5;
  --ink-2: #a3a3ac;
  --ink-3: #6c6c77;
  --ink-4: #4a4a53;
  --solid: #f4f4f5;   /* high-contrast fill (buttons) */
  --on-solid: #08080a;
  --glow: rgba(255, 255, 255, 0.06);

  /* Shadows are a falloff ramp, not one heavy blob. Each layer roughly doubles
     the blur while dropping the alpha, which is how light actually behaves —
     a single dense shadow on a near-black surface just reads as a dark slab.
     On dark, a hairline rim carries most of the elevation cue, because a black
     shadow cannot darken an already-black background. */
  --shadow:
    0 1px 2px rgba(0,0,0,.20),
    0 3px 8px rgba(0,0,0,.16),
    0 8px 20px rgba(0,0,0,.13),
    0 18px 40px rgba(0,0,0,.10);
  --shot-shadow:
    0 1px 2px rgba(0,0,0,.22),
    0 4px 10px rgba(0,0,0,.17),
    0 10px 28px rgba(0,0,0,.14),
    0 22px 56px rgba(0,0,0,.11),
    0 40px 88px rgba(0,0,0,.07);
  --rim: inset 0 1px 0 rgba(255,255,255,.05);
  /* Tint used by the animated shadow sweep under the tour showcase. */
  --shadow-tint: rgba(0,0,0,.55);

  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --r-sm: 4px;
  --r: 8px;
  --r-lg: 12px;
  --r-xl: 16px;

  --container: 1200px;
  --gutter: 24px;
  --nav-h: 60px;
}

[data-theme='light'] {
  --bg-0: #ffffff;
  --bg-1: #fafafa;
  --bg-2: #f4f4f5;
  --bg-3: #ebebed;
  --line: #e3e3e6;
  --line-2: #d0d0d5;
  --ink: #0b0b0d;
  --ink-2: #55555e;
  --ink-3: #85858f;
  --ink-4: #a5a5ae;
  --solid: #0b0b0d;
  --on-solid: #ffffff;
  --glow: rgba(0, 0, 0, 0.04);
  --shadow:
    0 1px 2px rgba(16,18,26,.05),
    0 3px 8px rgba(16,18,26,.05),
    0 8px 20px rgba(16,18,26,.05),
    0 18px 40px rgba(16,18,26,.04);
  --shot-shadow:
    0 1px 2px rgba(16,18,26,.06),
    0 4px 10px rgba(16,18,26,.06),
    0 10px 28px rgba(16,18,26,.06),
    0 22px 56px rgba(16,18,26,.05),
    0 40px 88px rgba(16,18,26,.04);
  --rim: inset 0 1px 0 rgba(255,255,255,.7);
  --shadow-tint: rgba(16,18,26,.20);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 24px);
}
body {
  background: var(--bg-0);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'ss01';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color .35s ease, color .35s ease;
}
img, svg, canvas { display: block; max-width: 100%; }
/* Author display rules beat the UA sheet, so [hidden] needs to win explicitly. */
[hidden] { display: none !important; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
:focus-visible { outline: 2px solid var(--ink-2); outline-offset: 2px; border-radius: 3px; }
::selection { background: var(--ink); color: var(--bg-0); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container-narrow { max-width: 780px; }
.section { padding-block: 68px; position: relative; }
.section--tight { padding-block: 44px; }
.divider { height: 1px; background: var(--line); border: 0; }

/* ---------- Type ---------- */
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.display {
  font-size: clamp(2.6rem, 6.4vw, 4.75rem);
  font-weight: 450;
  line-height: 1.02;
  letter-spacing: -0.042em;
}
h1, h2, h3, h4 { font-weight: 500; letter-spacing: -0.022em; line-height: 1.18; }
.h2 { font-size: clamp(1.75rem, 3.4vw, 2.6rem); font-weight: 450; letter-spacing: -0.032em; line-height: 1.1; }
.h3 { font-size: 1.2rem; font-weight: 500; }
.h4 { font-size: 1rem; font-weight: 500; }
.lede { font-size: clamp(1rem, 1.55vw, 1.15rem); color: var(--ink-2); line-height: 1.62; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); }
.center { text-align: center; }
.balance { text-wrap: balance; }
.pretty { text-wrap: pretty; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding-inline: 18px;
  border-radius: var(--r);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, transform .18s ease, opacity .18s ease;
}
.btn:active { transform: translateY(1px); }
.btn--solid { background: var(--solid); color: var(--on-solid); }
.btn--solid:hover { opacity: .86; }
.btn--outline { border-color: var(--line-2); color: var(--ink); background: transparent; }
.btn--outline:hover { background: var(--bg-2); border-color: var(--ink-4); }
.btn--ghost { color: var(--ink-2); }
.btn--ghost:hover { color: var(--ink); background: var(--bg-2); }
.btn--lg { height: 48px; padding-inline: 24px; font-size: 15px; }
.btn--sm { height: 34px; padding-inline: 13px; font-size: 13px; border-radius: var(--r-sm); }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn .ic { width: 15px; height: 15px; flex: none; }

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 80;
  height: var(--nav-h);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-0) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
}
.nav__in {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 28px;
}
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 500; letter-spacing: -0.03em; font-size: 15px; }
.brand__mark { width: 20px; height: 20px; flex: none; }
.nav__links { display: flex; align-items: center; gap: 4px; margin-left: 6px; }
.nav__link {
  padding: 6px 11px;
  border-radius: var(--r-sm);
  font-size: 14px;
  color: var(--ink-2);
  transition: color .16s ease, background-color .16s ease;
}
.nav__link:hover { color: var(--ink); background: var(--bg-2); }
.nav__link.is-active { color: var(--ink); }
.nav__right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 34px; height: 34px;
  display: inline-grid; place-items: center;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  border: 1px solid transparent;
  transition: color .16s, background-color .16s, border-color .16s;
}
.icon-btn:hover { color: var(--ink); background: var(--bg-2); border-color: var(--line); }
.icon-btn svg { width: 16px; height: 16px; }
.nav__toggle { display: none; }
[data-theme='light'] .theme-icon-sun { display: none; }
.theme-icon-moon { display: none; }
[data-theme='light'] .theme-icon-moon { display: block; }

/* mobile nav */
@media (max-width: 900px) {
  .nav__links { display: none; }
  .nav__toggle { display: inline-grid; }
  .nav.is-open .nav__links {
    display: flex;
    position: absolute;
    top: var(--nav-h); left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 12px var(--gutter) 18px;
    background: var(--bg-0);
    border-bottom: 1px solid var(--line);
    margin: 0;
  }
  .nav.is-open .nav__link { padding: 10px 12px; font-size: 15px; }
  .nav__cta-desktop { display: none; }
}

/* ---------- Hero ---------- */
.hero { position: relative; padding-block: 96px 0; overflow: hidden; }
.hero__canvas {
  position: absolute;
  inset: 0;
  /* A canvas is a replaced element: inset alone resolves to its intrinsic
     300x150, so the size has to be stated explicitly. */
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: .55;
  mask-image: radial-gradient(120% 80% at 50% 22%, #000 30%, transparent 78%);
  -webkit-mask-image: radial-gradient(120% 80% at 50% 22%, #000 30%, transparent 78%);
}
/* The hero text sits directly over the graph, so pull the field back on
   narrow screens where the two overlap far more. */
@media (max-width: 900px) {
  .hero__canvas { opacity: .3; }
}
.hero__in { position: relative; z-index: 1; }
.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 40px;
  align-items: end;
}
@media (max-width: 900px) { .hero__grid { grid-template-columns: 1fr; align-items: start; } }
.hero__title { margin-bottom: 20px; }
.hero__sub { max-width: 46ch; margin-bottom: 30px; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.hero__note { margin-top: 14px; font-size: 12.5px; color: var(--ink-3); font-family: var(--mono); }

/* Devin-style bordered mono callout */
.callout {
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  padding: 13px 15px;
  max-width: 290px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .085em;
  text-transform: uppercase;
  color: var(--ink-2);
  line-height: 1.75;
  background: var(--bg-1);
}
.callout a { color: var(--ink); display: inline-flex; gap: 5px; align-items: center; }
.callout a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Promise strip ---------- */
.promises {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg-1);
}
.promise { padding: 26px 24px; border-right: 1px solid var(--line); }
.promise:last-child { border-right: 0; }
.promise__k { font-family: var(--mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 10px; }
.promise__t { font-size: 1.05rem; font-weight: 500; letter-spacing: -0.02em; margin-bottom: 6px; }
.promise__d { font-size: 13.5px; color: var(--ink-2); line-height: 1.55; }
@media (max-width: 820px) {
  .promises { grid-template-columns: 1fr; }
  .promise { border-right: 0; border-bottom: 1px solid var(--line); }
  .promise:last-child { border-bottom: 0; }
}

/* ---------- Screenshot frame ---------- */
.shot {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg-1);
  box-shadow: var(--shot-shadow), var(--rim);
}
.shot__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding-inline: 13px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}
.shot__dots { display: flex; gap: 6px; }
.shot__dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); display: block; }
.shot__name { font-family: var(--mono); font-size: 11px; color: var(--ink-3); letter-spacing: .04em; }
.shot__img { width: 100%; display: block; }
.shot--flush .shot__img { border-radius: 0; }

.shot-caption {
  margin-top: 12px;
  font-size: 13px;
  color: var(--ink-3);
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.shot-caption b { font-weight: 500; color: var(--ink-2); }

/* ---------- Feature block (alternating) ---------- */
.feature { display: grid; grid-template-columns: minmax(0, 0.86fr) minmax(0, 1.14fr); gap: 56px; align-items: center; }
.feature + .feature { margin-top: 104px; }
.feature--flip .feature__text { order: 2; }
@media (max-width: 980px) {
  .feature { grid-template-columns: 1fr; gap: 30px; }
  .feature--flip .feature__text { order: 0; }
  .feature + .feature { margin-top: 72px; }
}
.feature__text .eyebrow { margin-bottom: 14px; display: block; }
.feature__text h2 { margin-bottom: 14px; }
.feature__text .lede { margin-bottom: 22px; }

.ticks { list-style: none; display: grid; gap: 9px; }
.ticks li { position: relative; padding-left: 22px; font-size: 14px; color: var(--ink-2); line-height: 1.55; }
.ticks li::before {
  content: '';
  position: absolute;
  left: 3px; top: 9px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--ink-4);
}
.ticks b { color: var(--ink); font-weight: 500; }

/* ---------- Cards ---------- */
.card {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--bg-1);
  padding: 22px;
  transition: border-color .2s ease, background-color .2s ease, transform .2s ease;
}
.card--hover:hover { border-color: var(--line-2); background: var(--bg-2); }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
@media (max-width: 1000px) { .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 700px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.section__head { max-width: 62ch; margin-bottom: 44px; }
.section__head .eyebrow { display: block; margin-bottom: 14px; }
.section__head h2 { margin-bottom: 14px; }

/* ---------- Findings gallery (tabbed) ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 22px; }
.tab {
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-2);
  background: var(--bg-1);
  transition: all .16s ease;
  display: inline-flex; align-items: center; gap: 7px;
}
.tab:hover { color: var(--ink); border-color: var(--line-2); }
.tab[aria-selected='true'] { background: var(--solid); color: var(--on-solid); border-color: var(--solid); }
.tab__n { font-family: var(--mono); font-size: 10.5px; opacity: .65; }

.tabpanel { display: none; }
.tabpanel.is-active { display: block; }
.tabpanel__grid { display: grid; grid-template-columns: 300px minmax(0,1fr); gap: 28px; align-items: start; }
@media (max-width: 900px) { .tabpanel__grid { grid-template-columns: 1fr; gap: 20px; } }
.tabpanel__desc h3 { margin-bottom: 10px; }
.tabpanel__desc p { font-size: 14px; color: var(--ink-2); line-height: 1.6; margin-bottom: 14px; }

/* ---------- Showcase: every app view bundled into one section ---------- */

/* The showcase is grounded by its own shadow layer rather than a box-shadow,
   so it can be masked and swept in from the left as the section arrives.
   --sweep defaults to fully revealed, so with no JS the shadow is simply there. */
.showcase-wrap { position: relative; }
.showcase-wrap::before {
  content: '';
  position: absolute;
  z-index: 0;
  left: 2.5%;
  right: 2.5%;
  top: 18px;
  bottom: -16px;
  border-radius: 50% / 14%;
  background: var(--shadow-tint);
  filter: blur(36px);
  pointer-events: none;
  --sweep: 118%;
  -webkit-mask-image: linear-gradient(90deg, #000 0 var(--sweep), rgba(0,0,0,0) calc(var(--sweep) + 18%));
  mask-image: linear-gradient(90deg, #000 0 var(--sweep), rgba(0,0,0,0) calc(var(--sweep) + 18%));
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
}
.showcase {
  position: relative;
  z-index: 1;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--bg-1);
  overflow: hidden;
  box-shadow: var(--shadow), var(--rim);
}
.showcase__bar {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}
.showcase__body { padding: 24px; }
@media (max-width: 640px) { .showcase__body { padding: 16px; } }

.panel { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 30px; align-items: start; }
@media (max-width: 980px) { .panel { grid-template-columns: 1fr; gap: 20px; } }
.panel__text h3 { font-size: 1.15rem; margin-bottom: 9px; }
.panel__text > p { font-size: 14px; color: var(--ink-2); line-height: 1.6; margin-bottom: 14px; }
.panel__media { min-width: 0; }

/* Two related views sit side by side so they read as one topic. */
.media-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
@media (max-width: 720px) { .media-2 { grid-template-columns: 1fr; } }

/* Secondary chip row for the finding types, nested inside a panel. */
.tabs--sm { margin-bottom: 14px; gap: 5px; }
.tabs--sm .tab { padding: 5px 10px; font-size: 12px; }

.shot--sm .shot__bar { height: 28px; padding-inline: 10px; }
.shot--sm .shot__name { font-size: 10px; }
.shot--sm .shot__dots i { width: 6px; height: 6px; }
.kv { display: grid; gap: 8px; font-size: 12.5px; }
.kv div { display: flex; gap: 10px; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 8px; }
.kv dt { color: var(--ink-3); font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.kv dd { color: var(--ink-2); text-align: right; }

/* ---------- Evidence mock (Change Review) ---------- */
.mock {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg-1);
  font-family: var(--mono);
  font-size: 12px;
  box-shadow: var(--shadow), var(--rim);
}
.mock__head {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 15px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--ink-3);
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
}
.pill {
  font-family: var(--mono);
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  padding: 3px 7px; border-radius: 3px;
  border: 1px solid var(--line-2); color: var(--ink-2);
}
.pill--on { background: var(--bg-3); color: var(--ink); }
.mock__row {
  display: grid; grid-template-columns: 1fr auto;
  gap: 14px; align-items: center;
  padding: 10px 15px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
}
.mock__row:last-child { border-bottom: 0; }
.mock__row span:last-child { color: var(--ink-3); font-size: 11px; white-space: nowrap; }
.mock__row em { font-style: normal; color: var(--ink); }

/* ---------- Code block ---------- */
.code {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg-1);
  overflow: hidden;
}
.code__bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
  font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3);
}
.code pre { padding: 16px; overflow-x: auto; }
.code code { font-family: var(--mono); font-size: 12.5px; line-height: 1.75; color: var(--ink-2); white-space: pre; }
.code .c-dim { color: var(--ink-4); }
.code .c-key { color: var(--ink); }
.copy-btn { font-family: var(--font); text-transform: none; letter-spacing: 0; font-size: 12px; color: var(--ink-3); }
.copy-btn:hover { color: var(--ink); }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-1); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 13px 18px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .13em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 500; background: var(--bg-2); white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }
td code, .inline-code {
  font-family: var(--mono); font-size: 12px;
  background: var(--bg-3); border: 1px solid var(--line);
  padding: 1.5px 5px; border-radius: 4px; color: var(--ink-2);
  white-space: nowrap;
}

/* ---------- Accordion (limitations) ---------- */
.acc { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: var(--bg-1); }
.acc__item { border-bottom: 1px solid var(--line); }
.acc__item:last-child { border-bottom: 0; }
.acc__btn {
  width: 100%; text-align: left;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 20px;
  font-size: 14.5px; font-weight: 450; color: var(--ink);
  transition: background-color .16s;
}
.acc__btn:hover { background: var(--bg-2); }
.acc__btn svg { width: 15px; height: 15px; flex: none; color: var(--ink-3); transition: transform .25s ease; }
.acc__btn[aria-expanded='true'] svg { transform: rotate(45deg); }
.acc__body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s ease; }
.acc__body > div { overflow: hidden; }
.acc__item.is-open .acc__body { grid-template-rows: 1fr; }
.acc__body p { padding: 0 20px 18px; font-size: 13.5px; color: var(--ink-2); line-height: 1.6; max-width: 78ch; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); padding-block: 56px 40px; background: var(--bg-1); }
.footer__grid { display: grid; grid-template-columns: 1.6fr repeat(2, 1fr); gap: 40px; margin-bottom: 44px; }
@media (max-width: 860px) { .footer__grid { grid-template-columns: 1fr 1fr; gap: 32px; } }
.footer__brand p { font-size: 13.5px; color: var(--ink-3); margin-top: 12px; max-width: 34ch; line-height: 1.6; }
.footer__col h4 { font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; margin-bottom: 14px; }
.footer__col ul { list-style: none; display: grid; gap: 9px; }
.footer__col a { font-size: 13.5px; color: var(--ink-2); transition: color .16s; }
.footer__col a:hover { color: var(--ink); }
.footer__bottom {
  border-top: 1px solid var(--line); padding-top: 22px;
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center;
  font-size: 12.5px; color: var(--ink-3); font-family: var(--mono); letter-spacing: .03em;
}

/* ---------- Auth pages ---------- */
.auth { min-height: 100dvh; display: grid; grid-template-columns: 1fr 1fr; }
@media (max-width: 940px) { .auth { grid-template-columns: 1fr; } .auth__aside { display: none; } }
.auth__main { display: flex; flex-direction: column; padding: 28px var(--gutter); }
.auth__body { flex: 1; display: grid; place-items: center; padding-block: 32px; }
.auth__card { width: 100%; max-width: 372px; }
.auth__card h1 { font-size: 1.7rem; font-weight: 450; letter-spacing: -0.03em; margin-bottom: 8px; }
.auth__card > p { color: var(--ink-2); font-size: 14px; margin-bottom: 30px; }
.auth__aside {
  border-left: 1px solid var(--line);
  background: var(--bg-1);
  padding: 48px;
  display: flex; flex-direction: column; justify-content: center; gap: 26px;
  position: relative; overflow: hidden;
}
.auth__aside-in { position: relative; z-index: 1; max-width: 400px; }
.auth__canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .5; }
.auth__quote { font-size: 1.32rem; font-weight: 450; letter-spacing: -0.028em; line-height: 1.32; margin-bottom: 22px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 7px; font-weight: 450; }
.input {
  width: 100%; height: 42px;
  padding-inline: 13px;
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  font-size: 14px;
  transition: border-color .16s, background-color .16s;
}
.input::placeholder { color: var(--ink-4); }
.input:focus { outline: none; border-color: var(--ink-3); background: var(--bg-2); }
.input:user-invalid { border-color: var(--ink-2); }
textarea.input { height: auto; min-height: 88px; padding-block: 11px; resize: vertical; line-height: 1.55; }
select.input { appearance: none; background-image: none; cursor: pointer; }
.field__row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.field__hint { font-size: 12px; color: var(--ink-3); margin-top: 7px; }
.link { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); }
.link:hover { text-decoration-color: currentColor; }
.check { display: flex; gap: 9px; align-items: flex-start; font-size: 13px; color: var(--ink-2); margin-bottom: 18px; }
.check input { margin-top: 3px; accent-color: var(--ink); flex: none; }
.divider-or { display: flex; align-items: center; gap: 14px; margin-block: 22px; color: var(--ink-3); font-size: 11px; font-family: var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.divider-or::before, .divider-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.form-msg {
  font-size: 13px; padding: 10px 13px; border-radius: var(--r);
  border: 1px solid var(--line-2); background: var(--bg-2); color: var(--ink-2);
  margin-bottom: 16px; display: none;
}
.form-msg.is-shown { display: block; }
.strength { display: flex; gap: 4px; margin-top: 8px; }
.strength i { height: 3px; flex: 1; border-radius: 2px; background: var(--line); transition: background-color .25s; display: block; }
.strength.s1 i:nth-child(1) { background: var(--ink-4); }
.strength.s2 i:nth-child(-n+2) { background: var(--ink-3); }
.strength.s3 i:nth-child(-n+3) { background: var(--ink-2); }
.strength.s4 i { background: var(--ink); }

/* ---------- Dashboard ---------- */
.app { min-height: 100dvh; display: grid; grid-template-columns: 232px minmax(0,1fr); }
@media (max-width: 900px) { .app { grid-template-columns: 1fr; } }
.side {
  border-right: 1px solid var(--line);
  background: var(--bg-1);
  padding: 18px 14px;
  display: flex; flex-direction: column; gap: 22px;
  position: sticky; top: 0; height: 100dvh; overflow-y: auto;
}
@media (max-width: 900px) { .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); } }
.side__brand { display: flex; align-items: center; gap: 9px; padding: 6px 8px; font-weight: 500; letter-spacing: -0.03em; }
.side__group { display: grid; gap: 2px; }
.side__label { font-family: var(--mono); font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-4); padding: 0 8px 7px; }
.side__link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 9px; border-radius: var(--r-sm);
  font-size: 13.5px; color: var(--ink-2);
  transition: background-color .16s, color .16s;
}
.side__link svg { width: 15px; height: 15px; flex: none; opacity: .8; }
.side__link:hover { background: var(--bg-2); color: var(--ink); }
.side__link.is-active { background: var(--bg-3); color: var(--ink); }
.side__link .badge {
  margin-left: auto; font-family: var(--mono); font-size: 10px;
  color: var(--ink-3); background: var(--bg-3); border: 1px solid var(--line);
  border-radius: 3px; padding: 0 5px;
}
.side__foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 14px; display: grid; gap: 8px; }
.side__user { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--bg-3); border: 1px solid var(--line-2);
  font-size: 11.5px; font-weight: 500; color: var(--ink-2); font-family: var(--mono);
}
.side__user-meta { min-width: 0; }
.side__user-meta b { display: block; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side__user-meta span { display: block; font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main { min-width: 0; }
.topbar {
  height: 58px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px;
  padding-inline: 28px;
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg-0) 86%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
@media (max-width: 640px) { .topbar { padding-inline: 18px; } }
.topbar h1 { font-size: 15px; font-weight: 500; letter-spacing: -0.02em; }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.view { padding: 30px 28px 72px; display: none; }
@media (max-width: 640px) { .view { padding: 24px 18px 56px; } }
.view.is-active { display: block; }
.view__head { margin-bottom: 24px; max-width: 70ch; }
.view__head h2 { font-size: 1.45rem; font-weight: 450; letter-spacing: -0.03em; margin-bottom: 7px; }
.view__head p { font-size: 14px; color: var(--ink-2); }
.block { margin-bottom: 32px; }
.block__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.block__head h3 { font-size: 13px; font-weight: 500; font-family: var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }

.stat { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-1); padding: 18px 20px; }
.stat__k { font-size: 11px; font-family: var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 10px; }
.stat__v { font-size: 1.85rem; font-weight: 450; letter-spacing: -0.035em; line-height: 1; margin-bottom: 8px; font-variant-numeric: tabular-nums; }
.stat__d { font-size: 12.5px; color: var(--ink-3); }

.meter { height: 5px; border-radius: 3px; background: var(--bg-3); overflow: hidden; margin-block: 10px 8px; border: 1px solid var(--line); }
.meter i { display: block; height: 100%; background: var(--ink-2); border-radius: 3px; width: 0; transition: width .9s cubic-bezier(.22,1,.36,1); }

.bars { display: grid; gap: 11px; }
.bar__top { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 6px; }
.bar__top span:first-child { color: var(--ink-2); font-family: var(--mono); font-size: 11.5px; }
.bar__top span:last-child { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.bar__track { height: 6px; background: var(--bg-3); border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
.bar__fill { height: 100%; background: var(--ink-3); width: 0; transition: width .9s cubic-bezier(.22,1,.36,1); display: block; }

.spark { width: 100%; height: 56px; display: block; overflow: visible; }
.spark path.line { fill: none; stroke: var(--ink-2); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.spark path.area { fill: var(--glow); stroke: none; }

.list { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-1); overflow: hidden; }
.list__row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.list__row:last-child { border-bottom: 0; }
.list__row b { font-weight: 500; font-size: 13.5px; }
.list__row .sub { font-size: 12.5px; color: var(--ink-3); }
.list__row .right { margin-left: auto; text-align: right; font-size: 12.5px; color: var(--ink-3); font-family: var(--mono); }
.tag {
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  border: 1px solid var(--line-2); border-radius: 3px; padding: 2px 6px; color: var(--ink-3);
}
.tag--on { background: var(--bg-3); color: var(--ink); border-color: var(--line-2); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0 16px; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.saved-note { font-size: 12.5px; color: var(--ink-3); opacity: 0; transition: opacity .3s; }
.saved-note.is-shown { opacity: 1; }

.toast {
  position: fixed; bottom: 22px; left: 50%;
  transform: translate(-50%, 14px);
  background: var(--bg-3); border: 1px solid var(--line-2);
  color: var(--ink); font-size: 13px;
  padding: 11px 17px; border-radius: var(--r);
  box-shadow: var(--shadow), var(--rim);
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  z-index: 200;
}
.toast.is-shown { opacity: 1; transform: translate(-50%, 0); }

.plan {
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-1);
  padding: 22px; display: flex; flex-direction: column; gap: 14px;
}
.plan.is-current { border-color: var(--ink-4); background: var(--bg-2); }
.plan__price { font-size: 1.7rem; font-weight: 450; letter-spacing: -0.035em; line-height: 1; }
.plan__price span { font-size: 13px; color: var(--ink-3); letter-spacing: 0; font-weight: 400; }
.plan ul { list-style: none; display: grid; gap: 8px; font-size: 13px; color: var(--ink-2); }
.plan li { padding-left: 18px; position: relative; }
.plan li::before { content: ''; position: absolute; left: 2px; top: 8px; width: 4px; height: 4px; border-radius: 50%; background: var(--ink-4); }

.empty { text-align: center; padding: 48px 20px; color: var(--ink-3); font-size: 13.5px; }

/* ---------- Animation helpers ----------
   Reveal targets stay visible by default so the page is readable if JS never
   arrives. motion.js sets .motion-ready on <html> only once it can actually
   drive the animation, and that is what hides them for the first frame. */
.motion-ready [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 14px, 0);
}
/* Reduced motion keeps the fade but drops the movement. */
.motion-ready.motion-fade [data-reveal] { transform: none; }
.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--solid); color: var(--on-solid);
  padding: 10px 16px; border-radius: var(--r); z-index: 999; font-size: 14px;
}
.skip:focus { left: 12px; top: 12px; }
