/* ==========================================================================
   site.css — the shell every document shares: bar, hero, footer, and the
   handful of components that appear on more than one page.

   No colour literals. Everything comes from the tokens in base.css, which
   come from the solver in tools/palette.mjs.
   ========================================================================== */

/* ---- skip link --------------------------------------------------------- */
.skip {
  position: absolute; left: 0.6rem; top: -3rem; z-index: 100;
  background: var(--ink); color: var(--plate-2); padding: 0.55rem 0.9rem;
  border-radius: var(--radius); font-size: var(--step--1); transition: top 0.16s;
}
.skip:focus { top: 0.6rem; }

/* ---- the bar ----------------------------------------------------------- */
.bar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in oklab, var(--ground) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--rule);
}
.bar-in { display: flex; align-items: center; gap: 1.4rem; height: 60px; }
.brand { display: flex; align-items: center; gap: 0.62rem; text-decoration: none; color: var(--ink); flex: none; }
.brand svg { width: 22px; height: 22px; }
.brand .word {
  font-family: var(--display); font-weight: 600; font-size: 0.98rem;
  letter-spacing: 0.16em; text-transform: uppercase;
}
.nav { display: flex; align-items: center; gap: 0.15rem; margin-left: auto; }
.nav a {
  font-size: var(--step--1); color: var(--ink-3); text-decoration: none;
  padding: 0.42rem 0.62rem; border-radius: var(--radius); white-space: nowrap;
  transition: color 0.14s, background 0.14s;
}
.nav a:hover { color: var(--ink); background: var(--plate); }
.nav a[aria-current='page'] { color: var(--ink); background: var(--plate-2); box-shadow: inset 0 0 0 1px var(--rule); }
.bar-cta { display: flex; align-items: center; gap: 0.5rem; flex: none; }

.nav-toggle { display: none; }
@media (max-width: 940px) {
  .nav {
    position: fixed; inset: 60px 0 auto 0; flex-direction: column; align-items: stretch;
    background: var(--ground); border-bottom: 1px solid var(--rule-2);
    padding: 0.5rem var(--gutter) 1.1rem; gap: 0.1rem;
    transform: translateY(-8px); opacity: 0; pointer-events: none;
    transition: opacity 0.18s, transform 0.18s, visibility 0.18s;
    max-height: calc(100dvh - 60px); overflow-y: auto;
    /* VISIBILITY, not just opacity. Hidden with opacity alone the five links
       stay focusable and stay in the accessibility tree, so a keyboard user
       tabs into a menu that is not on screen and a screen reader announces
       navigation nobody can see. */
    visibility: hidden;
  }
  .nav[data-open='true'] { transform: none; opacity: 1; pointer-events: auto; visibility: visible; }
  .nav a { padding: 0.62rem 0.4rem; font-size: var(--step-0); border-bottom: 1px solid var(--rule-faint); border-radius: 0; }
  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center; margin-left: auto;
    width: 38px; height: 34px; background: var(--plate); border: 1px solid var(--rule);
    border-radius: var(--radius); color: var(--ink); cursor: pointer;
  }
  .nav-toggle + .nav { margin-left: 0; }
}

/* ---- buttons ----------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--text); font-size: var(--step--1); font-weight: 500;
  padding: 0.58rem 1.05rem; border-radius: var(--radius); text-decoration: none;
  border: 1px solid var(--rule-2); background: var(--plate); color: var(--ink);
  cursor: pointer; transition: background 0.14s, border-color 0.14s, transform 0.14s;
  white-space: nowrap;
}
.btn:hover { background: var(--plate-2); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--plate-2); border-color: var(--ink); }
.btn-primary:hover { background: var(--ink-2); }
.btn-ghost { background: transparent; }
.btn[aria-disabled='true'] { opacity: 0.55; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.65rem; align-items: center; }

/* ---- the hero ---------------------------------------------------------- */
.hero { position: relative; border-bottom: 1px solid var(--rule-2); overflow: hidden; }
.hero-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  background: var(--deep);
}
/* Below the two-column breakpoint the headline sits ON the lattice, and the
   scrim that makes it readable is a horizontal gradient tuned for a wide
   viewport — measured at 1.97:1 for the lede at 390px, which is unreadable.
   Narrow viewports get an opaque ground behind the text instead and the
   canvas becomes a band under it. */
@media (max-width: 999px) {
  .hero-canvas { height: 46%; top: auto; bottom: 0; }
  .hero::after {
    background:
      linear-gradient(to bottom, var(--ground) 0%, var(--ground) 52%, color-mix(in oklab, var(--ground) 55%, transparent) 68%, transparent 88%),
      linear-gradient(to top, var(--ground) 0%, transparent 26%);
  }
}

