:root {
  --night: #111c19;
  --night-2: #18261f;
  --night-3: #233530;
  --evergreen: #243834;
  --wood: #3b2a1e;
  --wood-hi: #5a412c;
  --wood-lo: #24180f;
  --gold: #e8bb5c;
  --gold-soft: #c9a25a;
  --cream: #f3e8d0;
  --muted: #b3a48d;
  --faint: #7d705f;
  --parchment: #f7efdc;
  --parchment-2: #efe3c6;
  --ink: #2b2118;
  --ink-muted: #6a5947;
  --rubric: #9a2c22;
  --display: 'Cormorant Garamond', 'Iowan Old Style', Georgia, serif;
  --display-sc: 'Cormorant SC', 'Cormorant Garamond', Georgia, serif;
  --body: 'EB Garamond', 'Iowan Old Style', Georgia, serif;
  --sans: 'Montserrat', 'Segoe UI', system-ui, sans-serif;
  --radius: 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--body);
  font-size: 18px;
  line-height: 1.6;
  color: var(--cream);
  background:
    radial-gradient(1200px 600px at 50% -200px, rgba(232, 187, 92, .16), transparent 70%),
    radial-gradient(900px 500px at 100% 40%, rgba(70, 120, 100, .10), transparent 70%),
    var(--night);
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
}
a { color: var(--gold); }
button, input { font: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 4px; }
main { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px 48px; }
main:focus, main:focus-visible { outline: none; }

/* ---------- shared bits ---------- */
.ornament { height: 22px; margin: 30px auto; max-width: 300px; background: url(brand/ornament-gold.png) center / contain no-repeat; }
.eyebrow { font-family: var(--sans); font-weight: 600; letter-spacing: .22em; text-transform: uppercase; font-size: 12px; color: var(--gold); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 999px; border: 1px solid var(--gold);
  background: linear-gradient(180deg, #f0c76c, #d9a443); color: #2a1d0c;
  font-weight: 600; font-size: 16px; cursor: pointer; text-decoration: none;
  box-shadow: 0 6px 20px -8px rgba(232, 187, 92, .7);
}
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-ghost { background: transparent; color: var(--cream); border-color: rgba(232, 187, 92, .45); box-shadow: none; font-weight: 500; }
.btn-ghost:hover { background: rgba(232, 187, 92, .1); }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: 16px; margin: 4px 0 12px; }
.back:hover { color: var(--cream); }

.loading { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 120px 0; color: var(--muted); font-style: italic; }
.loading-flame { width: 14px; height: 22px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: var(--gold); box-shadow: 0 0 24px 6px rgba(232, 187, 92, .5); animation: flicker 2s infinite; }

/* ---------- library hero ---------- */
.hero { text-align: center; padding: 24px 0 12px; max-width: 680px; margin: 0 auto; }
.hero-symbol { width: 96px; height: auto; display: block; margin: 0 auto 10px; filter: drop-shadow(0 0 18px rgba(232, 187, 92, .35)); }
.hero h1 { font-family: var(--display); font-weight: 500; font-size: clamp(40px, 8vw, 66px); line-height: 1.02; margin: 10px 0 0; }
.hero .ornament { margin: 18px auto; max-width: 260px; }
.hero p { color: var(--muted); font-size: 19px; margin: 0 auto; max-width: 560px; }
.progress { margin: 26px auto 0; display: inline-flex; flex-direction: column; align-items: center; gap: 10px; }
.progress-flames { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.pf { width: 10px; height: 16px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: var(--night-3); border: 1px solid #4a3e55; }
.pf.on { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 10px 2px rgba(232, 187, 92, .55); animation: flicker 2.6s infinite; }
.progress-text { font-style: italic; color: var(--cream); }
.hero-actions { margin-top: 20px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.feast-banner {
  display: flex; align-items: center; gap: 14px; max-width: 640px; margin: 28px auto 0;
  padding: 12px 18px; border-radius: var(--radius); text-decoration: none; color: var(--cream);
  background: linear-gradient(90deg, rgba(232, 187, 92, .14), rgba(232, 187, 92, .04));
  border: 1px solid rgba(232, 187, 92, .28);
}
.feast-banner:hover { background: linear-gradient(90deg, rgba(232, 187, 92, .2), rgba(232, 187, 92, .07)); }
.feast-banner .fb-day { font-family: var(--display); font-weight: 600; font-size: 34px; color: var(--gold); line-height: 1; min-width: 44px; text-align: center; }
.feast-banner .fb-text { font-size: 16px; line-height: 1.35; }
.feast-banner .fb-text b { font-weight: 600; }

/* ---------- shelves ---------- */
.season { margin-top: 48px; }
.season-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; padding: 0 4px; }
.season-head h2 { font-family: var(--display-sc); font-weight: 600; font-size: 28px; margin: 0; letter-spacing: .04em; display: flex; align-items: center; gap: 10px; }
.season-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); }
.season-head p { margin: 0; color: var(--muted); font-style: italic; font-size: 16px; }

