/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; border: none; background: none; cursor: pointer; color: inherit; }
ul, ol { list-style: none; }

:root {
  --ink: #1f3a3f;
  --ink-soft: #3d5c60;
  --paper: #f7f4ec;
  --paper-warm: #f1ebda;
  --deep: #1c3339;
  --deep-2: #142529;
  --mist: #dfe9e4;
  --gold: #c9a24a;
  --gold-light: #e6c878;
  --line: rgba(31, 58, 63, 0.14);
  --shadow: 0 20px 60px rgba(20, 40, 45, 0.18);
  --ease: cubic-bezier(.22,.61,.36,1);
  --font-serif: "Shippori Mincho", "Zen Old Mincho", serif;
  --font-en: "Cormorant Garamond", serif;
}

body {
  font-family: var(--font-serif);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.9;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

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

.nowrap { white-space: nowrap; }

.section-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 64px);
}

.section-eyebrow {
  font-family: var(--font-en);
  font-style: italic;
  letter-spacing: 0.28em;
  font-size: 0.78rem;
  color: var(--gold);
  text-align: center;
  margin-bottom: 10px;
}
.section-eyebrow.light { color: var(--gold-light); }

.section-title {
  font-size: clamp(1.7rem, 3.2vw, 2.5rem);
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.08em;
  margin-bottom: 20px;
  color: var(--ink);
}
.section-title.light { color: var(--paper); }

.section-lead {
  text-align: center;
  color: var(--ink-soft);
  font-size: clamp(0.95rem, 1.4vw, 1.08rem);
  max-width: 560px;
  margin: 0 auto 56px;
}
.section-lead.light { color: rgba(247,244,236,0.82); }

section { position: relative; }

/* ===== Reveal animation ===== */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
  transition-delay: calc(var(--i, 0) * 90ms);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Top progress bar ===== */
#top-progress {
  position: fixed; top: 0; left: 0; width: 100%; height: 2px;
  z-index: 300; background: transparent;
}
#top-progress-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  transition: width 0.1s linear;
}

/* ===== Header ===== */
#site-header {
  position: fixed; top: 0; left: 0; width: 100%; z-index: 200;
  transition: background 0.4s var(--ease), box-shadow 0.4s var(--ease), padding 0.4s var(--ease);
  padding: 22px 0;
}
#site-header.scrolled {
  background: rgba(247, 244, 236, 0.88);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 24px rgba(20,40,45,0.08);
  padding: 12px 0;
}
.header-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 clamp(20px, 5vw, 64px);
  display: flex; align-items: center; justify-content: space-between;
}
.brand {
  font-size: 1rem; letter-spacing: 0.1em; font-weight: 600;
  color: var(--paper);
  transition: color 0.4s var(--ease);
}
#site-header.scrolled .brand { color: var(--ink); }
.main-nav { display: flex; gap: clamp(16px, 3vw, 36px); }
.main-nav a {
  font-size: 0.86rem; letter-spacing: 0.06em; color: var(--paper);
  position: relative; padding-bottom: 4px;
  transition: color 0.4s var(--ease);
}
#site-header.scrolled .main-nav a { color: var(--ink-soft); }
.main-nav a::after {
  content: ""; position: absolute; left: 0; bottom: 0; width: 0; height: 1px;
  background: currentColor; transition: width 0.35s var(--ease);
}
.main-nav a:hover::after { width: 100%; }

/* ===== BGM toggle ===== */
#bgm-toggle {
  position: fixed; right: clamp(16px, 3vw, 32px); bottom: clamp(16px, 3vw, 32px);
  z-index: 250; width: 54px; height: 54px; border-radius: 50%;
  background: rgba(28, 51, 57, 0.88);
  color: var(--paper);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 30px rgba(20,40,45,0.3);
  backdrop-filter: blur(6px);
  transition: transform 0.3s var(--ease), background 0.3s var(--ease);
}
#bgm-toggle:hover { transform: scale(1.08); background: var(--deep); }
.bgm-icon { width: 20px; height: 20px; }
.icon-note { width: 100%; height: 100%; }
.bgm-bars { display: none; position: absolute; inset: 0; align-items: center; justify-content: center; gap: 3px; }
.bgm-bars i {
  width: 2.5px; height: 8px; background: var(--gold-light); border-radius: 2px;
  animation: bars 0.9s ease-in-out infinite;
}
.bgm-bars i:nth-child(1){animation-delay:0s;}
.bgm-bars i:nth-child(2){animation-delay:0.15s;}
.bgm-bars i:nth-child(3){animation-delay:0.3s;}
.bgm-bars i:nth-child(4){animation-delay:0.45s;}
@keyframes bars { 0%,100%{height:6px;} 50%{height:16px;} }
#bgm-toggle.playing .bgm-icon { display: none; }
#bgm-toggle.playing .bgm-bars { display: flex; }

