/* Ten Evenings in Tidewick — palette and type taken from the cover (cover-E) and window-seat banners. */
:root {
  --night: #16203a;
  --dusk: #2e3656;
  --plum: #5a4e6a;
  --ember: #a8645a;
  --paper: #fbf4e3;
  --paper-2: #f4e9d0;
  --card: #fffaf0;
  --ink: #2b2118;
  --ink-soft: #5e4c3c;
  --rust: #9c4221;
  --rust-dark: #6e2814;
  --amber: #f7b45a;
  --gold: #ffd27a;
  --cream: #fff6dc;
  --wood: #4a2f1e;
  --line: #e2d2b0;
  --serif: Cochin, "Iowan Old Style", Baskerville, "Palatino Linotype", Palatino, Georgia, serif;
  --radius: 10px;
  color-scheme: light;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 18px/1.6 var(--serif);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--rust); }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 3px;
}
.small { font-size: .88rem; color: var(--ink-soft); }

/* ---------- buttons ---------- */
.btn {
  display: inline-block;
  padding: .62em 1.2em;
  border-radius: 999px;
  font: italic 1rem/1.2 var(--serif);
  text-decoration: none;
  border: 1.5px solid transparent;
  transition: transform .15s ease, background-color .15s ease, box-shadow .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-warm { background: var(--gold); color: var(--ink); box-shadow: 0 0 24px rgba(255, 210, 122, .35); }
.btn-warm:hover { background: #ffe2a0; }
.btn-ghost { color: var(--cream); border-color: rgba(255, 246, 220, .55); }
.btn-ghost:hover { background: rgba(255, 246, 220, .1); }
.btn-rust { background: var(--rust); color: var(--cream); }
.btn-rust:hover { background: var(--rust-dark); }
.btn-line { color: var(--rust); border-color: var(--rust); background: transparent; }
.btn-line:hover { background: rgba(156, 66, 33, .07); }

/* ---------- hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  color: var(--cream);
  background:
    radial-gradient(ellipse 60% 45% at 78% 30%, rgba(255, 210, 122, .12), transparent 70%),
    linear-gradient(180deg, var(--night) 0%, var(--dusk) 45%, var(--plum) 80%, var(--ember) 100%);
  padding: calc(56px + env(safe-area-inset-top, 0px)) 20px 72px;
}
.rain {
  position: absolute; inset: 0; pointer-events: none; opacity: .18;
  background-image: repeating-linear-gradient(100deg, transparent 0 22px, rgba(255, 246, 220, .5) 22px 23px, transparent 23px 61px);
  mask-image: linear-gradient(180deg, #000 0%, transparent 90%);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 90%);
}
.hero-inner {
  position: relative;
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 56px;
  align-items: center;
}
.kicker {
  margin: 0 0 .6rem;
  font-style: italic;
  color: var(--gold);
  letter-spacing: .02em;
}
h1 { margin: 0; font-weight: 400; line-height: 1; }
.h1-top {
  display: block;
  font-size: clamp(2.1rem, 5.2vw, 3.6rem);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--cream);
}
.h1-bottom {
  display: block;
  font-style: italic;
  font-size: clamp(3rem, 8vw, 5.6rem);
  color: var(--gold);
  margin-top: .08em;
  text-shadow: 0 0 30px rgba(255, 176, 74, .35);
}
.subtitle { margin: .9rem 0 0; font-size: clamp(1.15rem, 2.3vw, 1.45rem); font-style: italic; }
.rule { position: relative; height: 1px; width: 220px; margin: 1.4rem 0; background: rgba(255, 210, 122, .6); }
.rule span { position: absolute; left: 50%; top: -3.5px; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: var(--gold); }
.lede { margin: 0 0 .9rem; max-width: 34em; color: #efe3c6; }
.hero-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 1.6rem; }

.cover { margin: 0; justify-self: center; width: 100%; max-width: 400px; }
.cover img {
  width: 100%;
  border-radius: 3px 8px 8px 3px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .06),
    -6px 0 0 -2px #0b0f1d,
    0 30px 60px rgba(0, 0, 0, .55),
    0 0 80px rgba(255, 176, 74, .12);
  transform: rotate(1.2deg);
}

/* ---------- main sections ---------- */
main { max-width: 1000px; margin: 0 auto; padding: 0 20px; }
section { padding-block: 64px 8px; }
.section-title {
  margin: 0 0 1.5rem;
  font-weight: 400;
  font-style: italic;
  font-size: clamp(1.7rem, 3.6vw, 2.3rem);
  color: var(--rust);
  display: flex; align-items: center; gap: 18px;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.aside {
  margin: 1.5rem 0 0;
  padding: 14px 18px;
  border-left: 3px solid var(--amber);
  background: var(--paper-2);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  color: var(--ink-soft);
}
.intro { margin: -0.5rem 0 1.8rem; color: var(--ink-soft); }

/* how it works */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.steps li {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 22px 20px;
}
.steps h3 { margin: 0 0 .4rem; font-weight: 400; font-size: 1.3rem; }
.steps p { margin: 0; font-size: .97rem; color: var(--ink-soft); }
.step-n {
  position: absolute; top: -16px; left: 20px;
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--cream); color: var(--rust);
  border: 1.5px solid var(--rust);
  box-shadow: 0 0 0 3px var(--paper);
  font-size: 1.05rem;
}

/* map */
.map-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 32px; align-items: start; }
.map-frame {
  position: relative; display: block;
  background: #fffdf8;
  padding: 10px;
  border-radius: 4px;
  box-shadow: 0 1px 0 var(--line), 0 14px 34px rgba(74, 47, 30, .18);
  transform: rotate(-.6deg);
  transition: transform .2s ease, box-shadow .2s ease;
}
.map-frame:hover { transform: rotate(0deg) scale(1.01); box-shadow: 0 1px 0 var(--line), 0 20px 44px rgba(74, 47, 30, .25); }
.map-frame img { width: 100%; }
.map-zoom {
  position: absolute; right: 18px; bottom: 18px;
  padding: 4px 12px; border-radius: 999px;
  background: rgba(43, 33, 24, .82); color: var(--cream);
  font-size: .85rem; font-style: italic;
}
.map-text p { margin: 0 0 1rem; }
.map-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }

