:root {
  --ink: #1a1712;
  --ink-soft: #3a3226;
  --paper: #e8d9b5;
  --paper-light: #f4ead2;
  --rust: #8f3826;
  --rust-dark: #6b2718;
  --gold: #c49a58;
  --gold-soft: rgb(196 154 88 / .5);
  --night: #0d0c0a;
  --shadow: 0 18px 50px rgb(0 0 0 / .38);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--night); }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--serif);
  color: var(--paper-light);
  background: var(--night);
}
button, textarea, select, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, textarea:focus-visible, select:focus-visible, input:focus-visible {
  outline: 3px solid #ffd27b;
  outline-offset: 3px;
}
img { max-width: 100%; }

.skip-link {
  position: fixed; left: 1rem; top: -5rem; z-index: 1000;
  background: #fff; color: #000; padding: .75rem 1rem; border-radius: .3rem;
}
.skip-link:focus { top: 1rem; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- global storm backdrop ---------- */
.global-backdrop { position: fixed; inset: 0; z-index: 0; }
.global-backdrop video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover;
  filter: sepia(.4) saturate(.7) brightness(.62) contrast(1.08);
}
.video-tint {
  position: absolute; inset: 0;
  background: linear-gradient(180deg,
    rgb(13 12 10 / .82) 0%,
    rgb(13 12 10 / .55) 45%,
    rgb(13 12 10 / .85) 100%);
}
.video-vignette {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 42%, transparent 40%, rgb(0 0 0 / .65) 100%);
}