/* ===== HERO ===== */
#hero {
  position: relative; min-height: 100svh; display: flex; align-items: flex-end;
  overflow: hidden; background: var(--deep-2);
}
.hero-bg {
  position: absolute; inset: 0; z-index: 0;
}
.hero-bg img {
  width: 100%; height: 100%; object-fit: cover; object-position: 60% 30%;
  transform: scale(1.08);
  animation: hero-zoom 26s ease-in-out infinite alternate;
}
@keyframes hero-zoom {
  from { transform: scale(1.08) translateY(0); }
  to { transform: scale(1.16) translateY(-1.5%); }
}
.hero-bg::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(20,37,41,0.15) 0%, rgba(20,37,41,0.05) 40%, rgba(20,37,41,0.75) 100%);
}
#rain-canvas {
  position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: 0.5;
}
.hero-content {
  position: relative; z-index: 2; width: 100%;
  text-align: center; padding: 0 20px 8vh;
}
.hero-eyebrow {
  font-family: var(--font-en); font-style: italic; letter-spacing: 0.3em;
  font-size: 0.85rem; color: var(--gold-light); margin-bottom: 14px;
}
.hero-title {
  font-size: clamp(2.6rem, 7vw, 4.6rem);
  font-weight: 700;
  line-height: 1.28;
  letter-spacing: 0.06em;
  margin-bottom: 26px;
}
.hero-title-line {
  display: block;
  background: linear-gradient(100deg, #fdf6e3 0%, var(--gold-light) 45%, #fff9e8 60%, var(--gold) 85%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 26px rgba(201, 162, 74, 0.35));
  animation: title-sheen 7s ease-in-out infinite;
}
@keyframes title-sheen {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.hero-copy {
  color: var(--paper); font-size: clamp(0.95rem, 1.6vw, 1.15rem);
  letter-spacing: 0.06em; margin-bottom: 34px;
  text-shadow: 0 2px 20px rgba(0,0,0,0.3);
}
.hero-cta { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 14px 34px; border-radius: 999px; font-size: 0.92rem;
  letter-spacing: 0.08em; position: relative; overflow: hidden;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.btn span { position: relative; z-index: 1; }
.btn-primary {
  background: linear-gradient(120deg, var(--gold) 0%, var(--gold-light) 100%);
  color: var(--deep-2); font-weight: 600;
  box-shadow: 0 10px 30px rgba(201,162,74,0.35);
}
.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 16px 40px rgba(201,162,74,0.45); }
.btn-ghost {
  border: 1px solid rgba(247,244,236,0.55); color: var(--paper);
  backdrop-filter: blur(4px);
}
.btn-ghost:hover { background: rgba(247,244,236,0.12); transform: translateY(-3px); }

.scroll-cue {
  position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: rgba(247,244,236,0.75);
}
.scroll-cue-line {
  width: 1px; height: 34px; background: rgba(247,244,236,0.5);
  position: relative; overflow: hidden;
}
.scroll-cue-line::after {
  content: ""; position: absolute; top: -100%; left: 0; width: 100%; height: 100%;
  background: var(--gold-light);
  animation: cue-drop 2.2s ease-in-out infinite;
}
@keyframes cue-drop { 0%{top:-100%;} 60%{top:100%;} 100%{top:100%;} }
.scroll-cue-text { font-family: var(--font-en); font-size: 0.65rem; letter-spacing: 0.3em; }

/* ===== Marquee ===== */
.marquee-wrap {
  background: var(--deep); overflow: hidden; padding: 14px 0;
  border-top: 1px solid rgba(230,200,120,0.2); border-bottom: 1px solid rgba(230,200,120,0.2);
}
.marquee-track {
  display: flex; width: max-content;
  animation: marquee 34s linear infinite;
}
.marquee-track span {
  white-space: nowrap; color: var(--gold-light);
  font-size: 0.85rem; letter-spacing: 0.12em; padding-right: 0;
}
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ===== Story section ===== */
.section-landscape {
  position: relative; padding: 140px 0 120px; overflow: hidden;
  background: var(--deep-2);
}
.landscape-bg { position: absolute; inset: 0; z-index: 0; }
.landscape-bg img {
  width: 100%; height: 100%; object-fit: cover; opacity: 0.55;
}
.landscape-bg::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(20,37,41,0.55) 0%, rgba(20,37,41,0.82) 60%, rgba(20,37,41,0.92) 100%);
}
.story-inner { position: relative; z-index: 1; max-width: 720px; }
.story-inner .section-eyebrow { color: var(--gold-light); }
.story-inner .section-title { color: var(--paper); margin-bottom: 56px; }
.story-text p {
  color: rgba(247,244,236,0.88);
  text-align: center;
  font-size: clamp(0.95rem, 1.5vw, 1.08rem);
  margin-bottom: 28px;
  text-wrap: balance;
}
.story-quote { font-size: clamp(1.05rem, 1.8vw, 1.25rem) !important; color: var(--paper) !important; }
.story-final {
  color: var(--gold-light) !important;
  padding-top: 10px;
  position: relative;
}

