/* ─────────────────────────────────────────────────────────────────────────
   Airrand 3D — brand system for the PUBLIC pages.

   The five static pages nginx serves (landing, pricing, terms, privacy,
   contact) used to carry a copy of the palette each. They drifted: the landing
   ran one violet, the legal pages ran another, and only the legal pages had a
   light theme at all — so a visitor on a light OS read a dark landing page,
   signed in, and landed in a light app. This file is the single definition all
   five now share, and it mirrors the app's own tokens in
   packages/dashboard/src/index.css. Edit the two together.

   Served by the app (nginx's /3d* locations are exact-match, so anything else
   falls through to `location /` and is proxied), which is also why the pages
   can load /theme-init.js and pick up the SAME stored `threed-theme` the app
   uses. That script stamps data-theme before first paint.

   Colour contract, in one line: orange ACTS (anything you can click); violet
   is the parent brand's mark and nothing else. It used to HOLD the room as an
   overhead wash, which is the purple these pages no longer render. The long
   version is in index.css.
   ───────────────────────────────────────────────────────────────────────── */

:root,
[data-theme="dark"] {
  --bg: #0d0e13;
  --surface: #15171f;
  --card: #171a23;
  /* A panel that is a shade off the page rather than a card in its own right —
     the callout boxes on the legal pages. */
  --bg-soft: #171a23;
  --ink: #eceef4;
  --body: #c8ccd8;
  --muted: #99a0b3;
  /* Decorative edge — dividers, card outlines. Not a control. */
  --line: #2a2e3d;
  /* The edge that identifies a control. WCAG 1.4.11 wants 3:1 from this. */
  --border: #6e7590;

  /* Ink: links, highlighted words, section eyebrows. 6.96:1 on --bg. */
  --accent: #f77525;
  --accent-soft: #fe995c;
  --accent-dim: #c9540f;
  /* Fill: the primary button's ground, and the label that sits on it. Brand
     orange is bright — white on it is 2.79:1 — so the label is near-black. */
  --accent-fill: #f77525;
  --accent-fill-hover: #fe995c;
  --accent-ink: #17110a;

  /* The parent brand, and the lockup's colour. Declared for reference: with the
     overhead wash gone nothing on these pages paints with it, and it was never
     a control. */
  --violet: #430eab;
  --violet-ink: #b9a2f5;

  /* Chip ground: the step numerals, the COMING SOON pills. OPAQUE, and mixed
     from BRAND orange rather than --accent. Both properties are load-bearing.
     Opaque because a translucent chip inherits whatever it lands on, and these
     land on an already-tinted band — the two tints stacked and dropped the
     chip's own label to 4.23:1. Brand orange because on paper --accent is the
     vermilion ink, and a tint made from it darkens the chip the same way. */
  --accent-chip: #2a1d14;
  --accent-tint: rgba(247, 117, 37, 0.14);
  --accent-tint-edge: rgba(247, 117, 37, 0.30);
  --plate-line: rgba(247, 117, 37, 0.16);
  /* No overhead wash. The violet vignette that sat here was the only purple
     these pages actually rendered, and it tinted every ground it lay over; the
     brand keeps its violet in the lockup instead. Kept as a token rather than
     deleted because four pages paint a `.glow` layer through it, and it is the
     seam an overhead vignette would come back through. */
  --glow-top: transparent;
  --glow-bottom: rgba(247, 117, 37, 0.09);
  --header-bg: rgba(13, 14, 19, 0.72);
  --stage-top: #0f1017;
  --stage-bottom: #0a0b10;
  --grain-opacity: 0.035;
  --grain-blend: overlay;
  --radius: 16px;

  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #eeedf2;
  --surface: #ffffff;
  --card: #ffffff;
  --bg-soft: #f7f6fa;
  --ink: #16151c;
  --body: #3b4053;
  --muted: #565c72;
  --line: #e0dfe6;
  --border: #7f829c;

  /* On paper the ink has to darken to clear 4.5:1, and an orange on the brand's
     own hue goes brown at that depth. So the ink keeps the brand's CHROMA and
     gives up ten degrees of hue instead: a vermilion, the most saturated colour
     that still carries small text on this ground (5.4:1 on --bg). The FILL
     stays brand orange, because a CTA is the one place the logo's colour
     belongs at full strength. */
  --accent: #b23300;
  /* No lighter orange survives here. --accent-soft is chip text (the step
     numerals, the COMING SOON pills) sitting on a 14% accent tint, and the
     obvious #c4580c is 3.32:1 on that ground. On paper the soft role collapses
     into the ink, the way ink and fill collapse into one orange at night. */
  --accent-soft: #b23300;
  --accent-dim: #8d1d00;
  --accent-fill: #f77525;
  --accent-fill-hover: #e0620f;
  --accent-ink: #17110a;

  --violet: #430eab;
  --violet-ink: #430eab;

  --accent-chip: #fdeee5;
  --accent-tint: rgba(247, 117, 37, 0.14);
  --accent-tint-edge: rgba(247, 117, 37, 0.34);
  --plate-line: rgba(196, 88, 12, 0.20);
  /* Paper needs the vignette dark gets for free, and it cannot be the same
     KIND of thing. A saturated warm field over white reads as a stain, like
     coffee through paper, because nothing on a white page is warmer than the
     page except dirt — which is why the violet that used to sit here was
     violet. With violet gone the bloom is a warm WHITE instead: brighter than
     --bg rather than more coloured than it, so it reads as light falling on
     the page. That is also why its alpha is high where the dark block's is
     low. Dark adds light by adding colour; paper adds it by adding luminance,
     and #eeedf2 is far enough off white to have somewhere to go. The foot
     keeps the orange, where the plate grid is already warm. */
  --glow-top: rgba(255, 237, 222, 0.95);
  --glow-bottom: rgba(247, 117, 37, 0.11);
  --header-bg: rgba(238, 237, 242, 0.78);
  --stage-top: #f9f8fb;
  --stage-bottom: #e9e7ee;
  /* Grain over a bright ground goes muddy on overlay and reads as dirt. */
  --grain-opacity: 0.02;
  --grain-blend: multiply;
  --radius: 16px;

  color-scheme: light;
}

