/* Julafton 2026 – natt, snö och guld. Mörkt tema med avsikt: sidan är en vinternatt. */
:root {
  color-scheme: dark;
  --night: #070d1c;
  --ink: #f6f2ea;
  --muted: #c4cbd9;
  --gold: #ebc66e;
  --gold-soft: #f6e3a9;
  --red: #b3262e;
  --red-deep: #7a1520;
  --green: #2c7a52;
  --green-deep: #133b2a;
  --glass: rgba(8, 14, 30, 0.7);
  --glass-strong: rgba(8, 14, 30, 0.84);
  --line: rgba(235, 198, 110, 0.24);
  --radius: 22px;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --script: 'Pinyon Script', 'Snell Roundhand', cursive;
}

* { box-sizing: border-box; }
html { background: var(--night); scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overflow-x: clip; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  min-height: 100svh;
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-size: clamp(16px, 0.95rem + 0.25vw, 18.5px);
  line-height: 1.55;
  color: var(--ink);
  background: radial-gradient(120% 80% at 50% 0%, #1a2b52 0%, #0b1530 45%, var(--night) 100%) fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

#scene {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
  z-index: 0;
  touch-action: pan-y;
  opacity: 0;
  transition: opacity 1.2s ease;
}
body.scene-ready #scene { opacity: 1; }
body.exploring #scene { touch-action: none; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Typografi ---------- */
h1, h2, h3 {
  font-family: var(--serif);
  font-variation-settings: 'SOFT' 100, 'WONK' 1;
  font-weight: 600;
  line-height: 1.05;
  margin: 0;
  text-wrap: balance;
}
h2 { font-size: clamp(1.9rem, 1.2rem + 2.6vw, 2.8rem); letter-spacing: -0.01em; }
h3 { font-size: 1.3rem; font-variation-settings: 'SOFT' 100, 'WONK' 0; }
.script { font-family: var(--script); color: var(--gold); font-size: clamp(2.4rem, 1.6rem + 3.5vw, 4.2rem); line-height: 1; margin: 0; font-weight: 400; }
.script.small { font-size: 2.1rem; }
.eyebrow {
  margin: 0 0 0.4rem;
  font-size: 0.78rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--gold); font-weight: 600;
  font-variation-settings: 'SOFT' 0, 'WONK' 0;
}
.sub { color: var(--muted); margin: 0.5rem 0 0; }
strong { font-weight: 650; }

a { color: var(--gold-soft); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 8px; }

