:root {
  --forest-950: #0b211d;
  --forest-900: #113129;
  --forest-800: #173f35;
  --forest-700: #27584a;
  --ivory: #f7f1e6;
  --paper: #eee4d3;
  --blush: #d9aba5;
  --rose: #b46f6d;
  --gold: #c7a76b;
  --ink: #1f2a25;
  --serif: "Iowan Old Style", "Baskerville", "Times New Roman", "Yu Mincho", "Hiragino Mincho ProN", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--forest-950);
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--ivory);
  font-family: var(--sans);
  overflow-x: hidden;
}

body.is-locked {
  height: 100dvh;
  overflow: hidden;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

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

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 1rem;
  left: 1rem;
  padding: 0.75rem 1rem;
  color: var(--forest-950);
  background: var(--ivory);
  transform: translateY(-180%);
}

.skip-link:focus {
  transform: translateY(0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sp-only {
  display: none;
}

/* Opening story gate */
.story-gate {
  position: fixed;
  z-index: 500;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  perspective: 1600px;
  color: var(--ivory);
  background: var(--forest-950);
  transition: visibility 0s linear 2.2s;
}

.story-gate::after {
  content: "";
  position: absolute;
  z-index: 4;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(8, 24, 20, 0.16), rgba(8, 24, 20, 0.7)),
    radial-gradient(circle at 50% 50%, transparent 0 15%, rgba(8, 24, 20, 0.5) 82%);
  pointer-events: none;
  transition: opacity 1s ease 0.35s;
}

.story-gate__panel {
  position: absolute;
  z-index: 3;
  top: 0;
  width: 50.05%;
  height: 100%;
  background-color: var(--forest-900);
  background-image:
    linear-gradient(rgba(10, 31, 26, 0.14), rgba(10, 31, 26, 0.2)),
    url("./assets/story-door.webp");
  background-repeat: no-repeat;
  background-size: 200% 100%;
  backface-visibility: hidden;
  box-shadow: inset 0 0 70px rgba(5, 18, 14, 0.65);
  transition: transform 1.85s cubic-bezier(0.72, 0, 0.16, 1), filter 1.6s ease;
}

.story-gate__panel--left {
  left: 0;
  background-position: left center;
  transform-origin: left center;
}

.story-gate__panel--right {
  right: 0;
  background-position: right center;
  transform-origin: right center;
}

.story-gate__glow {
  position: absolute;
  z-index: 2;
  inset: -10%;
  background: radial-gradient(circle, #fff8cf 0, #edc98b 18%, rgba(209, 164, 93, 0.12) 45%, transparent 68%);
  opacity: 0.35;
  filter: blur(10px);
  animation: breathe 3.4s ease-in-out infinite;
}

.story-gate__copy {
  position: relative;
  z-index: 6;
  width: min(90%, 720px);
  padding: 2rem;
  text-align: center;
  text-shadow: 0 3px 30px rgba(4, 20, 15, 0.9);
  transition: opacity 0.5s ease, transform 0.7s ease;
}

.story-gate__eyebrow,
.kicker,
.chapter-label {
  margin: 0 0 1.2rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.28em;
}

.story-gate h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.35rem, 7vw, 5.8rem);
  font-weight: 500;
  line-height: 1.32;
  letter-spacing: 0.08em;
}

