/* ==========================================================================
   DeX tokens + signature primitives  (brand/dex-tokens.css)  v1.0  2026-11-08
   Spec: brand/DEX_DESIGN_SYSTEM.md. Templates link this file; tools/render.py
   inlines it. Trade templates override --c-* / --font-display / --radius.
   ========================================================================== */

:root {
  /* colour: DeX house, light (default). Client builds overwrite every --c-* from brand.colors (dex-core.js) */
  --c-bg: #F4F4EF;              /* paper */
  --c-surface: #FFFFFF;
  --c-surface-2: #E8E9E1;
  --c-ink: #0B1B2B;             /* DeX navy */
  --c-muted: #4F5B67;
  --c-line: #D3D5CC;
  --c-accent: #C6F24E;          /* DeX lime: a highlighter fill, never text */
  --c-on-accent: #0B1B2B;
  --c-accent-ink: #2F5A00;      /* text-safe partner of the lime */
  --c-accent-edge: #0B1B2B;
  --c-accent-2: #0B1B2B;
  --c-on-accent-2: #FFFFFF;
  --c-accent-2-ink: #0B1B2B;
  --c-accent-tint: #EDF7CF;
  --c-accent-inv: #C6F24E;
  --c-muted-inv: #A9B4BF;
  --c-focus: #0B1B2B;

  /* type */
  --font-display: "Archivo", system-ui, sans-serif;   /* trades set their own; DeX house uses Schibsted Grotesk */
  --font-body: "Archivo", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --display-stretch: 118%;
  --display-weight: 750;

  --fs-xs: .75rem;   --lh-xs: 1rem;
  --fs-sm: .875rem;  --lh-sm: 1.25rem;
  --fs-base: 1rem;   --lh-base: 1.5rem;
  --fs-lg: 1.125rem; --lh-lg: 1.75rem;
  --fs-xl: 1.25rem;  --lh-xl: 1.75rem;
  --fs-2xl: 1.5rem;  --lh-2xl: 2rem;
  --fs-3xl: 1.875rem;--lh-3xl: 2.25rem;
  --fs-4xl: 2.25rem; --lh-4xl: 2.5rem;
  --fs-5xl: 3rem;
  --fs-6xl: 3.75rem;
  --fs-7xl: 4.5rem;
  --fs-8xl: 6rem;
  --fs-9xl: 8rem;

  /* space (4px base) */
  --s-1: 2px;  --s-2: 4px;  --s-3: 8px;  --s-4: 12px; --s-5: 16px;
  --s-6: 24px; --s-7: 32px; --s-8: 40px; --s-9: 48px; --s-10: 64px;
  --s-11: 80px; --s-12: 96px; --s-13: 128px;
  --gutter: 20px;
  --maxw: 1200px;
  --section-y: var(--s-11);

  /* radius */
  --r-0: 0; --r-1: 2px; --r-2: 6px; --r-3: 10px; --r-pill: 999px;
  --radius: var(--r-2);

  /* motion */
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-io: cubic-bezier(.65, 0, .35, 1);
  --t-1: 120ms; --t-2: 200ms; --t-3: 320ms; --t-reveal: 640ms;

  /* misc */
  --bar-h: 64px;
  --photo-filter: none;
  --shadow-bar: 0 -1px 0 var(--c-line), 0 -12px 32px rgb(0 0 0 / .18);
}

html[data-client-brand] { --photo-filter: none; }
/* client display font: template line-heights are tuned to their own face, so open them up a little */
html[data-brand-font] :is(h1, .sweep, .disp) { line-height: 1.02; }   /* never restyle a client's own photos */

@media (min-width: 900px) {
  :root { --gutter: 40px; --section-y: var(--s-13); }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--c-bg); color: var(--c-ink);
  font-family: var(--font-body); font-size: var(--fs-base); line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4 { margin: 0; text-wrap: balance; font-weight: 600; }
