/* ==========================================================================
   Base — tokens, reset, typography, shared controls.

   THEME RULE — the one thing to understand before editing colours here.

   The page has a light and a dark theme. The mat does not.

   --mat / --mat-alt are the neutral immediately surrounding a photograph, and
   they hold the SAME value in both themes. A surround changes how a black-and-
   white image reads, so letting it swap would mean two shoppers judging the
   same merchandise against two different references — and one of them
   receiving a print that does not match what they chose. Galleries hang work
   on varied walls but mat it consistently, for exactly this reason.

   --surface / --surface-alt are the theme-aware greys for ordinary interface
   chrome: hovers, chips, toolbars. Use these for UI. Never use --mat for UI,
   and never use --surface behind a photograph.
   ========================================================================== */

:root {
  color-scheme: light;

  --ink:         #16181c;
  --ink-soft:    #6b7078;
  --ink-faint:   #9aa0a8;
  /* Softened from pure white — decision 0019. Chosen to close most of the
     brightness gap against --mat (1.05:1, down from 1.12:1) while keeping
     --ink-soft, the tightest text pairing on a light background, at 4.5:1
     against both this and --paper-warm. */
  --paper:       #f8f7f5;
  --paper-warm:  #f6f5f3;

  /* Photograph surround — constant across themes. Do not put these in a
     [data-theme] block. */
  --mat:         #f2f2f0;
  --mat-alt:     #e8e8e5;

  /* Interface greys — theme-aware. */
  --surface:     #f2f2f0;
  --surface-alt: #e8e8e5;

  --rule:        #e4e4e1;
  --rule-strong: #c9c9c4;
  --accent:      #16181c;
  --focus:       #2563eb;
  --warn-ink:    #7a5a12;
  --warn-bg:     #fdf6e3;
  --button-hover: #2c2f36;

  --step-0: 1rem;
  --step-1: 1.125rem;
  --step-2: clamp(1.375rem, 1.1rem + 1.2vw, 1.875rem);
  --step-3: clamp(1.875rem, 1.4rem + 2.2vw, 2.75rem);
  /* The one figure a page leads with — bigger than a heading gets to be. */
  --step-hero: clamp(2.25rem, 1.7rem + 2.4vw, 3.25rem);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;

  --measure: 34rem;
  --radius: 6px;
  /* A second, larger step for CONTAINERS — cards, panels, the readiness band.
     Controls (buttons, chips, inputs) keep --radius. The size difference reads
     as a hierarchy: a container holds controls, so it earns a softer corner. */
  --radius-lg: 12px;

  /* Semantic state, factored out of the many places that already spelled these
     hex values by hand (pills, chips, notices). New work reads the token; the
     existing call sites are untouched, so nothing already shipped had to be
     re-verified to introduce this. */
  --good:    #1a7a4c;
  --bad:     #8c2f24;
  --good-bg: #f0f8f3;
  --bad-bg:  #fdf3f2;
}

/* Dark theme. Note what is absent: --mat and --mat-alt are not overridden, so
   every photograph keeps the same surround it has in the light theme. */
:root[data-theme="dark"] {
  color-scheme: dark;

  --ink:         #e9e9e7;
  --ink-soft:    #a0a09c;
  --ink-faint:   #74746f;
  --paper:       #131315;
  --paper-warm:  #1a1a1d;

  --surface:     #232327;
  --surface-alt: #2c2c31;

  --rule:        #2a2a2f;
  --rule-strong: #414148;
  --accent:      #e9e9e7;
  --focus:       #7aa7ff;
  --warn-ink:    #e0c274;
  --warn-bg:     #2a2416;
  --button-hover: #d2d2ce;

  /* Same hues the existing chip--paid/chip--failed dark overrides already use,
     so a new component sits beside an old one without a visible seam. */
  --good:    #7cd0a1;
  --bad:     #f0a99e;
  --good-bg: #16281e;
  --bad-bg:  #2b1a18;
}

/* In dark mode the primary button inverts: light fill, dark label. */
:root[data-theme="dark"] .button {
  background: var(--ink);
  border-color: var(--ink);
  color: #131315;
}