.open-story {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  margin-top: 2.4rem;
  padding: 0.95rem 1.2rem 0.95rem 1.55rem;
  color: var(--forest-950);
  background: rgba(247, 241, 230, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 999px;
  box-shadow: 0 14px 50px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: transform 0.25s ease, background 0.25s ease;
}

.open-story:hover,
.open-story:focus-visible {
  background: #fffaf0;
  transform: translateY(-3px);
}

.open-story__key {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  color: var(--ivory);
  background: var(--forest-800);
  border-radius: 50%;
  font-family: var(--serif);
  font-size: 1.3rem;
}

.skip-story {
  display: block;
  margin: 1rem auto 0;
  padding: 0.5rem;
  color: rgba(247, 241, 230, 0.8);
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(247, 241, 230, 0.35);
  cursor: pointer;
}

.story-gate__leaf {
  position: absolute;
  z-index: 5;
  width: 0.65rem;
  height: 1.4rem;
  background: rgba(221, 184, 126, 0.72);
  border-radius: 100% 0 100% 0;
  filter: blur(0.2px);
  pointer-events: none;
  animation: leaf-fall 7s linear infinite;
}

.story-gate__leaf--one { left: 18%; animation-delay: -2s; }
.story-gate__leaf--two { left: 66%; animation-delay: -5s; animation-duration: 9s; }
.story-gate__leaf--three { left: 82%; animation-delay: -1s; animation-duration: 6s; }

.story-gate.is-opening::after,
.story-gate.is-opening .story-gate__copy,
.story-gate.is-open::after,
.story-gate.is-open .story-gate__copy {
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  pointer-events: none;
}

.story-gate.is-opening .story-gate__panel--left,
.story-gate.is-open .story-gate__panel--left {
  transform: rotateY(-108deg);
  filter: brightness(0.55);
}

.story-gate.is-opening .story-gate__panel--right,
.story-gate.is-open .story-gate__panel--right {
  transform: rotateY(108deg);
  filter: brightness(0.55);
}

.story-gate.is-open {
  visibility: hidden;
  pointer-events: none;
}

/* Site */
.site-shell {
  min-height: 100vh;
  background: var(--ivory);
}

.site-header {
  position: absolute;
  z-index: 20;
  top: 0;
  left: 0;
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  padding: 1.4rem clamp(1.2rem, 5vw, 5rem);
  color: var(--ivory);
}

.brand {
  font-family: var(--serif);
  font-size: 1.35rem;
  letter-spacing: 0.24em;
}

.desktop-nav {
  display: flex;
  gap: 2.2rem;
  font-family: var(--serif);
  font-size: 0.92rem;
  letter-spacing: 0.09em;
}

.desktop-nav a {
  position: relative;
  padding: 0.4rem 0;
}

.desktop-nav a::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transition: transform 0.25s ease;
}

.desktop-nav a:hover::after,
.desktop-nav a:focus-visible::after {
  transform: scaleX(1);
}

.menu-button,
.mobile-nav {
  display: none;
}

.hero {
  position: relative;
  display: grid;
  min-height: 100svh;
  place-items: center;
  overflow: hidden;
  color: var(--ivory);
  background: var(--forest-900);
}

.hero__image {
  position: absolute;
  inset: -4%;
  background-image: url("./assets/story-door.webp");
  background-position: center;
  background-size: cover;
  animation: slow-push 14s ease-out both;
}

.hero__veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(6, 25, 20, 0.35), rgba(6, 25, 20, 0.78)),
    radial-gradient(circle at 50% 48%, rgba(217, 171, 165, 0.08), rgba(5, 20, 16, 0.36) 60%);
}

.hero__content {
  position: relative;
  z-index: 2;
  width: min(90%, 1000px);
  padding: 8rem 0 5rem;
  text-align: center;
}

.kicker {
  color: rgba(247, 241, 230, 0.82);
}

.hero h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(3rem, 8vw, 7.5rem);
  font-weight: 400;
  line-height: 1.13;
  letter-spacing: 0.07em;
}

.hero h2 em {
  color: #f1cdc6;
  font-style: normal;
}

.hero__lead {
  margin: 2rem 0;
  font-family: var(--serif);
  font-size: clamp(1rem, 2vw, 1.3rem);
  line-height: 2;
  letter-spacing: 0.12em;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid rgba(247, 241, 230, 0.55);
  font-size: 0.83rem;
  letter-spacing: 0.12em;
}

.text-link span {
  animation: arrow-bob 1.8s ease-in-out infinite;
}

.hero__chapter {
  position: absolute;
  z-index: 2;
  right: clamp(1.2rem, 4vw, 4rem);
  bottom: 2.5rem;
  margin: 0;
  font-family: var(--serif);
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  writing-mode: vertical-rl;
}

