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

:root {
  --paper: #ecdcb6;
  --paper-light: #f8ecd2;
  --paper-deep: #ddc696;
  --ink: #2b1c11;
  --ink-soft: #4d3826;
  --brass: #a9772f;
  --brass-light: #d9b46a;
  --brass-dark: #7a5420;
  --shadow: rgba(35, 20, 8, 0.35);
  --serif-jp: "Shippori Mincho", "Noto Serif JP", serif;
  --serif-en: "Cinzel", serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; overflow-x: hidden; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-soft);
  font-family: var(--serif-jp);
  line-height: 1.9;
  overflow-x: hidden;
  width: 100%;
}

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

a { color: inherit; }

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

.nowrap { white-space: nowrap; }

/* ---------- Gate ---------- */
#gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: radial-gradient(ellipse at center, #3a2712 0%, #1c1208 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.gate-box {
  max-width: 420px;
  width: 100%;
  text-align: center;
  background: var(--paper-light);
  border: 1px solid var(--brass);
  border-radius: 6px;
  padding: 40px 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.gate-eyebrow {
  font-family: var(--serif-en);
  letter-spacing: 0.25em;
  font-size: 0.7rem;
  color: var(--brass-dark);
  margin: 0 0 12px;
}

.gate-title {
  font-size: 1.6rem;
  margin: 0 0 16px;
  color: var(--ink);
}

.gate-desc {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin: 0 0 24px;
}

#gate-form {
  display: flex;
  gap: 8px;
}

#gate-input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--brass);
  border-radius: 4px;
  background: #fff8e8;
  font-size: 1rem;
  font-family: var(--serif-jp);
}

#gate-form button {
  padding: 12px 18px;
  border: none;
  border-radius: 4px;
  background: var(--brass);
  color: #fff8e8;
  font-family: var(--serif-jp);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

#gate-form button:hover { background: var(--brass-dark); }

.gate-error {
  color: #a13a2e;
  font-size: 0.8rem;
  margin: 14px 0 0;
  display: none;
}

.gate-error.show { display: block; }

.site-hidden { display: none; }

/* ---------- Reveal animation ---------- */
.reveal {
  opacity: 0;
  transform: perspective(900px) rotateX(8deg) translateY(24px);
  transform-origin: top center;
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal.in {
  opacity: 1;
  transform: perspective(900px) rotateX(0) translateY(0);
}

/* ---------- Layout helpers ---------- */
.section { position: relative; padding: 100px 20px; }

.section-inner { max-width: 980px; margin: 0 auto; }

.section-label {
  font-family: var(--serif-en);
  letter-spacing: 0.3em;
  font-size: 0.75rem;
  color: var(--brass-dark);
  text-align: center;
  margin: 0 0 10px;
}

.section-title {
  font-size: clamp(1.6rem, 4vw, 2.3rem);
  text-align: center;
  color: var(--ink);
  margin: 0 0 40px;
  text-wrap: balance;
}

.section-lead {
  text-align: center;
  margin: -20px 0 40px;
  color: var(--ink-soft);
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(217,180,106,0.35), transparent 55%),
    linear-gradient(160deg, #3a2712 0%, #241708 60%, #1a1006 100%);
}

.hero-bg {
  position: absolute;
  inset: -5%;
  background-image: url('assets/img/paper-texture.jpg');
  background-size: cover;
  background-position: center;
  opacity: 0.16;
  mix-blend-mode: overlay;
  animation: heroZoom 26s ease-in-out infinite alternate;
}

@keyframes heroZoom {
  from { transform: scale(1) translate(0,0); }
  to { transform: scale(1.12) translate(-1%, -1%); }
}

.hero-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(10,6,2,0.55) 100%);
  pointer-events: none;
}

.hero-airship {
  position: absolute;
  right: -4%;
  bottom: 6%;
  width: min(52vw, 620px);
  opacity: 0.28;
  filter: drop-shadow(0 0 30px rgba(217,180,106,0.25));
  animation: airshipDrift 12s ease-in-out infinite;
  pointer-events: none;
}

@keyframes airshipDrift {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-16px) rotate(1deg); }
}

.gear-field { position: absolute; inset: 0; pointer-events: none; }

.gear-field::before, .gear-field::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  border: 2px dashed rgba(217,180,106,0.18);
}

