:root {
  --cream: #f8f5ee;
  --cream-soft: rgba(248, 245, 238, 0.78);
  --cream-muted: rgba(248, 245, 238, 0.54);
  --gold: #e6c98f;
  --glass: rgba(18, 24, 21, 0.42);
  --glass-border: rgba(255, 255, 255, 0.18);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #131b16;
  color: var(--cream);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  cursor: none;
}

@media (pointer: coarse) {
  html,
  body {
    cursor: auto;
  }
  #cursor-dot,
  #cursor-ring {
    display: none;
  }
}

/* Cinematic Blurred Environment Stage */
#env-stage {
  position: fixed;
  inset: -4%;
  width: 108%;
  height: 108%;
  z-index: 0;
  overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #243829 0%, #101914 100%);
}

.env-layer {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transform: scale(1.06);
  filter: blur(9px) saturate(1.12) brightness(0.86);
  will-change: opacity, transform;
}

.env-0 {
  opacity: 1;
  filter: blur(4.5px) saturate(1.14) brightness(0.88);
  background-image:
    radial-gradient(circle at 55% 22%, rgba(255, 234, 175, 0.22), transparent 55%),
    url("./bg-forest.jpg");
}

.env-1 {
  filter: blur(2.5px) saturate(1.08) brightness(0.9);
  background-image:
    radial-gradient(circle at 50% 30%, rgba(255, 240, 206, 0.2), transparent 60%),
    url("./bg-archive.jpg");
}

.env-2 {
  filter: blur(1.5px) saturate(1.1) brightness(0.9);
  background-image:
    radial-gradient(circle at 50% 45%, rgba(255, 246, 214, 0.14), transparent 60%),
    url("./bg-pond.jpg");
}

.env-frosted-veil {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 48%, rgba(10, 16, 12, 0.04) 0%, rgba(8, 12, 10, 0.36) 100%),
    linear-gradient(180deg, rgba(8, 12, 10, 0.24) 0%, transparent 22%, transparent 76%, rgba(8, 12, 10, 0.46) 100%);
}

/* Crisp Foreground Interactive Canvas */
#world {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  z-index: 5;
}

/* Custom Cursor */
#cursor-dot {
  position: fixed;
  top: -40px;
  left: -40px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fffdf7;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 12px rgba(255, 250, 230, 0.95);
}

#cursor-ring {
  position: fixed;
  top: -40px;
  left: -40px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.2px solid rgba(255, 252, 240, 0.45);
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, -50%);
  transition: width 0.26s cubic-bezier(0.22, 1, 0.36, 1),
    height 0.26s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.22s ease,
    background-color 0.22s ease;
}

body.cursor-active #cursor-ring {
  width: 56px;
  height: 56px;
  border-color: rgba(246, 222, 162, 0.92);
  background: rgba(246, 222, 162, 0.12);
}

/* Header Navigation */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 38px;
  pointer-events: none;
}

.topbar > * {
  pointer-events: auto;
}

.brand {
  appearance: none;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--cream);
  padding: 9px 16px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: none;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  transition: transform 0.22s ease, border-color 0.22s ease;
}

.brand:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.38);
}

.brand-seed {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, #b8f2be, #f3d38c);
  box-shadow: 0 0 10px rgba(184, 242, 190, 0.85);
}

.brand-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.22em;
}

.brand-sub {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  opacity: 0.65;
  padding-left: 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
}

.chapter-jump,
.email-pill {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--cream-soft);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: none;
  transition: all 0.22s ease;
}

.chapter-jump:hover {
  color: #ffffff;
}

.chapter-jump.active {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.email-pill {
  background: rgba(246, 224, 174, 0.16);
  border: 1px solid rgba(246, 224, 174, 0.34);
  color: #fdf6e4;
}

.email-pill:hover {
  background: rgba(246, 224, 174, 0.28);
}

/* Bottom-Left Poetic Editorial Caption */
.scene-plaque {
  position: fixed;
  left: 42px;
  bottom: 36px;
  z-index: 20;
  max-width: 470px;
  pointer-events: none;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.55);
  transition: opacity 0.35s ease;
}

.plaque-kicker {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.24em;
  color: #e8d39e;
  margin-bottom: 8px;
}

.plaque-heading {
  font-family: "Playfair Display", "Didot", "Optima", "Georgia", serif;
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 500;
  line-height: 1.16;
  letter-spacing: -0.01em;
  color: #fcfaf5;
  margin-bottom: 8px;
}

.plaque-sub {
  font-size: 13px;
  line-height: 1.55;
  color: rgba(248, 245, 238, 0.78);
}

