/*
  theme.css — the 1.10 look (design canvas "Secret Santa redesign").
  Loaded last on every page: warm cream ground, deep pine cards, cranberry
  for the main action, gold for the register. Space Grotesk headings over
  Inter text, both served from assets/fonts (OFL). Overrides tokens and
  component styles from base.css, app.css, gift.css and polish.css.
*/

@font-face { font-family: 'Inter'; src: url('../fonts/inter-latin-wght-normal.woff2') format('woff2'); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'Space Grotesk'; src: url('../fonts/space-grotesk-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Space Grotesk'; src: url('../fonts/space-grotesk-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Space Grotesk'; src: url('../fonts/space-grotesk-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --eucalypt: #17362f;
  --pine: #17362f;
  --pine-2: #2c5048;
  --gum: #5e7d73;
  --gum-mist: #e3eee8;
  --paper: #f7f3ea;
  --paper-2: #ece5d6;
  --card: #ffffff;
  --bush: #b8323f;
  --bush-press: #9d2934;
  --beetle: #c9a24b;
  --gold: #e8c877;
  --gold-mist: #f4e8c8;
  --gold-ink: #6b5414;
  --ink: #1d2422;
  --ink-soft: #5c6662;
  --line: #e6dfd1;
  --line-2: #d9d2c3;
  --warn-bg: #f3dadb;
  --warn-ink: #8e2430;
  --ok-ink: #2e7d57;
  --ok-bg: #e3eee8;
  --on-bush: #ffffff;
  --tag-bg: var(--pine);
  --tag-ink: #f7f3ea;
  --tag-soft: #c8d6cf;
  --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --r-sm: 10px;
  --r-md: 12px;
  --r-lg: 18px;
  --shadow: none;
}
@media (prefers-color-scheme: dark) {
  :root {
    --pine: #1f4239; --pine-2: #2f5a50; --eucalypt: #cfe0d8; --gum: #8db6a8; --gum-mist: #1f3a33;
    --paper: #12201c; --paper-2: #1a2b26; --card: #192a25; --bush: #e05a69; --bush-press: #ec7285;
    --gold: #e8c877; --gold-mist: #3a3220; --gold-ink: #f0d894; --ink: #eef2ef; --ink-soft: #a9b8b2;
    --line: #2a3d37; --line-2: #36504a; --warn-bg: #3c1f25; --warn-ink: #ffb8c1; --ok-ink: #8fd1b8; --ok-bg: #1f3a33;
    --on-bush: #ffffff; --tag-bg: #1f4239; --tag-ink: #f3f1e6; --tag-soft: #b5c9c1;
  }
}

body { font-family: var(--font-ui); background: var(--paper); }
h1, h2, h3, .tag-title, .list-name, .nav-brand, .topbar-title { font-family: var(--font-display); letter-spacing: -0.01em; }
h1 { font-weight: 700; font-size: clamp(1.75rem, 6vw, 2.1rem); }
h2 { font-size: 1.2rem; font-weight: 600; }
h3 { font-size: 1.05rem; font-weight: 600; }
a { color: var(--pine); }
@media (prefers-color-scheme: dark) { a { color: var(--gold); } }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* Cards: flat, hairline border, no drop shadow. */
.card, .list, .step, .wish-row, .roster-toolbar, .draw-groups, .people-table {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: none;
}

/* The hero card (was the gift-tag shape). */
.tag { clip-path: none; border-radius: 20px; padding: 20px; background: var(--pine); }
.tag::before { display: none; }
.tag-title { font-size: clamp(1.6rem, 6vw, 2rem); }
.eyebrow { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); margin: 0 0 6px; }
.tag .muted, .tag .fact-label { color: var(--tag-soft); }

/* Big countdown: whole days, the number people care about. */
.big-count { display: flex; align-items: baseline; gap: 10px; margin: 16px 0 12px; }
.big-count-number { font-family: var(--font-display); font-weight: 700; font-size: clamp(3.4rem, 18vw, 4.6rem); line-height: 1; font-variant-numeric: tabular-nums; }
.big-count-label { color: var(--tag-soft); font-size: 1rem; }
.count-bar { height: 6px; border-radius: 3px; background: var(--pine-2); overflow: hidden; margin-bottom: 14px; }
.count-bar > span { display: block; height: 100%; background: var(--gold); border-radius: 3px; }
.tag .event-facts { padding-top: 14px; border-top: 1px solid var(--pine-2); }

/* Buttons */
.btn { border-radius: var(--r-md); font-weight: 600; min-height: 48px; background: var(--bush); color: var(--on-bush); border: 0; box-shadow: none; }
.btn:hover { background: var(--bush-press); }
.btn.secondary { background: var(--card); color: var(--pine); border: 1px solid var(--line-2); }
.btn.secondary:hover { background: var(--paper); }
.btn.ghost { background: transparent; color: var(--pine); border: 0; }
.btn.dark { background: var(--pine); color: #fff; }
.tag .btn.secondary { background: rgba(255,255,255,.08); color: var(--tag-ink); border-color: var(--pine-2); }
@media (prefers-color-scheme: dark) { .btn.secondary, .btn.ghost { color: var(--ink); } }
.btn.small { min-height: 40px; padding: 8px 14px; font-size: .9rem; }
.btn.danger { background: transparent; color: var(--warn-ink); border: 1px solid var(--warn-bg); }
.link-btn { color: var(--pine); font-weight: 600; }

/* Inputs */
.input { border-radius: 10px; border: 1px solid var(--line-2); background: var(--card); min-height: 44px; font: inherit; }
.field > span { font-size: .85rem; font-weight: 600; }
.field .hint { font-weight: 400; color: var(--ink-soft); }

/* Chips and badges */
.chip { border-radius: 18px; background: var(--card); border: 1px solid var(--line-2); font-size: .85rem; padding: 6px 12px; }
.chip.gold { background: var(--gold-mist); color: var(--gold-ink); border-color: transparent; }
.chip.warn { background: var(--warn-bg); color: var(--warn-ink); border-color: transparent; }
button.chip-btn.no-ideas { border-style: dashed; border-color: var(--bush); color: var(--warn-ink); }
.status-badge { border: 0; border-radius: 8px; padding: 4px 8px; font-size: .75rem; }
.status-badge.complete { background: var(--ok-bg); color: var(--ok-ink); }
.status-badge.attention { background: var(--warn-bg); color: var(--warn-ink); }

/* Top bar and navigation */
.topbar { padding-top: calc(16px + env(safe-area-inset-top)); }
button.topbar-switch { display: flex; flex-direction: column; align-items: flex-start; gap: 0; font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; color: var(--ink); }
.topbar-group { font-family: var(--font-ui); font-size: .72rem; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }
.nav { background: var(--card); border-top: 1px solid var(--line); }
.nav a { font-weight: 500; }
.nav a[aria-current='page'] { color: var(--bush); font-weight: 600; }
@media (min-width: 900px) { .nav { border-right: 1px solid var(--line); } .nav a[aria-current='page'] { background: var(--warn-bg); } }

/* Home */
.next-up { padding: 16px; display: grid; gap: 12px; }
.next-up-row { display: flex; gap: 12px; align-items: center; }
.next-up-count { width: 36px; height: 36px; border-radius: 18px; display: grid; place-items: center; font-weight: 700; background: var(--warn-bg); color: var(--warn-ink); flex: none; }
.next-up-count.ok { background: var(--ok-bg); color: var(--ok-ink); }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.stat-value { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.stat-label { font-size: .78rem; color: var(--ink-soft); }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.checklist li { display: flex; gap: 10px; align-items: center; color: var(--ink-soft); font-size: .95rem; }
.checklist .tick { width: 22px; height: 22px; border-radius: 11px; display: grid; place-items: center; font-size: .75rem; background: var(--line); color: var(--ink-soft); flex: none; }
.checklist .done .tick { background: var(--ok-bg); color: var(--ok-ink); }
.checklist .current { color: var(--ink); font-weight: 600; }
.checklist .current .tick { background: var(--bush); color: #fff; }

/* Event picker */
.event-row { display: flex; gap: 14px; align-items: center; }
.date-badge { width: 52px; height: 52px; border-radius: 14px; background: var(--pine); color: var(--tag-ink); display: flex; flex-direction: column; align-items: center; justify-content: center; flex: none; line-height: 1; }
.date-badge small { font-size: .62rem; letter-spacing: .06em; }
.date-badge strong { font-family: var(--font-display); font-size: 1.25rem; }
.date-badge.alt { background: var(--warn-bg); color: var(--warn-ink); }
.date-badge.register { background: var(--gold-mist); color: var(--gold-ink); }
.list-item[aria-current='true'] { outline: 2px solid var(--pine); outline-offset: -2px; border-radius: 16px; }
.section-label { font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); margin: 4px 0 -4px; }
.section-label.warn { color: var(--warn-ink); }
.button-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

/* Draw: status strip, matches as a tidy list */
.status-strip { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 16px; background: var(--ok-bg); }
.status-strip.warn { background: var(--warn-bg); }
.status-dot { width: 10px; height: 10px; border-radius: 5px; background: var(--ok-ink); flex: none; }
.status-strip.warn .status-dot { background: var(--bush); }
.pairs { gap: 0; background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.pair-wrap + .pair-wrap { border-top: 1px solid var(--line); }
.tag.pair { background: transparent; color: var(--ink); border-radius: 0; padding: 12px 14px; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 6px 10px; align-items: center; min-height: 0; width: 100%; text-align: left; border: 0; }
.tag.pair .pair-line { display: contents; }
.tag.pair .pair-label { display: none; }
.tag.pair .pair-line:first-child .pair-name { font-weight: 600; }
.tag.pair .pair-line:first-child::after { content: '\2192'; color: var(--ink-soft); }
.tag.pair .pair-line + .pair-line .pair-name { text-align: right; }
.tag.pair .pair-notes { grid-column: 1 / -1; }
.tag.pair .pair-name { font-family: var(--font-ui); font-size: 1rem; color: var(--ink); }
.tag.pair.selected { background: var(--gold-mist); }
.tag.pair.blurred .pair-notes .muted { color: var(--ink-soft); }
.wrapped { background: repeating-linear-gradient(135deg, var(--bush) 0 6px, var(--gold) 6px 12px); border-radius: 7px; display: inline-block; width: 72px; height: 14px; }

/* People */
.people-heading { display: none; }
.people-table { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.person-row { display: grid !important; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 12px 14px !important; }
.person-row + .person-row { border-top: 1px solid var(--line); }
.avatar { width: 40px; height: 40px; border-radius: 20px; display: grid; place-items: center; font-weight: 600; background: var(--ok-bg); color: var(--pine); grid-row: span 2; }
.avatar.attention { background: var(--warn-bg); color: var(--warn-ink); }
.person-row .person-name { grid-column: 2; flex-direction: column; align-items: flex-start; gap: 0; }
.person-row .person-contact { grid-column: 2; }
.person-row .person-delivery, .person-row .person-profile { display: none; }
.person-row .person-event { grid-column: 3; grid-row: 1 / span 2; flex-direction: column; align-items: flex-end; gap: 6px; }
.people-filters { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
.people-filters .btn { white-space: nowrap; border-radius: 18px; min-height: 36px; }
.people-filters .btn[aria-pressed='true'] { background: var(--pine); color: #fff; border-color: var(--pine); }
.link-card { background: var(--pine); color: var(--tag-ink); border-radius: 16px; padding: 16px; display: grid; gap: 12px; }
.link-card h3 { color: var(--tag-ink); }
.link-card .muted { color: var(--tag-soft); }
.link-card .btn.secondary { background: var(--paper); color: var(--pine); border: 0; }
.link-card .btn.ghost { color: var(--tag-ink); border: 1px solid var(--gum); }
.link-card-events { display: grid; gap: 6px; font-size: .88rem; }
.link-card-events div { display: flex; justify-content: space-between; gap: 10px; }

/* Wishlists */
.progress { display: flex; align-items: center; gap: 12px; }
.progress-track { flex: 1; height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.progress-track > span { display: block; height: 100%; background: var(--ok-ink); }
.progress strong { font-size: .9rem; white-space: nowrap; }

/* Archive / register entry */
.register-card { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 16px; background: var(--gold-mist); color: var(--ink); text-decoration: none; }
.register-card strong { display: block; }
.register-card span span { display: block; font-size: .85rem; color: var(--gold-ink); }

/* Sheets (dialogs) */
dialog.sheet { background: var(--paper); }
.sheet-head h2 { font-size: 1.35rem; }

/* Event form */
.form-section { border: 1px solid var(--line); border-radius: 16px; background: var(--card); padding: 16px; margin: 0; display: grid; gap: 12px; min-width: 0; }
.form-section legend { font-family: var(--font-display); font-weight: 600; font-size: 1rem; padding: 0 6px; margin-left: -6px; }
.switch-row { display: flex; gap: 12px; align-items: flex-start; }
.switch-row input { width: 22px; height: 22px; accent-color: var(--pine); margin-top: 2px; flex: none; }

/* Wishlist editor */
.wish-row { grid-template-columns: 28px minmax(0, 1fr) 44px; }
.wish-handle { width: 28px; min-height: 44px; display: grid; place-items: center; color: var(--ink-soft); cursor: grab; border: 0; background: transparent; padding: 0; touch-action: none; }
.wish-row.sortable-ghost { opacity: .4; }
.wish-row.sortable-chosen { border-color: var(--pine); }
@media (max-width: 420px) { .wish-row { grid-template-columns: 24px minmax(0, 1fr) 36px; } .wish-handle { width: 24px; } }

/* Gift page */
.gift { padding-top: calc(20px + env(safe-area-inset-top)); }
.gift-kicker { font-family: var(--font-ui); font-size: .75rem; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.gift-events { display: flex; gap: 6px; padding: 4px; border-radius: 14px; background: var(--paper-2); flex-wrap: nowrap; overflow-x: auto; }
.gift-events .btn { flex: 1 0 auto; min-height: 40px; border-radius: 10px; background: transparent; color: var(--ink-soft); border: 0; font-weight: 500; }
.gift-events .btn[aria-pressed='true'] { background: var(--card); color: var(--ink); font-weight: 600; }
.reveal { border-radius: 20px; background: var(--pine); }
.reveal:not(.is-revealed) .reveal-name .wrapped { width: 100%; height: 56px; border-radius: 14px; background: repeating-linear-gradient(135deg, var(--bush) 0 14px, #a12c38 14px 28px); }
.reveal-name { font-family: var(--font-display); }
.register-link { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 16px; background: var(--gold-mist); color: var(--ink); text-decoration: none; }
.register-link span span { display: block; font-size: .85rem; color: var(--gold-ink); }

/* Register page */
.reg-search { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }
.reg-search input { border: 0; outline: 0; font: inherit; flex: 1; background: transparent; color: var(--ink); min-height: 42px; }
.reg-person { display: flex; align-items: center; gap: 12px; padding: 14px; width: 100%; border: 0; background: var(--card); font: inherit; color: var(--ink); text-align: left; cursor: pointer; }
.reg-person + .reg-person { border-top: 1px solid var(--line); }
.reg-person .avatar { grid-row: auto; background: var(--gold-mist); color: var(--gold-ink); flex: none; }
.reg-preview { display: block; font-size: .85rem; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reg-items { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; list-style: none; margin: 0; padding: 0; }
.reg-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; padding: 12px 14px; }
.reg-item + .reg-item { border-top: 1px solid var(--line); }
.reg-item.no { background: var(--warn-bg); color: var(--warn-ink); }
.reg-item small { display: block; color: var(--ink-soft); font-size: .78rem; }
.reg-lock { display: flex; gap: 12px; align-items: flex-start; padding: 16px; border-radius: 16px; background: var(--pine); color: var(--tag-ink); }
.reg-lock .muted { color: var(--tag-soft); }
.reg-group-tabs { display: flex; gap: 6px; flex-wrap: wrap; }

/* The person sheet opens on their link. */
.stack-lg:has(> .link-card) { display: flex; flex-direction: column; gap: 24px; }
.stack-lg:has(> .link-card) > * + * { margin-top: 0; }
.stack-lg > .link-card { order: -1; }
