/* ════════════════════════════════════════════════════════════════════════════
   Détente — detente.dev component layer.

   Every colour, radius and rule weight comes from tokens.css. Nothing here
   hard-codes a brand colour except the four theme swatches, which have to
   preview a theme they are not currently in.

   There are no `style` attributes in index.html, and there is no <style> block.
   The vhost serves `style-src 'self'` with no 'unsafe-inline', so either would
   be dropped by the browser rather than applied — silently, and only on the
   live site.

   No media queries, by design. Every band is a wrapping flexbox or an auto-fit
   minmax grid, so it collapses 3-up → 2-up → 1-up on its own measure. If you
   add one, keep the flex-basis / minmax values as the breakpoints.
   ════════════════════════════════════════════════════════════════════════════ */

/* brand-fonts/brand.css and tokens.css are linked separately from index.html
   rather than @import-ed here. @import would chain the requests — this file has
   to arrive before the theme layer is even discovered — and the theme layer is
   the one that must not arrive late. */

*, *::before, *::after { box-sizing: border-box; }

.shell {
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  transition: background-color .25s ease, color .25s ease;
}

.wrap { max-width: 1160px; margin: 0 auto; padding: 0 28px; }

.mono { font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ── Mark colourway follows the GROUND, not the mode ──────────────────────────
   Vermillion's light ground is oxblood, so it needs the lifted colourway too.
   Getting this wrong puts black triangles on a dark red field. Both colourways
   ship in the markup and CSS picks one: no flash on load, no layout shift, and
   a correct mark still renders with JavaScript disabled. */
   🔴 These four rules are the ONLY place `display` is set on a mark. Sizing rules
   below deliberately do not touch it: `.logo img` is specificity (0,1,1) and would
   quietly outrank `.mark-dark` at (0,1,0), which renders BOTH colourways side by
   side — and a check that asks "which mark is showing" still passes, because one
   of them is. */
.mark-light, .mark-dark { display: block; }
.mark-dark { display: none; }
:root[data-mode="dark"] .mark-light,
:root[data-variant="vermillion"] .mark-light { display: none; }
:root[data-mode="dark"] .mark-dark,
:root[data-variant="vermillion"] .mark-dark { display: block; }

/* ═══════════════════════════════════════════════════════ 1. Header (sticky) ═ */

.masthead {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hair);
}
.masthead-inner {
  max-width: 1160px; margin: 0 auto; padding: 14px 28px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px 28px;
}
.logo { display: flex; align-items: flex-end; gap: 12px; color: var(--fg); }
.logo img { height: 52px; width: auto; }

.nav {
  display: flex; flex-wrap: wrap; gap: 10px 24px; margin-left: auto;
  font-size: 14px; font-weight: 500; white-space: nowrap;
}
.nav a { color: var(--muted); }
.nav a:hover { color: var(--fg); }

.controls { display: flex; align-items: center; gap: 10px; }