:root[data-theme="dark"] .notice--error {
  background: #2b1a18; border-color: #6b3a33; color: #f0b3a9;
}
:root[data-theme="dark"] .prototype-banner { border-bottom-color: #4a3f22; }
:root[data-theme="dark"] .notice--info,
:root[data-theme="dark"] .data-note { border-color: #4a3f22; }

/* Status chips carry meaning, so they keep their hue and only lose brightness. */
:root[data-theme="dark"] .chip--paid,
:root[data-theme="dark"] .status-pill--paid    { background: #16281e; border-color: #2f5a41; color: #7cd0a1; }
:root[data-theme="dark"] .chip--failed,
:root[data-theme="dark"] .status-pill--failed  { background: #2b1a18; border-color: #6b3a33; color: #f0a99e; }
:root[data-theme="dark"] .chip--pending,
:root[data-theme="dark"] .status-pill--pending { background: #2a2416; border-color: #4a3f22; color: #e0c274; }
:root[data-theme="dark"] .chip--print          { background: #1a2030; border-color: #35456b; color: #9db6e8; }
:root[data-theme="dark"] .chip--shipped        { background: #16281e; border-color: #2f5a41; color: #7cd0a1; }
:root[data-theme="dark"] .tally--ok            { background: #16281e; border-color: #2f5a41; color: #7cd0a1; }
:root[data-theme="dark"] .tally--bad           { background: #2b1a18; border-color: #6b3a33; color: #f0a99e; }
:root[data-theme="dark"] .variance-good        { color: #7cd0a1; }
:root[data-theme="dark"] .variance-bad         { color: #f0a99e; }
:root[data-theme="dark"] .pass .case__mark     { color: #7cd0a1; }
:root[data-theme="dark"] .fail .case__mark     { color: #f0a99e; }

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

/* A class that sets `display` (`.field`, grid/flex layout classes) otherwise
   beats the browser's own `[hidden]` rule, because author CSS always wins
   over the user-agent stylesheet regardless of specificity — so an element
   toggled with `.hidden = true` in JS, or a plain `hidden` attribute in
   markup, would stay visible. This puts `[hidden]` back in charge everywhere. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Helvetica Neue", Helvetica, -apple-system, BlinkMacSystemFont,
               "Segoe UI", Arial, sans-serif;
  font-size: var(--step-0);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.15; font-weight: 500; margin: 0; letter-spacing: -0.015em; }
h1 { font-size: var(--step-3); }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }
p  { margin: 0; }

img { max-width: 100%; }

/* Visible focus everywhere, offset so it never touches a photograph. */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}

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

/* --- layout ------------------------------------------------------------- */

.page {
  max-width: 68rem;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) 0;
  border-bottom: 1px solid var(--rule);
  margin-bottom: var(--space-6);
}

.site-header__brand {
  font-size: var(--step-1);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--ink);
}
/* ~25% larger on customer-facing pages than the admin console — the mark
   customers actually shop under gets more presence than the one staff work
   under all day. */
.site-header__brand--large { font-size: 1.4rem; }

.site-header__nav {
  display: flex;
  gap: var(--space-4);
  font-size: 0.9375rem;
}

.site-header__nav a { color: var(--ink-soft); text-decoration: none; padding-bottom: 2px; border-bottom: 2px solid transparent; }
.site-header__nav a:hover { color: var(--ink); }
/* The page you are already on. `aria-current` was doing this job for screen
   readers alone before; it costs nothing to let it carry the sighted signal
   too, and a nav with no visible "you are here" is one you re-read every time. */
.site-header__nav a[aria-current="page"] { color: var(--ink); font-weight: 500; border-bottom-color: var(--ink); }

.site-footer {
  margin-top: var(--space-7);
  padding: var(--space-5) 0;
  border-top: 1px solid var(--rule);
  color: var(--ink-soft);
  font-size: 0.875rem;
}

/* --- controls ----------------------------------------------------------- */

.button {
  font: inherit;
  font-size: 0.9375rem;
  padding: 0.6875rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.button:hover:not(:disabled) { background: var(--button-hover); border-color: var(--button-hover); }

.button--quiet {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule-strong);
}
.button--quiet:hover:not(:disabled) { background: var(--surface); border-color: var(--ink-faint); }

.button:disabled { opacity: 0.45; cursor: not-allowed; }

.field-label {
  display: block;
  font-size: 0.8125rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: var(--space-2);
}

.text-input {
  font: inherit;
  font-size: var(--step-2);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
}

.text-input::placeholder { color: var(--ink-faint); letter-spacing: 0.08em; }
.text-input[aria-invalid="true"] { border-color: #b4453a; }

.notice {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  border: 1px solid;
}

.notice--error  { background: #fdf3f2; border-color: #e8c4bf; color: #8c2f24; }
.notice--info   { background: var(--warn-bg); border-color: #e8dbb4; color: var(--warn-ink); }

/* A row-and-column list — orders, codes, production items. `.admin-table` is
   used across the owner console, the wholesale portal and a customer's own
   order page alike, so it lives here rather than in admin.css (moved from
   there, along with `.chip`/`.mono`/`.num`, for the same reason). Wrap it in
   `.table-wrap` when a table is wide enough to need to scroll sideways on a
   narrow screen; the wrap also supplies the rounded border. */
.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius); }

.admin-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }

.admin-table th {
  text-align: left; font-weight: 500; font-size: 0.75rem;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft);
  padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--rule);
  white-space: nowrap; background: var(--paper-warm);
}

.admin-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
}

.admin-table tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: var(--paper-warm); }

.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; letter-spacing: 0.01em; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* A status value, one word, coloured by what it means rather than what field
   it came from — payment and fulfillment share this palette because "paid"
   and "shipped" are both simply good news. Rendered through <x-status-chip>. */
.chip {
  display: inline-block; font-size: 0.6875rem; letter-spacing: 0.04em;
  text-transform: uppercase; padding: 2px var(--space-2); border-radius: 999px;
  border: 1px solid var(--rule-strong); background: var(--paper); white-space: nowrap;
}
.chip--paid      { background: #f0f8f3; border-color: #bfe0cd; color: #1a7a4c; }
.chip--failed    { background: #fdf3f2; border-color: #e8c4bf; color: #8c2f24; }
.chip--pending   { background: var(--warn-bg); border-color: #e8dbb4; color: var(--warn-ink); }
.chip--print     { background: #eef2fb; border-color: #c6d3ee; color: #2c4a86; }
.chip--shipped   { background: #f0f8f3; border-color: #bfe0cd; color: #1a7a4c; }
.chip--hold      { background: var(--warn-bg); border-color: #e8dbb4; color: var(--warn-ink); }
.chip--hidden    { background: var(--surface-alt); border-color: var(--rule-strong); color: var(--ink-soft); }

/* ==========================================================================
   PAGE HEAD, CARD, AND THE FEW SHAPES BUILT FROM IT
   --------------------------------------------------------------------------
   One vocabulary for "a page has a title" and "a page is made of sections",
   used everywhere from the owner's dashboard to a customer's own order page.
   Before this, the same idea was built by hand on every page: a bare <h1>, a
   <section style="margin-top:2rem"> with a bare <h2> inside it, spacing set in
   an inline style that the next section down would silently disagree with.
   Nothing here removes a class already in use — `.dash__section`, `.gate`,
   `.state-card`, `.metric`, `.pill` all keep working exactly as they did; this
   is what a page reaches for FIRST, and those stay for the layouts that
   genuinely need something more specific.
   ========================================================================== */

/* A small-caps kicker naming the DOMAIN a title belongs to — "Revenue" over
   "Money", "Fulfilment" over "Order pipeline". The title says what question
   the section answers; the eyebrow says what part of the business it is. */
.eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 var(--space-1);
}

/* A value sitting beside an eyebrow label — the signed-in address next to
   "Account". Not uppercased and not letter-spaced, because an email address
   read as ALL CAPS with gaps in it is harder to check at a glance than one set
   plainly, and checking it at a glance is the entire reason it is there. */
.eyebrow__detail {
  margin-left: var(--space-2);
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink-soft);
}

/* The title row at the top of a page. A bare <h1> before this had no fixed
   relationship to the content below it — sometimes a margin, sometimes none,
   never the same page twice. */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-3) var(--space-5);
  margin-bottom: var(--space-5);
}
.page-head h1 { font-size: var(--step-3); }
.page-head__meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: 0.8125rem;
  color: var(--ink-soft);
}

/*
  A card: one distinct block of related content, with a header that names it.

      <section class="card">
        <header class="card__head">
          <div><p class="eyebrow">Revenue</p><h2 class="card__title">Money</h2></div>
          <p class="card__meta">Paid orders only.</p>
        </header>
        …
      </section>

  --radius-lg rather than --radius: a container reads as one size step above
  the controls inside it, and the softer corner is what says so without a
  heavier border.
*/
.card {
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--paper);
  padding: var(--space-5);
  margin-top: var(--space-5);
}
/* The first card under a page-head needs no extra gap above it; the page-head
   already carries the space. */
.page-head + .card { margin-top: 0; }

.card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  margin-bottom: var(--space-4);
}
.card__title { font-size: var(--step-1); }
.card__meta { font-size: 0.8125rem; color: var(--ink-soft); text-align: right; }
.card__aside {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--rule);
  font-size: 0.8125rem;
  color: var(--ink-faint);
}
.card__link { font-size: 0.8125rem; color: var(--ink-soft); text-decoration: underline; text-underline-offset: 2px; }
.card__link:hover { color: var(--ink); }

/* Two cards side by side where the content is genuinely a pair — Delivery and
   Codes, the two wholesale gates on a narrow reading. Collapses to one column
   rather than squeezing, per the breakpoint below. */
.card-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5); align-items: start; }
.card-row > .card { margin-top: 0; }

/*
  A metric: one figure, worth reading on its own. Used loose in a `.metrics`
  flex row for a short list, or in `.metric-grid` where several sit together
  and should line up. Moved here from admin.css: a figure worth reading is not
  an admin-only idea, and a class defined in a stylesheet only the admin layout
  loads cannot be reached from anywhere else.
*/
.metric {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: var(--space-4);
  background: var(--paper);
}
/* Two columns' worth, for the one figure in a row that deserves more room. */
.metric--wide { grid-column: span 2; }
@media (max-width: 40rem) { .metric--wide { grid-column: span 1; } }

/* Something with a person waiting at the other end of it. */
.metric--live { border-color: var(--rule-strong); background: var(--surface); }

.metric__value {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.metric__label { margin: var(--space-2) 0 0; font-size: 0.875rem; }
.metric__note { margin: var(--space-1) 0 0; font-size: 0.75rem; color: var(--ink-faint); }
.metric__link { display: inline-block; margin-top: var(--space-2); font-size: 0.8125rem; }

.metric-grid {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
}

/*
  A status strip: the one question a page answers before anything else.
  Quiet by default — colour and a dot carry the fact, the copy carries the
  explanation. Never a full-bleed colour block, which reads as an alarm
  rather than as information.
*/
.status-band {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  margin-top: var(--space-5);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--paper);
}
.status-band--ok      { border-color: color-mix(in srgb, var(--good) 40%, var(--rule)); background: var(--good-bg); }
.status-band--blocked { border-color: color-mix(in srgb, var(--bad) 40%, var(--rule)); background: var(--bad-bg); }

.status-band__row { display: flex; align-items: flex-start; gap: var(--space-3); }
.status-band__dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; margin-top: 0.5rem; flex: none; background: var(--bad); }
.status-band--ok .status-band__dot { background: var(--good); }

.status-band__answer { font-size: 1.375rem; font-weight: 500; margin: 0; }
.status-band--ok .status-band__answer      { color: var(--good); }
.status-band--blocked .status-band__answer { color: var(--bad); }

.status-band__list { margin: 0; padding-left: 1.35rem; font-size: 0.9375rem; display: grid; gap: 0.3rem; }
.status-band__aside {
  margin: 0;
  padding-top: var(--space-2);
  border-top: 1px solid var(--rule-strong);
  font-size: 0.8125rem;
  color: var(--ink-soft);
}
.status-band__aside strong { color: var(--ink); font-weight: 600; }

/*
  A queue: rows to CLICK, distinct from a grid of figures to READ. Used
  wherever a page lists things with a person waiting at the other end of them.
*/
.queue-list { list-style: none; margin: 0; padding: 0; display: grid; }
.queue-list__row {
  display: grid;
  grid-template-columns: 2.75rem 1fr auto;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--rule);
}
.queue-list__row:last-child { border-bottom: none; padding-bottom: 0; }
.queue-list__count { font-size: 1.375rem; font-weight: 600; text-align: right; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.queue-list__row--live .queue-list__count { color: var(--ink); }
.queue-list__body { display: flex; align-items: baseline; gap: var(--space-2); flex-wrap: wrap; min-width: 0; }
.queue-list__label { font-size: 0.9375rem; font-weight: 500; color: var(--ink-faint); }
.queue-list__row--live .queue-list__label { color: var(--ink); }
.queue-list__note { font-size: 0.8125rem; color: var(--ink-faint); }
.queue-list__dot { width: 0.4rem; height: 0.4rem; border-radius: 50%; background: var(--warn-ink); flex: none; }
.queue-list__action {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  white-space: nowrap;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
}
.queue-list__row--live .queue-list__action { color: var(--ink); border-color: var(--rule-strong); }
.queue-list__row--live .queue-list__action:hover { background: var(--surface); border-color: var(--ink-faint); }

/*
  A hero figure: the one number a card leads with, plus supporting figures
  beside it, plus an optional quieter strip for figures that qualify the hero
  rather than add to it (tax collected, given away, unpaid — all real, none of
  them "what was earned").
*/
.figure-hero { display: grid; grid-template-columns: 13rem 1fr; gap: var(--space-6); align-items: start; }
.figure-hero__lead { display: grid; gap: 0.2rem; padding-right: var(--space-5); border-right: 1px solid var(--rule); }
.figure-hero__value { font-size: var(--step-hero); font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.figure-hero__label { font-size: 0.8125rem; color: var(--ink-soft); margin-top: 0.3rem; }
.figure-hero__note { font-size: 0.75rem; color: var(--ink-faint); }
.figure-hero__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }

.figure-hero__extra {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px dashed var(--rule-strong);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}
.figure-hero__extra .metric__value { font-size: 1.0625rem; }
.figure-hero__extra .metric--net { padding-left: var(--space-4); border-left: 1px solid var(--rule); }
.figure-hero__extra .metric--net .metric__label { color: var(--ink); font-weight: 500; }

@media (max-width: 46rem) {
  .card-row { grid-template-columns: 1fr; }
  .figure-hero { grid-template-columns: 1fr; }
  .figure-hero__lead { border-right: none; padding-right: 0; padding-bottom: var(--space-4); border-bottom: 1px solid var(--rule); }
  .figure-hero__grid { grid-template-columns: repeat(2, 1fr); }
  .figure-hero__extra { grid-template-columns: repeat(2, 1fr); }
  .figure-hero__extra .metric--net { border-left: none; padding-left: 0; grid-column: span 2; padding-top: var(--space-3); border-top: 1px solid var(--rule); }
  .queue-list__row { grid-template-columns: 2.25rem 1fr; row-gap: 0.3rem; }
  .queue-list__action { grid-column: 1 / -1; justify-self: start; padding-left: 0; }
}

.prototype-banner {
  background: var(--warn-bg);
  border-bottom: 1px solid #e8dbb4;
  color: var(--warn-ink);
  font-size: 0.8125rem;
  text-align: center;
  padding: var(--space-2) var(--space-4);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- theme toggle ---------------------------------------------------------
   A real switch: the sun and the moon are fixed at either end of the track,
   and only the thumb travels between them. `role="switch"` on the button, so
   assistive tech announces it as one rather than as a plain toggle button. */

.theme-toggle {
  flex: none;
  background: transparent;
  border: none;
  padding: 0.25rem;
  margin: -0.25rem;
  cursor: pointer;
  border-radius: var(--radius);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.theme-toggle__track {
  position: relative;
  display: block;
  width: 3.25rem;
  height: 1.625rem;
  border-radius: 999px;
  background: var(--surface-alt);
  border: 1px solid var(--rule-strong);
  transition: background-color 0.15s ease;
}

.theme-toggle:hover .theme-toggle__track { border-color: var(--ink-soft); }

.theme-toggle__track-icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  line-height: 1;
  color: var(--ink-faint);
}
.theme-toggle__track-icon--sun { left: 0.3125rem; }
.theme-toggle__track-icon--moon { right: 0.3125rem; }

.theme-toggle__thumb {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 1.375rem;
  height: 1.375rem;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  transition: transform 0.18s ease;
}

/* Track width less the thumb's own width and its two 1px insets. */
.theme-toggle[aria-checked="true"] .theme-toggle__thumb {
  transform: translateX(1.625rem);
}

/* --- site footer ---------------------------------------------------------
   Three columns that become one on a narrow screen. Grid rather than flex so
   the columns keep their proportions without each child having to know how
   many siblings it has. */

.footer {
  margin-top: var(--space-7);
  padding: var(--space-6) 0 var(--space-5);
  border-top: 1px solid var(--rule);
  font-size: 0.875rem;
  color: var(--ink-soft);
}

/* Named for screen readers, not shown. The footer is a landmark and an
   unlabelled one is announced as just "footer". */
.footer__heading {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.footer__columns {
  display: grid;
  gap: var(--space-6) var(--space-5);
  grid-template-columns: 1fr;
}

@media (min-width: 46rem) {
  .footer__columns {
    /* The signup needs the most room; identity the least. */
    grid-template-columns: minmax(10rem, 0.8fr) minmax(12rem, 1fr) minmax(15rem, 1.2fr);
  }
}

.footer__col { display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; }

.footer__brand {
  font-size: var(--step-1);
  letter-spacing: 0.08em;
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
}
.footer__brand:hover { text-decoration: underline; }
.footer__brand--large { font-size: 1.4rem; }

.footer__place { margin: 0; }

.footer__social { display: flex; gap: var(--space-3); list-style: none; margin: 0; padding: 0; }

.footer__social a {
  display: inline-flex;
  padding: var(--space-2);
  margin: calc(var(--space-2) * -1);   /* a 44px target without visible bulk */
  color: var(--ink-soft);
  border-radius: var(--radius);
}
.footer__social a:hover { color: var(--ink); }
.footer__social a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.footer__icon { width: 1.25rem; height: 1.25rem; display: block; }

/* The two link columns sit inside the middle column and collapse together. */
.footer__col--nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-5); }

.footer__links ul { list-style: none; margin: var(--space-2) 0 0; padding: 0; display: grid; gap: var(--space-2); }
.footer__links a { color: var(--ink-soft); }
.footer__links a:hover { color: var(--ink); }

.footer__label {
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0;
  font-weight: 500;
}

.footer__legal {
  margin: var(--space-6) 0 0;
  padding-top: var(--space-4);
  border-top: 1px solid var(--rule);
  color: var(--ink-faint);
  font-size: 0.8125rem;
}

/* --- the signup form, wherever it is placed ------------------------------ */

.signup-form { display: grid; gap: var(--space-2); }

.signup-form__title { font-size: var(--step-1); margin: 0; color: var(--ink); }
.signup-form__note { margin: 0; }

.signup-form__label {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.signup-form__row { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); }

.signup-form__input {
  font: inherit;
  flex: 1 1 12rem;
  min-width: 0;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
}
.signup-form__input::placeholder { color: var(--ink-faint); }
.signup-form__input:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

.signup-form__button {
  font: inherit;
  padding: 0.55rem 1rem;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  flex: none;
}
.signup-form__button:hover { background: var(--button-hover); border-color: var(--button-hover); }
.signup-form__button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

:root[data-theme="dark"] .signup-form__button { background: var(--ink); border-color: var(--ink); color: #131315; }

/* Mailchimp's bot trap. Off-screen rather than display:none — a hidden input
   is easier for a bot to detect and skip. */
.signup-form__trap { position: absolute; left: -5000px; }

.signup-form__fine { margin: 0; font-size: 0.8125rem; color: var(--ink-faint); }

/* --- frame recommendations ----------------------------------------------
   A reading page, so it is set to a measure rather than filling the width.
   The two-up split collapses early: "why" and "what to buy" are read in
   sequence on a phone, not compared side by side. */

.frames__lede { max-width: var(--measure); font-size: var(--step-1); margin-top: var(--space-3); }

.frames__disclosure {
  max-width: var(--measure);
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-left: 3px solid var(--rule-strong);
  background: var(--surface);
  font-size: 0.875rem;
  color: var(--ink-soft);
}

.frames__approach { margin-top: var(--space-7); }
.frames__approach-lede { max-width: var(--measure); color: var(--ink-soft); margin-top: var(--space-2); }

.frames__label {
  font-size: 0.6875rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-faint); margin: 0 0 var(--space-3); font-weight: 500;
}

.frames__split { display: grid; gap: var(--space-6); margin-top: var(--space-5); }
@media (min-width: 52rem) { .frames__split { grid-template-columns: 1fr 1fr; } }

.frames__why { margin: 0; padding-left: 1.1rem; display: grid; gap: var(--space-2); color: var(--ink-soft); }

.frames__watch {
  margin-top: var(--space-4);
  font-size: 0.875rem;
  color: var(--ink-soft);
  border-top: 1px solid var(--rule);
  padding-top: var(--space-3);
}
.frames__watch strong { color: var(--ink); }

.frames__products { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }

.frames__product {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: var(--space-4);
  display: grid;
  gap: var(--space-2);
}

.frames__product-head { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: baseline; }
.frames__product-name { font-weight: 500; }

.frames__openings {
  font-size: 0.6875rem; letter-spacing: 0.06em; text-transform: uppercase;
  border: 1px solid var(--rule-strong); border-radius: 999px;
  padding: 0.1rem 0.45rem; color: var(--ink-soft); white-space: nowrap;
}

.frames__product-note { margin: 0; font-size: 0.875rem; color: var(--ink-soft); }
.frames__buy { font-size: 0.875rem; justify-self: start; }

.frames__advice { display: grid; gap: var(--space-5); margin-top: var(--space-5); }
@media (min-width: 46rem) { .frames__advice { grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); } }

