/* fallbacks sized like the web fonts so the swap does not move the layout */
@font-face {
  font-family: "Fraunces Fallback";
  src: local("Georgia");
  font-weight: 700;
  size-adjust: 93.9%;
  ascent-override: 97.8%;
  descent-override: 25.5%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Fraunces Fallback";
  src: local("Georgia Bold");
  font-weight: 900;
  size-adjust: 96.8%;
  ascent-override: 97.8%;
  descent-override: 25.5%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Source Serif Fallback";
  src: local("Georgia");
  size-adjust: 95.9%;
  ascent-override: 103.6%;
  descent-override: 33.5%;
  line-gap-override: 0%;
}

:root {
  --gold: #f2b950;
  --ochre: #c79a4a;
  --peach: #f6d9bf;
  --sky: #9fc3e0;
  --red: #c45a2a;
  --sesame: #4a2f1f;
  --cream: #f7efdc;
  --ink: #221a14;
  --display: "Fraunces", "Fraunces Fallback", serif;
  --body: "Source Serif 4", "Source Serif Fallback", serif;
  --mono: "Cutive Mono", "Courier New", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--body);
  font-size: 18px;
  line-height: 1.6;
  background: var(--ochre) url("/images/grass.webp") repeat;
  background-size: 400px;
  overflow-x: hidden;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a,
button {
  color: inherit;
  cursor: pointer;
}

p {
  margin: 0;
}

[hidden] {
  display: none !important;
}

.wrap {
  width: min(1180px, 100% - 32px);
  margin: 0 auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 24px;
  border: 2px solid var(--ink);
  border-radius: 2px;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--ink);
  background: var(--cream);
  transition: background 0.4s ease, transform 0.4s ease;
}

.btn:hover {
  transform: translateY(-2px);
  background: #fff;
}

.btn--gold {
  background: var(--gold);
}

.btn--gold:hover {
  background: #ffc964;
}

.title {
  margin: 0 0 14px;
  font-family: var(--display);
  font-size: clamp(2rem, 4.4vw, 3.2rem);
  font-weight: 900;
  font-variation-settings: "opsz" 144;
  line-height: 1.05;
  color: var(--ink);
}

/* header: the corner text of a nature show */
.top .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 18px;
}

.third {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 18px 6px 6px;
  border-left: 4px solid var(--gold);
  text-decoration: none;
  color: var(--cream);
  background: rgba(34, 26, 20, 0.82);
}

.third img {
  border-radius: 2px;
}

.third-text b {
  display: block;
  font-family: var(--display);
  font-size: 1.15rem;
  letter-spacing: 0.08em;
  font-variant: small-caps;
  line-height: 1.1;
}

.third-text small {
  display: block;
  font-size: 0.85rem;
  color: var(--peach);
}

.top-links {
  display: flex;
  gap: 4px;
}

.top-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 14px;
  font-family: var(--display);
  font-weight: 700;
  text-decoration: none;
  color: var(--cream);
  background: rgba(34, 26, 20, 0.82);
}

.top-links a:hover {
  color: var(--gold);
}

/* hero: a letterboxed documentary frame */
.hero {
  padding: 28px 0 40px;
}

.film {
  position: relative;
  padding: clamp(14px, 2.4vw, 30px) 0;
  background: #0d0a08;
  box-shadow: 0 20px 40px rgba(34, 26, 20, 0.5);
}

.film-shot {
  overflow: hidden;
}

.film-shot img {
  width: 100%;
  aspect-ratio: 7 / 3;
  object-fit: cover;
}

/* the camera drifts slowly along the herd */
.film-plain {
  animation: drift 24s ease-in-out infinite alternate;
}

@keyframes drift {
  from {
    transform: scale(1.06) translateX(-2%);
  }
  to {
    transform: scale(1.06) translateX(2%);
  }
}

.film-title {
  position: absolute;
  left: 0;
  right: 0;
  top: 13%;
  text-align: center;
  color: var(--cream);
}

.film-title h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(3.2rem, 11vw, 9.4rem);
  font-weight: 900;
  font-variation-settings: "opsz" 144;
  line-height: 0.95;
  letter-spacing: 0.06em;
  text-shadow: 0 4px 30px rgba(34, 26, 20, 0.55), 0 2px 0 rgba(34, 26, 20, 0.5);
}

.film-title p {
  margin-top: 0.5em;
  font-size: clamp(1rem, 2vw, 1.5rem);
  font-style: italic;
  text-shadow: 0 2px 10px rgba(34, 26, 20, 0.8);
}

/* a line of dogs walks along the bottom of the title */
.film-herd {
  position: absolute;
  left: 50%;
  top: calc(13% + clamp(2.6rem, 9vw, 7.6rem));
  width: min(56%, 640px);
  aspect-ratio: 1382 / 174;
  background: url("/images/herd-line.webp") center / contain no-repeat;
  transform: translateX(-50%);
  filter: drop-shadow(0 6px 6px rgba(34, 26, 20, 0.4));
}

