:root {
  color-scheme: dark;
  --paper: #15302c;          /* the 2024 site's background */
  --paper-deep: #0f2420;
  --card: #1b3a35;
  --card-hi: #224540;
  --ink: #f4ede6;
  --muted: #9db3ac;
  --line: rgba(255, 255, 255, .10);
  --rose: #b98cf5;           /* purple, to go with the green */
  --rose-soft: rgba(185, 140, 245, .16);
  --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 10px 30px rgba(0, 0, 0, .28);
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;
  --digit: "digit", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --gutter: clamp(16px, 4vw, 40px);
}

@font-face {
  font-family: "digit";
  src: url("../../2024/digital-7_mono.ttf") format("truetype");
  font-display: swap;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.6 var(--sans);
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
body.locked { overflow: hidden; }
img { max-width: 100%; display: block; }
a { color: var(--rose); }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }

/* ---------- gate ---------- */
.gate {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center; padding: var(--gutter);
  background: radial-gradient(circle at 50% 35%, #23483f 0%, var(--paper) 55%, var(--paper-deep) 100%);
  transition: opacity .45s ease;
}
.gate.opening { opacity: 0; }
.gate-card {
  width: min(360px, 100%); text-align: center;
  background: var(--card); border-radius: 22px; padding: 36px 28px 28px;
  box-shadow: var(--shadow); border: 1px solid var(--line);
}
.gate-card h1 { font: 500 32px/1.1 var(--serif); margin: 0 0 4px; }
.gate-card p { margin: 0 0 18px; color: var(--muted); }
.gate-card input {
  width: 100%; padding: 13px 16px; font-size: 18px; text-align: center; letter-spacing: .15em;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--paper-deep); color: var(--ink); outline: none;
}
.gate-card input:focus { border-color: var(--rose); }
.gate-card button {
  margin-top: 12px; width: 100%; padding: 12px; border: 0; border-radius: 12px;
  background: var(--rose); color: var(--paper-deep); font-weight: 700; cursor: pointer;
}
.gate-error { margin: 12px 0 0 !important; color: var(--rose) !important; font-size: 14px; }
.shake { animation: shake .4s; }
@keyframes shake { 20%,60% { transform: translateX(-8px); } 40%,80% { transform: translateX(8px); } }

/* ---------- hero ---------- */
.hero {
  min-height: 92svh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 48px var(--gutter);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(185, 140, 245, .14), transparent 60%),
    var(--paper);
}
.eyebrow { font: 600 13px/1 var(--sans); letter-spacing: .22em; text-transform: uppercase; color: var(--rose); margin: 0 0 18px; }
.hero-title { font: 300 clamp(30px, 6vw, 56px)/1.1 var(--serif); margin: 0 0 32px; font-style: italic; }
.counter { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(10px, 2.5vw, 28px); }
.counter div {
  min-width: 78px; padding: 14px 10px 10px; border-radius: 16px;
  background: var(--card); box-shadow: var(--shadow); border: 1px solid var(--line);
}
.counter span { display: block; font: 400 clamp(34px, 6.5vw, 54px)/1 var(--digit); color: var(--rose); text-shadow: 0 0 18px rgba(185, 140, 245, .35); }
.counter small { display: block; margin-top: 6px; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.since { margin: 22px 0 0; color: var(--muted); font-family: var(--hand); font-size: 22px; }
.hero-nav { margin-top: 40px; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.hero-nav a {
  text-decoration: none; color: var(--ink); font-size: 14px; font-weight: 500;
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,.04);
}
.hero-nav a:hover { border-color: var(--rose); color: var(--rose); }

/* ---------- sections ---------- */
.section { max-width: 760px; margin: 0 auto; padding: 72px var(--gutter); }
.section-wide { max-width: 1180px; }
.section-title { font: 400 clamp(28px, 5vw, 40px)/1.15 var(--serif); text-align: center; margin: 0 0 8px; }
.section-sub { text-align: center; color: var(--muted); margin: 0 0 28px; }
.section-title + .timeline, .section-title + .gallery { margin-top: 32px; }

/* ---------- letter ---------- */
.paper {
  position: relative; background: var(--card); border-radius: 6px; box-shadow: var(--shadow);
  padding: clamp(28px, 6vw, 56px) clamp(22px, 6vw, 60px);
  background-image: repeating-linear-gradient(transparent 0 37px, rgba(255, 255, 255, .06) 37px 38px);
  background-position: 0 clamp(26px, 5vw, 50px);
}
.paper::before { /* margin line */
  content: ""; position: absolute; top: 0; bottom: 0; left: clamp(14px, 3vw, 34px);
  width: 1px; background: rgba(185, 140, 245, .35);
}
.letter-date { margin: 0 0 10px; font: 500 13px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.paper .letter-body { font: 500 clamp(23px, 3.6vw, 28px)/38px var(--hand); }
.letter-body p { margin: 0 0 38px; }
.letter-body p:last-child { margin-bottom: 0; }
.paper .line { display: inline; opacity: 0; transition: opacity .9s ease; }
.paper .line::after { content: "\A"; white-space: pre; }
.paper .line:last-child::after { content: none; }
.paper .line.in { opacity: 1; }
.more-link { display: block; text-align: right; margin-top: 16px; font-weight: 500; text-decoration: none; }

/* ---------- timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 11px; top: 6px; bottom: 6px; width: 2px;
  background: linear-gradient(var(--rose-soft), var(--rose), var(--rose-soft));
}
.tl-item { position: relative; padding: 0 0 26px 40px; }
.tl-dot {
  position: absolute; left: 4px; top: 18px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--card); border: 3px solid var(--rose);
}
.tl-card { background: var(--card); border-radius: 14px; padding: 14px 18px; box-shadow: var(--shadow); }
.tl-card time { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.tl-card h3 { margin: 2px 0 0; font: 500 21px/1.25 var(--serif); }
.tl-card p { margin: 4px 0 0; color: var(--muted); }
.tl-photo { display: block; width: min(100%, 340px); margin-top: 12px; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 10px; overflow: hidden; }
.tl-photo img { width: 100%; height: 220px; object-fit: cover; transition: transform .4s; }
.tl-photo:hover img { transform: scale(1.03); }

/* ---------- gallery ---------- */
.gallery { columns: 2 160px; column-gap: 12px; }
@media (min-width: 720px) { .gallery { columns: 3; column-gap: 16px; } }
@media (min-width: 1040px) { .gallery { columns: 4; } }
.g-item {
  display: block; width: 100%; margin: 0 0 12px; padding: 0; border: 0; background: var(--line);
  break-inside: avoid; position: relative; border-radius: 12px; overflow: hidden; cursor: zoom-in;
}
@media (min-width: 720px) { .g-item { margin-bottom: 16px; } }
.g-item img { width: 100%; height: auto; transition: transform .5s ease; }
.g-item:hover img { transform: scale(1.04); }
.g-cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 12px 9px; text-align: left;
  color: #fff; font-size: 13px; font-weight: 500;
  background: linear-gradient(transparent, rgba(0,0,0,.55));
}

/* ---------- map ---------- */
.map { height: min(70svh, 560px); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); background: #1d2b29; border: 1px solid var(--line); }
.pin span {
  display: block; width: 18px; height: 18px; border-radius: 50%;
  background: var(--rose); border: 3px solid #fff;
  box-shadow: 0 0 0 4px rgba(185, 140, 245, .25), 0 2px 6px rgba(0,0,0,.35);
}
.map .tiles { filter: invert(1) hue-rotate(185deg) saturate(.55) brightness(.82) contrast(.92); }
.pop { font-family: var(--sans); min-width: 140px; }
.pop strong { display: block; font: 500 17px/1.2 var(--serif); }
.pop small { display: block; color: var(--muted); }
.pop-pics { display: grid; grid-template-columns: repeat(2, 64px); gap: 4px; margin-top: 8px; }
.pop-pics img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; cursor: zoom-in; }