.frames__tip h3 { font-size: var(--step-0); margin: 0 0 var(--space-2); }
.frames__tip p { margin: 0; color: var(--ink-soft); font-size: 0.9375rem; max-width: 34ch; }

/* --- FAQ ----------------------------------------------------------------- */

.faq { max-width: var(--measure); }
.faq__item { border-bottom: 1px solid var(--rule); padding: var(--space-4) 0; }
.faq__item summary {
  cursor: pointer; font-weight: 500; list-style-position: outside;
  padding-right: var(--space-3);
}
.faq__item summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.faq__item p { margin: var(--space-3) 0 0; color: var(--ink-soft); }

.field textarea { resize: vertical; min-height: 8rem; }

/* The production sheet is a screen page that gets printed, and it extends the
   admin layout — so without this the marketing footer lands on the paper that
   goes to the print shop. Same reasoning as the feedback widget. */
@media print {
  .footer { display: none !important; }
}

/* --- QC checklist --------------------------------------------------------
   A working document. Dense, scannable, and printable; the interactive parts
   are marks that live in one person's browser. */

.qc__head { margin-bottom: var(--space-5); }
.qc__eyebrow {
  font-size: 0.6875rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-faint); margin: 0 0 var(--space-2);
}
.qc__standfirst { max-width: var(--measure); color: var(--ink-soft); margin-top: var(--space-3); }