.hero-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 24px;
}

.hero-note {
  max-width: 34em;
  padding: 10px 16px;
  background: rgba(247, 239, 220, 0.9);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* the live tracker, a field notebook */
.tracker {
  padding: 30px 0 40px;
}

.notebook {
  max-width: 900px;
  margin: 0 auto;
  padding: 30px 36px 28px 64px;
  background:
    linear-gradient(90deg, transparent 40px, rgba(196, 90, 42, 0.45) 40px, rgba(196, 90, 42, 0.45) 42px, transparent 42px),
    repeating-linear-gradient(transparent 0 31px, rgba(74, 47, 31, 0.14) 31px 32px),
    var(--cream);
  box-shadow: 0 18px 36px rgba(34, 26, 20, 0.4);
  transform: rotate(-0.6deg);
}

.notebook-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 20px;
}

.notebook-updated {
  min-width: 11em;
  text-align: right;
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--sesame);
}

.count {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-top: 8px;
}

.count-number {
  font-family: var(--mono);
  font-size: clamp(4rem, 12vw, 7rem);
  font-weight: 400;
  line-height: 1;
  color: var(--red);
}

.count-label {
  font-family: var(--display);
  font-size: clamp(1.2rem, 2.6vw, 1.8rem);
  font-weight: 700;
}

.gauge {
  margin-top: 20px;
}

.gauge-bar {
  height: 18px;
  border: 2px solid var(--ink);
  background: rgba(255, 255, 255, 0.6);
}

.gauge-fill {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--red));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 1.6s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.gauge-marks {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  font-family: var(--mono);
  font-size: 0.95rem;
  color: rgba(34, 26, 20, 0.55);
}

.gauge-marks li {
  padding-left: 6px;
  border-left: 2px solid rgba(34, 26, 20, 0.35);
}

.gauge-marks li.is-now {
  color: var(--ink);
  font-weight: 700;
  border-left-color: var(--red);
}

.sesame-says {
  margin-top: 18px;
  font-family: var(--display);
  font-size: 1.35rem;
  font-style: italic;
}

.count-source {
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--sesame);
}

/* the walk: a sideways strip */
.herd {
  padding: 30px 0 40px;
}

.herd-hint,
.guide-hint {
  margin: -6px 0 18px;
  font-style: italic;
}

.strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: min(560px, 80vw);
  gap: 22px;
  padding: 8px max(16px, (100vw - 1180px) / 2) 26px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: var(--sesame) transparent;
  cursor: grab;
}

.strip.is-dragging {
  cursor: grabbing;
  scroll-snap-type: none;
  user-select: none;
}

.beat {
  margin: 0;
  padding: 10px 10px 16px;
  background: #0d0a08;
  color: var(--cream);
  scroll-snap-align: center;
}

.beat img {
  pointer-events: none;
}

.beat p {
  margin-top: 12px;
  padding: 0 6px;
  font-style: italic;
  line-height: 1.45;
}

/* field guide */
.guide {
  padding: 30px 0 40px;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.spec {
  display: grid;
  padding: 0;
  border: 0;
  font: inherit;
  text-align: left;
  background: none;
  perspective: 1000px;
}

.spec-front,
.spec-back {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  padding: 10px 10px 14px;
  background: var(--cream);
  box-shadow: 0 10px 20px rgba(34, 26, 20, 0.3);
  backface-visibility: hidden;
  transition: transform 0.8s cubic-bezier(0.3, 0.7, 0.2, 1);
}

.spec-back {
  justify-content: center;
  padding: 24px;
  font-size: 1.2rem;
  font-style: italic;
  line-height: 1.45;
  color: var(--cream);
  background: var(--sesame);
  transform: rotateY(180deg);
}

.spec.is-open .spec-front {
  transform: rotateY(-180deg);
}

.spec.is-open .spec-back {
  transform: rotateY(0);
}

.spec b {
  display: block;
  margin-top: 10px;
  font-family: var(--display);
  font-size: 1.3rem;
  font-style: normal;
  font-weight: 900;
}

.spec-back b {
  margin: 0 0 8px;
  color: var(--gold);
}

/* Sesame */
.elder {
  padding: 30px 0 40px;
}

.elder-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) 1fr;
  align-items: center;
  gap: 0;
}

.elder-photo {
  position: relative;
  z-index: 1;
  border: 10px solid #0d0a08;
  box-shadow: 0 18px 36px rgba(34, 26, 20, 0.45);
}

.elder-words {
  margin-left: -40px;
  padding: 34px 36px 34px 76px;
  background: rgba(247, 239, 220, 0.94);
}