.hero::after {
  /* The lattice is a picture, and the words sit on top of it. A single
     wash rather than a gradient stack: the canvas is already low-contrast
     by construction and a heavy scrim would hide the thing being shown. */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(100deg, var(--ground) 0%, color-mix(in oklab, var(--ground) 88%, transparent) 42%, transparent 72%),
    linear-gradient(to top, var(--ground) 0%, transparent 30%);
}
.hero-in { position: relative; z-index: 2; padding-block: clamp(3.4rem, 2rem + 8vw, 8rem); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2rem; }
@media (min-width: 1000px) { .hero-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); align-items: end; gap: 3rem; } }
.hero h1 { max-width: 15ch; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero-lede { margin-top: 1.3rem; max-width: 46ch; font-size: var(--step-1); color: var(--ink-2); }

/* The live readout. A strip of monospace that reports what the lattice is
   doing right now, because a canvas nobody can read a number off is
   decoration. */
.readout {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(7.6rem, 1fr));
  gap: 1px; background: var(--rule); border: 1px solid var(--rule);
  border-radius: var(--radius); overflow: hidden; margin-top: 2rem; max-width: 46rem;
}
.readout div { background: var(--plate); padding: 0.62rem 0.8rem; }
.readout dt { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); margin: 0 0 0.18rem; }
.readout dd { margin: 0; font-family: var(--mono); font-size: var(--step-0); color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---- the trace divider -------------------------------------------------
   Every section rule on this site is a real Barkhausen trace, drawn from
   the model in js/abbm.js at build time. It is a divider that happens to be
   the measurement. */
.trace { display: block; width: 100%; height: 26px; opacity: 0.5; }
.trace path { fill: none; stroke: var(--ink-3); stroke-width: 1; vector-effect: non-scaling-stroke; }

/* ---- footer ------------------------------------------------------------ */
.foot { background: var(--ground-2); border-top: 1px solid var(--rule-2); padding-block: 3rem 2.2rem; margin-top: 3rem; }
.foot-grid { display: grid; gap: 2rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 780px) { .foot-grid { grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); gap: 2.4rem; } }
.foot h4 { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); margin-bottom: 0.8rem; font-weight: 500; }
.foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.42rem; }
.foot a { color: var(--ink-3); text-decoration: none; font-size: var(--step--1); }
.foot a:hover { color: var(--ink); text-decoration: underline; }
.foot-note { margin-top: 2.4rem; padding-top: 1.2rem; border-top: 1px solid var(--rule); display: flex; flex-wrap: wrap; gap: 0.8rem 1.6rem; align-items: baseline; font-size: var(--step--1); color: var(--faint); }

/* The demo badge. It is not decoration and validate.mjs fails the build if
   it goes missing. */
.demo-badge {
  display: inline-flex; align-items: center; gap: 0.42rem;
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 0.2em 0.55em; border: 1px solid color-mix(in oklab, var(--garnet) 40%, transparent);
  background: var(--garnet-wash); color: var(--garnet); border-radius: 2px;
}

/* ---- shared page furniture --------------------------------------------- */
.page-head { padding-block: clamp(2.6rem, 1.6rem + 4vw, 4.6rem) 0; }
.page-head h1 { max-width: 20ch; font-size: var(--step-3); }
.page-head .lede { margin-top: 1.1rem; }

.grid { display: grid; gap: clamp(1rem, 0.7rem + 1vw, 1.6rem); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); }
/* Exactly two across at desktop. `.grid-2` auto-fits, which puts FOUR cards
   into three columns and leaves an orphan on the row below. */