.site-header, main, footer { position: relative; z-index: 1; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; justify-content: space-between; gap: 1rem; align-items: center;
  padding: .7rem clamp(1rem, 4vw, 3.5rem);
  background: rgb(13 12 10 / .82);
  border-bottom: 1px solid var(--gold-soft);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.brand {
  border: 0; background: none; color: var(--paper-light);
  display: flex; gap: .6rem; align-items: center;
  font-size: 1.05rem; letter-spacing: .04em;
}
.brand span:last-child { font-variant: small-caps; font-size: 1.15rem; }
.fish-mark { color: var(--gold); font-size: 1.3rem; }
nav { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
nav button {
  background: transparent; border: 1px solid transparent; color: var(--paper);
  padding: .5rem .75rem; border-radius: .25rem; letter-spacing: .03em;
  transition: border-color .18s ease, color .18s ease;
}
nav button:hover { border-color: var(--gold); color: #fff; }
.sound-toggle {
  border: 1px solid var(--gold-soft) !important; border-radius: 2rem !important;
  padding: .45rem .9rem !important; font-size: .88rem;
  display: flex; gap: .45rem; align-items: center;
}

main { min-height: calc(100vh - 110px); }
.screen { display: none; padding: clamp(1rem, 4vw, 3.5rem); animation: screen-in .45s ease; }
.screen.active { display: block; }
@keyframes screen-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- landing ---------- */
.home-screen { padding: 0; }
.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(240px, .55fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
  min-height: calc(100vh - 66px);
  padding: clamp(2rem, 5vw, 4rem) clamp(1.2rem, 5vw, 4.5rem) clamp(3.5rem, 7vw, 5rem);
  max-width: 1500px; margin: 0 auto;
}
.eyebrow {
  color: #d9a05f; text-transform: uppercase; letter-spacing: .28em;
  font-weight: 700; font-size: .78rem; margin: 0 0 .4rem;
}
.eyebrow em { text-transform: none; letter-spacing: .12em; }
h1, h2, h3 { line-height: 1.04; font-weight: 700; }
h1 {
  font-size: clamp(3.2rem, 8.5vw, 7.5rem);
  margin: .2rem 0 1.1rem;
  text-shadow: 0 4px 30px rgb(0 0 0 / .6);
}
.title-period { color: var(--gold); }
h2 { font-size: clamp(1.9rem, 3.6vw, 3.4rem); margin: .2rem 0 .9rem; }
.lede {
  max-width: 56ch; font-size: clamp(1.05rem, 1.6vw, 1.32rem);
  line-height: 1.65; color: #eee2c6;
  text-shadow: 0 2px 12px rgb(0 0 0 / .5);
}
.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.6rem; }
.hero-footnote { color: #b7a888; font-size: .92rem; margin-top: 1.1rem; letter-spacing: .02em; }
#audio-hint { color: #ffd27b; font-style: italic; }

.hero-card {
  width: min(100%, 430px); justify-self: center;
  border-radius: .9rem;
  box-shadow: 0 30px 70px rgb(0 0 0 / .65), 0 0 0 1px rgb(196 154 88 / .25);
  transform: rotate(2deg);
  transition: transform .5s ease;
}
.hero-card:hover { transform: rotate(0deg) scale(1.015); }
.hero-scroll-hint {
  position: absolute; left: 50%; bottom: 1.15rem; transform: translateX(-50%);
  color: rgb(238 226 198 / .55); font-style: italic;
  font-size: .88rem; letter-spacing: .08em; pointer-events: none; white-space: nowrap;
}
.home-screen { position: relative; }

/* ---------- buttons ---------- */
.primary, .secondary, .ghost, .small {
  border-radius: .3rem; padding: .78rem 1.25rem;
  border: 1px solid var(--gold);
  letter-spacing: .05em;
  transition: transform .18s ease, box-shadow .18s ease;
}
.primary {
  background: linear-gradient(180deg, #a2432d, var(--rust-dark));
  color: #fff4de; border-color: #d9a05f;
  box-shadow: 0 6px 18px rgb(0 0 0 / .35);
}
.secondary { background: #1c1914; color: var(--paper-light); }
.ghost { background: rgb(13 12 10 / .45); color: var(--paper-light); backdrop-filter: blur(4px); }
.dark-ghost { background: transparent; color: var(--ink); border-color: #9b7950; }
.big { font-size: 1.08rem; padding: .95rem 1.7rem; }
.primary:hover, .secondary:hover, .ghost:hover {
  transform: translateY(-2px); box-shadow: 0 10px 24px rgb(0 0 0 / .32);
}
button:disabled { opacity: .42; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.button-row, .export-controls { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.2rem; }
.button-row.center { justify-content: center; }

/* ---------- paper panels ---------- */
.paper-panel {
  max-width: 1100px; margin: 0 auto; color: var(--ink);
  background:
    linear-gradient(rgb(244 232 205 / .97), rgb(224 203 163 / .97)),
    radial-gradient(circle at 18% 8%, #fff7df, #d9c193);
  border: 1px solid #9b7950; border-radius: .8rem;
  padding: clamp(1.3rem, 3.5vw, 3rem);
  box-shadow: var(--shadow);
  position: relative;
}
.paper-panel::after {
  content: ""; position: absolute; inset: 9px;
  border: 1px solid rgb(120 90 50 / .35); border-radius: .5rem;
  pointer-events: none;
}
.paper-panel.narrow { max-width: 700px; }
.paper-panel.wide { max-width: 1250px; }
.eyebrow.dark { color: var(--rust); }
.panel-lede { color: var(--ink-soft); line-height: 1.6; max-width: 62ch; margin-top: 0; }

form label { display: block; margin: 1rem 0; font-weight: 700; }
textarea, select, input[type="text"] {
  display: block; width: 100%; margin-top: .45rem;
  background: #fffaf0; color: var(--ink);
  border: 1px solid #a08050; border-radius: .35rem;
  padding: .65rem .75rem; font-weight: 400; line-height: 1.5;
}
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 1.2rem; }

/* ---------- the listening table ---------- */
.table-screen { padding: clamp(1rem, 3vw, 2.5rem); }
.table-stage {
  max-width: 900px; margin: 0 auto;
  display: flex; flex-direction: column; align-items: center;
  min-height: calc(100vh - 160px);
  text-align: center;
}
.table-progress {
  text-transform: uppercase; letter-spacing: .3em; font-size: .75rem;
  color: #b7a888; margin: 0 0 1.6rem;
}
.reveal-zone { perspective: 1200px; }
.reveal-card {
  margin: 0;
  opacity: 0;
  transform: translateY(26px) scale(.96);
  filter: blur(14px) brightness(.4);
  transition: opacity 6s ease, transform 6s ease, filter 6s ease;
  will-change: opacity, transform, filter;
}
.reveal-card.revealed {
  opacity: 1;
  transform: none;
  filter: blur(0) brightness(1);
}
.reveal-card img {
  width: min(72vw, 340px);
  border-radius: .9rem;
  box-shadow: 0 40px 90px rgb(0 0 0 / .7), 0 0 60px rgb(196 154 88 / .18);
}
.reveal-quote {
  margin-top: 1.1rem; font-style: italic; font-size: 1.05rem;
  color: #e6d8b8; text-shadow: 0 2px 10px rgb(0 0 0 / .6);
}

.prompt-block {
  margin-top: 1.8rem; max-width: 640px;
  opacity: 0; transform: translateY(14px);
  transition: opacity 1.6s ease, transform 1.6s ease;
}
.prompt-block.visible { opacity: 1; transform: none; }
.prompt-block .eyebrow { letter-spacing: .22em; }
.table-prompt {
  font-size: clamp(1.2rem, 2.4vw, 1.55rem);
  line-height: 1.55; color: #f4ead2;
  text-shadow: 0 2px 14px rgb(0 0 0 / .65);
  margin: .6rem 0 0;
}
.capture-block { margin-top: 1.4rem; text-align: left; }
.capture-label { color: #e6d8b8; font-weight: 400; font-size: .95rem; }
.capture-block textarea {
  background: rgb(20 17 13 / .75); color: var(--paper-light);
  border: 1px solid var(--gold-soft);
}
.capture-block textarea::placeholder { color: #8d8065; }

/* ---------- reflection overlay ---------- */
.overlay-screen.active {
  position: fixed; inset: 0; z-index: 100; overflow: auto;
  display: grid; place-items: center;
  background: rgb(8 7 5 / .8); backdrop-filter: blur(6px);
  padding: clamp(1rem, 4vw, 3rem);
}
.reflection-panel { max-width: 640px; width: 100%; }

/* ---------- journal ---------- */
.section-heading { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; align-items: flex-end; }
.journal-entry {
  border-left: 5px solid var(--rust);
  background: rgb(255 250 238 / .75);
  padding: .9rem 1.2rem; margin: 1.1rem 0; border-radius: 0 .5rem .5rem 0;
}
.journal-entry h3 { margin: 0 0 .5rem; }
.journal-entry dl { display: grid; grid-template-columns: 170px 1fr; gap: .4rem 1rem; margin: 0; }
.journal-entry dt { font-weight: 700; color: var(--rust-dark); }
.journal-entry dd { margin: 0; line-height: 1.5; }

/* ---------- learn ---------- */
.rule-grid { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin-top: 1.4rem; }
.rule-grid article {
  border: 1px solid rgb(120 90 50 / .5); border-radius: .6rem;
  padding: 1.1rem 1.2rem; background: rgb(255 250 238 / .6);
}
.rule-num {
  display: inline-grid; place-items: center;
  width: 2.3rem; height: 2.3rem; border-radius: 50%;
  background: var(--rust); color: #fff4de; font-weight: 700; font-size: 1.05rem;
}
.rule-grid h3 { margin: .7rem 0 .4rem; font-size: 1.12rem; }
.rule-grid p { margin: 0; line-height: 1.55; color: var(--ink-soft); }
.ref-heading { margin-top: 2.2rem; }
.teacher-note {
  margin-top: 2.2rem; border-top: 1px solid rgb(120 90 50 / .4); padding-top: 1.2rem;
  line-height: 1.6; color: var(--ink-soft);
}
.verify-note { font-style: italic; font-size: .92rem; }
.credits { color: var(--ink-soft); line-height: 1.7; font-size: .92rem; max-width: 80ch; }

/* ---------- gallery ---------- */
.gallery-grid { display: grid; gap: 1.3rem; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); margin-top: 1.4rem; }
.gallery-card { text-align: center; }
.gallery-listen { border: 0; background: none; padding: 0; display: block; width: 100%; }
.gallery-listen img {
  border-radius: .6rem; box-shadow: 0 12px 26px rgb(0 0 0 / .3);
  transition: transform .25s ease;
}
.gallery-listen:hover img, .gallery-listen:focus-visible img { transform: translateY(-5px) rotate(-.6deg); }
.gallery-card h3 { margin: .7rem 0 .2rem; font-size: 1.1rem; }
.gallery-card p { margin: 0; font-size: .9rem; color: var(--ink-soft); line-height: 1.45; }

footer {
  padding: 1.4rem clamp(1rem, 4vw, 3.5rem);
  border-top: 1px solid var(--gold-soft);
  background: rgb(13 12 10 / .85);
  color: #b7a888; font-size: .9rem; line-height: 1.55;
}
footer p { max-width: 90ch; margin: 0; }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .hero-inner { grid-template-columns: 1fr; min-height: auto; padding-bottom: 4.5rem; }
  .hero-card { display: none; }
  .journal-entry dl { grid-template-columns: 1fr; gap: .1rem .8rem; }
  .journal-entry dt { margin-top: .45rem; }
  .hero-scroll-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .3s !important; }
  .reveal-card { transition-duration: .3s; }
}

/* ---------- print ---------- */
@media print {
  body { background: #fff; color: #000; }
  .site-header, footer, nav, .export-controls, .global-backdrop, .screen { display: none !important; }
  #screen-journal { display: block !important; padding: 0; }
  #screen-journal .paper-panel { box-shadow: none; border: 0; background: #fff; color: #000; }
  #screen-journal .paper-panel::after { display: none; }
  .journal-entry { break-inside: avoid; background: #fff; border-left-color: #444; }
  .journal-entry dt { color: #000; }
  .eyebrow { color: #444; }
}
