/* Emergency Snack — the brochure. The same door as the QR form
   (app/templates/base.html), always lit UV: DESIGN.md's tokens, rule tiers and
   components, plus what a brochure needs — signage, steps, the request slip, the
   shirt plate and the questions. One stylesheet, no JavaScript. */

@font-face {
  font-family: 'Shoulders';
  src: url('/static/fonts/bigshoulders-stencil-var-latin.woff2') format('woff2-variations'),
       url('/static/fonts/bigshoulders-stencil-var-latin.woff2') format('woff2');
  font-weight: 400 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Archivo';
  src: url('/static/fonts/archivo-var-latin.woff2') format('woff2-variations'),
       url('/static/fonts/archivo-var-latin.woff2') format('woff2');
  font-weight: 400 800; font-style: normal; font-display: swap;
}

:root {
  /* UV, the default scheme (app/themes.py). The site never takes a pool's light. */
  --void:        #08070A;
  --rule:        #6B5A8C;  /* 3.32:1 — section and door edges */
  --rule-mid:    #7C6B9E;  /* 4.26:1 — field rules */
  --rule-strong: #8D7CB0;  /* 5.40:1 — control boundaries, drawn marks */
  --uv:          #AD93D6;
  --uv-hot:      #D8C8F0;
  --uv-deep:     #4E3488;
  --text:        #EDE8F5;
  --muted:       #A99BC4;

  --display: 'Shoulders', 'Archivo Narrow', sans-serif;
  --body: 'Archivo', ui-sans-serif, system-ui, sans-serif;
  --gutter: 1.25rem;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--void); }

body {
  margin: 0;
  background: var(--void);
  color: var(--text);
  font: 400 clamp(1rem, 0.94rem + 0.3vw, 1.0625rem)/1.55 var(--body);
  font-synthesis-weight: none;
  min-height: 100svh;
  padding-inline: var(--gutter);
  position: relative;
  overflow-x: hidden;
}

/* The door light. The page's only light source, already on. */
body::before {
  content: ""; position: fixed; inset: -20% -20% auto -20%; height: 78vh;
  background:
    radial-gradient(min(46%, 30rem) 48% at 50% 0%, color-mix(in oklab, var(--uv-deep) 38%, transparent) 0%, transparent 76%),
    radial-gradient(min(24%, 15rem) 26% at 50% 0%, color-mix(in oklab, var(--uv) 16%, transparent) 0%, transparent 74%);
  pointer-events: none; z-index: 0;
}

.door {
  position: relative; z-index: 1;
  width: 100%; max-width: 31rem; min-height: 100svh;
  display: flex; flex-direction: column;
}
main { flex: 1; padding-block: 2.25rem 3.5rem; }

/* Wide viewports: the column holds the left, and becomes the door. */
@media (min-width: 62rem) {
  body { padding-left: clamp(2.5rem, 8vw, 7rem); }
  .door { max-width: 38rem; border-right: 1px solid var(--rule); padding-right: 4.5rem; }
  body::before {
    inset: 0 0 auto 0; width: auto; height: 100vh;
    background:
      radial-gradient(42rem 36rem at 48rem 5rem,
        color-mix(in oklab, var(--uv-deep) 44%, transparent) 0%, transparent 74%),
      radial-gradient(15rem 13rem at 47rem 3rem,
        color-mix(in oklab, var(--uv) 18%, transparent) 0%, transparent 76%);
  }
}

/* ---- Browser surfaces ---- */
::selection { background: var(--uv-deep); color: var(--uv-hot); }
:focus-visible { outline: 2px solid var(--uv); outline-offset: 3px; border-radius: 0; }
* { scrollbar-color: var(--rule-strong) transparent; scrollbar-width: thin; }
a { color: var(--uv); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--uv-hot); }
strong { font-weight: 600; }

.skip {
  position: absolute; left: var(--gutter); top: 0.5rem; z-index: 5;
  padding: 0.6rem 0.9rem; background: var(--uv); color: var(--void);
  font-weight: 700; text-decoration: none; translate: 0 -200%;
}
.skip:focus-visible { translate: 0 0; }