.hero__sparkles i {
  position: absolute;
  z-index: 2;
  width: 4px;
  height: 4px;
  background: #fff4c5;
  border-radius: 50%;
  box-shadow: 0 0 12px #fff4c5;
  animation: sparkle 4.4s ease-in-out infinite;
}

.hero__sparkles i:nth-child(1) { top: 24%; left: 18%; }
.hero__sparkles i:nth-child(2) { top: 46%; left: 76%; animation-delay: -1.2s; }
.hero__sparkles i:nth-child(3) { top: 68%; left: 28%; animation-delay: -2.5s; }
.hero__sparkles i:nth-child(4) { top: 20%; left: 62%; animation-delay: -3.5s; }
.hero__sparkles i:nth-child(5) { top: 76%; left: 84%; animation-delay: -0.7s; }

.section-pad {
  padding: clamp(5.5rem, 11vw, 10rem) clamp(1.3rem, 8vw, 8rem);
}

.chapter-label {
  color: var(--rose);
}

.intro {
  display: grid;
  grid-template-columns: minmax(10rem, 0.7fr) minmax(20rem, 1fr);
  column-gap: 8vw;
  align-items: start;
  background:
    radial-gradient(circle at 80% 20%, rgba(217, 171, 165, 0.22), transparent 25%),
    var(--ivory);
}

.intro > .chapter-label {
  grid-column: 1 / -1;
}

.intro h2,
.section-heading h2,
.about h2,
.closing h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.2rem, 5vw, 4.8rem);
  font-weight: 400;
  line-height: 1.34;
  letter-spacing: 0.07em;
}

.intro__copy {
  padding-top: 0.45rem;
  font-family: var(--serif);
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  line-height: 2.2;
  letter-spacing: 0.055em;
}

.intro__copy p {
  margin: 0 0 1.5rem;
}

.chapters {
  color: var(--ivory);
  background: var(--forest-900);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 3rem;
  margin-bottom: clamp(3rem, 6vw, 5rem);
}

.section-heading .chapter-label {
  color: #d9b9ad;
}

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid rgba(247, 241, 230, 0.2);
  border-left: 1px solid rgba(247, 241, 230, 0.2);
}

.chapter-card {
  position: relative;
  min-height: 25rem;
  padding: clamp(2rem, 5vw, 4.5rem);
  overflow: hidden;
  border-right: 1px solid rgba(247, 241, 230, 0.2);
  border-bottom: 1px solid rgba(247, 241, 230, 0.2);
  transition: background-color 0.4s ease, color 0.4s ease;
}

.chapter-card::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 10rem;
  height: 10rem;
  background: radial-gradient(circle at 100% 0, rgba(217, 171, 165, 0.35), transparent 65%);
  transition: transform 0.5s ease;
}

.chapter-card:hover {
  color: var(--forest-950);
  background: var(--paper);
}

.chapter-card:hover::before {
  transform: scale(1.5);
}

.chapter-card__number {
  margin: 0 0 4rem;
  color: var(--gold);
  font-family: var(--serif);
  font-size: 0.8rem;
  letter-spacing: 0.2em;
}

.chapter-card__en {
  margin: 0 0 0.7rem;
  font-family: var(--serif);
  font-size: 0.95rem;
  font-style: italic;
  letter-spacing: 0.1em;
}

.chapter-card h3 {
  margin: 0 0 1.5rem;
  font-family: var(--serif);
  font-size: clamp(1.8rem, 3vw, 3rem);
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: 0.08em;
}

.chapter-card > p:last-child {
  max-width: 30rem;
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.9;
}

.quote-band {
  position: relative;
  padding: clamp(6rem, 13vw, 12rem) 1.5rem;
  overflow: hidden;
  text-align: center;
  background:
    linear-gradient(115deg, rgba(217, 171, 165, 0.22), transparent 45%),
    var(--paper);
}