p { margin: 0; text-wrap: pretty; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; }
.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; }
.skip { position: absolute; left: var(--s-3); top: -60px; z-index: 100; background: var(--c-ink); color: var(--c-bg); padding: var(--s-3) var(--s-4); border-radius: var(--radius); transition: transform var(--t-2) var(--ease-out); }
.skip:focus { transform: translateY(68px); }
.wrap { width: 100%; max-width: calc(var(--maxw) + var(--gutter) * 2); margin-inline: auto; padding-inline: var(--gutter); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.label { font-family: var(--font-mono); font-size: var(--fs-xs); line-height: var(--lh-xs); letter-spacing: .08em; text-transform: uppercase; color: var(--c-muted); }
.muted { color: var(--c-muted); }
.display { font-family: var(--font-display); font-weight: var(--display-weight); font-stretch: var(--display-stretch); }
.dex-notice { font: var(--fs-sm)/1.4 var(--font-mono); padding: var(--s-5); background: #FFF4C2; color: #1A1A1A; border-bottom: 1px solid #1A1A1A; }

/* ---------- S1  Tick Rail ---------- */
.rail {
  --rail-c: var(--c-line);
  position: relative; display: flex; align-items: flex-end; gap: var(--s-4);
  height: 28px; padding-inline: var(--gutter);
  max-width: calc(var(--maxw) + var(--gutter) * 2); margin-inline: auto;
}
.rail::before {            /* the ruler */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 12px;
  background:
    linear-gradient(var(--rail-c), var(--rail-c)) bottom / 100% 1px no-repeat,
    repeating-linear-gradient(90deg, var(--rail-c) 0 1px, transparent 1px 40px) bottom / 100% 12px no-repeat,
    repeating-linear-gradient(90deg, var(--rail-c) 0 1px, transparent 1px 8px) bottom / 100% 5px no-repeat;
  pointer-events: none;
}
.rail__idx { position: relative; z-index: 1; padding: 0 var(--s-3) var(--s-4) 0; background: var(--c-bg); font-family: var(--font-mono); font-size: var(--fs-xs); line-height: 1; letter-spacing: .08em; text-transform: uppercase; color: var(--c-muted); white-space: nowrap; }
.rail__idx b { color: var(--c-ink); font-weight: 500; }
.rail__now { position: absolute; bottom: 0; width: 2px; height: 16px; background: var(--c-accent); right: var(--now, 22%); }

/* ---------- S2  Registration corners ---------- */
.reg { position: relative; --reg: 12px; --reg-c: var(--c-ink); }
.reg::before, .reg::after, .reg > .reg__b::before, .reg > .reg__b::after {
  content: ""; position: absolute; width: var(--reg); height: var(--reg); pointer-events: none;
  border: 0 solid var(--reg-c);
}
.reg::before { left: 0; top: 0; border-left-width: 1.5px; border-top-width: 1.5px; }
.reg::after { right: 0; top: 0; border-right-width: 1.5px; border-top-width: 1.5px; }
.reg > .reg__b { position: absolute; inset: 0; pointer-events: none; }
.reg > .reg__b::before { left: 0; bottom: 0; border-left-width: 1.5px; border-bottom-width: 1.5px; }
.reg > .reg__b::after { right: 0; bottom: 0; border-right-width: 1.5px; border-bottom-width: 1.5px; }

/* ---------- S4  Live dot ---------- */
.live { display: inline-flex; align-items: center; gap: var(--s-3); }
.live__dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--c-accent); flex: none; }
.live__dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--c-accent); animation: dex-ping 2.4s var(--ease-out) infinite; }
.live__dot.is-off { background: var(--c-muted); }
.live__dot.is-off::after { display: none; }
@keyframes dex-ping { 0% { transform: scale(1); opacity: .55; } 70%, 100% { transform: scale(3); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .live__dot::after { display: none; } }

/* ---------- buttons, chips ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-3);
  min-height: 48px; padding: var(--s-4) var(--s-6); border-radius: var(--radius);
  border: 1.5px solid var(--c-ink); background: transparent; color: var(--c-ink);
  font-weight: 600; font-size: var(--fs-base); line-height: 1; text-decoration: none;
  transition: transform var(--t-1) var(--ease-out), background-color var(--t-2) var(--ease-out), color var(--t-2) var(--ease-out);
}
.btn svg { width: 20px; height: 20px; flex: none; }
.btn:active { transform: scale(.98); }
.btn--solid { background: var(--c-accent); border-color: var(--c-accent-edge); color: var(--c-on-accent); }
.btn--ink { background: var(--c-ink); border-color: var(--c-ink); color: var(--c-bg); }
.btn[aria-disabled="true"], .btn:disabled { opacity: .45; cursor: not-allowed; }
@media (hover: hover) {
  .btn:hover { background: var(--c-ink); color: var(--c-bg); }
  .btn--solid:hover { background: var(--c-ink); border-color: var(--c-ink); color: var(--c-bg); }
  .btn--ink:hover { background: var(--c-accent); border-color: var(--c-accent); color: var(--c-on-accent); }
}

.lang { display: inline-flex; border: 1px solid var(--c-line); border-radius: var(--radius); overflow: hidden; }
.lang button { min-width: 44px; min-height: 36px; padding: 0 var(--s-3); border: 0; background: transparent; font-family: var(--font-mono); font-size: var(--fs-xs); letter-spacing: .08em; color: var(--c-muted); transition: background-color var(--t-2) var(--ease-out), color var(--t-2) var(--ease-out); }
.lang button[aria-pressed="true"] { background: var(--c-ink); color: var(--c-bg); }

/* ---------- photo + photo slot ---------- */
.photo { position: relative; overflow: hidden; background: var(--c-surface); border-radius: var(--radius); }
.photo img { width: 100%; height: 100%; object-fit: cover; filter: var(--photo-filter); }
.photo__tag { position: absolute; left: var(--s-3); bottom: var(--s-3); padding: var(--s-2) var(--s-3); background: var(--c-bg); color: var(--c-ink); font: 500 var(--fs-xs)/1 var(--font-mono); letter-spacing: .04em; border-radius: var(--r-1); }
.slot {
  display: grid; place-items: center; width: 100%; height: 100%; padding: var(--s-5); text-align: center;
  background:
    repeating-linear-gradient(135deg, transparent 0 9px, color-mix(in srgb, var(--c-ink) 9%, transparent) 9px 10px),
    var(--c-surface);
  color: var(--c-muted); font: var(--fs-xs)/1.4 var(--font-mono); letter-spacing: .06em; text-transform: uppercase;
}

/* ---------- booking (shared structure; trades restyle) ---------- */
.bk { display: grid; gap: var(--s-7); }
.bk fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.bk legend { display: flex; align-items: baseline; gap: var(--s-4); padding: 0; margin-bottom: var(--s-4); font-weight: 600; font-size: var(--fs-lg); }
.bk legend .mono { font-size: var(--fs-xs); color: var(--c-muted); font-weight: 400; }
.bk-opts { display: grid; gap: var(--s-3); }
.bk-opt { position: relative; }
.bk-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.bk-opt > span > .mono { white-space: nowrap; flex: none; }
.bk-opt > span {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-4);
  min-height: 52px; padding: var(--s-4) var(--s-5); border: 1px solid var(--c-line); border-radius: var(--radius);
  background: var(--c-surface);
  transition: border-color var(--t-2) var(--ease-out), background-color var(--t-2) var(--ease-out), transform var(--t-1) var(--ease-out);
}
.bk-opt input:checked + span { border-color: var(--c-accent); box-shadow: inset 0 0 0 1px var(--c-accent); }
.bk-opt input:focus-visible + span { outline: 2px solid var(--c-focus); outline-offset: 2px; }
.bk-opt input:disabled + span { opacity: .4; text-decoration: line-through; cursor: not-allowed; }
.bk-opt:active > span { transform: scale(.98); }
.bk-dates { display: flex; gap: var(--s-3); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: var(--s-3); scrollbar-width: thin; }
.bk-dates .bk-opt { flex: 0 0 64px; scroll-snap-align: start; }
.bk-dates .bk-opt > span { flex-direction: column; justify-content: center; gap: var(--s-1); min-height: 72px; padding: var(--s-3) var(--s-2); text-align: center; }
.bk-dates .dow { font: var(--fs-xs)/1 var(--font-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--c-muted); }
.bk-dates .dnum { font: 500 var(--fs-2xl)/1 var(--font-mono); }
.bk-times { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: var(--s-3); position: relative; padding-bottom: var(--s-6); }
.bk-times::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 8px; background: linear-gradient(var(--c-line), var(--c-line)) bottom / 100% 1px no-repeat, repeating-linear-gradient(90deg, var(--c-line) 0 1px, transparent 1px 8px) bottom / 100% 5px no-repeat; }
.bk-times .bk-opt > span { justify-content: center; min-height: 44px; padding: var(--s-3); font-family: var(--font-mono); font-size: var(--fs-sm); }
.bk-period { grid-column: 1 / -1; margin-top: var(--s-3); }
.bk-field { display: grid; gap: var(--s-3); }
.bk-field label { font-size: var(--fs-sm); font-weight: 600; }
.bk-field input, .bk-field select { min-height: 48px; padding: var(--s-4); border: 1px solid var(--c-line); border-radius: var(--radius); background: var(--c-surface); font-size: var(--fs-base); }
.bk-field input:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 0; border-color: transparent; }
.bk-fields { display: grid; gap: var(--s-5); }
@media (min-width: 640px) { .bk-fields { grid-template-columns: 1fr 1fr; } }
.bk-sum { padding: var(--s-6); background: var(--c-surface); display: grid; gap: var(--s-5); }
.bk-sum dl { display: grid; grid-template-columns: auto 1fr; gap: var(--s-3) var(--s-5); margin: 0; }
.bk-sum dt { font: var(--fs-xs)/1.5rem var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--c-muted); }
.bk-sum dd { margin: 0; text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.bk-sum dd.is-empty { color: var(--c-muted); }
.bk-err { min-height: var(--lh-sm); font-size: var(--fs-sm); color: var(--c-ink); }
.bk-err:not(:empty)::before { content: "! "; font-family: var(--font-mono); color: var(--c-accent); }

/* ---------- FAQ ---------- */
.faq details { border-top: 1px solid var(--c-line); }
.faq details:last-child { border-bottom: 1px solid var(--c-line); }
.faq summary { display: flex; justify-content: space-between; align-items: center; gap: var(--s-5); min-height: 64px; padding: var(--s-4) 0; cursor: pointer; list-style: none; font-weight: 600; font-size: var(--fs-lg); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font: 400 var(--fs-2xl)/1 var(--font-mono); color: var(--c-muted); transition: transform var(--t-2) var(--ease-out); flex: none; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding: 0 0 var(--s-6); max-width: 62ch; color: var(--c-muted); }

/* ---------- hours ---------- */
.hours { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.hours th, .hours td { padding: var(--s-3) 0; border-bottom: 1px solid var(--c-line); text-align: left; font-weight: 400; }
.hours td { text-align: right; }
.hours tr.is-today th, .hours tr.is-today td { color: var(--c-ink); font-weight: 600; }
.hours tr:not(.is-today) { color: var(--c-muted); }
.hours .brk { display: block; font-size: var(--fs-xs); color: var(--c-muted); font-weight: 400; }

/* ---------- sticky action bar (mobile) ---------- */
.abar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 1px; background: var(--c-line); box-shadow: var(--shadow-bar); padding-bottom: env(safe-area-inset-bottom); }
.abar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-1); min-height: var(--bar-h); background: var(--c-bg); color: var(--c-ink); text-decoration: none; font-size: var(--fs-xs); font-weight: 600; letter-spacing: .02em; transition: transform var(--t-1) var(--ease-out); }
.abar a:active { transform: scale(.98); }
.abar a.is-primary { background: var(--c-accent); color: var(--c-on-accent); }
.abar svg { width: 22px; height: 22px; }
body.has-abar { padding-bottom: calc(var(--bar-h) + env(safe-area-inset-bottom)); }
@media (min-width: 900px) { .abar { display: none; } body.has-abar { padding-bottom: 0; } }