/* ---- The sign over the door ---- */
.head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0 1rem; padding-top: max(0.6rem, env(safe-area-inset-top));
  border-bottom: 1px solid var(--rule);
}
.wordmark {
  font: 800 1.4rem/1 var(--display); letter-spacing: 0.03em; text-transform: uppercase;
  color: var(--text); text-decoration: none; padding-block: 0.85rem;
}
.wordmark:hover { color: var(--uv-hot); }
.nav { flex-basis: 100%; display: flex; gap: 0 1.5rem; }
.nav a {
  position: relative; padding-block: 0.95rem;
  font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted); text-decoration: none;
}
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--uv); }
.nav a[aria-current="page"]::after {
  content: ""; position: absolute; left: 0; right: 0.16em; bottom: -1px; height: 2px; background: var(--uv);
}

/* ---- Type: the door's voice is stencilled; everything else is Archivo ---- */
.sign {
  font: 800 clamp(2.5rem, 1.5rem + 5.4vw, 3.6rem)/0.92 var(--display);
  text-transform: uppercase; letter-spacing: -0.005em;
  margin: 0 0 1rem; text-wrap: balance;
}
.lede {
  margin: 0 0 2rem; color: var(--muted); font-size: 1.0625rem;
  max-width: 36ch; text-wrap: pretty;
}
.lede strong { color: var(--text); }

.section { margin-top: 2.75rem; padding-top: 1.6rem; border-top: 1px solid var(--rule); }
.section h2 {
  font: 700 1.3rem/1.2 var(--body); letter-spacing: -0.01em;
  margin: 0 0 0.85rem; text-wrap: balance;
}
.section h3 {
  font: 700 1.0625rem/1.3 var(--body); margin: 1.6rem 0 0.4rem;
}
.section p { margin: 0 0 0.9rem; color: var(--muted); max-width: 42ch; text-wrap: pretty; }
.section p:last-child { margin-bottom: 0; }
.section p strong, .section li strong { color: var(--text); }
.small { font-size: 0.875rem; }
.section .sign-off { margin-top: 1.75rem; color: var(--text); font-weight: 600; }

q { quotes: "“" "”"; color: var(--text); }

/* Commands are code: tap once and the whole thing selects. */
code {
  font: 600 0.92em/1 ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  color: var(--text); white-space: nowrap;
  border-bottom: 1px solid var(--rule-mid); padding: 0 0.08em;
  -webkit-user-select: all; user-select: all;
}

/* ---- Icon rows: the door-policy list, used wherever a list needs saying plainly ---- */
.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.9rem; }
.rows li {
  display: grid; grid-template-columns: 1.1rem 1fr; gap: 0.75rem;
  font-size: 0.9375rem; line-height: 1.5; color: var(--muted);
}
.rows li svg { width: 1.1rem; height: 1.1rem; color: var(--rule-strong); margin-top: 0.2rem; }
.rows li > span { max-width: 44ch; }

/* ---- Steps: rows on the ruled sheet, numbered because the order matters ---- */
.steps {
  list-style: none; margin: 0; padding: 0 0 0 1.15rem;
  border-left: 2px solid var(--rule); counter-reset: step;
}
.steps > li {
  counter-increment: step;
  display: grid; grid-template-columns: 2.1rem 1fr; column-gap: 0.55rem;
  padding-block: 1.05rem 1.15rem; border-bottom: 1px solid var(--rule);
}
.steps > li:last-child { border-bottom: 0; }
.steps > li::before {
  content: counter(step);
  font: 800 2.1rem/0.9 var(--display); color: var(--uv);
}
.steps h3 { font: 700 1.125rem/1.3 var(--body); margin: 0.1rem 0 0.3rem; color: var(--text); }
.steps p { margin: 0; color: var(--muted); max-width: 40ch; text-wrap: pretty; }
.steps p + p { margin-top: 0.5rem; }

/* ---- Home: the sign by the door ---- */
/* Sized off the column, not the window: EMERGENCY spans the door and never past it. */
.posted { container-type: inline-size; }
.sign-door {
  font-size: min(20.5cqi, 7.5rem); line-height: 0.84; letter-spacing: -0.01em;
  margin: 0 0 1.35rem;
}
.claim {
  font: 700 clamp(1.6rem, 0.95rem + 3.4vw, 2.35rem)/1.14 var(--body); letter-spacing: -0.018em;
  margin: 0 0 0.85rem; max-width: 17ch; text-wrap: balance;
}
.claim em { font-style: normal; color: var(--uv); }
.posted .lede { margin-bottom: 1.6rem; }
/* The sign and its stamps own the first screen; the house rules start at the fold. */
.posted + .section { margin-top: 5.5rem; }