/* ===== Gold divider ===== */
.gold-divider { max-width: 420px; margin: 0 auto; padding: 44px 20px; }
.gold-divider svg { width: 100%; height: 30px; display: block; }
.gold-line {
  stroke-dasharray: 460;
  stroke-dashoffset: 460;
  transition: stroke-dashoffset 1.6s var(--ease);
}
.gold-divider.is-visible .gold-line { stroke-dashoffset: 0; }

/* ===== Characters ===== */
#characters { padding: 120px 0 100px; background: var(--paper); }
.characters-banner {
  width: 100%; max-height: 420px; overflow: hidden; margin-bottom: 90px;
  position: relative;
}
.characters-banner::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(28,51,57,0) 60%, var(--paper) 100%);
}
.characters-banner img { width: 100%; height: 100%; object-fit: cover; object-position: center 30%; }

.char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: clamp(18px, 2.4vw, 30px);
}
.char-card {
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease);
}
.char-card:hover { transform: translateY(-8px); box-shadow: 0 26px 70px rgba(20,40,45,0.24); }
.char-card-face {
  position: relative;
  background: var(--card-tint, #eee);
  min-height: 380px;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 26px 22px 28px;
}
.char-blob {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover;
  mix-blend-mode: multiply;
  opacity: 0.9;
  transition: transform 0.6s var(--ease);
}
.char-card:hover .char-blob { transform: scale(1.06); }
.char-card-text { position: relative; z-index: 1; }
.char-role {
  font-size: 0.72rem; letter-spacing: 0.22em; color: var(--card-color, var(--gold));
  font-family: var(--font-en); font-style: italic; margin-bottom: 8px;
}
.char-name {
  font-size: clamp(1.15rem, 3vw, 1.5rem); font-weight: 600; color: var(--ink);
  white-space: nowrap; margin-bottom: 10px; letter-spacing: 0.04em;
}
.char-kana {
  font-size: 0.66rem; letter-spacing: 0.12em; color: var(--ink-soft);
  font-weight: 400; margin-bottom: 4px; white-space: nowrap;
}
.char-desc {
  font-size: 0.86rem; line-height: 1.85; color: var(--ink-soft);
}

/* ===== Highlights ===== */
#highlights { padding: 20px 0 130px; background: var(--paper); }
.highlight-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 28px; margin-top: 10px;
}
.highlight-card {
  background: var(--paper-warm);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 34px 28px;
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease), border-color 0.4s var(--ease);
}
.highlight-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 50px rgba(20,40,45,0.12);
  border-color: rgba(201,162,74,0.4);
}
.highlight-icon {
  display: inline-flex; width: 44px; height: 44px; color: var(--gold);
  margin-bottom: 18px;
}
.highlight-icon svg { width: 100%; height: 100%; }
.highlight-card h3 {
  font-size: 1.08rem; margin-bottom: 12px; letter-spacing: 0.03em; color: var(--ink);
}
.highlight-card p { font-size: 0.88rem; color: var(--ink-soft); line-height: 1.85; }