/* ---------- ribbon + footer mark ---------- */
.ribbon { position: relative; z-index: 60; display: flex; align-items: center; justify-content: center; gap: var(--s-3); width: 100%; min-height: 32px; padding: var(--s-2) var(--s-3); background: var(--c-ink); color: var(--c-bg); font: 500 11px/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.ribbon i { width: 6px; height: 6px; border-radius: 50%; background: var(--c-bg); opacity: .7; flex: none; }
.ribbon button { width: 28px; height: 28px; margin: -6px -6px -6px 0; border: 0; border-radius: 50%; background: transparent; color: inherit; opacity: .75; font: inherit; font-size: 14px; }
@media (min-width: 900px) { .ribbon { position: fixed; top: auto; bottom: var(--s-5); right: var(--s-5); width: auto; min-height: 0; padding: var(--s-2) var(--s-3); border-radius: var(--r-pill); } }
.dexmark { display: inline-flex; align-items: center; gap: var(--s-3); font: var(--fs-xs)/1 var(--font-mono); letter-spacing: .04em; color: var(--c-muted); text-decoration: none; }
.dexmark i { width: 48px; height: 8px; background: linear-gradient(var(--c-muted), var(--c-muted)) bottom / 100% 1px no-repeat, repeating-linear-gradient(90deg, var(--c-muted) 0 1px, transparent 1px 8px) bottom / 100% 5px no-repeat; }
.dexmark i::after { content: ""; display: block; width: 2px; height: 8px; margin-left: 34px; background: var(--c-muted); }

/* ---------- reveal (content visible unless JS + motion allowed) ---------- */
.dex-motion [data-reveal] { opacity: 0; transform: translateY(16px); transition: opacity var(--t-reveal) var(--ease-out), transform var(--t-reveal) var(--ease-out); }
.dex-motion [data-reveal].is-in { opacity: 1; transform: none; }
.sweep .w { transition: opacity 480ms var(--ease-out); }
.dex-motion .sweep .w { opacity: .28; }
.dex-motion .sweep .w.is-on { opacity: 1; }

@media print { .abar, .ribbon { display: none !important; } }

/* live number roll (DEX.setNum) */
.roll { display: inline-block; animation: dex-roll var(--t-2) var(--ease-out); }
@keyframes dex-roll { from { opacity: 0; transform: translateY(35%); } }

/* ---------- client logo (brand.logo) ---------- */
.brandlogo { display: block; width: auto; height: auto; max-width: 100%; object-fit: contain; }
.brandlogo.is-plate-light, .brandlogo.is-plate-dark { padding: 6px 10px; border-radius: var(--r-2); box-sizing: content-box; }
img.brandlogo.is-plate-light { background: #FFFFFF; }
img.brandlogo.is-plate-dark { background: #111111; }
.logo-head { max-height: 40px; max-width: min(180px, 46vw); }
.logo-hero { max-height: 88px; max-width: min(260px, 70vw); margin-bottom: var(--s-6); }
.logo-panel { max-height: 56px; max-width: min(200px, 60%); margin-bottom: var(--s-5); }   /* the shop's own sign on its live board */
@media (min-width: 900px) { .logo-head { max-height: 48px; max-width: 220px; } .logo-hero { max-height: 112px; max-width: 320px; } .logo-panel { max-height: 64px; max-width: 240px; } }