/* The same values again, for a visitor with JavaScript off: theme-init.js is
   what normally stamps data-theme, and without it the bare :root above would
   hand a light-OS visitor the dark page this file exists to stop. Byte-identical
   to the block above on purpose — 3d-brand-css.test.ts fails if they drift. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
  --bg: #eeedf2;
  --surface: #ffffff;
  --card: #ffffff;
  --bg-soft: #f7f6fa;
  --ink: #16151c;
  --body: #3b4053;
  --muted: #565c72;
  --line: #e0dfe6;
  --border: #7f829c;

  /* On paper the ink has to darken to clear 4.5:1, and an orange on the brand's
     own hue goes brown at that depth. So the ink keeps the brand's CHROMA and
     gives up ten degrees of hue instead: a vermilion, the most saturated colour
     that still carries small text on this ground (5.4:1 on --bg). The FILL
     stays brand orange, because a CTA is the one place the logo's colour
     belongs at full strength. */
  --accent: #b23300;
  /* No lighter orange survives here. --accent-soft is chip text (the step
     numerals, the COMING SOON pills) sitting on a 14% accent tint, and the
     obvious #c4580c is 3.32:1 on that ground. On paper the soft role collapses
     into the ink, the way ink and fill collapse into one orange at night. */
  --accent-soft: #b23300;
  --accent-dim: #8d1d00;
  --accent-fill: #f77525;
  --accent-fill-hover: #e0620f;
  --accent-ink: #17110a;

  --violet: #430eab;
  --violet-ink: #430eab;

  --accent-chip: #fdeee5;
  --accent-tint: rgba(247, 117, 37, 0.14);
  --accent-tint-edge: rgba(247, 117, 37, 0.34);
  --plate-line: rgba(196, 88, 12, 0.20);
  /* Paper needs the vignette dark gets for free, and it cannot be the same
     KIND of thing. A saturated warm field over white reads as a stain, like
     coffee through paper, because nothing on a white page is warmer than the
     page except dirt — which is why the violet that used to sit here was
     violet. With violet gone the bloom is a warm WHITE instead: brighter than
     --bg rather than more coloured than it, so it reads as light falling on
     the page. That is also why its alpha is high where the dark block's is
     low. Dark adds light by adding colour; paper adds it by adding luminance,
     and #eeedf2 is far enough off white to have somewhere to go. The foot
     keeps the orange, where the plate grid is already warm. */
  --glow-top: rgba(255, 237, 222, 0.95);
  --glow-bottom: rgba(247, 117, 37, 0.11);
  --header-bg: rgba(238, 237, 242, 0.78);
  --stage-top: #f9f8fb;
  --stage-bottom: #e9e7ee;
  /* Grain over a bright ground goes muddy on overlay and reads as dirt. */
  --grain-opacity: 0.02;
  --grain-blend: multiply;
  --radius: 16px;

  color-scheme: light;
}
}