.gear-field::before { width: 260px; height: 260px; top: 8%; left: 6%; animation: spin 40s linear infinite; }
.gear-field::after { width: 160px; height: 160px; bottom: 10%; left: 12%; animation: spin 30s linear infinite reverse; }

@keyframes spin { to { transform: rotate(360deg); } }

.hero-inner {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 0 20px;
  max-width: 760px;
}

.hero-eyebrow {
  font-family: var(--serif-en);
  letter-spacing: 0.35em;
  font-size: 0.72rem;
  color: var(--brass-light);
  margin: 0 0 20px;
}

.hero-title {
  font-size: clamp(2.6rem, 9vw, 5rem);
  margin: 0 0 28px;
  background: linear-gradient(180deg, #f3dfa8 0%, #d9b46a 45%, #a9772f 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(217,180,106,0.35));
  animation: titleGlow 5s ease-in-out infinite;
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.2em;
  justify-content: center;
  text-wrap: balance;
}

@keyframes titleGlow {
  0%, 100% { filter: drop-shadow(0 0 14px rgba(217,180,106,0.3)); }
  50% { filter: drop-shadow(0 0 28px rgba(217,180,106,0.55)); }
}

.hero-copy {
  color: #ead9b4;
  font-size: 1rem;
  margin: 0 0 32px;
}

.spec-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 0 0 36px;
}

.chip {
  font-size: 0.78rem;
  padding: 7px 16px;
  border: 1px solid rgba(217,180,106,0.5);
  border-radius: 999px;
  color: var(--brass-light);
  letter-spacing: 0.04em;
}

.cta-button {
  display: inline-block;
  position: relative;
  overflow: hidden;
  padding: 15px 36px;
  border: 1px solid var(--brass-light);
  border-radius: 999px;
  color: #2b1c11;
  background: linear-gradient(180deg, #ecd6a0, #c99a4e);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.06em;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.cta-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 36px rgba(0,0,0,0.4);
}

.cta-button::after {
  content: "";
  position: absolute;
  top: 0; left: -60%;
  width: 40%; height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255,255,255,0.6), transparent);
  transform: skewX(-20deg);
  transition: left 0.6s ease;
}

.cta-button:hover::after { left: 130%; }

.cta-large { padding: 17px 44px; font-size: 1.05rem; }

.scroll-cue {
  position: absolute;
  bottom: 28px; left: 50%;
  transform: translateX(-50%);
  width: 22px; height: 36px;
  border: 2px solid rgba(217,180,106,0.5);
  border-radius: 12px;
}

.scroll-cue span {
  position: absolute;
  top: 6px; left: 50%;
  width: 4px; height: 8px;
  margin-left: -2px;
  background: var(--brass-light);
  border-radius: 2px;
  animation: scrollDown 1.8s ease-in-out infinite;
}

@keyframes scrollDown {
  0% { opacity: 1; top: 6px; }
  70% { opacity: 0; top: 18px; }
  100% { opacity: 0; top: 6px; }
}

/* ---------- Story ---------- */
.story-text { max-width: 680px; margin: 0 auto 56px; font-size: 0.98rem; }
.story-text p { margin: 0 0 1.4em; }
.story-text strong { color: var(--brass-dark); }

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

.glossary-item {
  background: var(--paper-light);
  border: 1px solid var(--paper-deep);
  border-radius: 6px;
  padding: 22px;
}

.glossary-item h3 {
  margin: 0 0 10px;
  font-size: 1rem;
  color: var(--brass-dark);
  position: relative;
  padding-left: 16px;
}

.glossary-item h3::before {
  content: "";
  position: absolute;
  left: 0; top: 4px;
  width: 8px; height: 8px;
  background: var(--brass);
  transform: rotate(45deg);
}

.glossary-item p { margin: 0; font-size: 0.85rem; color: var(--ink-soft); }

/* ---------- Characters ---------- */
.characters { background: var(--paper-light); }

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

.char-card {
  background: var(--paper);
  border: 1px solid var(--paper-deep);
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
}

.char-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 18px 36px var(--shadow);
}

.char-photo {
  height: 260px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: linear-gradient(180deg, var(--paper-deep) 0%, var(--paper) 100%);
  overflow: hidden;
}

.char-photo img {
  height: 100%;
  width: auto;
  object-fit: contain;
  object-position: bottom;
}

.char-body { padding: 18px 18px 22px; flex: 1; display: flex; flex-direction: column; }