.qc__progress {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.qc__count { font-variant-numeric: tabular-nums; font-size: 1.125rem; font-weight: 500; }
.qc__bar { flex: 1 1 10rem; height: 6px; background: var(--rule); position: relative; overflow: hidden; min-width: 7rem; }
.qc__bar span { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--ink); transition: width 200ms ease; }

.qc__notice {
  margin-top: var(--space-5); padding: var(--space-4);
  border: 1px solid var(--rule); border-left: 4px solid var(--rule-strong);
  border-radius: var(--radius); max-width: var(--measure);
}
.qc__notice--blocked { border-left-color: #8c2f24; }
.qc__notice--pass { border-left-color: #1a7a4c; }
.qc__notice h2 {
  font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase;
  margin: 0 0 var(--space-2);
}
.qc__notice--blocked h2 { color: #8c2f24; }
.qc__notice--pass h2 { color: #1a7a4c; }
:root[data-theme="dark"] .qc__notice--blocked h2 { color: #e29e93; }
:root[data-theme="dark"] .qc__notice--pass h2 { color: #6fc094; }
.qc__notice p { margin: 0; font-size: 0.9375rem; color: var(--ink-soft); }
.qc__notice ul { margin: var(--space-3) 0 0; padding-left: 1.1rem; font-size: 0.9375rem; }
.qc__notice li { margin-bottom: var(--space-2); }

.qc__section { margin-top: var(--space-7); }
.qc__sechead {
  display: flex; align-items: baseline; gap: var(--space-3);
  border-bottom: 1px solid var(--ink); padding-bottom: var(--space-2);
}
.qc__sechead h2 { margin: 0; font-size: var(--step-2); }
.qc__tally { margin-left: auto; font-variant-numeric: tabular-nums; font-size: 0.8125rem; color: var(--ink-faint); white-space: nowrap; }
.qc__intro { max-width: var(--measure); color: var(--ink-soft); margin-top: var(--space-3); }

.qc__rows { margin-top: var(--space-4); }

.qc__row {
  display: grid; grid-template-columns: auto 1fr; gap: var(--space-3);
  padding: var(--space-4) var(--space-2);
  border-bottom: 1px solid var(--rule); align-items: start;
}
.qc__row:hover { background: var(--surface); }
.qc__row.is-done { opacity: 0.45; }
.qc__row input[type="checkbox"] { margin-top: 0.3rem; width: 1.05rem; height: 1.05rem; }

.qc__top { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2) var(--space-3); }

.qc__path { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.875rem; font-weight: 500; }
.qc__path--flat { color: var(--ink); text-decoration: none; }

.qc__name { color: var(--ink-soft); font-size: 0.9375rem; }
.qc__note { margin: var(--space-2) 0 0; font-size: 0.8125rem; color: var(--ink-faint); }

.qc__badge {
  font-size: 0.625rem; letter-spacing: 0.08em; text-transform: uppercase;
  border: 1px solid currentColor; border-radius: 999px;
  padding: 0.1rem 0.4rem; white-space: nowrap;
}
.qc__badge--blocked { color: #8c2f24; }
.qc__badge--watch { color: #7a5a12; }
.qc__badge--pass { color: #1a7a4c; }
.qc__badge--auth { color: var(--ink-faint); }
.qc__badge--mark { color: var(--focus); }
:root[data-theme="dark"] .qc__badge--blocked { color: #e29e93; }
:root[data-theme="dark"] .qc__badge--watch { color: #d8b866; }
:root[data-theme="dark"] .qc__badge--pass { color: #6fc094; }

.qc__states {
  margin: var(--space-3) 0 0; padding: 0; list-style: none;
  display: grid; gap: var(--space-2);
  font-size: 0.9375rem; color: var(--ink-soft); max-width: var(--measure);
}
.qc__states li { padding-left: 1rem; position: relative; }
.qc__states li::before {
  content: ""; position: absolute; left: 0; top: 0.62em;
  width: 0.4rem; height: 1px; background: var(--rule-strong);
}
.qc__states strong { color: var(--ink); }

@media print {
  .qc__progress, .toggle { display: none; }
  .qc__row { break-inside: avoid; }
}

/* --- activity panel ------------------------------------------------------
   A QC instrument, not part of the product. It sits above everything, is
   dragged by its handle only, and never blocks a control it overlaps for
   longer than it takes to move it. */

.activity-launcher {
  position: fixed;
  /* Overridden by --nav when it lands in a header. */
  right: 1rem;
  /* Clear of the feedback widget, which also lives bottom-right. */
  bottom: 5.5rem;
  z-index: 900;
  width: 2.75rem; height: 2.75rem;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--rule-strong);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink-soft);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.activity-launcher:hover { color: var(--ink); }
.activity-launcher:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.activity-launcher svg { width: 1.25rem; height: 1.25rem; }

/* In the nav it is a nav-sized control, not a floating action button. */
.activity-launcher--nav {
  position: static;
  width: 1.9rem; height: 1.9rem;
  border-color: var(--rule);
  box-shadow: none;
  vertical-align: middle;
}
.activity-launcher--nav svg { width: 1rem; height: 1rem; }
.activity-launcher--nav .activity-launcher__dot { top: 0.1rem; right: 0.1rem; }

.activity-launcher__dot {
  position: absolute; top: 0.35rem; right: 0.35rem;
  width: 0.5rem; height: 0.5rem; border-radius: 50%;
  background: var(--focus);
}

.activity {
  position: fixed;
  /* Clears the readout beneath it and nothing else: the launcher moved into
     the nav, so the old offset was reserving space for something that is no
     longer there. */
  right: 1rem; bottom: 4.5rem;
  z-index: 901;
  width: min(26rem, calc(100vw - 2rem));
  max-height: min(28rem, 60vh);
  display: flex; flex-direction: column;
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(0,0,0,.16);
  overflow: hidden;
}
/*
 * `hidden` must actually hide it.
 *
 * The rule above sets `display: flex`, and an author declaration beats the user
 * agent's `[hidden] { display: none }` — so closing the panel set the attribute,
 * changed nothing visible, and left the close button and the launcher toggle
 * both looking broken. The attribute was working; the stylesheet was ignoring
 * it.
 */
.activity[hidden] { display: none; }

.activity.is-dragging { user-select: none; box-shadow: 0 10px 32px rgba(0,0,0,.24); }

.activity__head {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
}

.activity__grip {
  border: 0; background: none; padding: 0.25rem; cursor: grab;
  color: var(--ink-faint); display: inline-flex; touch-action: none;
}
.activity__grip:active { cursor: grabbing; }
.activity__grip svg { width: 1rem; height: 1rem; }
.activity__grip:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

.activity__title {
  font-size: 0.8125rem; letter-spacing: 0.06em; text-transform: uppercase;
  margin: 0; margin-right: auto; color: var(--ink-soft);
}

.activity__icon {
  border: 0; background: none; padding: 0.25rem; cursor: pointer;
  color: var(--ink-faint); display: inline-flex; border-radius: var(--radius);
}
.activity__icon:hover { color: var(--ink); background: var(--surface-alt); }
.activity__icon:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.activity__icon svg { width: 1.05rem; height: 1.05rem; }
.activity__icon.is-on { color: var(--focus); }
/* Brief acknowledgement that the copy landed. */
.activity__icon.is-done { color: #1a7a4c; }
:root[data-theme="dark"] .activity__icon.is-done { color: #6fc094; }

/* A note has no duration, so it reads as a marker rather than a result. */
.activity__row--ok.activity__row--note { border-left-color: var(--rule-strong); }

.activity__list {
  list-style: none; margin: 0; padding: 0;
  overflow-y: auto; flex: 1 1 auto;
  font-size: 0.8125rem;
}

.activity__row {
  display: grid; grid-template-columns: 4.5rem 1fr;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--rule);
  align-items: baseline;
}
.activity__time {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.6875rem; color: var(--ink-faint); font-variant-numeric: tabular-nums;
}
.activity__what { min-width: 0; }
.activity__label { display: block; }
.activity__detail {
  display: block; font-size: 0.6875rem; color: var(--ink-faint);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  overflow-wrap: anywhere;
}

/* State reads from the left edge, so a column of them is scannable. */
.activity__row--running { border-left: 3px solid var(--focus); }
.activity__row--ok { border-left: 3px solid #1a7a4c; }
.activity__row--failed { border-left: 3px solid #b4453a; }
.activity__row--failed .activity__label { color: #8c2f24; }

/* Indented and quieter: these happened INSIDE the call above them, and reading
   them as siblings of it would misrepresent what happened. */
.activity__row--server {
  border-left-color: var(--rule-strong);
  background: var(--surface);
}
.activity__row--server .activity__what { padding-left: var(--space-3); }
.activity__row--server .activity__label { color: var(--ink-soft); font-size: 0.75rem; }
:root[data-theme="dark"] .activity__row--failed .activity__label { color: #e29e93; }

/* The fallback when the clipboard is refused: the log, selected, ready for
   Cmd-C. Sized so it does not push the list off the panel. */
.activity__copyout {
  flex: none;
  width: 100%;
  height: 8rem;
  border: 0;
  border-top: 1px solid var(--rule-strong);
  padding: var(--space-3);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.6875rem;
  background: var(--surface);
  color: var(--ink);
  resize: none;
}

.activity__empty { margin: 0; padding: var(--space-5); text-align: center; color: var(--ink-faint); font-size: 0.8125rem; }

/* --- the live readout ---------------------------------------------------- */

.activity-readout {
  position: fixed;
  right: 1rem; bottom: 2rem;
  z-index: 902;
  max-width: min(20rem, calc(100vw - 2rem));
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-size: 0.8125rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.14);
  transition: opacity 200ms ease;
}
.activity-readout.is-ok { border-color: #1a7a4c; }
.activity-readout.is-failed { border-color: #b4453a; }

.activity-readout__dots { display: inline-flex; gap: 0.15rem; margin-left: 0.2rem; }
.activity-readout__dots i {
  width: 0.2rem; height: 0.2rem; border-radius: 50%;
  background: currentColor; opacity: 0.25;
  animation: activity-dot 1.1s infinite;
}
.activity-readout__dots i:nth-child(2) { animation-delay: 0.18s; }
.activity-readout__dots i:nth-child(3) { animation-delay: 0.36s; }

@keyframes activity-dot {
  0%, 60%, 100% { opacity: 0.25; }
  30% { opacity: 1; }
}

/* Still says what is happening; just stops moving. */
@media (prefers-reduced-motion: reduce) {
  .activity-readout__dots i { animation: none; opacity: 0.7; }
  .activity-readout { transition: none; }
}

@media print {
  .activity, .activity-launcher, .activity-readout { display: none !important; }
}

/* ==========================================================================
   Legal pages, and the quiet links to them
   ========================================================================== */

/*
  Beside the copyright rather than in the navigation above it. They have to be
  findable — a shop that has taken money needs them reachable — but nobody
  arrives wanting to read them, so they are the last thing on the page and the
  smallest.
*/
.footer__legal-links { margin-left: var(--space-3); display: inline-flex; gap: var(--space-3); }
.footer__legal-links a { color: var(--ink-faint); text-decoration: underline; text-underline-offset: 2px; }
.footer__legal-links a:hover { color: var(--ink-soft); }

/*
  A legal page is read, not scanned, so it gets a reading measure and generous
  spacing rather than the dense working layout the admin pages use.
*/
.legal { max-width: 38rem; }
.legal__lede { font-size: 1.0625rem; color: var(--ink); }
.legal h2 {
  font-size: var(--step-1);
  margin: var(--space-6) 0 var(--space-3);
  padding-top: var(--space-4);
  border-top: 1px solid var(--rule);
}
.legal p { margin: 0 0 var(--space-3); color: var(--ink-soft); }
.legal p strong { color: var(--ink); font-weight: 600; }
.legal__list { margin: 0 0 var(--space-3); padding-left: 1.25rem; display: grid; gap: var(--space-2); color: var(--ink-soft); }
.legal__list strong { color: var(--ink); font-weight: 600; }
