/* Same Moon: "harvest night" palette.
   ink #141B34 (sky), dusk #1F2A4D (surfaces), pearl #EFE6CF (moonlight, text),
   harvest #E9A23B (the shared Moon: only used for things everyone shares), mist #8A94B8 (secondary). */
:root {
  --ink: #141b34;
  --dusk: #1f2a4d;
  --dusk-2: #28355f;
  --pearl: #efe6cf;
  --harvest: #e9a23b;
  --mist: #8a94b8;
  --line: rgba(239, 230, 207, 0.14);
  --display: 'Cormorant Garamond', 'Iowan Old Style', Georgia, serif;
  --body: 'Karla', 'Avenir Next', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--ink); }
body {
  margin: 0;
  color: var(--pearl);
  font: 17px/1.55 var(--body);
  background:
    radial-gradient(1200px 600px at 78% -10%, rgba(233, 162, 59, 0.10), transparent 60%),
    radial-gradient(900px 500px at 10% 30%, rgba(90, 110, 180, 0.12), transparent 60%),
    var(--ink);
  -webkit-font-smoothing: antialiased;
}

h1, h2 { font-family: var(--display); font-weight: 600; letter-spacing: 0.005em; margin: 0; }
h2 { font-size: clamp(1.7rem, 2.6vw, 2.2rem); line-height: 1.15; margin-bottom: 0.35rem; }
p { margin: 0 0 0.8rem; max-width: 70ch; }
.hint { color: var(--mist); font-size: 0.95rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

button, input, select { font: inherit; color: inherit; }
button {
  background: var(--pearl); color: var(--ink); border: 0; border-radius: 999px;
  padding: 0.6rem 1.15rem; font-weight: 700; cursor: pointer;
}
button.quiet { background: transparent; color: var(--pearl); border: 1px solid var(--line); font-weight: 500; }
button:hover { filter: brightness(1.06); }
:focus-visible { outline: 2px solid var(--harvest); outline-offset: 3px; }
input[type=text], select {
  background: var(--dusk); border: 1px solid var(--line); border-radius: 10px; padding: 0.55rem 0.75rem;
}

/* Hero: the Moon is the headline */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: center;
  gap: 2rem; max-width: 1180px; margin: 0 auto; padding: 4.5rem 1.5rem 2.5rem;
}
.hero h1 { font-size: clamp(3.6rem, 9vw, 7.2rem); line-height: 0.92; font-weight: 500; }
.tagline { font-family: var(--display); font-style: italic; font-size: clamp(1.4rem, 2.6vw, 2rem); margin: 0.6rem 0 1.6rem; color: var(--pearl); }
.next { font-size: 1.15rem; max-width: 46ch; border-left: 3px solid var(--harvest); padding-left: 0.9rem; }
.poem { margin: 2rem 0 0; color: var(--mist); }
.poem blockquote { margin: 0; font-size: 1.5rem; color: var(--pearl); letter-spacing: 0.08em; }
.poem figcaption { font-family: var(--display); font-style: italic; font-size: 1.15rem; max-width: 44ch; }
.poem figcaption span { display: block; font-style: normal; font-family: var(--body); font-size: 0.85rem; margin-top: 0.2rem; }
.hero-moon { text-align: center; }
#moonCanvas { width: min(100%, 460px); height: auto; aspect-ratio: 1; }
.moon-caption { color: var(--mist); font-size: 0.95rem; margin: 0.4rem auto 0; }

main { max-width: 1180px; margin: 0 auto; padding: 0 1.5rem 3rem; }
main > section { padding: 2.6rem 0; border-top: 1px solid var(--line); }

