/* ── Every Second Since · committed single-theme night world ─────────── */
:root {
  --ink-ground:   #141021;
  --ink-raise:    #1E1733;
  --ink-raise-2:  #261D40;
  --starlight:    #F3ECE2;
  --muted:        #A79BC2;
  --muted-deep:   #6E628C;
  --rose:         #EC7E95;
  --rose-soft:    rgba(236,126,149,.16);
  --gold:         #E3B96E;
  --line:         rgba(167,155,194,.22);
  --display: "Cormorant Garamond", "Georgia", serif;
  --body: "Figtree", "Segoe UI", system-ui, sans-serif;
  --hand: "Caveat", "Segoe Script", cursive;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--ink-ground);
  color: var(--starlight);
  font-family: var(--body);
  font-weight: 300;
  line-height: 1.65;
  overflow-x: hidden;
}

::selection { background: var(--rose); color: var(--ink-ground); }

#sky {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  z-index: 0; pointer-events: none;
}

main { position: relative; z-index: 1; }

a { color: var(--rose); }
button { font-family: var(--body); cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 2px; }

.eyebrow {
  font-size: .72rem; font-weight: 600;
  letter-spacing: .22em; text-transform: uppercase;
  color: var(--muted);
}

/* ── Gates (shared by date-lock and magic-word) ────────────────────────── */
.gate-screen {
  position: fixed; inset: 0; z-index: 40;
  background:
    radial-gradient(120% 90% at 50% 110%, #2A1B38 0%, transparent 55%),
    var(--ink-ground);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  transition: opacity 1.1s ease;
}
.gate-screen.open { opacity: 0; pointer-events: none; }

.gate-card { max-width: 420px; width: 100%; text-align: center; }

.gate-card .script {
  font-family: var(--hand); font-size: 1.5rem; color: var(--rose);
  display: block; margin-bottom: .4rem;
}
.gate-card h1 {
  font-family: var(--display); font-weight: 300; font-style: italic;
  font-size: clamp(2rem, 6vw, 2.7rem); line-height: 1.15;
  text-wrap: balance; margin-bottom: .9rem;
}
.gate-card p { color: var(--muted); font-size: .95rem; margin-bottom: 2rem; }

.lock-row {
  display: flex; align-items: center; justify-content: center;
  gap: .6rem; margin-bottom: 1.5rem;
}
.lock-row .sep { color: var(--muted-deep); font-family: var(--display); font-size: 1.6rem; }
.lock-row input {
  width: 4.2rem; padding: .8rem 0; text-align: center;
  font-family: var(--display); font-size: 1.7rem; color: var(--starlight);
  background: var(--ink-raise); border: 1px solid var(--line); border-radius: 10px;
  font-variant-numeric: tabular-nums;
}
.lock-row input.yy { width: 5.6rem; }
.lock-row input.word {
  width: 100%; max-width: 300px;
  font-size: 1.3rem; letter-spacing: .08em; padding: .8rem 1rem;
}
.lock-row input::placeholder { color: var(--muted-deep); }
.lock-row input:focus { border-color: var(--rose); outline: none; }

.gate-card.shake .lock-row { animation: shake .45s ease; }
@keyframes shake {
  20% { transform: translateX(-9px); } 40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); } 80% { transform: translateX(4px); }
}

.gate-btn {
  background: var(--rose); color: #241019; border: none;
  font-weight: 600; font-size: .95rem; letter-spacing: .04em;
  padding: .85rem 2.6rem; border-radius: 999px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.gate-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(236,126,149,.35); }

.gate-hint {
  min-height: 1.6rem; margin-top: 1.1rem;
  font-family: var(--hand); font-size: 1.15rem; color: var(--gold);
  opacity: 0; transition: opacity .5s ease;
}
.gate-hint.show { opacity: 1; }

.demo-key {
  margin-top: 2.2rem; padding: .7rem 1rem;
  border: 1px dashed var(--line); border-radius: 10px;
  font-size: .78rem; color: var(--muted);
}
.demo-key strong { color: var(--starlight); font-weight: 500; font-variant-numeric: tabular-nums; }

/* ── Hero ──────────────────────────────────────────────────────────────── */
.hero {
  min-height: 92vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  padding: 96px 24px 48px;
}
.hero .script-line {
  font-family: var(--hand); font-size: clamp(1.3rem, 3vw, 1.7rem);
  color: var(--rose); margin-bottom: .8rem;
}
.hero h2 {
  font-family: var(--display); font-weight: 300;
  font-size: clamp(3.2rem, 11vw, 6.5rem); line-height: 1.05;
  text-wrap: balance;
}
.hero h2 .name { display: inline-block; }
.hero h2 .amp {
  display: inline-block;
  font-style: italic; color: var(--gold);
  cursor: pointer; border: none; background: none;
  font: inherit; padding: 0 .06em;
  transition: text-shadow .3s ease, color .3s ease;
}
.hero h2 .amp:hover { color: var(--rose); text-shadow: 0 0 22px rgba(236,126,149,.6); }

