:root {
  --bg: #f5efe3;
  --bg-deep: #efe0c2;
  --ink: #211913;
  --muted: #5f5448;
  --line: rgba(52, 38, 22, 0.14);
  --card: rgba(255, 250, 242, 0.8);
  --green: #5f7d3a;
  --green-deep: #40561e;
  --gold: #d8a13d;
  --orange: #d46a38;
  --shadow: 0 22px 60px rgba(72, 48, 22, 0.16);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Atkinson Hyperlegible", system-ui, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(216, 161, 61, 0.23), transparent 32%),
    radial-gradient(circle at top right, rgba(95, 125, 58, 0.2), transparent 28%),
    linear-gradient(180deg, var(--bg), var(--bg-deep));
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 92%);
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  width: 100%;
}

.page-shell {
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 32px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 18px;
  color: #fef7eb;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 900;
  letter-spacing: 0.08em;
  background: linear-gradient(180deg, var(--green), var(--green-deep));
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-text strong {
  font-size: 1.02rem;
}

.brand-text small,
.mini-label,
.page-kicker,
.hero-tag,
.hero-subtitle,
.page-summary,
.ending-copy {
  color: var(--muted);
}

.back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.62);
  font-weight: 700;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.back-link:hover,
.back-link:focus-visible,
.button:hover,
.button:focus-visible {
  transform: translateY(-2px);
}

.hero-card {
  position: relative;
  overflow: hidden;
  margin-top: 18px;
  border-radius: 34px;
  border: 1px solid var(--line);
  background: #1a1611;
  box-shadow: var(--shadow);
  aspect-ratio: 16 / 8.8;
}

.hero-card img {
  height: 100%;
  object-fit: cover;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 26px;
  background: linear-gradient(180deg, transparent 30%, rgba(0, 0, 0, 0.8) 100%);
}

.hero-meta {
  max-width: 42rem;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  margin: 0 0 12px;
  border-radius: 999px;
  color: #fff8ef;
  background: linear-gradient(135deg, var(--orange), var(--gold));
  font-size: 0.82rem;
  font-weight: 700;
}

.hero-title,
.story-intro h2,
.story-page__copy h2,
.ending-card h2 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  letter-spacing: -0.03em;
  line-height: 0.96;
}

.hero-title {
  color: #fff9f0;
  font-size: clamp(2.4rem, 6vw, 5rem);
  max-width: 12ch;
}

.hero-subtitle {
  margin: 12px 0 0;
  color: rgba(255, 248, 240, 0.82);
  font-size: 1.04rem;
}

.story-column {
  display: grid;
  gap: 18px;
  margin-top: 22px;
}

.story-intro {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  padding: 18px 22px 4px;
}

.story-intro h2 {
  font-size: clamp(2rem, 4vw, 3.2rem);
}

.story-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.story-meta span {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.54);
  font-size: 0.92rem;
}

.story-page {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--card);
  box-shadow: 0 16px 36px rgba(74, 53, 24, 0.08);
}

.story-page--reverse .story-page__media {
  order: 2;
}

.story-page__media {
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, rgba(0, 0, 0, 0.08), rgba(255, 255, 255, 0.35));
  min-height: 280px;
}

.story-page__media img {
  height: 100%;
  object-fit: cover;
}

.story-page__copy {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 8px 6px 8px 4px;
}

.story-page__copy h2 {
  font-size: clamp(1.8rem, 3.4vw, 2.8rem);
}

.page-kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.78rem;
}

.page-summary {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.7;
}

.page-body {
  display: grid;
  gap: 10px;
}

.page-body p {
  margin: 0;
  line-height: 1.8;
}

.dialogue-stack {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}

.dialogue {
  margin: 0;
  padding: 14px 15px;
  border-radius: 18px;
  border: 1px solid rgba(95, 125, 58, 0.16);
  background: rgba(255, 255, 255, 0.48);
}

.dialogue-speaker {
  display: block;
  margin-bottom: 5px;
  font-weight: 700;
  color: var(--green-deep);
}

.ending-card {
  margin-top: 8px;
  padding: 24px;
  border-radius: 32px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.75), rgba(248, 240, 226, 0.82));
  box-shadow: var(--shadow);
  text-align: center;
}

.ending-card h2 {
  font-size: clamp(2rem, 4vw, 3rem);
  max-width: 18ch;
  margin: 8px auto 0;
}

.ending-copy {
  margin: 14px auto 0;
  max-width: 42rem;
  line-height: 1.75;
}

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

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.button.primary {
  color: #fffaf3;
  background: linear-gradient(180deg, var(--green), var(--green-deep));
  box-shadow: 0 14px 24px rgba(64, 86, 30, 0.2);
}

.button.secondary {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.55);
}

@media (max-width: 920px) {
  .story-page,
  .story-intro {
    grid-template-columns: 1fr;
    display: grid;
    align-items: start;
  }

  .story-page--reverse .story-page__media {
    order: 0;
  }

  .story-meta {
    justify-content: flex-start;
  }

  .hero-card {
    aspect-ratio: 16 / 10.3;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 18px, 1120px);
    padding-top: 10px;
  }

  .topbar,
  .story-intro {
    padding-inline: 0;
  }

  .hero-card,
  .story-page,
  .ending-card {
    border-radius: 24px;
  }

  .hero-overlay,
  .story-page {
    padding: 16px;
  }

  .story-page__media {
    min-height: 220px;
  }
}