/* Family */
.say { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.4rem; }
.say input { flex: 1 1 380px; min-width: 0; }
.say-status { min-height: 1.4em; color: var(--mist); font-size: 0.95rem; margin-top: 0.5rem; }
.people { list-style: none; padding: 0; margin: 0.4rem 0 1rem; display: grid; gap: 0.5rem; }
.people li {
  display: grid; grid-template-columns: minmax(110px, 1fr) minmax(170px, 1.6fr) minmax(120px, 1fr) auto auto;
  gap: 0.5rem; align-items: center;
}
.people li > * { min-width: 0; }
.people li input[type=text], .people li select { width: 100%; } /* long city names must not widen the grid */
.people label.owl { font-size: 0.9rem; color: var(--mist); white-space: nowrap; }
.people button.remove { background: transparent; color: var(--mist); border: 1px solid var(--line); padding: 0.45rem 0.8rem; font-weight: 500; }
.row-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

/* Windows */
.windows { list-style: none; padding: 0; margin: 0.8rem 0 0; display: grid; gap: 0.7rem; }
.windows button {
  width: 100%; text-align: left; background: var(--dusk); color: var(--pearl);
  border: 1px solid var(--line); border-radius: 14px; padding: 0.9rem 1.1rem; font-weight: 400;
  display: grid; grid-template-columns: 7.5rem 1fr; gap: 0.8rem; align-items: baseline;
}
.windows button[aria-pressed=true] { border-color: var(--harvest); box-shadow: inset 4px 0 0 var(--harvest); }
.windows .when { font-family: var(--display); font-size: 1.35rem; line-height: 1.1; }
.windows .when small { display: block; font-family: var(--body); font-size: 0.85rem; color: var(--mist); }
.windows .who { display: flex; flex-wrap: wrap; gap: 0.3rem 1.4rem; }
.windows .who span { white-space: nowrap; }
.windows .who b { font-weight: 700; }
.windows .who em { font-style: normal; color: var(--mist); }
.windows .empty { color: var(--mist); }

/* Timeline + map */
.timeline-wrap, .map-wrap { margin-top: 0.8rem; background: var(--dusk); border-radius: 16px; overflow: hidden; border: 1px solid var(--line); }
#timelineCanvas { display: block; width: 100%; cursor: pointer; }
.world { position: relative; }
.map-wrap { border-color: rgba(233, 162, 59, 0.35); box-shadow: 0 0 80px rgba(233, 162, 59, 0.08); }
#mapCanvas { display: block; width: 100%; aspect-ratio: 2 / 1; }
.scrub { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-top: 0.9rem; }
.scrub input[type=range] { flex: 1 1 260px; accent-color: var(--harvest); }
.scrub output { min-width: 15ch; font-variant-numeric: tabular-nums; }
.map-status { color: var(--mist); margin-top: 0.5rem; min-height: 1.4em; }

/* Moment bubble */
.bubble {
  margin-top: 0.8rem; max-width: 62ch; background: var(--dusk-2); border-radius: 20px 20px 20px 6px;
  padding: 1rem 1.2rem; white-space: pre-wrap; line-height: 1.5;
}
.bubble::before { content: 'Same Moon'; display: block; font-weight: 700; color: var(--harvest); margin-bottom: 0.3rem; font-size: 0.9rem; }

/* Postcard */
.photo-inputs { display: flex; gap: 1.2rem; flex-wrap: wrap; margin: 0.6rem 0 1rem; }
.photo-inputs label { display: grid; gap: 0.3rem; font-size: 0.95rem; }
#postcardCanvas { display: block; width: 100%; max-width: 900px; height: auto; border-radius: 14px; margin-bottom: 1rem; }

footer { max-width: 1180px; margin: 0 auto; padding: 2rem 1.5rem 4rem; color: var(--mist); font-size: 0.95rem; border-top: 1px solid var(--line); }
footer strong { color: var(--pearl); }

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; padding-top: 2.5rem; }
  .hero-moon { order: -1; }
  .people li { grid-template-columns: 1fr 1fr; }
  .windows button { grid-template-columns: 1fr; }
  .windows .who { flex-direction: column; }
  .windows .who span { white-space: normal; }
  .windows .who em { white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
