/* Shared tokens and base components. Each app restyles by changing the
   tokens in :root and the dark blocks (keep both dark blocks in step), and by
   swapping the font files. Components use only tokens. */

@font-face { font-family: "Gloock"; src: url(/fonts/gloock-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Nunito"; src: url(/fonts/nunito-var.woff2) format("woff2"); font-weight: 200 1000; font-style: normal; font-display: swap; }
@font-face { font-family: "Nunito"; src: url(/fonts/nunito-var-italic.woff2) format("woff2"); font-weight: 200 1000; font-style: italic; font-display: swap; }

/* Soft editorial (modern romantic), from the approved v2 mock-ups. The second
   group of names (--bg, --blue, --flower ...) are the mock-ups' own, so their
   CSS can be ported as is. --flower is the couple's colour: screens set it on
   an element from the album (FLOWER_COLOURS in src/shared/album.ts). */
:root {
  color-scheme: light;
  --canvas: #EEF1F8; --surface: #FFFFFF; --surface-2: #F6F8FC; --ink: #1B1E2A; --ink-2: #333849; --muted: #545B71;
  --line: #DCE1EE; --accent: #4463BE; --accent-ink: #FFFFFF; --accent-soft: #DFE6F8; --danger: #A3261D; --danger-soft: #F8DEDB;
  --warn: #7A4E0C; --warn-soft: #F8ECD2; --focus: #4463BE; --scrim: rgba(20, 22, 32, .45);
  --shadow: 0 1px 2px rgba(27, 30, 42, .05), 0 8px 24px -8px rgba(40, 56, 110, .14);
  --shadow-lift: 0 2px 4px rgba(27, 30, 42, .06), 0 22px 48px -18px rgba(40, 56, 110, .32);
  --bg: var(--canvas); --blue: var(--accent); --blue-soft: var(--accent-soft); --flower: #6F8FDB; --pollen: #E2A93B;
  --ok: #2F7A57; --ok-soft: #DDF0E5; --btn: #1B1E2A; --btn-ink: #FFFFFF;
  --radius: 14px; --radius-sm: 10px; --r-xl: 28px; --r-lg: 20px; --r-md: 14px;
  --serif: "Gloock", "Iowan Old Style", Georgia, serif;
  --sans: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: var(--serif);
  --tap: 44px;
}
/* Dark, when following the phone */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --canvas: #11141D; --surface: #1A1E2B; --surface-2: #222738; --ink: #EDEFF6; --ink-2: #D3D7E4; --muted: #A7AEC3;
    --line: #2F3548; --accent: #9DB3F2; --accent-ink: #141722; --accent-soft: #253050; --danger: #FF9B90; --danger-soft: #4A1F1B;
    --warn: #F0C977; --warn-soft: #3A2F1A; --focus: #9DB3F2; --scrim: rgba(0, 0, 0, .6);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px -10px rgba(0, 0, 0, .6);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, .3), 0 24px 52px -18px rgba(0, 0, 0, .75);
    --flower: #8EA7EE; --pollen: #EDBA52; --ok: #7FD3A6; --ok-soft: #1F3A2E; --btn: #EDEFF6; --btn-ink: #141722;
  }
}
/* Dark, picked with the toggle (same values as above) */
:root[data-theme="dark"] {
    color-scheme: dark;
    --canvas: #11141D; --surface: #1A1E2B; --surface-2: #222738; --ink: #EDEFF6; --ink-2: #D3D7E4; --muted: #A7AEC3;
    --line: #2F3548; --accent: #9DB3F2; --accent-ink: #141722; --accent-soft: #253050; --danger: #FF9B90; --danger-soft: #4A1F1B;
    --warn: #F0C977; --warn-soft: #3A2F1A; --focus: #9DB3F2; --scrim: rgba(0, 0, 0, .6);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px -10px rgba(0, 0, 0, .6);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, .3), 0 24px 52px -18px rgba(0, 0, 0, .75);
    --flower: #8EA7EE; --pollen: #EDBA52; --ok: #7FD3A6; --ok-soft: #1F3A2E; --btn: #EDEFF6; --btn-ink: #141722;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--canvas); color: var(--ink);
  font: 400 1rem/1.5 var(--sans); -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
h1, h2, h3 { font-family: var(--display); line-height: 1.2; margin: 0 0 .5em; text-wrap: balance; }
h1 { font-size: 1.9rem; font-weight: 400; letter-spacing: -.01em; }
h2 { font-size: 1.3rem; font-weight: 400; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 1em; overflow-wrap: anywhere; }
a { color: var(--accent); }
img { max-width: 100%; height: auto; display: block; }
.muted { color: var(--muted); }
.sprite { display: none; }
.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--surface); color: var(--ink); padding: 10px 14px; border-radius: var(--radius-sm); z-index: 50; }
.skip:focus { top: 8px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---- shell ---- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 720px; margin: 0 auto; padding: 10px 16px; }
.brand { font: 750 1.1rem/1.2 var(--display); color: var(--ink); text-decoration: none; }
.topbar-actions { display: flex; gap: 4px; }
.app { max-width: 720px; margin: 0 auto; padding: 8px 16px 48px; outline: none; }
.stack { display: grid; gap: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.offline-banner { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--warn-soft); color: var(--warn); text-align: center; font-weight: 600; }
.noscript { padding: 16px; }
.offline-page { display: grid; place-items: center; min-height: 80dvh; }