/* ---------- Knappar ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4em;
  min-height: 46px; padding: 0.6em 1.3em;
  font: inherit; font-weight: 600; font-size: 1rem;
  color: #1b1206; background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  border: 0; border-radius: 999px; cursor: pointer; text-decoration: none;
  box-shadow: 0 6px 24px rgba(235, 198, 110, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 30px rgba(235, 198, 110, 0.35); }
.btn.ghost { color: var(--ink); background: rgba(8, 14, 30, 0.55); border: 1px solid var(--line); box-shadow: none; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.link { font: inherit; color: var(--muted); background: none; border: 0; padding: 0.4em; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--ink); }

/* ---------- Kodlåset ---------- */
.gate {
  position: fixed; inset: 0; z-index: 20;
  display: grid; place-items: center;
  padding: 16px;
  background: radial-gradient(60% 50% at 50% 50%, rgba(5, 10, 22, 0.25), rgba(5, 10, 22, 0.6));
  transition: opacity 0.65s ease, transform 0.65s ease;
}
.gate[hidden], .is-open .gate { display: none; }
.gate.leaving { opacity: 0; transform: scale(1.04); }
.gate-card {
  width: min(400px, 100%);
  text-align: center;
  padding: 32px 28px 22px;
  background: var(--glass-strong);
  border: 1px solid var(--line);
  border-radius: 28px;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
.gate-card h1 { font-size: 2.3rem; margin: 0.2rem 0 0.6rem; }
.gate-card p { color: var(--muted); margin: 0 0 1rem; }
.gate-card input {
  display: block; width: 100%;
  margin: 0 0 12px; padding: 12px;
  font: inherit; font-size: 2rem; letter-spacing: 0.5em; text-align: center; text-indent: 0.5em;
  color: var(--ink); background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line); border-radius: 16px;
}
.gate-card input::placeholder { color: rgba(255, 255, 255, 0.3); }
.gate-card input:focus { outline: 2px solid var(--gold); outline-offset: 2px; }
.gate-card .btn { width: 100%; }
.gate-msg { min-height: 1.6em; margin: 10px 0 0 !important; color: var(--gold-soft) !important; }
.shake { animation: shake 0.45s ease; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* ---------- Innehållet ovanpå natten ---------- */
main { position: relative; z-index: 1; pointer-events: none; }
main a, main button, main .card { pointer-events: auto; }
.wrap { width: min(1120px, 100%); margin: 0 auto; }
.section { padding: 14vh 16px; }

.card {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(20px, 3vw, 34px);
  backdrop-filter: blur(14px) saturate(1.15); -webkit-backdrop-filter: blur(14px) saturate(1.15);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

/* Hero: luft nedtill så att huset syns */
.hero { overflow: clip; min-height: 100svh; display: flex; flex-direction: column; align-items: center; padding: 9svh 16px 4svh; text-align: center; }
.hero-inner { position: relative; max-width: 760px; pointer-events: auto; }
.hero-inner::before {
  content: ''; position: absolute; inset: -12% -10%; z-index: -1;
  background: radial-gradient(closest-side, rgba(5, 10, 24, 0.62), rgba(5, 10, 24, 0));
}
.hero h1 { font-size: clamp(3.3rem, 1.6rem + 8vw, 7.6rem); letter-spacing: -0.025em; text-shadow: 0 4px 40px rgba(0, 0, 0, 0.5); }
.hero .year { display: block; font-size: 0.42em; letter-spacing: 0.3em; color: var(--gold); font-variation-settings: 'SOFT' 50, 'WONK' 0; font-weight: 500; margin-top: 0.25em; }
.lead { font-size: clamp(1.1rem, 1rem + 0.5vw, 1.35rem); margin: 1rem 0 0.4rem; }
.countdown { margin: 0; color: var(--gold-soft); font-style: italic; min-height: 1.5em; }
.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 1.2rem; }
.whisper { margin: 1rem 0 0; font-size: 0.9rem; color: var(--muted); font-style: italic; }
.scroll-cue {
  margin-top: auto; pointer-events: auto;
  width: 44px; height: 44px; display: grid; place-items: center;
  color: var(--gold-soft); text-decoration: none; font-size: 1.4rem;
  border: 1px solid var(--line); border-radius: 50%; background: rgba(8, 14, 30, 0.45);
  animation: bob 2.4s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translateY(6px); } }

