/* 24 Days to Your Christmas Glow: blush, cream and champagne gold. Mobile first. */
:root {
  --blush: #f8e1e4;
  --blush-deep: #ecbcc6;
  --cream: #fff8f0;
  --cream-2: #fdf0e3;
  --champagne: #d9be88;
  --gold: #b8924a;
  --gold-text: #7a5c1f;
  --berry: #7a3e4b;
  --berry-dark: #5f2f3a;
  --ink: #3b2a2f;
  --muted: #6b5359;
  --line: #ead9c4;
  --radius: 18px;
  --shadow: 0 6px 24px rgba(122, 62, 75, .10);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--cream) linear-gradient(180deg, var(--blush) 0, var(--cream) 360px) no-repeat;
  min-height: 100vh;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; margin: 0 0 .5rem; font-weight: 600; color: var(--berry-dark); }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 .75rem; }
a { color: var(--berry); }
.muted { color: var(--muted); }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--berry); outline-offset: 3px; border-radius: 6px; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--berry); color: #fff; padding: 10px 14px; border-radius: 10px; z-index: 50; }
.skip:focus { top: 12px; }

/* Masthead */
.masthead {
  position: relative;
  text-align: center;
  padding: 34px 20px 20px;
  overflow: hidden;
}
.masthead::before, .masthead::after {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 28%, rgba(217,190,136,.55) 0 2px, transparent 3px),
    radial-gradient(circle at 86% 18%, rgba(217,190,136,.6) 0 3px, transparent 4px),
    radial-gradient(circle at 70% 70%, rgba(217,190,136,.45) 0 2px, transparent 3px),
    radial-gradient(circle at 28% 78%, rgba(217,190,136,.5) 0 3px, transparent 4px);
}
.eyebrow { font-size: .78rem; letter-spacing: .18em; text-transform: uppercase; color: var(--gold-text); font-weight: 600; margin: 0 0 .35rem; }
.masthead h1 { font-size: clamp(1.75rem, 7vw, 2.6rem); margin-bottom: .35rem; }
.masthead h1 span { display: block; color: var(--gold-text); font-style: italic; font-weight: 500; }
.tagline { color: var(--muted); margin: 0; }

/* Navigation: bottom bar on phones, top bar on larger screens */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(255, 248, 240, .96);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  backdrop-filter: blur(8px);
}
.tabs a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 9px 4px 8px; min-height: 56px;
  font-size: .78rem; font-weight: 600; text-decoration: none; color: var(--muted);
}
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabs a[aria-current="page"] { color: var(--berry-dark); }
.tabs a[aria-current="page"] svg { stroke: var(--gold); }
.tabs a[aria-current="page"] span { border-bottom: 2px solid var(--gold); }

main { max-width: 760px; margin: 0 auto; padding: 8px 16px 24px; outline: none; }
.view > h2 { margin-top: .5rem; }
.lead { margin-bottom: 1rem; }

/* Cards */
.card {
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin: 0 0 14px;
}
.card h3 { margin-bottom: .4rem; }
.section-h { margin: 22px 2px 10px; }
.greeting { font-family: var(--serif); font-size: 1.5rem; color: var(--berry-dark); margin: 0 0 .15rem; }

.progress-card { display: flex; gap: 18px; align-items: center; }
.ring { position: relative; width: 112px; height: 112px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; }
.ring-bg { stroke: var(--blush); }
.ring-fg { stroke: var(--gold); stroke-linecap: round; stroke-dasharray: 326.7; stroke-dashoffset: 326.7; transition: stroke-dashoffset .6s ease; }
.ring-num { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.1; }
.ring-num strong { font-family: var(--serif); font-size: 1.9rem; color: var(--berry-dark); }
.ring-num span { font-size: .75rem; color: var(--muted); }
.streak { color: var(--gold-text); font-weight: 600; margin: 0; }

.next-card { background: linear-gradient(135deg, var(--blush), var(--cream-2)); border-color: var(--champagne); }
.next-card h3 { margin-bottom: .2rem; }
.next-card .eyebrow { margin-bottom: .2rem; }