/* One long plank per season; on narrow screens the shelf scrolls sideways. */
.shelf {
  --stage: 200px;
  display: flex; gap: 4px; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: var(--wood-hi) transparent;
  padding-bottom: 10px;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, .55), transparent) 0 var(--stage) / 100% 18px no-repeat local,
    linear-gradient(180deg, var(--wood-hi) 0, var(--wood) 35%, var(--wood-lo) 100%) 0 calc(var(--stage) - 16px) / 100% 16px no-repeat local;
}
.candle-card {
  flex: 0 0 180px; scroll-snap-align: start;
  appearance: none; background: none; border: 0; padding: 0; color: inherit; text-align: center;
  cursor: pointer; display: flex; flex-direction: column; text-decoration: none;
}
.candle-card .stage {
  position: relative; height: var(--stage); display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 14px;
}
.candle-card .stage svg { width: 118px; height: auto; position: relative; z-index: 1; transition: transform .35s ease; }
.candle-card:hover .stage svg, .candle-card:focus-visible .stage svg { transform: translateY(-6px); }
.candle-card .meta { padding: 14px 8px 0; }
.candle-card .c-name { font-family: var(--display); font-weight: 600; font-size: 22px; line-height: 1.1; }
.candle-card .c-feast { font-style: italic; color: var(--muted); font-size: 15px; line-height: 1.3; margin-top: 3px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 8px; padding: 3px 10px;
  border-radius: 999px; font-family: var(--sans); font-weight: 600; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  border: 1px solid rgba(255, 255, 255, .14); color: var(--muted);
}
.chip svg { width: 11px; height: 11px; }
.chip-lit { color: #2a1d0c; background: var(--gold); border-color: var(--gold); }
.chip-soon { border-style: dashed; }

.is-locked .stage svg { filter: saturate(.55) brightness(.78); }
.is-forthcoming .stage svg { opacity: .45; }
.is-forthcoming .c-name { color: var(--muted); }

/* ---------- jar svg ---------- */
.flame { transform-origin: 60px 69px; animation: flicker 2.8s infinite ease-in-out; }
.flame-inner { transform-origin: 60px 69px; animation: flicker 2.1s infinite ease-in-out reverse; }
.glow { animation: glow 3.4s infinite ease-in-out; transform-origin: 60px 56px; }
@keyframes flicker {
  0%, 100% { transform: scale(1, 1) rotate(0deg); }
  25% { transform: scale(.94, 1.06) rotate(-2deg); }
  50% { transform: scale(1.04, .95) rotate(1.5deg); }
  75% { transform: scale(.97, 1.04) rotate(-1deg); }
}
@keyframes glow { 0%, 100% { opacity: .85; transform: scale(1); } 50% { opacity: 1; transform: scale(1.06); } }

/* ---------- candle page ---------- */
.candle-head { display: grid; grid-template-columns: 220px 1fr; gap: 36px; align-items: center; padding: 16px 0 32px; }
.candle-head .jar-big { display: flex; justify-content: center; }
.candle-head .jar-big svg { width: 200px; height: auto; }
.candle-head.locked .jar-big svg { filter: saturate(.35) brightness(.55); }
.candle-head.forthcoming .jar-big svg { opacity: .5; }
.candle-head h1 { font-family: var(--display); font-weight: 500; font-size: clamp(36px, 7vw, 56px); line-height: 1.05; margin: 6px 0 10px; }
.scent { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; }
.scent li { font-size: 15px; padding: 3px 12px; border-radius: 999px; border: 1px solid rgba(232, 187, 92, .35); color: var(--cream); background: rgba(232, 187, 92, .06); }
.countdown { color: var(--muted); font-style: italic; margin-top: 10px; font-size: 16px; }
.teaser { font-size: 20px; font-style: italic; color: var(--cream); max-width: 640px; margin: 16px 0 0; }

.seal {
  max-width: 640px; margin: 8px auto 0; text-align: center; padding: 34px 24px 30px;
  border: 1px solid rgba(232, 187, 92, .3); border-radius: 16px;
  background: radial-gradient(400px 200px at 50% 0, rgba(232, 187, 92, .1), transparent), var(--night-2);
}
.seal-icon { width: 54px; height: 54px; margin: 0 auto 8px; display: block; }
.seal h2 { font-family: var(--display); font-weight: 600; font-size: 30px; margin: 0 0 8px; }
.seal p { color: var(--muted); margin: 0 auto 18px; max-width: 460px; }
.key-form { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.key-input {
  width: 100%; max-width: 280px; padding: 11px 16px; border-radius: 999px;
  border: 1px solid rgba(232, 187, 92, .45); background: rgba(0, 0, 0, .25); color: var(--cream);
  font-family: 'Courier New', ui-monospace, monospace; font-size: 18px; letter-spacing: .08em; text-transform: uppercase; text-align: center;
}
.key-input::placeholder { color: var(--faint); letter-spacing: .08em; }
.form-msg { min-height: 1.5em; margin-top: 12px; font-size: 16px; font-style: italic; color: #f0a58f; }
.form-msg.ok { color: var(--gold); }
.shop-line { margin-top: 18px; font-size: 16px; color: var(--muted); }

/* ---------- the storybook page ---------- */
.page {
  position: relative; max-width: 760px; margin: 0 auto; color: var(--ink);
  background:
    radial-gradient(120% 80% at 50% 0, rgba(255, 255, 255, .5), transparent 60%),
    radial-gradient(140% 100% at 50% 120%, rgba(160, 120, 60, .18), transparent 60%),
    var(--parchment);
  border-radius: 6px; padding: 56px clamp(22px, 7vw, 72px) 48px;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .9), 0 0 0 1px rgba(0, 0, 0, .25), inset 0 0 60px rgba(150, 110, 50, .18);
}
.page::before { /* a double rule just inside the edge, like an old book */
  content: ""; position: absolute; inset: 14px; border: 1px solid rgba(154, 44, 34, .25);
  outline: 1px solid rgba(154, 44, 34, .12); outline-offset: 3px; pointer-events: none; border-radius: 3px;
}
.page-title { text-align: center; margin-bottom: 18px; }
.page-title .eyebrow { color: var(--rubric); }
.page-title h1 { font-family: var(--display); font-weight: 600; font-size: clamp(36px, 6vw, 54px); line-height: 1.04; margin: 10px 0 6px; color: var(--evergreen); }
.page-title .scent-line { font-style: italic; color: var(--ink-muted); }
.page .ornament { background-image: url(brand/ornament-ink.png); opacity: .8; }

.story { font-size: 19.5px; line-height: 1.72; hyphens: auto; }
.story p { margin: 0 0 1em; }
.story h2 { font-family: var(--display); font-weight: 600; font-size: 30px; color: var(--evergreen); line-height: 1.2; text-align: center; margin: 2em 0 .9em; }
.story h2:first-child { margin-top: .6em; }
/* a sprig between scenes already makes the break, so a heading right after it needs little extra room */
.story .ornament { margin: 26px auto 22px; }
.story .ornament + h2 { margin-top: .5em; }
.story h2 .num { display: block; font-family: var(--sans); font-weight: 600; font-size: 11.5px; letter-spacing: .28em; color: var(--rubric); margin-bottom: 2px; }
.story > h2:first-child + p::first-letter {
  float: left; font-family: var(--display); font-size: 4.6em; line-height: .82; padding: .06em .1em 0 0; color: var(--rubric);
}
.story blockquote {
  margin: 1.4em 0; padding: .2em 0 .2em 1.2em; border-left: 2px solid var(--gold-soft);
  font-style: italic; color: #4a3a2a;
}
.story blockquote em { font-style: normal; }
.story blockquote p { margin: 0; }
.story .box {
  position: relative; margin: 2.2em 0 1.2em; padding: 22px 24px 8px; border-radius: 8px;
  background: rgba(255, 255, 255, .45); border: 1px solid rgba(154, 44, 34, .25);
}
.story .box h3 { font-family: var(--sans); font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--rubric); font-size: 12px; margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.story .box-ritual { background: linear-gradient(180deg, rgba(232, 187, 92, .22), rgba(255, 255, 255, .4)); border-color: rgba(201, 162, 90, .6); }
.story .box-ritual h3::before { content: ""; width: 10px; height: 15px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: #e0a43c; box-shadow: 0 0 8px 2px rgba(224, 164, 60, .5); }
.page-end { text-align: center; margin-top: 30px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.page-end .btn-ghost { color: var(--ink); border-color: rgba(154, 44, 34, .4); }
.page-end .btn-ghost:hover { background: rgba(154, 44, 34, .06); }
.lit-head { text-align: center; padding: 6px 0 22px; }
.lit-head svg { width: 140px; height: auto; }

/* ---------- keyring ---------- */
.keyring { max-width: 680px; margin: 0 auto; }
.keyring h1 { font-family: var(--display); font-weight: 500; font-size: clamp(36px, 7vw, 50px); margin: 8px 0 6px; text-align: center; }
.keyring > p { text-align: center; color: var(--muted); }
.panel { margin-top: 26px; padding: 22px; border-radius: 14px; background: var(--night-2); border: 1px solid rgba(255, 255, 255, .07); }
.panel h2 { font-family: var(--display-sc); font-weight: 600; font-size: 23px; letter-spacing: .04em; margin: 0 0 12px; }
.panel p { color: var(--muted); font-size: 16px; margin: 0 0 12px; }
.key-list { list-style: none; margin: 0; padding: 0; }
.key-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid rgba(255, 255, 255, .07); }
.key-list li:first-child { border-top: 0; }
.key-list .kl-name { flex: 1; min-width: 0; }
.key-list .kl-name a { color: var(--cream); text-decoration: none; font-family: var(--display); font-weight: 600; font-size: 20px; }
.key-list .kl-name a:hover { color: var(--gold); }
.key-list code { font-family: 'Courier New', ui-monospace, monospace; font-size: 15px; color: var(--gold); letter-spacing: .05em; }
.carry { display: flex; gap: 8px; }
.carry input { flex: 1; min-width: 0; padding: 9px 12px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .15); background: rgba(0, 0, 0, .3); color: var(--muted); font-size: 14px; }
.danger-link { background: none; border: 0; color: var(--faint); text-decoration: underline; cursor: pointer; font-size: 14px; padding: 0; }
.danger-link:hover { color: #f0a58f; }
.empty { font-style: italic; color: var(--muted); }

/* ---------- unlocking ceremony ---------- */
.ceremony {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(600px 500px at 50% 40%, rgba(30, 48, 42, .985), rgba(8, 14, 12, .995));
  padding: 24px; text-align: center; opacity: 0; transition: opacity .5s ease;
}
.ceremony.show { opacity: 1; }
.ceremony[hidden] { display: none; }
.cer-inner { max-width: 440px; }
.cer-art { position: relative; width: 220px; height: 290px; margin: 0 auto 6px; }
.cer-art > * { position: absolute; inset: 0; margin: auto; transition: opacity .8s ease, transform .8s ease; }
.cer-lock { width: 150px; height: 190px; }
.cer-key { width: 64px; height: 150px; transform-origin: 50% 22%; transform: translateY(70px); opacity: 0; }
.cer-jar { width: 190px; height: auto; opacity: 0; transform: scale(.9); }
.cer-jar .flame, .cer-jar .flame-inner, .cer-jar .glow { opacity: 0; transition: opacity 1.2s ease .2s; }
.ceremony.s1 .cer-key { opacity: 1; transform: translateY(18px); }
.ceremony.s2 .cer-key { opacity: 1; transform: translateY(18px) rotate(90deg); }
.ceremony.s3 .cer-lock, .ceremony.s3 .cer-key { opacity: 0; transform: scale(1.15); }
.ceremony.s3 .cer-jar { opacity: 1; transform: scale(1); }
.ceremony.s4 .cer-jar .flame, .ceremony.s4 .cer-jar .flame-inner, .ceremony.s4 .cer-jar .glow { opacity: 1; }
.cer-text { opacity: 0; transform: translateY(8px); transition: opacity .8s ease, transform .8s ease; }
.ceremony.s4 .cer-text { opacity: 1; transform: none; }
.cer-text h2 { font-family: var(--display); font-weight: 600; font-size: 38px; line-height: 1.1; margin: 10px 0 8px; }
.cer-text p { color: var(--muted); margin: 0 0 20px; }

/* ---------- misc ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); z-index: 60;
  background: var(--cream); color: var(--ink); padding: 10px 18px; border-radius: 999px;
  font-size: 16px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); opacity: 0; pointer-events: none;
  transition: opacity .3s ease, transform .3s ease; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.noscript { text-align: center; padding: 40px; }
.error-box { max-width: 560px; margin: 80px auto; text-align: center; color: var(--muted); }
.error-box h1 { font-family: var(--display); font-weight: 500; color: var(--cream); }

@media (max-width: 640px) {
  body { font-size: 17px; }
  .shelf { --stage: 176px; margin: 0 -16px; padding-left: 8px; padding-right: 8px; }
  .candle-card { flex-basis: 150px; }
  .candle-card .stage svg { width: 100px; }
  .candle-card .c-name { font-size: 18px; }
  .candle-head { grid-template-columns: 1fr; gap: 6px; text-align: center; padding-top: 0; }
  .candle-head .jar-big svg { width: 150px; }
  .scent { justify-content: center; }
  .teaser { margin-left: auto; margin-right: auto; }
  .page { padding-top: 44px; padding-bottom: 36px; }
  .page::before { inset: 8px; }
  .story { font-size: 18px; hyphens: auto; }
  .story .box { padding: 18px 16px 6px; }
  .carry { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}

/* ---------- accounts ---------- */
.hero .acct-hint, .acct-hint { text-align: center; margin: 14px auto 0; font-style: italic; color: var(--muted); font-size: 16px; }
.acct-hint a { color: var(--gold); }
.panel.account .acct-step { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
.panel.account .acct-step[hidden] { display: none; }
.panel.account .acct-step .key-input { flex: 1 1 220px; min-width: 0; text-transform: none; letter-spacing: normal; }
.panel.account .acct-code .key-input { letter-spacing: .3em; font-variant-numeric: tabular-nums; max-width: 200px; text-align: center; }
.panel.account .acct-step p { flex-basis: 100%; margin: 0; }
.acct-news { flex-basis: 100%; display: flex; gap: 8px; align-items: center; font-size: 15px; margin-top: 4px; cursor: pointer; }
.acct-news input { accent-color: #e8bb5c; width: 16px; height: 16px; }
.acct-who { margin: 4px 0 6px; }
.acct-actions { margin: 14px 0 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.acct-privacy { font-size: 13px; opacity: .75; margin: 14px 0 0; }
.text-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--gold); text-decoration: underline; cursor: pointer; }
.text-btn.danger { color: #d98c80; }
.signup-trap[hidden] { display: none; }
.panel.account .acct-email .key-input { font-family: var(--body); font-size: 18px; text-transform: none; letter-spacing: .01em; }
.panel.account .acct-email .key-input::placeholder { letter-spacing: .01em; }