.hero .since { margin-top: 1.4rem; color: var(--muted); font-size: .95rem; }
.hero .since strong { color: var(--starlight); font-weight: 500; }

.counter {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: .8rem; margin-top: 2.6rem;
}
.counter .cell {
  background: var(--ink-raise); border: 1px solid var(--line);
  border-radius: 14px; padding: 1rem 1.3rem; min-width: 6.2rem;
}
.counter .num {
  font-family: var(--display); font-weight: 400;
  font-size: clamp(1.8rem, 4.5vw, 2.6rem); line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.counter .lbl {
  font-size: .68rem; font-weight: 600; letter-spacing: .18em;
  text-transform: uppercase; color: var(--muted); margin-top: .2rem;
}

.scroll-cue {
  margin-top: 3.4rem; color: var(--muted-deep);
  font-size: .8rem; letter-spacing: .14em; text-transform: uppercase;
}

/* ── Sections ──────────────────────────────────────────────────────────── */
section { padding: 88px 24px; }
.section-head { max-width: 640px; margin: 0 auto 3.2rem; text-align: center; }
.section-head h3 {
  font-family: var(--display); font-weight: 300; font-style: italic;
  font-size: clamp(1.9rem, 5vw, 2.6rem); text-wrap: balance;
  margin-top: .5rem;
}
.section-head p { color: var(--muted); margin-top: .7rem; font-size: .95rem; }

/* ── Timeline ──────────────────────────────────────────────────────────── */
.timeline { max-width: 860px; margin: 0 auto; position: relative; }
.timeline::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 50%;
  width: 1px; background: linear-gradient(var(--line), transparent);
  transform: scaleY(var(--line-scale, 1));
  transform-origin: top;
}
.moment {
  display: grid; grid-template-columns: 1fr 1fr; gap: 48px;
  align-items: center; margin-bottom: 72px; position: relative;
}
.moment::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 9px; height: 9px; border-radius: 50%;
  transform: translate(-50%, -50%);
  background: var(--gold); box-shadow: 0 0 12px rgba(227,185,110,.7);
}
.moment .txt { text-align: right; padding-right: 12px; }
.moment:nth-child(even) .txt { order: 2; text-align: left; padding-right: 0; padding-left: 12px; }
.moment:nth-child(even) .pic { order: 1; justify-self: end; }

.moment .when {
  font-size: .72rem; font-weight: 600; letter-spacing: .2em;
  text-transform: uppercase; color: var(--gold);
}
.moment h4 {
  font-family: var(--display); font-weight: 400;
  font-size: 1.7rem; margin: .35rem 0 .5rem; text-wrap: balance;
}
.moment p { color: var(--muted); font-size: .93rem; max-width: 34ch; display: inline-block; }

.star-egg {
  background: none; border: none; color: var(--muted-deep);
  font-size: .85rem; padding: 0 .15em;
  transition: color .3s ease, text-shadow .3s ease;
}
.star-egg:hover { color: var(--gold); text-shadow: 0 0 10px rgba(227,185,110,.8); }

.polaroid {
  background: #F6F1E8; padding: 10px 10px 38px; border-radius: 4px;
  box-shadow: 0 14px 34px rgba(0,0,0,.45);
  transform: rotate(var(--tilt, -2.5deg));
  width: min(280px, 78vw);
  transition: transform .35s ease;
}
.polaroid:hover { transform: rotate(0deg) scale(1.03); }
.polaroid .frame {
  aspect-ratio: 4 / 3; border-radius: 2px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, #2E2248, #4A2B44);
}
.polaroid .frame svg { width: 42px; height: 42px; opacity: .55; }
.polaroid img.shot {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  display: block; border-radius: 2px;
}
.polaroid .cap {
  font-family: var(--hand); font-size: 1.15rem; color: #4A3E5C;
  text-align: center; margin-top: 9px; line-height: 1.1;
}