/* Phases */
.phases { display: grid; gap: 12px; }
.phase { padding: 16px; margin: 0; }
.phase-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.phase-head h4 { font-family: var(--serif); font-size: 1.1rem; margin: 0; color: var(--berry-dark); }
.phase-head .count { font-size: .85rem; color: var(--muted); white-space: nowrap; }
.phase p { margin: .25rem 0 .6rem; color: var(--muted); font-size: .92rem; }
progress { width: 100%; height: 10px; border: 0; border-radius: 999px; overflow: hidden; background: var(--blush); appearance: none; -webkit-appearance: none; }
progress::-webkit-progress-bar { background: var(--blush); }
progress::-webkit-progress-value { background: linear-gradient(90deg, var(--champagne), var(--gold)); border-radius: 999px; }
progress::-moz-progress-bar { background: linear-gradient(90deg, var(--champagne), var(--gold)); border-radius: 999px; }
.badge { display: inline-block; margin-top: .55rem; padding: 3px 11px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--gold-text); color: #fff; }
.badge.off { background: transparent; color: var(--muted); border: 1px dashed var(--champagne); font-weight: 500; }

.name-card label { display: block; font-weight: 600; margin-bottom: .4rem; }
input[type="text"], textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff;
  border: 1px solid #cdb79a; border-radius: 12px; padding: 11px 13px;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 11px 20px; border-radius: 999px; border: 1.5px solid transparent;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; text-align: center;
}
.btn.primary { background: var(--berry); color: #fff; }
.btn.primary:hover { background: var(--berry-dark); }
.btn.primary[aria-pressed="true"] { background: var(--gold-text); }
.btn.secondary { background: var(--cream); color: var(--berry-dark); border-color: var(--berry); }
.btn.ghost { background: transparent; color: var(--berry-dark); border-color: var(--champagne); }
.btn.danger { background: #fff; color: #8a2a2a; border-color: #8a2a2a; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: .6rem; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-btn:focus-within { outline: 3px solid var(--berry); outline-offset: 3px; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: #fff; cursor: pointer; display: grid; place-content: center; }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: var(--berry-dark); stroke-width: 2; stroke-linecap: round; }

/* Doors */
.key { list-style: none; display: flex; gap: 16px; padding: 0; margin: 0 0 14px; font-size: .85rem; color: var(--muted); }
.key li { display: flex; align-items: center; gap: 6px; }
.swatch { width: 16px; height: 16px; border-radius: 5px; border: 1.5px solid var(--gold); display: inline-block; }
.s-open { background: var(--cream); }
.s-done { background: var(--gold); }
.s-locked { background: var(--cream-2); border-style: dashed; border-color: #c9b79d; }

.phase-block { margin: 0 0 22px; }
.phase-block h3 { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.phase-block h3 small { font-family: var(--sans); font-size: .8rem; font-weight: 500; color: var(--muted); }
.phase-block > p { color: var(--muted); font-size: .92rem; }
.door-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.door {
  position: relative; aspect-ratio: 1 / 1.08; border-radius: 16px 16px 8px 8px;
  border: 2px solid var(--champagne);
  background: linear-gradient(160deg, #fff, var(--blush) 120%);
  color: var(--berry-dark);
  font-family: var(--serif); font-size: 2rem; font-weight: 600;
  display: grid; place-content: center; text-align: center; cursor: pointer;
  box-shadow: 0 3px 10px rgba(122, 62, 75, .10);
  transition: transform .18s ease, box-shadow .18s ease;
  padding: 4px;
}
.door small { display: block; font-family: var(--sans); font-size: .68rem; font-weight: 600; letter-spacing: .04em; color: var(--gold-text); margin-top: 2px; }
.door:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(122, 62, 75, .16); }
.door.today { border-color: var(--berry); box-shadow: 0 0 0 4px rgba(122, 62, 75, .15); }
.door.done { background: linear-gradient(160deg, var(--champagne), var(--gold)); border-color: var(--gold-text); color: #2d1f0c; }
.door.done small { color: #2d1f0c; }
.door.locked { background: var(--cream-2); border-style: dashed; border-color: #c9b79d; color: #6b5a50; box-shadow: none; cursor: default; }
.door.locked:hover { transform: none; }
.door .ico { position: absolute; top: 7px; right: 7px; width: 18px; height: 18px; }
.door .ico svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Worksheets list */
.ws-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.ws-list li { background: var(--cream); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; }
.ws-list .n { font-family: var(--serif); font-weight: 600; color: var(--gold-text); min-width: 2.2rem; font-size: 1.15rem; }
.ws-list .t { flex: 1; }
.ws-list .t small { display: block; color: var(--muted); }
.ws-list a { font-weight: 600; }
.ws-list .lock { color: var(--muted); font-size: .85rem; }

.plain-list { padding-left: 1.1rem; margin: 0 0 .5rem; }
.plain-list li { margin-bottom: .45rem; }
.note { background: var(--blush); border-left: 4px solid var(--gold); padding: 10px 12px; border-radius: 0 10px 10px 0; font-size: .92rem; margin-top: .6rem; }
.switch { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.switch input { width: 24px; height: 24px; flex: none; accent-color: var(--berry); margin-top: 2px; }

.foot { text-align: center; color: var(--muted); font-size: .85rem; padding: 0 16px 16px; }

/* Door dialog */
dialog {
  border: 0; padding: 0; background: var(--cream); color: var(--ink);
  width: 100%; max-width: 640px; max-height: 100dvh; height: 100dvh;
  margin: 0 auto; border-radius: 0; overflow: hidden;
}
dialog::backdrop { background: rgba(59, 42, 47, .55); }
.dlg-inner { height: 100%; overflow-y: auto; padding: 18px 18px calc(24px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, var(--blush) 0, var(--cream) 180px); }
.dlg-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.dlg-top .eyebrow { margin: 0; }
#dlg-title { font-size: 1.8rem; outline: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 1rem; }
.chips span { background: #fff; border: 1px solid var(--champagne); border-radius: 999px; padding: 3px 12px; font-size: .82rem; color: var(--gold-text); font-weight: 600; }
.block { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 12px; }
.block h3 { font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-text); font-family: var(--sans); font-weight: 700; margin-bottom: .2rem; }
.block-name { font-family: var(--serif); font-size: 1.25rem; color: var(--berry-dark); margin-bottom: .5rem; }
.block ol { margin: 0; padding-left: 1.3rem; }
.block li { margin-bottom: .45rem; }
.block li::marker { color: var(--gold-text); font-weight: 700; }
.message { margin: 14px 0; padding: 18px; background: linear-gradient(135deg, var(--champagne), #f1dfb9); border-radius: 16px; text-align: center; }
.message p { font-family: var(--serif); font-style: italic; font-size: 1.25rem; color: #3b2a14; margin: 0; }
.dlg-actions { display: grid; gap: 10px; margin: 12px 0; }
.dlg-actions .btn { width: 100%; }
.dlg-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#dlg-ws-wrap { margin: 0; }
#dlg-ws-wrap a { display: flex; }

.toast { position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--berry-dark); color: #fff; padding: 10px 18px; border-radius: 999px; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 60; max-width: 90vw; text-align: center; font-size: .95rem; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes pop { 0% { transform: scale(.92); opacity: .4; } 100% { transform: scale(1); opacity: 1; } }
dialog[open] .dlg-inner { animation: pop .25s ease; }

/* Larger screens */
@media (min-width: 720px) {
  body { padding-bottom: 24px; }
  .tabs { position: sticky; top: 0; bottom: auto; max-width: 560px; margin: 0 auto 12px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 8px; }
  .tabs a { flex-direction: row; justify-content: center; gap: 8px; min-height: 44px; font-size: .9rem; }
  .toast { bottom: 28px; }
  .door-grid { grid-template-columns: repeat(6, 1fr); }
  .phases { grid-template-columns: 1fr 1fr; }
  dialog { height: auto; max-height: 90dvh; margin: 5dvh auto; border-radius: 22px; }
  .dlg-inner { max-height: 90dvh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .door, .btn, .card { border: 2px solid CanvasText; }
  .door.done { border-style: double; }
}

/* Access code screen (gated edition) */
.gate { max-width: 460px; margin: 0 auto; padding: 8px 16px 40px; }
.gate-card h2 { margin-top: 0; }
.gate-card label { display: block; font-weight: 600; margin: 14px 0 6px; }
.gate-card input[type="text"] { font-size: 1.15rem; letter-spacing: .08em; text-transform: uppercase; text-align: center; }
.gate-card input::placeholder { text-transform: none; letter-spacing: .04em; color: #6b5359; }
.gate-msg { min-height: 1.4em; color: #8a2a2a; font-weight: 600; margin: 8px 0 12px; }
.gate-card .btn { width: 100%; }
.small { font-size: .88rem; }
body.is-gate { padding-bottom: 24px; }
body.is-gate .tabs, body.is-gate main, body.is-gate .foot { display: none; }