.section h2.sign-sm, .sign-sm {
  font: 800 clamp(1.9rem, 1.3rem + 3vw, 2.5rem)/0.95 var(--display);
  text-transform: uppercase; letter-spacing: 0; margin: 0 0 1.15rem;
}
.rules > li::before { font-size: 2.6rem; }
.rules h3 { font: 800 1.55rem/1 var(--display); text-transform: uppercase; letter-spacing: 0.02em; margin-bottom: 0.4rem; }

.which { margin: 0 0 1.5rem; color: var(--muted); max-width: 40ch; }
.which strong { color: var(--text); }
/* Two ways in: two rows on the ruled sheet, like the house rules. Never cards. */
.doors { list-style: none; margin: 0; padding: 0 0 0 1.15rem; border-left: 2px solid var(--rule); }
.doorway { padding-block: 1.1rem 1.4rem; border-bottom: 1px solid var(--rule); }
.doorway:first-child { padding-top: 0.2rem; }
.doorway:last-child { border-bottom: 0; padding-bottom: 0.4rem; }
.doorway h3 {
  margin: 0 0 0.5rem;
  font: 800 2rem/1 var(--display); text-transform: uppercase; letter-spacing: 0.02em;
}
.doorway p { margin: 0 0 1.2rem; color: var(--muted); max-width: 38ch; text-wrap: pretty; }
.more { display: inline-block; margin-top: 0.7rem; padding-block: 0.55rem; font-size: 0.9375rem; }
.after-slip { margin-top: 1.6rem; }

/* ---- The stamp pad: an inked object, not a pill ---- */
.stamp {
  position: relative; display: block; width: 100%; min-height: 3.9rem;
  padding: 0; border: 0; background: transparent; text-decoration: none;
  cursor: pointer; isolation: isolate; -webkit-tap-highlight-color: transparent;
  transition: transform 90ms cubic-bezier(.3,.8,.4,1);
}
.stamp .pad {
  position: absolute; inset: 0; z-index: 0;
  background: var(--uv); border-bottom: 3px solid var(--uv-deep);
  filter: url(#ink-soft);
}
.stamp .face {
  position: relative; z-index: 2; display: flex; height: 100%; min-height: 3.9rem;
  align-items: center; justify-content: center; gap: 0.6rem; padding-inline: 1rem;
  font: 800 1.6rem/1 var(--display); text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--void);
}
.stamp svg { width: 1.25rem; height: 1.25rem; flex: none; }
.stamp:hover .pad { filter: url(#ink-soft) brightness(1.06); }
.stamp:active { transform: translateY(3px); }
.stamp:active .pad { border-bottom-width: 1px; }
/* The ink blooms out of the press point. The one authored moment. */
.stamp::after {
  content: ""; position: absolute; left: 50%; top: 50%; z-index: 1;
  width: 240%; aspect-ratio: 1; translate: -50% -50%; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in oklab, var(--uv-hot) 90%, transparent) 0%, transparent 62%);
  opacity: 0; scale: 0.25; pointer-events: none;
}
.stamp:active::after { animation: ink 520ms cubic-bezier(.16,1,.3,1) forwards; }
@keyframes ink {
  0%   { opacity: 0.75; scale: 0.25; filter: blur(0px); }
  100% { opacity: 0;    scale: 1.15; filter: blur(7px); }
}