/* ---- button ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 54px; padding: 0 24px; border-radius: 999px; border: 1.5px solid transparent;
  font: 750 1rem/1.2 var(--sans); text-decoration: none; cursor: pointer; text-align: center;
  background: var(--surface-2); color: var(--ink); transition: transform .15s ease-out, background .15s ease, box-shadow .2s ease-out;
}
.btn:active { transform: scale(.98); }
/* the mock-ups' button: ink on light, light on dark */
.btn-primary { background: var(--btn); color: var(--btn-ink); }
.btn-soft { background: var(--blue-soft); color: var(--ink); }
.btn-line { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-sm { min-height: var(--tap); padding: 0 18px; font-size: 15px; }
.btn-secondary { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-danger { background: var(--danger); color: var(--surface); }
.btn-ghost { background: transparent; color: var(--accent); padding-inline: 10px; }
.btn-block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; }
.btn[aria-busy="true"] { cursor: progress; }
.btn[aria-busy="true"]::after { content: ""; width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.iconbtn {
  display: inline-grid; place-items: center; width: var(--tap); height: var(--tap); border-radius: 50%;
  border: 0; background: transparent; color: var(--ink); cursor: pointer;
}
.iconbtn:hover { background: var(--surface-2); }

/* ---- input ---- */
.field { display: grid; gap: 6px; }
.field label { font-weight: 650; }
.field .hint { color: var(--muted); font-size: .9rem; margin: 0; }
.field .error { color: var(--danger); font-size: .9rem; font-weight: 600; margin: 0; }
.input {
  width: 100%; min-height: var(--tap); padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font: 400 1rem/1.3 var(--sans);
}
.input:focus-visible { border-color: var(--focus); outline-offset: 0; }
.input[aria-invalid="true"] { border-color: var(--danger); }
textarea.input { min-height: 140px; resize: vertical; line-height: 1.45; }
/* a row of choices (radio pills) */
.choice { display: flex; flex-wrap: wrap; gap: 8px; border: 0; padding: 0; margin: 0; }
.choice legend { font-weight: 650; padding: 0; margin-bottom: 6px; }
.choice label { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice span { display: inline-flex; align-items: center; min-height: var(--tap); padding: 8px 16px; border-radius: 999px; border: 1.5px solid var(--line); font-weight: 650; }
.choice input:checked + span { background: var(--accent-soft); border-color: var(--accent); }
.choice input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
/* the field only bots fill: off screen, never focusable */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---- card ---- */
.card { background: var(--surface); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card > :last-child { margin-bottom: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--ink); font-size: .85rem; font-weight: 650; }

/* ---- sheet (a <dialog>: focus stays inside, Esc closes) ---- */
.sheet {
  border: 0; padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); width: 100%; max-width: 560px;
  margin: auto auto 0; border-radius: 20px 20px 0 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
  max-height: 90dvh; overflow: auto;
}
.sheet::backdrop { background: var(--scrim); }
.sheet[open] { animation: rise .2s ease-out; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.sheet-head h2 { margin: 0; }
@media (min-width: 700px) { .sheet { margin: auto; border-radius: 20px; } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }

/* ---- toast ---- */
.toasts { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; gap: 8px; width: min(92vw, 420px); z-index: 40; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--ink); color: var(--canvas); box-shadow: var(--shadow); font-weight: 600; animation: rise .2s ease-out; }
.toast.error { background: var(--danger); color: var(--surface); }
.toast .btn-ghost { color: inherit; min-height: 32px; margin-left: auto; }

/* ---- base screens ---- */
.plans { display: grid; gap: 12px; }
.site-foot { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: center; max-width: 720px; margin: 0 auto; padding: 0 16px 32px; color: var(--muted); font-size: .9rem; }
.site-foot a { color: inherit; }
@media (min-width: 640px) { .plans { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); } }
.kit-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.kit-swatch { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); }
.sw-canvas { background: var(--canvas); } .sw-surface { background: var(--surface); } .sw-accent { background: var(--accent); }
.sw-accent-soft { background: var(--accent-soft); } .sw-danger { background: var(--danger); } .sw-warn { background: var(--warn); }
