/* Design tokens + shared shell. Photos are the interface; everything here is quiet. */
:root {
  color-scheme: dark;
  --bg: #0d0d0e;
  --fg: #ebe9e4;
  --muted: #8f8d88;
  --line: #27272a;
  --panel: #151517;
  --danger: #d9534f;
  --ok: #6fcf97;
  --ok-line: #2f5e43;
  --warn: #d8a24a;
  --warn-line: #5e4a2f;
  --row-h: 300px;
  --gap: 4px;
  --radius: 6px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Motion (ADR 017). Decelerating curves, short for UI, longer only for photos arriving.
     Transform and opacity only, so everything stays on the compositor. */
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-in-out: cubic-bezier(.4, 0, .22, 1);
  --t-fast: 160ms;
  --t-base: 300ms;
  --t-slow: 650ms;
  --t-morph: 1100ms; /* The pending page's waiting animation only (ADR 022). */
  --lb-bg: #000;
  --lb-fg: rgba(255,255,255,.82);
}
/* Light palette: follows the system unless the visitor picked a theme (data-theme on <html>). */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light; --bg: #faf9f7; --fg: #19191a; --muted: #6f6d69; --line: #e5e3df; --panel: #ffffff;
    --ok: #1f7a4a; --ok-line: #b5dcc4; --warn: #9a6512; --warn-line: #ead2a8;
    --lb-bg: #f7f6f3; --lb-fg: #3a3936;
  }
}
:root[data-theme="light"] {
  color-scheme: light; --bg: #faf9f7; --fg: #19191a; --muted: #6f6d69; --line: #e5e3df; --panel: #ffffff;
  --ok: #1f7a4a; --ok-line: #b5dcc4; --warn: #9a6512; --warn-line: #ead2a8;
  --lb-bg: #f7f6f3; --lb-fg: #3a3936;
}
@media (max-width: 640px) { :root { --row-h: 180px; --gap: 3px; } }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font);
  font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased;
  padding-top: env(safe-area-inset-top, 0); padding-bottom: env(safe-area-inset-bottom, 0);
}
a { color: inherit; }
img { max-width: 100%; height: auto; display: block; }
h1 { font-weight: 400; letter-spacing: -0.01em; font-size: clamp(1.6rem, 4vw, 2.4rem); margin: 0 0 .5rem; line-height: 1.15; }
h2 { font-weight: 500; font-size: 1.05rem; margin: 0 0 .75rem; }
.brand { font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 1rem; }
.meta { color: var(--muted); font-size: .9rem; margin: .25rem 0; }
code { font-size: .85em; color: var(--muted); }

button, .button {
  font: inherit; font-size: .95rem; cursor: pointer; border: 1px solid var(--line); background: var(--panel); color: var(--fg);
  padding: .55rem 1rem; border-radius: var(--radius); text-decoration: none; display: inline-block; line-height: 1.2;
}
button, .button, input, select {
  transition: background-color var(--t-fast) ease, border-color var(--t-fast) ease, color var(--t-fast) ease, transform var(--t-fast) var(--ease-out), opacity var(--t-fast) ease;
}
button:hover, .button:hover { border-color: var(--muted); }
button:active:not(:disabled), .button:active { transform: scale(.97); }
button.primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
button.quiet, .button.quiet { background: transparent; }
button.danger { color: var(--danger); }
button.warn { color: var(--warn); }
button.link { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; }
button:disabled { opacity: .4; cursor: default; }
input, select {
  font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: .55rem .7rem;
}
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--muted); outline-offset: 1px; }

/* Single-message pages: pending, lapsed, expired, removed, landing. */
.status { max-width: 34rem; margin: 0 auto; padding: 18vh 1.25rem 4rem; }
.waiting { display: none; }
html.js .waiting { display: block; position: relative; width: 9rem; height: 9rem; margin: 0 auto 2rem; animation: rise var(--t-slow) var(--ease-out) both, waiting-sway 7s var(--ease-in-out) infinite alternate; }
.waiting span { position: absolute; left: 50%; top: 50%; width: 7px; height: 7px; margin: -3.5px; opacity: 0; transform: scale(0); transition: transform var(--t-morph) var(--ease-in-out), opacity var(--t-morph) var(--ease-in-out); }
.waiting i { display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--fg); will-change: transform; }
@keyframes waiting-sway { from { rotate: -7deg; } to { rotate: 7deg; } }
.status-line { font-size: 1.1rem; color: var(--muted); margin: 0 0 1.5rem; }
.notice { color: var(--fg); border-left: 2px solid var(--line); padding-left: .75rem; }
.signup label { display: block; color: var(--muted); font-size: .95rem; margin-bottom: .5rem; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.row input { flex: 1 1 14rem; }

.site-footer {
  max-width: 34rem; margin: 0 auto; padding: 2rem 1.25rem 3rem; display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap;
  color: var(--muted); font-size: .85rem;
}
.site-footer .brand { margin: 0; }
.site-footer nav { display: flex; gap: 1.25rem; }
.site-footer a.quiet { color: var(--muted); }
.pin-input { font-size: 1.4rem; letter-spacing: .15em; font-variant-numeric: tabular-nums; max-width: 12rem; }

/* Theme toggle: a quiet icon button; the icon shows the theme you'd switch to. */
.theme-toggle { background: transparent; border: 0; padding: .35rem; color: var(--muted); line-height: 0; border-radius: 999px; }
.theme-toggle:hover { color: var(--fg); }
.theme-toggle svg { width: 18px; height: 18px; transition: transform var(--t-slow) var(--ease-out); }
.theme-toggle:hover svg { transform: rotate(20deg); }
.theme-toggle .moon { display: none; }
:root[data-theme="light"] .theme-toggle .sun { display: none; }
:root[data-theme="light"] .theme-toggle .moon { display: inline; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-toggle .sun { display: none; }
  :root:not([data-theme="dark"]) .theme-toggle .moon { display: inline; }
}

/* Arrival: single-message pages rise in gently; page-to-page navigation cross-fades
   where the browser supports cross-document view transitions. */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes fade { from { opacity: 0; } }
.status > * { animation: rise var(--t-slow) var(--ease-out) both; }
.status > :nth-child(2) { animation-delay: 60ms; }
.status > :nth-child(3) { animation-delay: 120ms; }
.status > :nth-child(n+4) { animation-delay: 180ms; }
.site-footer { animation: fade var(--t-slow) ease both; animation-delay: 240ms; }

@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 220ms; animation-timing-function: var(--ease-in-out); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; }
}