/* The outline impression: the same stamp, pressed without the ink pad. */
.stamp-ghost .pad { background: transparent; border: 2.5px solid var(--uv); filter: url(#ink-hard); }
.stamp-ghost .face { color: var(--uv); }
.stamp-ghost:hover .pad { filter: url(#ink-hard) brightness(1.15); }
.stamp-ghost:active .pad { border-bottom-width: 2.5px; }

/* The small one that hangs by the sign on pages without their own. */
.stamp-tab { width: auto; min-height: 2.75rem; }
.stamp-tab .face { min-height: 2.75rem; font-size: 1.1rem; gap: 0.45rem; padding-inline: 0.95rem; }
.stamp-tab svg { width: 1rem; height: 1rem; }

.stamp-note { margin: 0.65rem 0 0; font-size: 0.875rem; color: var(--muted); }
.cta { display: grid; gap: 0.85rem; }
.close { margin-top: 3rem; padding-top: 1.75rem; border-top: 1px solid var(--rule); }
.close .sign { font-size: clamp(2rem, 1.3rem + 3.6vw, 2.6rem); margin-bottom: 1.25rem; }

/* ---- The stamp impression ---- */
.mark {
  width: 5.6rem; height: 5.6rem; display: grid; place-content: center;
  border: 3.5px solid var(--uv); border-radius: 2px;
  color: var(--uv); rotate: -7deg;
  filter: url(#ink-hard);
}
.mark svg { width: 2.6rem; height: 2.6rem; }
.mark.cold { border-color: var(--rule-strong); color: var(--rule-strong); }

/* ---- The request slip: a mock of what lands in the owner's Telegram ---- */
.slip { margin: 0; width: 100%; max-width: 21rem; }
.slip-body { border-top: 1px solid var(--rule-strong); border-bottom: 1px solid var(--rule-strong); }
.slip-photo { display: block; width: 100%; height: auto; }
.slip-photo .ground { fill: var(--void); }
.slip-photo .hatch { stroke: var(--rule); stroke-width: 1; }
.slip-photo text { font: 700 11px/1 var(--body); letter-spacing: 0.16em; fill: var(--muted); }
.slip-caption {
  margin: 0; padding: 0.8rem 0 0.85rem; border-top: 1px solid var(--rule);
  font-size: 0.9375rem; line-height: 1.5; color: var(--text); font-variant-numeric: tabular-nums;
}
.slip-caption b { font-weight: 700; }
.slip-keys { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--rule); }
.slip-keys span {
  padding: 0.75rem 0; text-align: center; font-weight: 600; font-size: 0.9375rem; color: var(--uv);
}
.slip-keys span + span { border-left: 1px solid var(--rule); }
.slip figcaption { margin-top: 0.6rem; font-size: 0.875rem; color: var(--muted); }

/* ---- Drawn plates (the shirt) ---- */
.plate { margin: 0.25rem 0 1.4rem; }
.plate svg { display: block; width: 100%; max-width: 26rem; height: auto; }
.plate .tee { fill: none; stroke: var(--rule-strong); stroke-width: 1.5; stroke-linejoin: round; }
.plate .seam { fill: none; stroke: var(--rule); stroke-width: 1; stroke-dasharray: 3 3; }
.plate .avoid { fill: url(#hatch-avoid); }
.plate .hatch-line { stroke: var(--rule); stroke-width: 1; }
.plate .code { color: var(--uv); }
.plate .dim { stroke: var(--muted); stroke-width: 1; }
.plate text {
  font: 700 11px/1 var(--body); letter-spacing: 0.16em; fill: var(--muted);
}
.plate text.hot { fill: var(--uv); }
.plate figcaption { margin-top: 0.6rem; font-size: 0.875rem; color: var(--muted); max-width: 40ch; }

/* ---- Where to print ---- */
.vendors { list-style: none; margin: 1rem 0 0; padding: 0; border-top: 1px solid var(--rule); }
.vendors li { padding-block: 0.95rem 1rem; border-bottom: 1px solid var(--rule); }
.vendors a { font-weight: 700; font-size: 1.0625rem; }
.vendors .where {
  display: block; margin: 0.3rem 0 0.35rem;
  font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted);
}
.vendors p { margin: 0; font-size: 0.9375rem; }

/* ---- Questions ---- */
.qa { margin: 0; border-top: 1px solid var(--rule); }
.qa > div { padding-block: 1.15rem 1.25rem; border-bottom: 1px solid var(--rule); }
.qa dt { font: 700 1.125rem/1.3 var(--body); color: var(--text); text-wrap: balance; }
.qa dd { margin: 0.4rem 0 0; color: var(--muted); max-width: 42ch; text-wrap: pretty; }
.qa dd strong { color: var(--text); }

/* ---- Terminal page ---- */
.verdict { min-height: 58svh; display: flex; flex-direction: column; justify-content: center; }
.verdict .mark { margin-bottom: 1.9rem; }
.verdict p { color: var(--muted); font-size: 1.0625rem; margin: 0; max-width: 34ch; }

/* ---- The foot of the page ---- */
.foot {
  border-top: 1px solid var(--rule);
  padding-block: 1rem calc(2rem + env(safe-area-inset-bottom));
  font-size: 0.875rem; color: var(--muted);
}
.foot nav { display: flex; flex-wrap: wrap; gap: 0 1.4rem; }
.foot nav a { color: var(--muted); padding-block: 0.7rem; overflow-wrap: anywhere; }
.foot nav a:hover { color: var(--text); }
.foot-note { margin: 0.4rem 0 0; font-size: 0.875rem; }

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