/* Reveal fallback (no GSAP or reduced motion) */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .8s ease, transform .8s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ── Reasons deck ──────────────────────────────────────────────────────── */
.deck { max-width: 480px; margin: 0 auto; text-align: center; }
.reason-card {
  background: var(--ink-raise-2); border: 1px solid var(--line);
  border-radius: 18px; padding: 3rem 2.2rem; min-height: 200px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .8rem; box-shadow: 0 18px 44px rgba(0,0,0,.35);
}
.reason-card .no {
  font-size: .7rem; font-weight: 600; letter-spacing: .2em;
  text-transform: uppercase; color: var(--gold);
}
.reason-card blockquote {
  font-family: var(--display); font-style: italic; font-weight: 400;
  font-size: 1.45rem; line-height: 1.4; text-wrap: balance;
}
#drawBtn {
  margin-top: 1.6rem; background: none; color: var(--rose);
  border: 1px solid var(--rose); border-radius: 999px;
  padding: .75rem 2rem; font-size: .9rem; font-weight: 500;
  transition: background .2s ease;
}
#drawBtn:hover { background: var(--rose-soft); }

/* ── The letter ────────────────────────────────────────────────────────── */
.letter-wrap { max-width: 560px; margin: 0 auto; text-align: center; perspective: 1100px; }

#envelope {
  background: none; border: none; display: inline-block;
  transition: transform .3s ease;
}
#envelope:hover { transform: translateY(-4px); }
#envelope svg { width: min(300px, 70vw); height: auto; display: block; }
#envelope .tap {
  display: block; margin-top: 1rem; font-family: var(--hand);
  font-size: 1.25rem; color: var(--gold);
}

#letter {
  display: none; text-align: left;
  background: #F6F1E8; color: #3A3050;
  border-radius: 6px; padding: clamp(1.6rem, 5vw, 2.8rem);
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
  transform: rotate(-.6deg);
}
#letter p {
  font-family: var(--hand); font-size: 1.5rem; line-height: 1.5;
  margin-bottom: 1.1rem;
}
#letter .sign { text-align: right; font-size: 1.7rem; color: #8A4A5C; margin-bottom: 0; }

/* ── Footer ────────────────────────────────────────────────────────────── */
footer.site {
  padding: 72px 24px 96px; text-align: center;
  border-top: 1px solid var(--line);
}
footer.site .next { color: var(--muted); font-size: .95rem; }
footer.site .next strong { color: var(--gold); font-weight: 500; font-variant-numeric: tabular-nums; }
footer.site .script { font-family: var(--hand); font-size: 1.6rem; color: var(--rose); margin-top: 1.2rem; }

/* ── Secret modal ──────────────────────────────────────────────────────── */
#secret {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(10,7,18,.8); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center; padding: 24px;
}
#secret.show { display: flex; }
#secret .box {
  max-width: 400px; text-align: center;
  background: var(--ink-raise-2); border: 1px solid var(--gold);
  border-radius: 18px; padding: 2.6rem 2.2rem;
  box-shadow: 0 0 60px rgba(227,185,110,.25);
}
#secret .box h5 {
  font-family: var(--display); font-style: italic; font-weight: 400;
  font-size: 1.5rem; margin: .6rem 0 .8rem;
}
#secret .box p { font-family: var(--hand); font-size: 1.35rem; color: var(--starlight); }
#secret .close {
  margin-top: 1.6rem; background: none; border: 1px solid var(--line);
  color: var(--muted); border-radius: 999px; padding: .5rem 1.4rem; font-size: .85rem;
}

/* ── Falling hearts ────────────────────────────────────────────────────── */
.fall-heart {
  position: fixed; top: -30px; z-index: 55; pointer-events: none;
  color: var(--rose); animation: fall linear forwards;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(340deg); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .fall-heart { display: none; } }

/* ── The Typing Room (editor route) ────────────────────────────────────── */
#editor { position: relative; z-index: 1; padding: 56px 24px 150px; }

.ed-inner { max-width: 780px; margin: 0 auto; }
.ed-head { text-align: center; margin-bottom: 3rem; }
.ed-head h2 {
  font-family: var(--display); font-weight: 300; font-style: italic;
  font-size: clamp(2rem, 6vw, 2.8rem); margin-top: .5rem; text-wrap: balance;
}
.ed-head p { color: var(--muted); font-size: .92rem; margin-top: .7rem; }
.ed-head a { color: var(--gold); }