.grid-pair { grid-template-columns: repeat(auto-fit, minmax(min(100%, 27rem), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); }

.note {
  border-left: 2px solid var(--accent-mark); padding: 0.1rem 0 0.1rem 1rem;
  color: var(--ink-2); max-width: var(--measure);
}
.callout { background: var(--accent-wash); border: 1px solid color-mix(in oklab, var(--accent) 28%, transparent); border-radius: var(--radius); padding: clamp(1rem, 0.8rem + 0.8vw, 1.5rem); }
.callout h3 { margin-bottom: 0.5rem; }
.callout .btn-row, .callout p:has(> .btn) { display: flex; flex-wrap: wrap; gap: 0.65rem; margin-top: 1.1rem; }
.callout > :last-child { margin-bottom: 0; }

details.disclose { border-top: 1px solid var(--rule); }
details.disclose summary { cursor: pointer; padding: 0.95rem 0; font-family: var(--display); font-weight: 600; color: var(--ink); list-style: none; display: flex; gap: 0.9rem; align-items: baseline; }
details.disclose summary::-webkit-details-marker { display: none; }
details.disclose summary::after { content: '+'; margin-left: auto; font-family: var(--mono); color: var(--faint); font-size: 1.15em; }
details.disclose[open] summary::after { content: '\2212'; }
details.disclose .body { padding-bottom: 1.1rem; max-width: var(--measure); }
details.disclose .body > :last-child { margin-bottom: 0; }

/* ==========================================================================
   The landing-page components. Everything below appears on more than one
   document and belongs to the product narrative rather than to a figure.
   ========================================================================== */

/* A section heading with an accented clause, the way the reference marks its
   emphasis — but coloured rather than italicised, because the display face
   has no true italic and a synthesised one is a slant, not a cut. */
.h-lead { font-size: var(--step-3); max-width: 20ch; }
/* Every heading, not just the big ones: the rail titles use the same device
   and were rendering as a SYNTHESISED italic, which the display face has no
   cut for — a slant, not a typeface. */
h1 em, h2 em, h3 em, h4 em, .h-lead em { font-style: normal; color: var(--accent); }

.btn-lg { padding: 0.78rem 1.4rem; font-size: var(--step-0); }

/* ---- the hero's before/after card -------------------------------------- */
.hero-card { max-width: 34rem; margin-left: auto; }
.ba { display: grid; gap: 0.55rem; }
.ba-row { border: 1px solid var(--rule); border-radius: var(--radius); padding: 0.85rem 1rem; background: var(--plate); }
.ba-row p { margin: 0.35rem 0 0; }
.ba-before { opacity: 0.82; }
.ba-after { background: var(--verdigris-wash); border-color: color-mix(in oklab, var(--verdigris) 30%, transparent); }
.ba-tag { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }
.ba-arrow { text-align: center; color: var(--faint); font-size: 1rem; line-height: 1; }

/* ---- the numbers band --------------------------------------------------- */
.band { border-bottom: 1px solid var(--rule); background: var(--ground-2); }
.numbers {
  display: grid; gap: 1px; margin: 0;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  background: var(--rule);
  border-inline: 1px solid var(--rule);
}
.numbers > div { background: var(--ground-2); padding: 1.5rem 1.2rem; }
.numbers dt {
  font-family: var(--display); font-size: var(--step-3); font-weight: 600; color: var(--ink);
  line-height: 1; letter-spacing: -0.035em; font-variant-numeric: tabular-nums;
}
.numbers dd { margin: 0.55rem 0 0; font-size: var(--step--1); color: var(--ink-3); line-height: 1.45; }

/* ---- rails -------------------------------------------------------------- */
.rail h3 { font-size: var(--step-1); line-height: 1.2; }

/* ---- the four steps ----------------------------------------------------- */
.steps { display: grid; gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
.steps > .step { background: var(--plate); padding: 1.3rem 1.25rem; }
.step-n { font-family: var(--mono); font-size: var(--step--1); color: var(--accent); letter-spacing: 0.08em; }
.step h3 { margin-top: 0.5rem; font-size: var(--step-1); }
.step p { margin: 0.5rem 0 0; }
.step-row { display: flex; gap: 1.1rem; padding: 1.1rem 0; border-top: 1px solid var(--rule); background: none; }
.step-row .step-n { flex: none; }

/* ---- proof cards -------------------------------------------------------- */
.proof-card { display: flex; flex-direction: column; text-decoration: none; color: inherit; transition: border-color 0.15s, transform 0.15s; }
.proof-card:hover { border-color: var(--accent-mark); transform: translateY(-2px); }
.proof-card h3 { font-size: var(--step-1); }
.proof-card p { margin-top: 0.6rem; }
.proof-go { margin-top: auto; padding-top: 1rem; font-family: var(--mono); font-size: var(--step--1); color: var(--accent); }

/* ---- the closing call --------------------------------------------------- */
.cta {
  background: var(--plate); border: 1px solid var(--rule-2); border-radius: var(--radius-lg);
  padding: clamp(2rem, 1.4rem + 3vw, 3.6rem); text-align: center;
  box-shadow: 0 1px 0 var(--plate-2) inset, 0 2px 6px var(--shade);
}
.cta h2 { font-size: var(--step-3); max-width: 22ch; margin-inline: auto; }
.cta .lede { margin: 1rem auto 0; max-width: 48ch; }
.cta .btn-row { justify-content: center; }

/* The social link in the bar. An icon-only control, so it carries an
   aria-label and a hit area larger than the glyph. */
.bar-social {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex: none;
  color: var(--ink-3); border: 1px solid transparent; border-radius: var(--radius);
  transition: color 0.14s, background 0.14s, border-color 0.14s;
}
.bar-social:hover { color: var(--ink); background: var(--plate); border-color: var(--rule); }
@media (max-width: 940px) { .bar-social { order: -1; } }