/* ─── The lockup ─────────────────────────────────────────────────────────
   The master horizontal logo, in the cut its ground can carry: the colour file
   puts "airrand" in Airrand violet, which vanishes on the night ground, so the
   dark theme gets the white-wordmark cut. Both files are the same canvas with
   the artwork on identical bounds, so the swap causes no reflow.

   Done in CSS, not script, so the right cut is on screen at first paint — and
   so a visitor with JavaScript off still gets a logo rather than a broken one.
   Mirrors the .threed-logo-* rules the app uses in index.css.

   --lockup-h is the height of the WORDMARK ITSELF, not of the file. The
   artwork ships with its clear space baked in: on the 2040x438 canvas it
   occupies rows 49-404 and columns 110-1928, so 19% of the file's height and
   11% of its width are transparent margin. Setting `height` on the <img>
   therefore drew a wordmark a fifth smaller than the number said, which is how
   a phone header reading 21px put a 17px logo on screen. So the image is
   scaled up by that ratio and the baked-in margin pulled back off with negative
   margins, and every number in the ladder below is now a height you can see.

   Not clipped: what spills is transparent, and leaving it be keeps the home
   link's tap target a little wider than the letters, which on a phone is the
   difference between hitting it and hitting nothing. */
.brandmark {
  --lockup-h: 34px;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  line-height: 0;
}
/* On a phone the lockup is 21–28px tall, and a home link a thumb cannot land
   on is no home link. Vertical padding pulled back with a matching negative
   margin grows the tap target to about 44px without moving the row. */
@media (pointer: coarse) {
  .brandmark { padding: 10px 0; margin: -10px 0; }
}
.brandmark img {
  width: auto;
  max-width: none;
  height: calc(var(--lockup-h) / 0.8105);
  margin: calc(var(--lockup-h) * -0.138) calc(var(--lockup-h) * -0.3155)
          calc(var(--lockup-h) * -0.0958) calc(var(--lockup-h) * -0.3099);
}
.brandmark .logo-light { display: none; }
.brandmark .logo-dark { display: block; }
[data-theme="light"] .brandmark .logo-light { display: block; }
[data-theme="light"] .brandmark .logo-dark { display: none; }

/* Visually-hidden label — the theme toggle's buttons are icon-only, and the
   nav is the one place every public page needs this. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ─── Theme toggle ───────────────────────────────────────────────────────
   Three states, matching the app's: system, light, dark. Hidden until the
   script that drives it has run, so a no-JS visitor is not shown a dead
   control — html.js is set inline at the top of every page. */
.theme-toggle {
  display: none;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}
html.js .theme-toggle { display: inline-flex; }
.theme-toggle button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  line-height: 0;
}
.theme-toggle button:hover { color: var(--ink); }
.theme-toggle button[aria-pressed="true"] {
  background: var(--accent-fill);
  color: var(--accent-ink);
}
.theme-toggle button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.theme-toggle svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* ─── Site nav ───────────────────────────────────────────────────────────
   The one top navigation every public page wears — the landing page, the
   marketing pages nginx serves, the legal pages, and the library and shared
   design pages Fastify renders.

   It used to exist only on the landing page, /pricing and /tips. The legal
   pages and every /d/:slug — the pages an ad or a shared link actually drops
   a stranger onto — carried a stub of a theme toggle and one link, so the
   most-linked pages on the site were the ones with no way into the rest of
   it. Defined here, next to the palette, for the same reason the palette is:
   five copies of a header is how the first three drifted apart.

   Pages keep their own `header` rule (the landing's is sticky, the others
   are not); this owns what is inside it. Where a page still declares .btn
   locally its copy wins, since a page's <style> comes after this link. */