.swatches { display: flex; gap: 6px; padding-right: 4px; }
.swatch {
  width: 22px; height: 22px; padding: 0; cursor: pointer;
  border-radius: var(--radius); border: 1px solid var(--outline);
  transition: transform .15s ease;
}
.swatch:hover { transform: translateY(-1px); }
.swatch-press       { background: linear-gradient(135deg,#F1E9D9 0 46%,#B08D57 46% 74%,#7A2E2E 74% 100%); }
.swatch-vermillion  { background: linear-gradient(135deg,#5C2222 0 46%,#87423F 46% 74%,#E2C295 74% 100%); }
.swatch-brass       { background: linear-gradient(135deg,#F7F1E3 0 46%,#7A2E2E 46% 74%,#B08D57 74% 100%); }
.swatch-letterpress { background: linear-gradient(135deg,#FAF7F0 0 46%,#14100E 46% 74%,#14100E 74% 100%); }

.mode-toggle {
  width: 34px; height: 34px; display: grid; place-items: center; cursor: pointer;
  border: var(--border) solid var(--outline); border-radius: var(--radius);
  background: transparent; color: var(--muted);
}
.mode-toggle:hover { color: var(--fg); border-color: var(--fg); }
.icon-moon { display: none; }
:root[data-mode="dark"] .icon-sun  { display: none; }
:root[data-mode="dark"] .icon-moon { display: block; }

.cta {
  font-size: 13.5px; font-weight: 500; padding: 9px 16px; white-space: nowrap;
  border-radius: var(--radius); background: var(--btn-bg); color: var(--btn-fg);
}
.cta:hover { color: var(--btn-fg); opacity: .85; }

/* ════════════════════════════════════════════════════════════════ 2. Hero ═ */

.hero {
  display: flex; flex-wrap: wrap; gap: 56px; align-items: center;
  padding: 96px 0 72px;
}
.hero-copy { flex: 1 1 420px; min-width: 0; }

.eyebrow-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 26px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .26em;
  text-transform: uppercase; color: var(--muted);
}
.dot { flex: 0 0 auto; width: 6px; height: 6px; border-radius: 50%; background: var(--brass); }
.eyebrow-text { color: var(--eyebrow); }

/* One of the levers that makes the four themes read differently: 2 / 2 / 3 / 4px. */
.accent-rule { width: 56px; height: var(--rule); background: var(--primary); margin: 0 0 24px; }

.h1 {
  font-size: clamp(40px, 5.2vw, 66px); line-height: 1.04; font-weight: 300;
  letter-spacing: -.025em; margin: 0 0 26px;
}
.lede { font-size: 19px; line-height: 1.6; color: var(--muted); max-width: 52ch; margin: 0 0 34px; }

.buttons { display: flex; flex-wrap: wrap; gap: 12px; }
.btn { font-size: 14.5px; font-weight: 500; padding: 13px 26px; border-radius: var(--radius); }
.btn-primary { background: var(--btn-bg); color: var(--btn-fg); }
.btn-primary:hover { color: var(--btn-fg); opacity: .85; }
.btn-secondary { border: var(--border) solid var(--outline); color: var(--fg); }
.btn-secondary:hover { border-color: var(--fg); color: var(--fg); }

.hero-mark { flex: 1 1 340px; min-width: 0; display: flex; justify-content: flex-end; }
.hero-mark img { width: 100%; max-width: 540px; height: auto; }

/* ══════════════════════════════════════════════════ 3. Key-identity panel ═ */

.keys {
  border: var(--border) solid var(--outline); border-radius: var(--radius);
  background: var(--raised); padding: 36px 34px;
  display: flex; flex-wrap: wrap; gap: 44px; align-items: center;
}
.keys-list { flex: 1 1 340px; min-width: 0; display: grid; gap: 10px; font-size: 12.5px; }
.key-row { display: flex; align-items: center; gap: 14px; min-width: 0; }

/* min-width:0 on both the row and the hash is load-bearing. Without it the flex
   item refuses to shrink below its content, the ellipsis never fires, and the
   label escapes into the paragraph beside it. */
.key-hash {
  flex: 1 1 auto; min-width: 0; color: var(--fg); opacity: .85;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.key-label {
  flex: 0 0 auto; font-size: 10.5px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--muted);
}
.key-label.is-agent { color: var(--brass); }
.keys-note { flex: 1 1 280px; margin: 0; font-size: 15px; line-height: 1.6; color: var(--muted); }

/* ══════════════════════════════════════════════════════ Section furniture ═ */

.band { padding: 110px 0 0; }

.eyebrow {
  display: inline-block; width: max-content; margin-bottom: 18px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .26em; text-transform: uppercase;
  line-height: 1.4; white-space: nowrap;
  color: var(--eyebrow-fg, var(--eyebrow));
  background: var(--eyebrow-bg);
  padding: var(--eyebrow-pad);
  border-bottom: var(--eyebrow-rule);
}

.h2 {
  font-size: clamp(30px, 3.6vw, 46px); line-height: 1.1; font-weight: 300;
  letter-spacing: -.02em; margin: 0 0 52px; max-width: 22ch;
}

.head-2up {
  display: flex; flex-wrap: wrap; gap: 40px 56px; align-items: end; margin-bottom: 56px;
}
.head-2up .h2 { margin: 0; flex: 1 1 340px; }
.head-2up p { flex: 1 1 360px; margin: 0; font-size: 17px; line-height: 1.62; color: var(--muted); }
.head-2up--tight { margin-bottom: 44px; }

/* ═══════════════════════════════════════════ 4. "The whole fleet" (#fleet) ═ */

/* The 1px gap over a --hair background IS the rule system. In letterpress
   --hair is near-opaque ink, so the same markup reads as a ruled table. */
.cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1px; background: var(--hair); border: var(--border) solid var(--hair);
}
.card { background: var(--bg); padding: 30px 32px 34px; }
.card h3 { font-size: 17px; font-weight: 600; margin: 0 0 12px; }
.card p { margin: 0; font-size: 15.5px; line-height: 1.62; color: var(--muted); }

/* ═══════════════════════════════════════════════ 5. "Built on MLS" (#protocol) ═ */

.pillars { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 34px; }
.pillar { padding-top: 22px; border-top: var(--rule) solid var(--outline); }
.pillar--primary { border-top-color: var(--primary); }
.pillar--brass   { border-top-color: var(--brass); }
.pillar--fg      { border-top-color: var(--fg); }

.pillar-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 16px; }
.pillar-head h3 { font-size: 18px; font-weight: 600; margin: 0; }
.chip {
  font-size: 10.5px; letter-spacing: .08em; color: var(--brass); white-space: nowrap;
  border: var(--border) solid var(--outline); border-radius: var(--radius); padding: 2px 6px;
}
.pillar ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 14px; }
.pillar li {
  font-size: 15px; line-height: 1.6; color: var(--muted);
  padding-left: 16px; border-left: 1px solid var(--outline);
}

.caveat {
  margin: 44px 0 0; padding: 22px 26px; max-width: 78ch;
  background: var(--raised); border-left: var(--rule) solid var(--brass);
  font-size: 15px; line-height: 1.62; color: var(--muted);
}

/* ══════════════════════════════════════ 6. "The cryptography is public" (#source) ═ */

.repos { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 24px; }
.repo {
  display: block; padding: 28px 30px; color: var(--fg);
  border: var(--border) solid var(--outline); border-radius: var(--radius);
  background: var(--raised);
}
.repo:hover { border-color: var(--primary); color: var(--fg); }
.repo-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.repo-name { font-size: 15px; font-weight: 500; }
.repo-licence {
  flex: 0 0 auto; margin-left: auto; font-size: 10.5px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted);
}
.repo p { margin: 0; font-size: 15px; line-height: 1.62; color: var(--muted); }
.source-note { margin: 28px 0 0; font-size: 15px; line-height: 1.62; color: var(--muted); max-width: 70ch; }

/* ═════════════════════════════════════════════════════ 7. Access + footer ═ */

.band-access { padding: 110px 0 96px; }
.access {
  border: var(--border) solid var(--outline); border-radius: var(--radius);
  padding: 56px 48px; display: flex; flex-wrap: wrap; gap: 40px 48px; align-items: center;
}
.access-copy { flex: 1 1 380px; min-width: 0; }
.access-copy .h2 {
  font-size: clamp(26px, 3vw, 38px); line-height: 1.12; margin: 0 0 14px; max-width: 24ch;
}
.access-copy p { margin: 0; font-size: 16.5px; line-height: 1.6; color: var(--muted); max-width: 56ch; }

.access-form { flex: 0 1 auto; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.access-form input {
  font-family: inherit; font-size: 14.5px; color: var(--fg);
  background: var(--raised); border: var(--border) solid var(--outline);
  border-radius: var(--radius); padding: 13px 14px; width: min(250px, 60vw);
}
.access-form input:focus { outline: none; border-color: var(--primary); }
.access-form button {
  font-family: inherit; font-size: 14.5px; font-weight: 500; padding: 13px 24px;
  border: none; border-radius: var(--radius);
  background: var(--btn-bg); color: var(--btn-fg); cursor: pointer; white-space: nowrap;
}
.access-form button:hover { opacity: .9; }

.footer { border-top: 1px solid var(--hair); }
.footer-inner {
  max-width: 1160px; margin: 0 auto; padding: 44px 28px 60px;
  display: flex; flex-wrap: wrap; gap: 40px 48px; align-items: start;
}
.footer-brand { flex: 1 1 380px; min-width: 0; }
.footer-logo { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 18px; }
.footer-logo img { height: 46px; width: auto; }
.footer-brand p { margin: 0; font-size: 14.5px; line-height: 1.6; color: var(--muted); max-width: 62ch; }

.footer-links { flex: 1 1 240px; display: flex; gap: 56px; justify-content: flex-end; font-size: 14px; }
.footer-col { display: grid; gap: 10px; }
.footer-col h2 {
  margin: 0; font-size: 10.5px; font-weight: 700; letter-spacing: .2em;
  text-transform: uppercase; color: var(--muted);
}
.footer-col a { color: var(--fg); }

/* ═══════════════════════════════════════════════════════════════ a11y ═════ */

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .shell, .swatch { transition: none; }
}