/* Program + julklappslek */
.split { display: grid; grid-template-columns: 1.35fr 1fr; gap: 20px; align-items: start; }
.timeline { list-style: none; margin: 1.4rem 0 0; padding: 0; position: relative; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 10px; bottom: 10px; width: 2px; background: linear-gradient(var(--gold), rgba(235, 198, 110, 0.15)); }
.timeline li { position: relative; display: grid; grid-template-columns: 5.6rem 1fr; gap: 12px; padding: 10px 0 10px 28px; align-items: baseline; }
.timeline li::before {
  content: ''; position: absolute; left: 0; top: 18px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--night); border: 2px solid var(--gold);
}
.timeline .time { font-variant-numeric: tabular-nums; font-weight: 650; color: var(--gold); font-size: 1.1rem; }
.timeline .what { font-size: 1.08rem; }
.timeline .is-past { opacity: 0.5; }
.timeline .is-now::before { background: var(--red); border-color: #ff8a8a; box-shadow: 0 0 0 6px rgba(179, 38, 46, 0.3); animation: pulse 1.8s ease-in-out infinite; }
.timeline .is-now .what { font-weight: 650; }
@keyframes pulse { 50% { box-shadow: 0 0 0 11px rgba(179, 38, 46, 0.12); } }
.prel {
  display: inline-block; margin-left: 6px; padding: 1px 6px;
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.05em; vertical-align: 2px;
  color: var(--muted); border: 1px solid rgba(196, 203, 217, 0.4); border-radius: 999px;
}
.now-badge { display: inline-block; margin-left: 6px; padding: 1px 8px; font-size: 0.75rem; font-weight: 700; color: #fff; background: var(--red); border-radius: 999px; vertical-align: 2px; }
.note { margin: 1rem 0 0; font-size: 0.85rem; color: var(--muted); }

.gift-card {
  position: relative; overflow: hidden;
  background: linear-gradient(150deg, rgba(150, 26, 38, 0.92), rgba(98, 14, 24, 0.94));
  border-color: rgba(246, 227, 169, 0.35);
}
.gift-card .eyebrow { color: var(--gold-soft); }
.ribbon::before, .ribbon::after { content: ''; position: absolute; background: linear-gradient(90deg, #c9a24c, var(--gold-soft), #c9a24c); opacity: 0.85; }
.ribbon::before { top: 0; bottom: 0; right: 30px; width: 14px; }
.ribbon::after { left: 0; right: 0; bottom: 18px; height: 14px; }
.gift-card > *:not(.ribbon) { position: relative; z-index: 1; }
.gift-facts { margin: 1.4rem 0 28px; display: grid; gap: 14px; padding-right: 40px; }
.gift-facts div { background: rgba(20, 4, 8, 0.45); border-radius: 14px; padding: 12px 16px; width: fit-content; max-width: 100%; }
.gift-facts dt { font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-soft); }
.gift-facts dd { margin: 2px 0 0; font-size: 1.2rem; }
.gift-facts .big { font-size: 2.2rem; font-weight: 700; font-variation-settings: 'SOFT' 100, 'WONK' 1; color: #fff; }

/* Mat */
.section-head { margin-bottom: 20px; }
.section-head.compact { display: inline-block; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 1rem; }
.chip {
  min-height: 40px; padding: 0.35em 1em;
  font: inherit; font-size: 0.98rem; color: var(--ink);
  background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 999px;
  cursor: pointer; transition: background 0.15s ease, border-color 0.15s ease;
}
.chip:hover { border-color: var(--gold); }
.chip[aria-pressed='true'] { background: var(--gold); color: #1b1206; border-color: var(--gold); font-weight: 650; }
.pick-summary { margin: 1rem 0 0; min-height: 0; color: var(--ink); }
.pick-summary:empty { display: none; }
.count { display: inline-block; margin-left: 6px; padding: 0 8px; font-size: 0.85em; color: #1b1206; background: var(--gold-soft); border-radius: 999px; font-variant-numeric: tabular-nums; }

.food-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(310px, 100%), 1fr)); gap: 18px; }
.food-card h3 { display: flex; align-items: center; gap: 10px; margin-bottom: 0.8rem; }
.food-card .icon { font-size: 1.5rem; }
.dishes { list-style: none; margin: 0; padding: 0; }
.dish {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 12px;
  padding: 9px 10px; margin: 0 -10px;
  border-radius: 12px; border-top: 1px solid rgba(255, 255, 255, 0.07);
  transition: opacity 0.2s ease, background 0.2s ease;
}
.dish:first-child { border-top: 0; }
.dish-name { font-weight: 500; }
.who { display: flex; flex-wrap: wrap; gap: 5px; justify-content: flex-end; }
.pill { font-size: 0.82rem; padding: 2px 9px; border-radius: 999px; background: rgba(255, 255, 255, 0.09); color: var(--ink); white-space: nowrap; }
.pill.all { background: rgba(44, 122, 82, 0.55); }
.pill.free { background: transparent; border: 1px dashed var(--gold); color: var(--gold-soft); }
.food-grid.filtering .dish { opacity: 0.32; }
.food-grid.filtering .dish.is-match { opacity: 1; background: rgba(235, 198, 110, 0.13); box-shadow: inset 3px 0 0 var(--gold); }

/* Julfirare */
/* 16 personer: 4 × 4 på mobil, 8 × 2 på dator */
.family-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px 10px; padding-top: 14px; }
@media (min-width: 900px) { .family-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 26px 12px; } }
.family.card { text-align: center; padding: 30px 6px 16px; position: relative; }
.family h3 { font-size: clamp(0.92rem, 0.8rem + 0.4vw, 1.1rem); margin: 0; overflow-wrap: anywhere; hyphens: manual; }
.family .bauble { width: 30px; height: 30px; top: -14px; }
.family .bauble::after { top: 6px; left: 7px; width: 7px; height: 5px; }
.bauble {
  position: absolute; top: -18px; left: 50%; translate: -50% 0;
  width: 40px; height: 40px; border-radius: 50%;
  box-shadow: inset -6px -8px 12px rgba(0, 0, 0, 0.35), 0 6px 18px rgba(0, 0, 0, 0.4);
}
.bauble::before { content: ''; position: absolute; top: -7px; left: 50%; translate: -50% 0; width: 12px; height: 8px; border-radius: 3px; background: linear-gradient(#e9d08a, #a8872f); }
.bauble::after { content: ''; position: absolute; top: 8px; left: 10px; width: 9px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, 0.55); rotate: -30deg; }
.b0 { background: radial-gradient(circle at 35% 30%, #ff6b6b, #a3141f 70%); }
.b1 { background: radial-gradient(circle at 35% 30%, #fbe39a, #b8892a 70%); }
.b2 { background: radial-gradient(circle at 35% 30%, #5fd49a, #145a3a 70%); }
.b3 { background: radial-gradient(circle at 35% 30%, #9cc0ff, #2b4c9a 70%); }
.b4 { background: radial-gradient(circle at 35% 30%, #ffffff, #b8c2d4 70%); }

/* Hemligheter */
.secrets { list-style: none; margin: 1.2rem 0 0.6rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr)); gap: 10px; }
.secrets li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.08); }
.secrets li.done { background: rgba(235, 198, 110, 0.1); border-color: rgba(235, 198, 110, 0.35); }
.secrets .mark { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; font-weight: 700; color: var(--muted); border: 1px dashed rgba(196, 203, 217, 0.5); }
.secrets li.done .mark { color: #1b1206; background: var(--gold); border: 0; }
.secrets strong { display: block; }
.secrets small { display: block; color: var(--muted); font-size: 0.85rem; margin-top: 2px; }

.footer { position: relative; z-index: 1; text-align: center; padding: 8vh 16px 16vh; color: var(--muted); pointer-events: none; }
.footer p { margin: 0.2rem 0; }

/* ---------- Utforska natten ---------- */
.fab {
  position: fixed; z-index: 5; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom));
  min-height: 48px; padding: 0.6em 1.2em;
  font: inherit; font-weight: 600; color: var(--ink);
  background: var(--glass-strong); border: 1px solid var(--line); border-radius: 999px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); cursor: pointer;
}
.fab:hover { border-color: var(--gold); }
main, .footer { transition: opacity 0.5s ease, visibility 0.5s; }
body.exploring main, body.exploring .footer { opacity: 0; visibility: hidden; }
.hud {
  position: fixed; z-index: 6; left: 50%; translate: -50% 0; bottom: max(16px, env(safe-area-inset-bottom));
  width: min(520px, calc(100% - 32px));
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 6px 14px;
  padding: 12px 14px 12px 18px;
  background: var(--glass-strong); border: 1px solid var(--line); border-radius: 20px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.hud[hidden] { display: none; }
@media (min-width: 821px) {
  .hud { left: auto; right: 16px; top: 16px; bottom: auto; translate: none; width: 340px; grid-template-columns: auto 1fr; }
  .hud-help { grid-column: 1 / -1; }
  .hud .btn { grid-column: 1 / -1; }
}
.hud p { margin: 0; }
.hud-label { color: var(--muted); font-size: 0.85rem; }
.hud strong { color: var(--gold); font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.hud-help { font-size: 0.82rem; color: var(--muted); }
.hud .btn { min-height: 40px; padding: 0.4em 1em; font-size: 0.92rem; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; z-index: 30; left: 50%; top: max(16px, env(safe-area-inset-top));
  translate: -50% -140%;
  width: max-content; max-width: calc(100% - 32px);
  padding: 12px 18px;
  color: var(--ink); background: var(--glass-strong);
  border: 1px solid var(--line); border-radius: 16px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  transition: translate 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  text-align: center;
}
.toast.show { translate: -50% 0; }
.toast:empty { display: none; }

.noscript { position: relative; z-index: 2; text-align: center; padding: 40vh 16px; }

/* ---------- Mobil ---------- */
@media (max-width: 820px) {
  .split { grid-template-columns: 1fr; }
  .section { padding: 10vh 16px; }
  .timeline li { grid-template-columns: 4.9rem 1fr; }
  .hud { grid-template-columns: 1fr auto; }
  .hud-help { grid-column: 1 / -1; grid-row: 2; }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-cue, .timeline .is-now::before { animation: none; }
  .gate, .toast, #scene, main { transition: none; }
}