.site-nav {
  /* Two spacings, not one. The reading (theme toggle, Pricing, Design
     library) wants air between items; the CTA and sign in are one control
     group and read as two halves of the same offer, so they sit tight. Both
     are variables because every breakpoint below re-tunes the row, and a
     literal gap there would leave the pair's spacing behind. */
  --nav-gap: 28px;
  --nav-btn-gap: 10px;
  display: flex; align-items: center; gap: var(--nav-gap);
}
/* Flex gap is uniform, so the pair is pulled back in rather than spaced out.
   Clamped at 0 by the calc going non-negative once --nav-gap is already at or
   under the button gap (381px and below), so the two can never overlap. */
.site-nav .nav-cta + .nav-signin { margin-left: calc(var(--nav-btn-gap) - var(--nav-gap)); }
.site-nav .navlink {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
}
.site-nav .navlink:hover { color: var(--ink); }
.site-nav .navlink[aria-current="page"] { color: var(--ink); }

/* The header CTA. Smaller than a body CTA on purpose: it follows the reader
   down every page and must not compete with the action the page itself is
   asking for ("Remix to your dimensions" on a design page). */
.site-nav .nav-cta {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.88rem;
  text-decoration: none;
  white-space: nowrap;
  background: var(--accent-fill);
  color: var(--accent-ink);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent),
              0 10px 34px -12px color-mix(in srgb, var(--accent) 60%, transparent);
  transition: background .15s, transform .15s;
}
.site-nav .nav-cta:hover { background: var(--accent-fill-hover); transform: translateY(-1px); }

/* "Sign in" sits last in the row, after the CTA, and is the header's second
   action rather than part of its reading — so it wears a button, not a link.
   Same geometry as .nav-cta so the pair reads as one control group, in the
   ghost treatment the pages already use for a second action (see .btn-ghost
   in 3d.html): the outline carries it, the fill stays with the CTA. That is
   also what keeps the two apart at a glance when they sit shoulder to
   shoulder, which is the whole reason only one of them is orange. */
.site-nav .nav-signin {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.88rem;
  text-decoration: none;
  white-space: nowrap;
  background: var(--card);
  color: var(--ink);
  transition: border-color .15s, transform .15s;
}
.site-nav .nav-signin:hover { border-color: var(--accent); transform: translateY(-1px); }
.site-nav .nav-cta:focus-visible,
.site-nav .nav-signin:focus-visible,
.site-nav .navlink:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Two text links plus two buttons wrap to three rows on a phone and eat the
   fold. The secondary reading is what goes; the two ways in stay. */
@media (max-width: 860px) {
  .site-nav { flex-wrap: wrap; justify-content: flex-end; --nav-gap: 22px; row-gap: 10px; }
  .site-nav .navlink.secondary { display: none; }
  /* Let the row the nav sits in break, so the nav drops below the lockup
     rather than squeezing it. Reached through :has() because the header is
     the page's own element and each page names it differently — a browser
     without :has() simply wraps the nav in place beside the lockup, which is
     the degradation, not a broken layout. */
  header:has(> .site-nav),
  .header-inner:has(> .site-nav) { flex-wrap: wrap; row-gap: 10px; }
}
/* Below this the theme toggle goes too. The palette still follows the OS
   through theme-init.js, and the control is a page down in the footer's
   reach. */
@media (max-width: 700px) {
  .site-nav { --nav-gap: 18px; row-gap: 8px; }
  .site-nav .theme-toggle,
  html.js .site-nav .theme-toggle { display: none; }
  /* The lockup shrinks with the nav. It lived in 3d.html, which meant the
     landing page narrowed properly and the library, design and legal pages
     carried a full-size logo down to 320px. */
  .brandmark { --lockup-h: 28px; }
}
/* The reading goes one step earlier than it used to. Between 495 and 560 the
   row holds "Pricing", a 138px CTA and an 80px sign-in, which left the lockup
   127px to sit in — narrower than the 133px it gets at 494, so the logo had to
   get SMALLER as the screen got wider. Dropping the link here is the same
   trade the block below makes for the same reason, and Pricing keeps the three
   other ways in listed there. */