.char-job {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--brass);
  margin: 0 0 6px;
}

.char-name {
  font-size: 1.1rem;
  margin: 0 0 10px;
  color: var(--ink);
}

.char-age { font-size: 0.8rem; color: var(--brass-dark); font-weight: 400; }

.char-bio {
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin: 0 0 12px;
  flex: 1;
}

.char-cite {
  font-size: 0.72rem;
  color: var(--brass-dark);
  margin: 0;
  text-align: right;
  font-style: italic;
}

/* ---------- Highlights ---------- */
.highlight-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.highlight-card {
  text-align: center;
  padding: 30px 20px;
}

.highlight-icon {
  width: 56px; height: 56px;
  margin: 0 auto 18px;
  color: var(--brass);
  animation: pulseGlow 3.4s ease-in-out infinite;
}

.highlight-icon svg { width: 100%; height: 100%; }

@keyframes pulseGlow {
  0%, 100% { filter: drop-shadow(0 0 0 rgba(169,119,47,0)); }
  50% { filter: drop-shadow(0 0 10px rgba(169,119,47,0.45)); }
}

.highlight-card h3 { font-size: 1rem; margin: 0 0 10px; color: var(--ink); }
.highlight-card p { font-size: 0.85rem; color: var(--ink-soft); margin: 0; }

/* ---------- Flow ---------- */
.flow { background: var(--paper-light); }

.flow-list {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  max-width: 520px;
  position: relative;
}

.flow-list::before {
  content: "";
  position: absolute;
  left: 23px; top: 8px; bottom: 8px;
  width: 2px;
  background: var(--paper-deep);
}

.flow-item {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 0;
  opacity: 0;
  transform: translateX(-16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.flow-item.in { opacity: 1; transform: translateX(0); }

.flow-num {
  position: relative;
  z-index: 1;
  flex: none;
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--brass);
  color: var(--brass-dark);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif-en);
  font-size: 0.85rem;
}

.flow-text { font-size: 0.95rem; color: var(--ink); }

/* ---------- Purchase / Info ---------- */
.info-panel {
  background: var(--paper-light);
  border: 1px solid var(--paper-deep);
  border-radius: 10px;
  padding: 40px;
  text-align: center;
}

.info-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 30px;
  text-align: left;
  max-width: 620px;
  margin: 0 auto 32px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px dashed var(--paper-deep);
  padding-bottom: 10px;
}

.info-row dt { color: var(--brass-dark); font-size: 0.82rem; flex: none; }
.info-row dd { margin: 0; text-align: right; font-size: 0.88rem; color: var(--ink); }

.info-note {
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin: 20px 0 0;
}

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  padding: 50px 20px 40px;
  font-size: 0.8rem;
  color: var(--ink-soft);
  background: var(--paper);
}

.footer-title {
  font-family: var(--serif-en);
  letter-spacing: 0.1em;
  color: var(--brass-dark);
  font-size: 1rem;
  margin: 0 0 14px;
}

.site-footer p { margin: 4px 0; }
.site-footer a { text-decoration: underline; }

/* ---------- BGM toggle ---------- */
#bgm-toggle {
  position: fixed;
  right: 18px; bottom: 18px;
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--brass-light);
  background: rgba(43, 28, 17, 0.85);
  color: var(--brass-light);
  font-family: var(--serif-jp);
  font-size: 0.78rem;
  cursor: pointer;
  backdrop-filter: blur(4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  transition: background 0.2s ease, transform 0.2s ease;
}

#bgm-toggle:hover { transform: translateY(-2px); }

#bgm-toggle .bgm-icon {
  display: inline-block;
  animation: none;
}

#bgm-toggle[aria-pressed="true"] .bgm-icon {
  animation: notePulse 1s ease-in-out infinite;
}

@keyframes notePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .glossary, .highlight-grid { grid-template-columns: 1fr; }
  .info-list { grid-template-columns: 1fr; }
  .char-grid { grid-template-columns: repeat(2, 1fr); }
  .section { padding: 72px 18px; }
}

@media (max-width: 480px) {
  .hero-title { gap: 0; }
  .spec-chips { gap: 8px; }
  .info-panel { padding: 28px 20px; }
  .char-grid { grid-template-columns: 1fr; max-width: 320px; margin: 0 auto; }
  #bgm-toggle .bgm-label { display: none; }
  #bgm-toggle { padding: 12px; }
}
