/* ============ Tokens ============ */
:root {
  --cream: #f7f2e7;
  --cream-2: #efe8d8;
  --ink: #241c13;
  --ink-soft: #5b5142;
  --gold: #a9822f;
  --gold-bright: #c9a227;
  --stage-dark: #171310;
  --stage-dark-2: #0e0b08;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Jost', 'Helvetica Neue', Arial, sans-serif;
  --shadow-soft: 0 20px 60px rgba(20, 14, 5, 0.18);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

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

/* subtle paper grain overlay */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

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

/* ============ Embed mode (used inside pop-out iframes) ============ */
html[data-embed="1"] .site-header,
html[data-embed="1"] .hero,
html[data-embed="1"] .site-footer,
html[data-embed="1"] .catalog-heading {
  display: none !important;
}
html[data-embed="1"] body { overflow: hidden; height: 100vh; }
html[data-embed="1"] main { height: 100vh; }
html[data-embed="1"] .catalog-section {
  padding: clamp(0.75rem, 2vw, 1.5rem);
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}
html[data-embed="1"] .stage {
  flex: 1;
  width: 100%;
  min-height: 0;
  max-width: 1400px;
}
html[data-embed="1"] .controls { flex: none; }
html[data-embed="1"] .catalog-footnote { flex: none; }

/* ============ Header ============ */
.site-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.6rem clamp(1.25rem, 4vw, 3.5rem);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--ink);
  min-width: 0;
  overflow: hidden;
}
.brand-mark { color: var(--gold); flex: none; }
.brand-word {
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-cta {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.55rem 1.1rem;
  border: 1px solid rgba(36, 28, 19, 0.25);
  border-radius: 999px;
  transition: background 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
  flex: none;
}
.header-cta:hover {
  background: var(--ink);
  color: var(--cream);
  border-color: var(--ink);
}

/* ============ Hero ============ */
.hero {
  position: relative;
  z-index: 2;
  max-width: 760px;
  margin: clamp(1rem, 6vw, 3rem) auto 0;
  padding: clamp(2rem, 6vw, 4rem) 1.5rem 2.5rem;
  text-align: center;
}

.hero-eyebrow {
  font-family: var(--sans);
  font-size: 0.8rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 1rem;
}

.hero-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(3.5rem, 11vw, 6.5rem);
  line-height: 1.05;
  margin: 0 0 0.9rem;
  letter-spacing: 0.01em;
}

.hero-dates {
  font-family: var(--sans);
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin: 0 0 1.6rem;
}

.hero-sub {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  line-height: 1.55;
  color: var(--ink);
  max-width: 560px;
  margin: 0 auto 2.2rem;
}

.hero-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--cream);
  background: var(--ink);
  padding: 0.95rem 1.8rem;
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}
.hero-btn:hover {
  transform: translateY(-2px);
  background: #382a17;
}
.hero-btn svg { animation: bob 1.8s ease-in-out infinite; }
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(3px); }
}

/* ============ Catalog Section ============ */
.catalog-section {
  position: relative;
  z-index: 2;
  padding: clamp(2rem, 5vw, 3.5rem) 1rem clamp(3rem, 6vw, 5rem);
}

.catalog-heading {
  text-align: center;
  max-width: 520px;
  margin: 0 auto 2rem;
}
.catalog-heading h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  margin: 0 0 0.4rem;
}
.catalog-heading p {
  font-size: 0.88rem;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
  margin: 0;
}