.quote-band::before,
.quote-band::after {
  content: "";
  position: absolute;
  width: 32rem;
  height: 32rem;
  border: 1px solid rgba(39, 88, 74, 0.16);
  border-radius: 50%;
}

.quote-band::before { top: -19rem; left: -12rem; }
.quote-band::after { right: -14rem; bottom: -22rem; }

.quote-band__ornament {
  color: var(--rose);
  font-size: 1.2rem;
}

.quote-band blockquote {
  margin: 1.5rem auto;
  font-family: var(--serif);
  font-size: clamp(2rem, 5vw, 4.6rem);
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: 0.08em;
}

.quote-band__sign {
  color: var(--forest-700);
  font-family: var(--serif);
  font-style: italic;
  letter-spacing: 0.16em;
}

.about {
  display: grid;
  grid-template-columns: minmax(17rem, 0.8fr) minmax(20rem, 1.15fr);
  gap: clamp(3rem, 8vw, 8rem);
  align-items: center;
}

.about__portrait {
  position: relative;
  display: grid;
  min-height: 36rem;
  place-content: center;
  overflow: hidden;
  color: var(--ivory);
  text-align: center;
  background:
    linear-gradient(140deg, rgba(217, 171, 165, 0.42), transparent 45%),
    var(--forest-800);
  border-radius: 55% 55% 1rem 1rem / 26% 26% 1rem 1rem;
  box-shadow: 0 25px 60px rgba(16, 49, 41, 0.2);
}

.about__portrait::before {
  content: "";
  position: absolute;
  inset: 1.2rem;
  border: 1px solid rgba(247, 241, 230, 0.4);
  border-radius: inherit;
}

.about__monogram {
  font-family: var(--serif);
  font-size: 10rem;
  font-style: italic;
  line-height: 0.9;
}

.about__portrait p {
  position: relative;
  margin: 1.5rem 0 0;
  font-family: var(--serif);
  font-size: 0.9rem;
  font-style: italic;
  line-height: 1.7;
  letter-spacing: 0.14em;
}

.about__content > p:not(.chapter-label) {
  margin: 2rem 0;
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 2.15;
  letter-spacing: 0.045em;
}

.proof-list {
  margin: 2.5rem 0 0;
  padding: 0;
  border-top: 1px solid rgba(31, 42, 37, 0.2);
  list-style: none;
}

.proof-list li {
  padding: 1rem 0;
  border-bottom: 1px solid rgba(31, 42, 37, 0.2);
  font-family: var(--serif);
  letter-spacing: 0.08em;
}

.closing {
  position: relative;
  display: grid;
  min-height: 90svh;
  place-items: center;
  overflow: hidden;
  padding: 6rem 1.5rem;
  color: var(--ivory);
  text-align: center;
  background:
    radial-gradient(circle at 50% 72%, rgba(217, 171, 165, 0.3), transparent 28%),
    linear-gradient(160deg, var(--forest-800), var(--forest-950));
}

.closing::before {
  content: "";
  position: absolute;
  top: 8%;
  width: min(74vw, 50rem);
  height: min(74vw, 50rem);
  border: 1px solid rgba(247, 241, 230, 0.15);
  border-radius: 50%;
}

.closing__content {
  position: relative;
  z-index: 2;
}

.closing .chapter-label {
  color: #e7bfb8;
}

.closing__content > p:not(.chapter-label) {
  margin: 2rem 0;
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 2;
  letter-spacing: 0.08em;
}

.primary-button {
  display: inline-flex;
  min-height: 3.8rem;
  align-items: center;
  justify-content: center;
  padding: 1rem 1.8rem;
  color: var(--forest-950);
  background: var(--ivory);
  border: 1px solid var(--ivory);
  border-radius: 999px;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  transition: color 0.25s ease, background 0.25s ease, transform 0.25s ease;
}

.primary-button:hover,
.primary-button:focus-visible {
  color: var(--ivory);
  background: transparent;
  transform: translateY(-3px);
}

