/* 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;
  --todo: #e8845c; /* Needs photos (ADR 103) */
  --todo-line: #63392a;
  --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; /* Slow changes only: the pending page's waiting animation (ADR 022), the Hero's cross-fade (ADR 069). */
  --lb-bg: #000;
  --lb-fg: rgba(255,255,255,.82);

  /* Glass (ADR 106): frosted surfaces that float over photos or scrolling content. A tint of the page, a strong blur
     with a little extra saturation so colour under it glows rather than greys, and a hairline edge with a faint
     top highlight, the way a pane of glass catches light. --glass-ink is for controls over photos in either theme. */
  --glass-tint: color-mix(in srgb, var(--bg) 66%, transparent);
  --glass-tint-strong: color-mix(in srgb, var(--panel) 80%, transparent);
  --glass-blur: blur(20px) saturate(1.7);
  --glass-edge: inset 0 0 0 1px color-mix(in srgb, var(--fg) 9%, transparent), inset 0 1px 0 rgb(255 255 255 / .07);
  --glass-lift: 0 10px 34px -8px rgb(0 0 0 / .4);
  --glass-ink: rgb(22 22 24 / .34);
  --glass-ink-edge: inset 0 0 0 1px rgb(255 255 255 / .16), inset 0 1px 0 rgb(255 255 255 / .12);
}
/* 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; --todo: #b4471f; --todo-line: #f0c4b0;
    --lb-bg: #f7f6f3; --lb-fg: #3a3936; --glass-lift: 0 10px 34px -10px rgb(0 0 0 / .16);
  }
}
: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; --todo: #b4471f; --todo-line: #f0c4b0;
  --lb-bg: #f7f6f3; --lb-fg: #3a3936; --glass-lift: 0 10px 34px -10px rgb(0 0 0 / .16);
}
@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); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

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, textarea {
  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;
}
/* The display above outranks the browser's own [hidden] rule, so say it again: a hidden button is gone. */
button[hidden], .button[hidden] { display: none; }
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, textarea {
  font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: .55rem .7rem;
}
/* A file input is as wide as its "No file chosen" text; on a phone that overflows the panel. */
input[type=file] { max-width: 100%; min-width: 0; }
input:focus, select:focus, textarea: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; }
/* Save to your account, or Saved (ADR 083), under the Album's actions. */
.save { margin: 1rem 0 0; }
.status .save { margin-top: 1.5rem; }
.save a { color: inherit; }

.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; flex-wrap: wrap; gap: .3rem 1.25rem; }
.site-footer nav a { white-space: nowrap; }
.site-footer a.quiet { color: var(--muted); }

/* 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; } }
/* Sheets and floating buttons settle in: a short rise from a hair smaller (ADR 106). */
@keyframes settle { from { opacity: 0; transform: translateY(8px) scale(.975); } }
.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; }
}

.tip-form { margin-top: 2rem; font-size: .9rem; }
.tip-form summary { color: var(--muted); text-decoration: underline; cursor: pointer; }
.tip-form-choices { display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin-bottom: .75rem; }
.tip-form-other { display: block; margin-bottom: .75rem; color: var(--muted); }
.heart { display: inline-block; margin-left: .15em; vertical-align: -.05em; fill: #d33a4a; }
.brand-mark { display: inline-block; height: 2.75rem; max-width: 100%; vertical-align: middle; background: currentColor; -webkit-mask: var(--mark) center / contain no-repeat; mask: var(--mark) center / contain no-repeat; }
.brand:has(.brand-mark) { color: var(--fg); }
.site-footer .brand-mark { height: 1.75rem; }
/* Scrollbars appear while scrolling and clear a second later (assets/js/scrollbars.js). */
html.js, html.js * { scrollbar-color: transparent transparent; }
html.js.is-scrolling, html.js .is-scrolling { scrollbar-color: var(--muted) transparent; }
.theme-corner { position: fixed; z-index: 6; top: calc(6px + env(safe-area-inset-top, 0px)); right: calc(var(--page, 1.25rem) - .7rem); }
.theme-corner .theme-toggle { padding: .7rem; }
.admin-back, .customer-back { position: fixed; z-index: 6; top: calc(16px + env(safe-area-inset-top, 0px)); left: .75rem; color: var(--muted); font-size: .75rem; text-decoration: none; }
.admin-back:hover, .customer-back:hover { color: var(--fg); }
body:has(.customer-back) .admin-back { display: none; }
.admin-back[hidden] { display: none; }