/* Scene III Floating Frosted Glass Studio Plaque */
.sanctuary-card {
  position: fixed;
  right: 68px;
  bottom: 42px;
  z-index: 25;
  max-width: 390px;
  padding: 26px 28px;
  border-radius: 24px;
  background: rgba(16, 26, 22, 0.46);
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.24);
  opacity: 0;
  transform: translateY(18px);
  pointer-events: none;
  transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.sanctuary-card.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.card-eyebrow {
  display: block;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: #d8ebc8;
  margin-bottom: 6px;
}

.card-name {
  font-family: "Optima", "Georgia", serif;
  font-size: 24px;
  font-weight: 500;
  letter-spacing: 0.12em;
  margin-bottom: 8px;
}

.card-tagline {
  font-size: 13px;
  line-height: 1.55;
  color: rgba(248, 245, 238, 0.76);
  margin-bottom: 18px;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn-primary,
.btn-glass {
  appearance: none;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-decoration: none;
  cursor: none;
  transition: all 0.2s ease;
}

.btn-primary {
  border: none;
  background: #f8f3e6;
  color: #131c17;
}

.btn-primary:hover {
  background: #ffffff;
  transform: translateY(-1px);
}

.btn-glass {
  border: 1px solid rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.btn-glass:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

/* Right Scroll Gauge */
.scroll-gauge {
  position: fixed;
  right: 28px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.gauge-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.68);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}

.gauge-rail {
  width: 2px;
  height: 110px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.2);
  overflow: hidden;
  position: relative;
}

.gauge-fill {
  width: 100%;
  height: 33%;
  border-radius: 99px;
  background: #f5dfb0;
  box-shadow: 0 0 8px rgba(245, 223, 176, 0.8);
}

/* Illustrated English Folio Reader Modal */
.folio-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.38s ease;
}

.folio-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.folio-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 14, 12, 0.58);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.folio-sheet {
  position: relative;
  max-width: 520px;
  width: 100%;
  padding: 38px 44px 34px;
  border-radius: 4px;
  background:
    radial-gradient(circle at 20% 15%, #fcf9f2 0%, #f1e9d8 65%, #e6dbc5 100%);
  color: #1f1c17;
  box-shadow:
    0 36px 90px rgba(0, 0, 0, 0.58),
    inset 0 0 0 1px rgba(168, 142, 96, 0.35),
    inset 0 0 0 7px #f7f1e3,
    inset 0 0 0 8px rgba(168, 142, 96, 0.28);
  transform: translateY(24px) scale(0.95);
  transition: transform 0.45s cubic-bezier(0.19, 1, 0.22, 1);
}

.folio-modal.open .folio-sheet {
  transform: translateY(0) scale(1);
}

.folio-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.24em;
  color: #7d6d52;
  margin-bottom: 14px;
}

.folio-close {
  appearance: none;
  border: none;
  background: none;
  font-size: 24px;
  line-height: 1;
  color: #5c503d;
  cursor: none;
  padding: 0 4px;
}

.folio-emblem {
  display: block;
  margin: 4px auto 14px;
  width: 220px;
  height: 120px;
}

.folio-title {
  font-family: "Playfair Display", "Didot", "Georgia", serif;
  font-size: 28px;
  font-weight: 500;
  text-align: center;
  color: #1a1712;
  margin-bottom: 6px;
}

.folio-epigraph {
  font-family: "Georgia", serif;
  font-style: italic;
  font-size: 13px;
  text-align: center;
  color: #756750;
  margin-bottom: 18px;
}

.folio-divider {
  width: 56px;
  height: 1px;
  background: #b9a37e;
  margin: 0 auto 18px;
}

.folio-body {
  font-family: "Georgia", serif;
  font-size: 14.5px;
  line-height: 1.82;
  color: #363026;
  margin-bottom: 28px;
  white-space: pre-line;
}

.folio-footer {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid rgba(138, 120, 90, 0.25);
  padding-top: 12px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: #877860;
}

/* Toast */
.toast {
  position: fixed;
  top: 84px;
  right: 38px;
  z-index: 90;
  background: rgba(250, 246, 236, 0.96);
  color: #151b17;
  font-size: 12px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.32);
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 768px) {
  .topbar {
    padding: 16px 18px;
  }
  .email-pill {
    display: none;
  }
  .scene-plaque {
    left: 20px;
    right: 20px;
    bottom: 24px;
  }
  .sanctuary-card {
    left: 20px;
    right: 20px;
    bottom: 24px;
    max-width: none;
  }
}