.replay-button {
  display: block;
  margin: 1.5rem auto 0;
  padding: 0.6rem;
  color: rgba(247, 241, 230, 0.75);
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(247, 241, 230, 0.3);
  cursor: pointer;
}

footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: 2rem clamp(1.3rem, 5vw, 5rem);
  color: rgba(247, 241, 230, 0.75);
  background: #071b17;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

footer p {
  margin: 0;
  text-align: center;
}

footer p:last-child {
  text-align: right;
}

.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.9s ease, transform 0.9s cubic-bezier(0.2, 0.65, 0.2, 1);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes breathe {
  0%, 100% { opacity: 0.25; transform: scale(0.92); }
  50% { opacity: 0.7; transform: scale(1.08); }
}

@keyframes leaf-fall {
  0% { top: -10%; transform: translateX(0) rotate(0deg); opacity: 0; }
  12% { opacity: 0.75; }
  100% { top: 110%; transform: translateX(8vw) rotate(420deg); opacity: 0; }
}

@keyframes slow-push {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

@keyframes sparkle {
  0%, 100% { opacity: 0.08; transform: scale(0.4); }
  50% { opacity: 0.9; transform: scale(1.4); }
}

@keyframes arrow-bob {
  0%, 100% { transform: translateY(-2px); }
  50% { transform: translateY(4px); }
}

@media (max-width: 760px) {
  .sp-only { display: initial; }
  .desktop-only { display: none; }

  .story-gate__panel {
    background-size: auto 100%;
  }

  .story-gate__panel--left {
    background-position: calc(50% - 25vw) center;
  }

  .story-gate__panel--right {
    background-position: calc(50% + 25vw) center;
  }

  .story-gate__copy {
    padding: 1rem;
  }

  .story-gate h1 {
    font-size: clamp(2.25rem, 11vw, 3.4rem);
    line-height: 1.42;
  }

  .site-header {
    position: absolute;
    padding: 1.2rem;
  }

  .desktop-nav {
    display: none;
  }

  .menu-button {
    position: relative;
    z-index: 3;
    display: grid;
    width: 2.8rem;
    height: 2.8rem;
    place-content: center;
    gap: 5px;
    padding: 0;
    color: inherit;
    background: rgba(8, 29, 24, 0.25);
    border: 1px solid rgba(247, 241, 230, 0.35);
    border-radius: 50%;
  }

  .menu-button > span:not(.sr-only) {
    width: 1.1rem;
    height: 1px;
    background: currentColor;
    transition: transform 0.3s ease, opacity 0.3s ease;
  }

  .menu-button[aria-expanded="true"] > span:first-child {
    transform: translateY(6px) rotate(45deg);
  }

  .menu-button[aria-expanded="true"] > span:nth-child(2) {
    opacity: 0;
  }

  .menu-button[aria-expanded="true"] > span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }

  .mobile-nav {
    position: fixed;
    z-index: 2;
    inset: 0;
    display: grid;
    align-content: center;
    gap: 1.7rem;
    padding: 4rem 2rem;
    text-align: center;
    background: rgba(11, 33, 29, 0.97);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-1rem);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0.3s;
  }

  .mobile-nav.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition-delay: 0s;
  }

  .mobile-nav a {
    font-family: var(--serif);
    font-size: 1.7rem;
    letter-spacing: 0.09em;
  }

  .hero__content {
    width: 88%;
    padding-top: 7rem;
  }

  .hero h2 {
    font-size: clamp(3rem, 15vw, 4.7rem);
    line-height: 1.26;
  }

  .hero__chapter {
    right: 0.8rem;
    bottom: 1.5rem;
  }

  .intro {
    display: block;
  }

  .intro h2 {
    margin-bottom: 2rem;
  }

  .section-heading {
    display: block;
  }

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

  .chapter-card {
    min-height: 22rem;
    padding: 2.5rem 1.5rem;
  }

  .chapter-card__number {
    margin-bottom: 3rem;
  }

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

  .about__portrait {
    min-height: 29rem;
  }

  footer {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 0.8rem;
    text-align: center;
  }

  footer p:last-child {
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