/* ---------- lightbox ---------- */
.lightbox {
  width: 100vw; height: 100svh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: rgba(20, 14, 12, .94); color: #fff;
}
.lightbox[open] { display: flex; align-items: center; justify-content: center; }
.lightbox::backdrop { background: rgba(20, 14, 12, .6); }
.lightbox figure { margin: 0; max-width: 92vw; display: flex; flex-direction: column; align-items: center; }
.lightbox img { max-width: 92vw; max-height: 82svh; width: auto; height: auto; border-radius: 6px; }
.lightbox figcaption { margin-top: 12px; font-size: 14px; opacity: .85; text-align: center; min-height: 1.4em; }
.lightbox button {
  position: absolute; border: 0; background: rgba(255,255,255,.12); color: #fff; cursor: pointer;
  width: 44px; height: 44px; border-radius: 50%; font-size: 28px; line-height: 1;
}
.lb-close { top: calc(14px + env(safe-area-inset-top, 0px)); right: 14px; }
.lb-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 12px; top: 50%; transform: translateY(-50%); }

/* ---------- letters page ---------- */
.page-head { max-width: 760px; margin: 0 auto; padding: 56px var(--gutter) 0; text-align: center; }
.page-head h1 { font: 400 clamp(34px, 6vw, 48px)/1.1 var(--serif); margin: 8px 0; }
.back { display: inline-block; text-decoration: none; font-weight: 500; }
.letters { display: grid; gap: 14px; }
.letter-card { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.letter-card summary { list-style: none; cursor: pointer; padding: 18px 22px; position: relative; }
.letter-card summary::-webkit-details-marker { display: none; }
.letter-card summary::after { content: "+"; position: absolute; right: 22px; top: 18px; font-size: 22px; color: var(--rose); }
.letter-card[open] summary::after { content: "–"; }
.letter-card time { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.letter-card h2 { margin: 2px 0 0; font: 500 22px/1.25 var(--serif); padding-right: 24px; }
.letter-card .preview { margin: 4px 0 0; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.letter-card[open] .preview { display: none; }
.letter-card .letter-body { padding: 0 22px 22px; font: 500 24px/1.5 var(--hand); }
.letter-card .letter-body p { margin: 0 0 18px; }

/* ---------- footer + reveal ---------- */
.footer { text-align: center; color: var(--muted); padding: 48px var(--gutter) 64px; font-size: 14px; }
.footer p { margin: 4px 0; }
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal, .paper .line { opacity: 1 !important; transform: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

@media (max-width: 480px) {
  .counter { gap: 6px; flex-wrap: nowrap; width: 100%; max-width: 400px; }
  .counter div { min-width: 0; flex: 1 1 0; padding: 10px 4px 8px; border-radius: 12px; }
  .counter span { font-size: 26px; }
  .counter small { font-size: 9px; letter-spacing: .04em; }
}

/* dark theme details */
::selection { background: var(--rose); color: #fff; }
.tl-dot { background: var(--paper); }
.leaflet-container { background: #1d2b29; font-family: var(--sans); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--card-hi); color: var(--ink); box-shadow: var(--shadow); }
.leaflet-popup-close-button { color: var(--muted) !important; }
.leaflet-bar a { background: var(--card-hi); color: var(--ink); border-color: var(--line); }
.leaflet-bar a:hover { background: var(--card); color: var(--rose); }
.leaflet-control-attribution { background: rgba(15, 36, 32, .75) !important; color: var(--muted); }
.leaflet-control-attribution a { color: var(--muted); }