.stage {
  position: relative;
  max-width: 1180px;
  margin: 0 auto;
  border-radius: 22px;
  background:
    radial-gradient(120% 140% at 50% 12%, #241c14 0%, var(--stage-dark) 45%, var(--stage-dark-2) 100%);
  padding: clamp(1.75rem, 5vw, 3.5rem) clamp(1rem, 5vw, 4rem);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 480px;
  box-shadow: 0 30px 80px rgba(10, 7, 3, 0.35);
  overflow: hidden;
}

.stage-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  color: var(--cream-2);
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.05rem;
  z-index: 5;
  background: radial-gradient(120% 140% at 50% 12%, #241c14 0%, var(--stage-dark) 45%, var(--stage-dark-2) 100%);
  transition: opacity 0.5s ease;
}
.stage-loading.hidden { opacity: 0; pointer-events: none; }

.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid rgba(201, 162, 39, 0.25);
  border-top-color: var(--gold-bright);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.book-wrap {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
}

#book {
  box-shadow: 0 25px 70px rgba(0,0,0,0.55);
}

/* page-flip renders its own page canvas/img elements; keep them crisp */
#book img { display: block; width: 100%; height: 100%; object-fit: cover; }

.nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(247, 242, 231, 0.25);
  background: rgba(247, 242, 231, 0.06);
  color: var(--cream-2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
  z-index: 6;
  backdrop-filter: blur(4px);
}
.nav-arrow:hover { background: rgba(201, 162, 39, 0.18); border-color: var(--gold-bright); }
.nav-arrow:active { transform: translateY(-50%) scale(0.94); }
.nav-prev { left: clamp(0.4rem, 2vw, 1.75rem); }
.nav-next { right: clamp(0.4rem, 2vw, 1.75rem); }
.nav-arrow:disabled { opacity: 0.3; cursor: default; }

.fullscreen-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(247, 242, 231, 0.25);
  background: rgba(247, 242, 231, 0.06);
  color: var(--cream-2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 6;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.fullscreen-btn:hover { background: rgba(201, 162, 39, 0.18); border-color: var(--gold-bright); }

.controls {
  max-width: 560px;
  margin: 1.6rem auto 0;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.page-slider {
  flex: 1;
  appearance: none;
  height: 3px;
  background: rgba(36, 28, 19, 0.18);
  border-radius: 999px;
  outline: none;
}
.page-slider::-webkit-slider-thumb {
  appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--gold-bright);
  border: 2px solid var(--cream);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  cursor: pointer;
}
.page-slider::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--gold-bright);
  border: 2px solid var(--cream);
  cursor: pointer;
}

.page-indicator {
  font-family: var(--sans);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  white-space: nowrap;
  min-width: 64px;
  text-align: right;
}

.catalog-footnote {
  text-align: center;
  margin-top: 1.4rem;
}
.catalog-footnote a {
  font-size: 0.82rem;
  color: var(--ink-soft);
  border-bottom: 1px solid rgba(36,28,19,0.25);
  padding-bottom: 1px;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.catalog-footnote a:hover { color: var(--gold); border-color: var(--gold); }

/* ============ Footer ============ */
.site-footer {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 2rem 1rem 2.5rem;
  font-size: 0.8rem;
  color: var(--ink-soft);
}
.site-footer a { border-bottom: 1px solid rgba(36,28,19,0.25); }
.site-footer a:hover { color: var(--gold); border-color: var(--gold); }

/* ============ Responsive ============ */
@media (max-width: 720px) {
  .stage { min-height: 380px; padding: 1.25rem 0.5rem; }
  .nav-arrow { width: 38px; height: 38px; }
  .controls { max-width: 92%; }
}

@media (max-width: 560px) {
  .site-header { padding: 1.25rem 1rem; gap: 0.5rem; }
  .brand-word { font-size: 0.62rem; letter-spacing: 0.08em; }
  .brand svg { width: 22px; height: 22px; }
  .header-cta { font-size: 0.66rem; padding: 0.5rem 0.8rem; white-space: nowrap; }
}

@media (max-width: 380px) {
  .site-header { flex-wrap: wrap; }
  .brand-word { display: none; }
}

/* Fullscreen mode */
.stage:fullscreen {
  border-radius: 0;
  width: 100vw;
  height: 100vh;
  max-width: none;
}
.stage:fullscreen .book-wrap { height: 100%; }