.elder-words p {
  font-family: var(--display);
  font-size: clamp(1.2rem, 2.2vw, 1.6rem);
  font-style: italic;
  line-height: 1.4;
}

.elder-words p + p {
  margin-top: 12px;
}

/* the coin: a ranger's trail sign */
.coin {
  padding: 30px 0 40px;
}

.ranger {
  position: relative;
  max-width: 620px;
  margin: 0 auto;
}

.ranger-sign {
  width: 100%;
  filter: drop-shadow(0 16px 18px rgba(34, 26, 20, 0.45));
}

.ranger-board {
  position: absolute;
  left: 13%;
  right: 13%;
  top: 15%;
  text-align: center;
  color: var(--cream);
}

.ticker {
  font-family: var(--display);
  font-size: clamp(2.4rem, 8vw, 4.6rem);
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 3px 0 rgba(34, 26, 20, 0.6);
}

.ranger-line {
  margin-top: 6px;
  font-size: clamp(0.85rem, 2vw, 1.05rem);
  font-style: italic;
  text-shadow: 0 1px 3px rgba(34, 26, 20, 0.8);
}

.ranger-below {
  max-width: 720px;
  margin: 18px auto 0;
  text-align: center;
}

.ca-box {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border: 2px solid var(--ink);
  background: var(--cream);
}

.ca-text {
  display: block;
  font-family: var(--mono);
  font-size: clamp(11px, 3.2vw, 18px);
  overflow-wrap: anywhere;
}

.ca-status {
  display: block;
  margin-top: 4px;
  font-style: italic;
  color: var(--red);
}

.ranger-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
}

/* footer */
.end {
  padding: 20px 0 40px;
}

.film--end .film-shot img {
  aspect-ratio: 16 / 7;
}

.end-title {
  position: absolute;
  left: 0;
  right: 0;
  top: 14%;
  font-family: var(--display);
  font-size: clamp(2rem, 6vw, 4.8rem);
  font-weight: 900;
  font-variation-settings: "opsz" 144;
  line-height: 1;
  text-align: center;
  color: var(--cream);
  text-shadow: 0 4px 24px rgba(34, 26, 20, 0.7);
}

.end-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 20px;
}

.end-note {
  max-width: 40em;
  padding: 8px 14px;
  font-size: 0.95rem;
  background: rgba(247, 239, 220, 0.9);
}

/* intro: black screen, one narrator line */
.intro {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  color: var(--cream);
  background: #0d0a08;
  transition: opacity 0.6s ease;
}

.intro-line {
  font-family: var(--display);
  font-size: clamp(1.6rem, 4vw, 2.8rem);
  font-style: italic;
  animation: fade-in 1.2s ease both;
}

.intro-tap {
  font-family: var(--mono);
  font-size: 0.9rem;
  color: rgba(247, 239, 220, 0.6);
}

.intro.is-closing {
  opacity: 0;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* 404 */
.lost {
  padding: 40px 0 70px;
}

.lost-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  align-items: center;
  padding: 26px;
  background: var(--cream);
  box-shadow: 0 18px 36px rgba(34, 26, 20, 0.4);
}

.lost-title {
  margin: 0 0 12px;
  font-family: var(--display);
  font-size: clamp(2.6rem, 7vw, 4.4rem);
  font-weight: 900;
  line-height: 1;
}

.lost-card p {
  margin-bottom: 22px;
  font-style: italic;
}

@media (max-width: 900px) {
  .guide-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .elder-grid {
    grid-template-columns: 1fr;
  }

  .elder-photo {
    max-width: 420px;
  }

  .elder-words {
    margin: -40px 0 0 24px;
    padding: 60px 24px 26px;
  }

  .lost-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  body {
    font-size: 16px;
  }

  .third-text small,
  .top-links a:first-child {
    display: none;
  }

  .third-text b {
    white-space: nowrap;
  }

  .film-shot img {
    aspect-ratio: 4 / 3;
  }

  .film-title {
    top: 8%;
  }

  .film-herd {
    top: calc(8% + 3.4rem);
    width: 84%;
  }

  .notebook {
    padding: 22px 18px 20px 46px;
    background:
      linear-gradient(90deg, transparent 28px, rgba(196, 90, 42, 0.45) 28px, rgba(196, 90, 42, 0.45) 30px, transparent 30px),
      repeating-linear-gradient(transparent 0 31px, rgba(74, 47, 31, 0.14) 31px 32px),
      var(--cream);
  }

  .gauge-marks {
    font-size: 0.75rem;
  }

  .guide-grid {
    gap: 12px;
  }

  .spec-back {
    padding: 14px;
    font-size: 0.95rem;
  }

  .spec b {
    font-size: 1.05rem;
  }

  .ranger-line {
    display: none;
  }

  .film--end .film-shot img {
    aspect-ratio: 4 / 3;
  }

  .end-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

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

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