fieldset {
  border: 1px solid var(--line); border-radius: 16px;
  padding: 1.5rem; margin-bottom: 1.7rem;
  background: rgba(30,23,51,.55);
  display: grid; gap: 1rem; min-width: 0;
}
legend {
  font-family: var(--display); font-style: italic; font-weight: 400;
  font-size: 1.35rem; padding: 0 .6rem; color: var(--starlight);
}
.fld { display: flex; flex-direction: column; gap: .4rem; min-width: 0; }
.fld > span {
  font-size: .68rem; font-weight: 600; letter-spacing: .16em;
  text-transform: uppercase; color: var(--muted);
}
.fld small, small.dim { color: var(--muted-deep); font-size: .76rem; }
.fld input, .fld textarea {
  background: var(--ink-raise); border: 1px solid var(--line);
  border-radius: 10px; color: var(--starlight);
  padding: .65rem .85rem; font-family: var(--body); font-size: .95rem;
  font-weight: 300; width: 100%;
}
.fld textarea { min-height: 110px; resize: vertical; line-height: 1.55; }
.fld input:focus, .fld textarea:focus { border-color: var(--rose); outline: none; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
@media (max-width: 560px) { .grid2, .grid4 { grid-template-columns: 1fr 1fr; } }

.m-list { display: grid; gap: 1rem; }
.m-card {
  border: 1px solid var(--line); border-radius: 14px;
  padding: 1.1rem; display: grid; gap: .9rem;
  background: var(--ink-raise);
}
.m-card .m-top { display: flex; justify-content: space-between; align-items: center; }
.m-card .m-top .no {
  font-size: .7rem; font-weight: 600; letter-spacing: .18em;
  text-transform: uppercase; color: var(--gold);
}
.m-tools { display: flex; gap: .4rem; }
.m-tools button {
  background: none; border: 1px solid var(--line); color: var(--muted);
  border-radius: 8px; width: 30px; height: 30px; font-size: .85rem; line-height: 1;
}
.m-tools button:hover { color: var(--starlight); border-color: var(--muted); }

.photo-drop { display: flex; gap: .9rem; align-items: center; flex-wrap: wrap; }
.photo-thumb {
  width: 92px; height: 69px; border-radius: 6px; object-fit: cover;
  background: linear-gradient(145deg, #2E2248, #4A2B44);
  border: 1px solid var(--line); flex-shrink: 0;
}
.photo-drop .fileline { display: flex; flex-direction: column; gap: .4rem; }
.photo-drop input[type=file] { color: var(--muted); font-size: .8rem; max-width: 230px; }
.btn-dim {
  background: none; border: 1px solid var(--line); color: var(--muted);
  border-radius: 999px; padding: .35rem 1rem; font-size: .78rem; width: fit-content;
}
.btn-dim:hover { color: var(--starlight); border-color: var(--muted); }

#addMoment {
  background: none; border: 1px dashed var(--muted-deep); color: var(--muted);
  border-radius: 12px; padding: .9rem; font-size: .9rem; width: 100%;
}
#addMoment:hover { color: var(--gold); border-color: var(--gold); }

.ed-actions {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: none; gap: .7rem; flex-wrap: wrap; justify-content: center;
  padding: .9rem 24px;
  background: rgba(20,16,33,.92);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
body.route-type .ed-actions { display: flex; }
.btn {
  border-radius: 999px; padding: .7rem 1.6rem;
  font-size: .88rem; font-weight: 600; letter-spacing: .03em;
}
.btn-rose { background: var(--rose); color: #241019; border: none; }
.btn-rose:hover { box-shadow: 0 6px 24px rgba(236,126,149,.35); }
.btn-ghost { background: none; color: var(--muted); border: 1px solid var(--line); }
.btn-ghost:hover { color: var(--starlight); border-color: var(--muted); }

#toast {
  position: fixed; bottom: 86px; left: 50%; transform: translateX(-50%);
  background: var(--ink-raise-2); border: 1px solid var(--gold);
  color: var(--starlight); padding: .6rem 1.3rem; border-radius: 999px;
  font-size: .88rem; opacity: 0; transition: opacity .3s ease;
  z-index: 80; pointer-events: none; white-space: nowrap;
}
#toast.show { opacity: 1; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .timeline::before { left: 8px; }
  .moment, .moment:nth-child(even) { grid-template-columns: 1fr; gap: 20px; padding-left: 32px; }
  .moment::after { left: 8px; top: 12px; }
  .moment .txt, .moment:nth-child(even) .txt { order: 1; text-align: left; padding: 0; }
  .moment .pic, .moment:nth-child(even) .pic { order: 2; justify-self: start; }
  .lock-row input { width: 3.4rem; font-size: 1.4rem; }
  .lock-row input.yy { width: 4.6rem; }
  .lock-row input.word { width: 100%; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  .gate-screen { transition: none; }
  .gate-card.shake .lock-row { animation: none; }
}