/* needs */
.needs-list {
  list-style: none; margin: 0; padding: 0;
  columns: 2; column-gap: 40px;
}
.needs-list li { break-inside: avoid; padding: .35rem 0 .35rem 1.6rem; position: relative; }
.needs-list li::before {
  content: ""; position: absolute; left: .2rem; top: .95em;
  width: 7px; height: 7px; border-radius: 50%; background: var(--amber);
  box-shadow: 0 0 0 3px rgba(247, 180, 90, .25);
}

/* ---------- evenings ---------- */
.evening-list { display: grid; gap: 34px; }
.evening {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(74, 47, 30, .08);
}
.evening-banner { background: var(--wood); }
.evening-banner img { width: 100%; aspect-ratio: 176 / 36; }
.evening-body { padding: 20px 26px 24px; }
.evening-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; margin-bottom: 14px; }
.evening-num { font-style: italic; color: var(--rust); font-size: 1rem; }
.evening-title { margin: 0; font-weight: 400; font-size: clamp(1.4rem, 3vw, 1.75rem); line-height: 1.2; flex: 1 1 auto; }
.evening-idea {
  font-size: .78rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-soft);
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 12px;
}

.tracks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

/* player */
.player {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 14px;
  align-items: center;
  padding: 12px 16px 12px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.player.is-playing { border-color: var(--amber); background: #fff3dc; }
.play {
  grid-row: span 2;
  width: 48px; height: 48px; border-radius: 50%;
  border: 0; cursor: pointer;
  background: var(--rust); color: var(--cream);
  display: grid; place-items: center;
  box-shadow: 0 3px 8px rgba(110, 40, 20, .3);
  transition: background-color .15s ease, transform .1s ease;
}
.play:hover { background: var(--rust-dark); }
.play:active { transform: scale(.95); }
.play svg { width: 18px; height: 18px; fill: currentColor; }
.play .i-pause { display: none; }
.is-playing .play .i-play { display: none; }
.is-playing .play .i-pause { display: block; }
.is-loading .play { opacity: .75; }

.track-label { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; }
.track-name { font-size: 1.05rem; }
.track-note { font-style: italic; color: var(--ink-soft); font-size: .92rem; }
.track-bar { display: flex; align-items: center; gap: 12px; min-width: 0; }
.time { font-variant-numeric: tabular-nums; font-size: .82rem; color: var(--ink-soft); white-space: nowrap; font-family: Georgia, serif; }

.seek {
  --p: 0%;
  flex: 1; min-width: 0;
  -webkit-appearance: none; appearance: none;
  height: 22px; background: transparent; cursor: pointer; margin: 0;
}
.seek::-webkit-slider-runnable-track {
  height: 4px; border-radius: 4px;
  background: linear-gradient(90deg, var(--amber) var(--p), var(--line) var(--p));
}
.seek::-moz-range-track { height: 4px; border-radius: 4px; background: var(--line); }
.seek::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--amber); }
.seek::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; margin-top: -5px; border-radius: 50%;
  background: var(--rust); border: 2px solid var(--card);
}
.seek::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--rust); border: 2px solid var(--card); }

/* locked "after the puzzle" track */
.locked {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  padding: 14px 16px;
  border: 1.5px dashed #cdb68c;
  border-radius: var(--radius);
  background: repeating-linear-gradient(-45deg, transparent 0 10px, rgba(205, 182, 140, .12) 10px 20px);
}
.locked-icon { width: 22px; height: 22px; fill: var(--rust); flex: none; }
.locked-text { flex: 1 1 220px; margin: 0; font-size: .97rem; }
.locked-text strong { font-weight: 400; }
.locked-text span { display: block; font-style: italic; color: var(--ink-soft); font-size: .9rem; }
.unlock {
  font: italic .95rem/1.2 var(--serif);
  padding: .55em 1.1em; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--rust); background: transparent; color: var(--rust);
}
.unlock:hover { background: var(--rust); color: var(--cream); }
.confirm { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.confirm[hidden] { display: none; }
.confirm span { font-style: italic; font-size: .92rem; color: var(--ink-soft); }
.unlock.yes { background: var(--rust); color: var(--cream); }

/* footer */
.foot {
  margin-top: 80px;
  padding: 40px 20px calc(40px + env(safe-area-inset-bottom, 0px));
  text-align: center;
  background: var(--night);
  color: #d9cdb2;
}
.foot p { margin: .2rem 0; }
.foot .small { color: #a99d86; }

/* ---------- responsive ---------- */
@media (max-width: 820px) {
  .hero-inner { grid-template-columns: 1fr; gap: 40px; }
  .cover { max-width: 300px; order: -1; }
  .steps { grid-template-columns: 1fr; gap: 28px; }
  .map-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  body { font-size: 17px; }
  .hero { padding-top: calc(36px + env(safe-area-inset-top, 0px)); padding-bottom: 52px; }
  .cover { max-width: 240px; }
  .needs-list { columns: 1; }
  .evening-body { padding: 16px 16px 18px; }
  .player { padding: 10px 12px 10px 10px; gap: 2px 12px; }
  .play { width: 42px; height: 42px; }
  section { padding-top: 48px; }
}