@media (max-width: 560px) {
  .site-nav .navlink { display: none; }
}
/* The row above claimed brand + reading + the way in fits one line. With one
   button it did; with two it stops at 494px — measured on /pricing and /tips,
   the tightest headers, where a 126px lockup, "Pricing", a 138px CTA and an
   80px sign-in need more than the row has and the header spends a second row
   before the page begins. 494 rather than a rounder number because that is
   where it actually happens: 495 fits, 494 does not.

   The reading goes here, and which link that is was never a free choice: the
   CTA is the page's job and sign in is how a returning customer gets back in,
   so what is left to cut is Pricing. It keeps three other ways in from this
   page alone (the #pricing section it points at, the footer, and "Full
   pricing →" in the notice and the FAQ). Selected by what the link IS rather
   than by href, because these pages spell the same destination "#pricing" and
   "/pricing" depending on which one is showing.

   The buttons tighten with it. One button could hold the body scale all the
   way down; two side by side cannot. */
@media (max-width: 494px) {
  .site-nav .nav-cta,
  .site-nav .nav-signin { padding: 7px 12px; font-size: 0.82rem; }
  .site-nav { --nav-gap: 14px; row-gap: 8px; }
  .brandmark { --lockup-h: 24px; }
  /* Sign in gives up its BOX here rather than at 363, where this used to sit.
     Two buttons shoulder to shoulder cost 191px of a phone row, and what was
     paying for the second box was the lockup — the whole reason a 375px phone
     was reading the brand at 17px. The link costs ~30px instead and keeps its
     place beside the CTA. The vertical padding stays behind to keep the 24px
     tap target WCAG 2.5.8 asks for, since the text alone is 17px tall. */
  .site-nav .nav-signin {
    padding: 6px 0;
    border-color: transparent;
    background: none;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.9rem;
  }
  .site-nav .nav-signin:hover { color: var(--ink); border-color: transparent; transform: none; }
}
/* 360px and 375px are still shipping phones, and at 375 the row above lands
   over: a 112px lockup, a 16px gap and 191px of buttons against 327px of
   content. The lockup gives up the difference. 381, because 381 is the last
   width that wraps — 380 left one pixel of the band uncovered. */
@media (max-width: 381px) {
  .site-nav { --nav-gap: 10px; row-gap: 8px; }
  .brandmark { --lockup-h: 21px; }
}
/* Below this even the link does not fit, so it goes and the CTA — which is
   also where a returning visitor lands, since 3d-nav-auth.js relabels it
   "Dashboard" for a live session — is what stays beside the lockup.

   357, up from 343, because the lockup beside it now draws 108px wide rather
   than 98px and the row gives out that much sooner. No shipping phone is
   344–357px wide — 320 and 360 are the two widths this band sits between — so
   what the move costs is a width nobody browses at, and what it buys is a
   brand you can read at 360.

   Every threshold in this block is a measured one; a rounder number here is a
   wrapped header on some real phone. */
@media (max-width: 357px) {
  .site-nav .nav-signin { display: none; }
}

/* ─── Footer links ───────────────────────────────────────────────────────
   Every public page shipped its footer links at 16px tall with 22px between
   rows. WCAG 2.5.8 wants 24px, and the spacing exception that forgives a
   small target needs 24px between centres — 22px does not clear it, so on a
   phone "Cookie settings" sat a mistap away from the row above it.

   Padding does the whole job: the text does not move relative to its
   neighbours (8px of padding replaces the 8px of margin the pages set), the
   box grows to 28px, and the rows push apart. Scoped to .foot-links, not
   `footer a`, so the "powered by Airrand" link inside a sentence stays
   inline — an inline link in prose is exempt, and padding would have boxed
   its underline. The negative margin puts the row's outer edge back where it
   was, which the space-between footers on the legal pages align against.

   Colour stays with each page's own `footer a`: that rule covers the prose
   link too, which this one deliberately does not. */
.foot-links { margin-left: -8px; margin-right: -8px; }
.foot-links a { display: inline-block; padding: 6px 8px; margin: 0; }
/* A thumb, not a pointer: the 28px box above clears WCAG's floor, but the
   rows are still a mistap apart on a phone. 10px brings each link to ~42px,
   which is what the landing page's own footer already gives them. */
@media (pointer: coarse) {
  .foot-links a { padding: 10px 8px; }
}