/* ===== Play / CTA ===== */
#play {
  position: relative; padding: 130px 0 120px; background: var(--deep-2);
  overflow: hidden;
}
.play-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 15% 20%, rgba(90,138,111,0.18), transparent 55%),
    radial-gradient(circle at 85% 80%, rgba(122,106,166,0.18), transparent 55%);
}
#play .section-inner { position: relative; z-index: 1; }
.play-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px; margin-top: 10px;
}
.play-card {
  background: rgba(247,244,236,0.05);
  border: 1px solid rgba(247,244,236,0.15);
  border-radius: 18px; padding: 34px 28px;
  transition: transform 0.4s var(--ease), background 0.4s var(--ease), border-color 0.4s var(--ease);
}
.play-card:hover {
  transform: translateY(-6px);
  background: rgba(247,244,236,0.09);
  border-color: rgba(230,200,120,0.5);
}
.play-icon {
  display: inline-flex; width: 42px; height: 42px; color: var(--gold-light);
  margin-bottom: 20px;
}
.play-icon svg { width: 100%; height: 100%; }
.play-card h3 { color: var(--paper); font-size: 1.1rem; margin-bottom: 12px; letter-spacing: 0.03em; }
.play-card p { color: rgba(247,244,236,0.7); font-size: 0.86rem; line-height: 1.8; margin-bottom: 20px; }
.play-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--gold-light); font-size: 0.85rem; letter-spacing: 0.05em;
}
.arrow { transition: transform 0.35s var(--ease); }
.play-card:hover .arrow { transform: translateX(6px); }

/* ===== Footer ===== */
#site-footer { background: var(--deep-2); padding: 56px 0 40px; text-align: center; }
.footer-inner { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.footer-title { color: var(--paper); font-size: 1.05rem; letter-spacing: 0.1em; }
.footer-nav { display: flex; gap: 26px; flex-wrap: wrap; justify-content: center; }
.footer-nav a { color: rgba(247,244,236,0.7); font-size: 0.85rem; letter-spacing: 0.04em; transition: color 0.3s; }
.footer-nav a:hover { color: var(--gold-light); }
.footer-credit { color: rgba(247,244,236,0.45); font-size: 0.75rem; line-height: 1.8; }

/* ===== Sparkles ===== */
#sparkle-layer { position: fixed; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
.sparkle {
  position: absolute; left: var(--x); top: var(--y);
  width: var(--s); height: var(--s);
  color: var(--gold-light);
  opacity: 0;
  animation: twinkle var(--d) ease-in-out infinite;
}
.sparkle svg { width: 100%; height: 100%; }
@keyframes twinkle {
  0%, 100% { opacity: 0; transform: scale(0.5) rotate(0deg); }
  50% { opacity: 0.75; transform: scale(1) rotate(90deg); }
}

/* ===== Cursor glow (desktop only) ===== */
#cursor-glow {
  position: fixed; width: 340px; height: 340px; border-radius: 50%;
  background: radial-gradient(circle, rgba(230,200,120,0.14), transparent 70%);
  pointer-events: none; z-index: 5; transform: translate(-50%,-50%);
  transition: opacity 0.4s ease; opacity: 0;
}

/* ===== Responsive ===== */
@media (max-width: 720px) {
  .main-nav { display: none; }
  .char-card-face { min-height: 320px; }
  .section-landscape { padding: 100px 0 90px; }
  #characters { padding: 90px 0 70px; }
  #highlights { padding: 10px 0 90px; }
  #play { padding: 90px 0 80px; }
  .characters-banner { max-height: 260px; margin-bottom: 60px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { transition: opacity 0.4s ease; transform: none !important; }
  .hero-bg img { animation: none; }
  .marquee-track { animation-duration: 90s; }
}
