/* ============================================================
   mystical.boo — Light-academia split-screen, retro-futuristic
   Palette:
     #FAF5E8 academy cream    #2A1028 mystical plum
     #B8962E gold scholarly   #D8D0C0 marble classical
     #1A1810 ink black        #C8C0D0 spirit silver
     #4A9088 vector teal
   Fonts:
     - Playfair Display (Google Fonts), weight 700
     - Source Serif 4 (Google Fonts), weight 400 / 600
     - Labels use Small-caps. with Letter-spacing: 0.1em.
   ============================================================ */

:root {
  --academy: #FAF5E8;
  --plum: #2A1028;
  --gold: #B8962E;
  --marble: #D8D0C0;
  --ink: #1A1810;
  --silver: #C8C0D0;
  --teal: #4A9088;

  --serif-display: "Playfair Display", "Lora", Georgia, serif;
  --serif-body: "Source Serif 4", "Source Serif Pro", "Lora", Georgia, serif;

  --gutter: 20px;
  --col-pad: clamp(28px, 4.5vw, 84px);
  --shadow-cream: 0 0 0 1px rgba(184, 150, 46, 0.18);
  --shadow-plum: 0 0 0 1px rgba(184, 150, 46, 0.30);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--academy);
  color: var(--ink);
  font-family: var(--serif-body);
  font-size: 16px;
  line-height: 1.85;
}

body {
  overflow-x: hidden;
}

/* SVG defs container */
.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* ---------------------------------------------------------------
   GATEWAY (100vh dual entrance)
   --------------------------------------------------------------- */
.gateway {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
  overflow: hidden;
}

.gateway-half {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--col-pad);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 1100ms ease 700ms, transform 1100ms ease 700ms;
}

.gateway-half.is-revealed {
  opacity: 1;
  transform: translateY(0);
}

.gateway-half.academy {
  background: var(--academy);
  color: var(--ink);
}

.gateway-half.mystic {
  background: var(--plum);
  color: var(--silver);
}

.gateway-inner {
  width: 100%;
  max-width: 540px;
}

.gateway-meta {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--gold);
  margin: 0 0 28px;
}

.gateway-title {
  font-family: var(--serif-display);
  font-weight: 700;
  font-size: clamp(64px, 11vw, 168px);
  line-height: 0.92;
  margin: 0 0 28px;
  letter-spacing: 0.02em;
}

.gateway-half.academy .gateway-title {
  color: var(--ink);
  text-shadow: 0 0 0 transparent;
}

.gateway-half.mystic .gateway-title {
  color: var(--academy);
}

.gateway-sub {
  font-size: clamp(15px, 1.05vw, 17px);
  line-height: 1.75;
  max-width: 36ch;
  margin: 0 0 24px;
  font-style: italic;
  color: inherit;
  opacity: 0.92;
}

.gateway-half.academy .gateway-sub {
  color: #4a3f3a;
}

.gateway-half.mystic .gateway-sub {
  color: var(--silver);
}

.gateway-excerpt {
  border-top: 1px solid rgba(184, 150, 46, 0.6);
  padding-top: 16px;
  font-size: 14px;
  line-height: 1.7;
  color: #4a3f3a;
}

.gateway-symbol {
  border-top: 1px solid rgba(184, 150, 46, 0.6);
  padding-top: 22px;
  display: flex;
  align-items: center;
  gap: 22px;
}

.gateway-symbol .vector-art {
  width: 96px;
  height: 96px;
  color: var(--gold);
  filter: drop-shadow(0 0 6px rgba(184, 150, 46, 0.18));
}

/* Center divider line */
.divider {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 100%;
  pointer-events: none;
  z-index: 5;
  transition: transform 220ms ease;
}

.gateway:hover .divider {
  animation: dividerWobble 1.4s ease-in-out infinite;
}

@keyframes dividerWobble {
  0%, 100% { transform: translateX(calc(-50% - 2px)); }
  50%      { transform: translateX(calc(-50% + 2px)); }
}

/* Scroll indicators (running along inner edges of split) */
.scroll-indicator {
  position: fixed;
  top: 0;
  width: 2px;
  background: var(--gold);
  height: 0%;
  z-index: 40;
  transition: height 80ms linear;
  opacity: 0.85;
  pointer-events: none;
}

.scroll-indicator.left  { left: calc(50% - 3px); }
.scroll-indicator.right { left: calc(50% + 1px); }

/* ---------------------------------------------------------------
   KINETIC TYPE — letter-spacing breathing
   --------------------------------------------------------------- */
.kinetic {
  animation: kineticBreathe 3s ease-in-out infinite;
  will-change: letter-spacing;
}

@keyframes kineticBreathe {
  0%, 100% { letter-spacing: 0.02em; }
  50%      { letter-spacing: 0.06em; }
}

/* ---------------------------------------------------------------
   STUDY PANELS (split-screen scrolling content)
   --------------------------------------------------------------- */
.study {
  display: grid;
  grid-template-columns: 1fr 1fr;
  position: relative;
  border-top: 1px solid rgba(184, 150, 46, 0.35);
}

.study-half {
  padding: clamp(56px, 7vw, 112px) var(--col-pad);
  position: relative;
  min-height: 88vh;
}

.study-half.academy {
  background: var(--academy);
  color: var(--ink);
}

.study-half.mystic {
  background: var(--plum);
  color: var(--silver);
}

.study-half + .study-half {
  border-left: 1px solid rgba(184, 150, 46, 0.35);
}

.study-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  font-variant: small-caps;
  letter-spacing: 0.1em;
  color: var(--gold);
  margin: 0 0 22px;
}

.study-title {
  font-family: var(--serif-display);
  font-weight: 700;
  font-size: clamp(28px, 3.5vw, 52px);
  line-height: 1.1;
  margin: 0 0 28px;
  letter-spacing: 0.02em;
}

.study-half.academy .study-title { color: var(--ink); }
.study-half.mystic  .study-title { color: var(--academy); }

.study-body {
  font-family: var(--serif-body);
  font-size: clamp(15px, 1vw, 16px);
  line-height: 1.85;
  margin: 0 0 22px;
  max-width: 56ch;
}

.study-half.mystic .study-body {
  color: var(--silver);
}

.study-body.italic {
  font-style: italic;
}

.study-half em {
  color: inherit;
}

.study-half.academy em {
  color: var(--ink);
}

.study-half.mystic em {
  color: var(--academy);
}

/* footnotes */
.footnote-num {
  display: inline-block;
  font-size: 10px;
  vertical-align: super;
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0 1px;
}

.footnote-num.inline {
  margin-left: 2px;
}

.study-footnotes {
  list-style: none;
  padding: 0;
  margin: 32px 0 0;
  font-size: 13px;
  line-height: 1.55;
  color: #5b524d;
  border-top: 1px solid rgba(184, 150, 46, 0.4);
  padding-top: 14px;
}

.study-footnotes li + li {
  margin-top: 6px;
}

.study-footnotes .footnote-num {
  margin-right: 6px;
}

/* cross-references between halves */
.cross-link {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  white-space: nowrap;
  display: inline-block;
  transition: transform 250ms ease;
}

.cross-link a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted var(--gold);
  padding-bottom: 1px;
}

.study-half.academy .cross-link a:hover {
  color: var(--plum);
  border-bottom-color: var(--plum);
}

.study-half.mystic .cross-link a:hover {
  color: var(--academy);
  border-bottom-color: var(--academy);
}

.study-half.academy:hover .cross-link {
  transform: translateX(4px);
}

.study-half.mystic:hover .cross-link {
  transform: translateX(-4px);
}

/* symbol stage on mystic side */
.symbol-stage {
  margin: 0 0 32px;
  display: flex;
  justify-content: center;
  padding: 22px;
  border: 1px solid rgba(184, 150, 46, 0.4);
  background: rgba(184, 150, 46, 0.04);
}

.vector-art {
  display: block;
  color: var(--gold);
  transition: transform 600ms cubic-bezier(.2,.7,.3,1), color 220ms ease;
}

.vector-art.large { width: clamp(180px, 22vw, 320px); height: clamp(180px, 22vw, 320px); }
.vector-art.mid   { width: clamp(110px, 14vw, 180px); height: clamp(110px, 14vw, 180px); }
.vector-art.big   { width: clamp(140px, 16vw, 220px); height: clamp(140px, 16vw, 220px); }

.study-half.mystic .vector-art {
  color: var(--gold);
  filter: drop-shadow(0 0 8px rgba(184, 150, 46, 0.2));
}

.symbol-stage:hover .vector-art {
  transform: rotate(5deg);
  color: var(--teal);
}

/* hover micro-interactions: text-shadow inversion hints */
.study-half.academy .study-title:hover,
.study-half.academy .study-body:hover {
  text-shadow: 1px 0 0 rgba(42, 16, 40, 0.06);
  transition: text-shadow 350ms ease;
}

.study-half.mystic .study-title:hover,
.study-half.mystic .study-body:hover {
  text-shadow: 1px 0 0 rgba(250, 245, 232, 0.10);
  transition: text-shadow 350ms ease;
}

/* ---------------------------------------------------------------
   CONVERGENCE (full width, marble background)
   --------------------------------------------------------------- */
.convergence {
  position: relative;
  background: var(--marble);
  color: var(--ink);
  padding: clamp(80px, 10vw, 160px) clamp(28px, 8vw, 140px);
  border-top: 1px solid rgba(184, 150, 46, 0.5);
  border-bottom: 1px solid rgba(184, 150, 46, 0.5);
  overflow: hidden;
  isolation: isolate;
}

/* Marble-classical SVG turbulence as background overlay */
.marble-bg {
  position: absolute;
  inset: 0;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='600' height='600'><filter id='m'><feTurbulence type='fractalNoise' baseFrequency='0.012 0.04' numOctaves='3' seed='7'/><feColorMatrix values='0 0 0 0 0.84  0 0 0 0 0.81  0 0 0 0 0.75  0 0 0 0.6 0'/></filter><rect width='600' height='600' filter='url(%23m)'/></svg>");
  background-size: 600px 600px;
  opacity: 0.55;
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: -1;
}

.convergence-inner {
  position: relative;
  max-width: 1180px;
  margin: 0 auto;
  z-index: 1;
}

.convergence-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--gold);
  margin: 0 0 22px;
}

.convergence-title {
  font-family: var(--serif-display);
  font-weight: 700;
  font-size: clamp(40px, 6vw, 96px);
  line-height: 1;
  margin: 0 0 36px;
  color: var(--plum);
  letter-spacing: 0.02em;
}

.convergence-body {
  font-family: var(--serif-body);
  font-size: clamp(16px, 1.1vw, 18px);
  line-height: 1.85;
  max-width: 70ch;
  margin: 0 0 22px;
  color: #2b211f;
}

.convergence-symbols {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 56px;
  position: relative;
}

.convergence-symbols .vector-art {
  color: var(--teal);
}

.drift-left  { transform: translateX(0); transition: transform 1200ms ease; }
.drift-right { transform: translateX(0); transition: transform 1200ms ease; }

.convergence.is-converging .drift-left  { transform: translateX(-22px); }
.convergence.is-converging .drift-right { transform: translateX(22px); }

/* clip-path style merge edges on the convergence section */
.convergence::before,
.convergence::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 60px;
  pointer-events: none;
}

.convergence::before {
  top: 0;
  background: linear-gradient(180deg,
    var(--academy) 0%,
    var(--academy) 50%,
    var(--plum) 50%,
    var(--plum) 100%);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  -webkit-clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  opacity: 0.95;
  mask-image: linear-gradient(180deg, rgba(0,0,0,1) 0%, rgba(0,0,0,0) 100%);
  -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,1) 0%, rgba(0,0,0,0) 100%);
}

.convergence::after {
  bottom: 0;
  background: linear-gradient(0deg,
    var(--academy) 0%,
    var(--academy) 50%,
    var(--plum) 50%,
    var(--plum) 100%);
  opacity: 0.95;
  mask-image: linear-gradient(0deg, rgba(0,0,0,1) 0%, rgba(0,0,0,0) 100%);
  -webkit-mask-image: linear-gradient(0deg, rgba(0,0,0,1) 0%, rgba(0,0,0,0) 100%);
}

/* ---------------------------------------------------------------
   GALLERY (horizontal vector arcana)
   --------------------------------------------------------------- */
.gallery {
  background: var(--plum);
  color: var(--silver);
  padding: clamp(72px, 9vw, 130px) 0 clamp(60px, 7vw, 100px);
  border-top: 1px solid rgba(184, 150, 46, 0.5);
  position: relative;
}

.gallery-header {
  padding: 0 clamp(28px, 6vw, 100px);
  max-width: 1100px;
  margin: 0 auto 40px;
}

.gallery-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--gold);
  margin: 0 0 14px;
}

.gallery-title {
  font-family: var(--serif-display);
  font-weight: 700;
  font-size: clamp(32px, 4.5vw, 64px);
  line-height: 1;
  color: var(--academy);
  margin: 0 0 18px;
  letter-spacing: 0.02em;
}

.gallery-sub {
  font-size: 15px;
  font-style: italic;
  color: var(--silver);
  margin: 0;
  max-width: 50ch;
}

.gallery-track {
  display: flex;
  gap: clamp(20px, 2.5vw, 40px);
  overflow-x: auto;
  padding: 12px clamp(28px, 6vw, 100px) 28px;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--gold) transparent;
}

.gallery-track::-webkit-scrollbar {
  height: 6px;
}

.gallery-track::-webkit-scrollbar-thumb {
  background: var(--gold);
  border-radius: 3px;
}

.gallery-card {
  flex: 0 0 clamp(220px, 22vw, 300px);
  scroll-snap-align: start;
  background: rgba(250, 245, 232, 0.04);
  border: 1px solid rgba(184, 150, 46, 0.4);
  padding: 28px 24px 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: transform 350ms ease, background 350ms ease, border-color 350ms ease;
}

.gallery-card:hover,
.gallery-card.is-near {
  background: rgba(250, 245, 232, 0.08);
  border-color: var(--gold);
  transform: translateY(-3px);
}

.gallery-card .vector-art {
  margin: 0 0 18px;
  color: var(--gold);
  transition: color 350ms ease, transform 600ms cubic-bezier(.2,.7,.3,1);
}

.gallery-card:hover .vector-art {
  color: var(--teal);
  transform: rotate(5deg);
}

.card-title {
  font-family: var(--serif-display);
  font-weight: 700;
  font-size: 22px;
  margin: 0 0 4px;
  color: var(--academy);
  letter-spacing: 0.02em;
}

.card-sub {
  font-style: italic;
  font-size: 13px;
  color: var(--silver);
  margin: 0 0 14px;
  opacity: 0.9;
}

.card-cite {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0;
}

.gallery-controls {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 clamp(28px, 6vw, 100px);
  margin: 18px auto 0;
  max-width: 1100px;
}

.gallery-btn {
  width: 44px;
  height: 44px;
  border: 1px solid var(--gold);
  background: transparent;
  color: var(--gold);
  font-family: var(--serif-display);
  font-size: 20px;
  cursor: pointer;
  transition: background 220ms ease, color 220ms ease;
}

.gallery-btn:hover {
  background: var(--gold);
  color: var(--plum);
}

.gallery-progress {
  flex: 1;
  height: 2px;
  background: rgba(184, 150, 46, 0.25);
  position: relative;
  overflow: hidden;
}

#gallery-progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 14%;
  background: var(--gold);
  transition: width 220ms ease;
}

/* ---------------------------------------------------------------
   COLOPHON
   --------------------------------------------------------------- */
.colophon {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid rgba(184, 150, 46, 0.5);
}

.colophon-inner {
  display: contents;
}

.colophon-half {
  padding: clamp(48px, 6vw, 88px) var(--col-pad);
}

.colophon-half.academy {
  background: var(--academy);
  color: var(--ink);
}

.colophon-half.mystic {
  background: var(--plum);
  color: var(--silver);
  border-left: 1px solid rgba(184, 150, 46, 0.5);
}

.colophon-meta {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--gold);
  margin: 0 0 16px;
}

.colophon-text {
  font-size: 14px;
  line-height: 1.75;
  max-width: 56ch;
  margin: 0;
}

.colophon-half.mystic .colophon-text em {
  color: var(--academy);
}

/* ---------------------------------------------------------------
   REVEAL (intersection observer fade-in for sections)
   --------------------------------------------------------------- */
.study, .convergence, .gallery, .colophon {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 900ms ease, transform 900ms ease;
}

.study.is-revealed,
.convergence.is-revealed,
.gallery.is-revealed,
.colophon.is-revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ---------------------------------------------------------------
   RESPONSIVE: collapse split to single column on narrow screens
   --------------------------------------------------------------- */
@media (max-width: 880px) {
  .gateway,
  .study,
  .colophon {
    grid-template-columns: 1fr;
  }

  .gateway-half {
    min-height: 60vh;
  }

  .study-half + .study-half,
  .colophon-half.mystic {
    border-left: none;
    border-top: 1px solid rgba(184, 150, 46, 0.5);
  }

  .divider {
    display: none;
  }

  .scroll-indicator {
    display: none;
  }

  .gateway-title {
    font-size: clamp(56px, 18vw, 120px);
  }

  .convergence {
    padding-left: clamp(20px, 6vw, 40px);
    padding-right: clamp(20px, 6vw, 40px);
  }

  .convergence::before,
  .convergence::after {
    background: var(--marble);
  }
}

@media (max-width: 540px) {
  .gateway-half { padding: 36px 22px; }
  .study-half   { padding: 56px 22px; }
  .gallery-header { padding: 0 22px; }
  .gallery-track { padding-left: 22px; padding-right: 22px; }
  .gallery-controls { padding: 0 22px; }
  .colophon-half { padding: 48px 22px; }
}

/* ---------------------------------------------------------------
   REDUCED MOTION
   --------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .kinetic { animation: none; letter-spacing: 0.04em; }
  .gateway:hover .divider { animation: none; }
  .gateway-half { transition: opacity 200ms ease, transform 200ms ease; }
  .study, .convergence, .gallery, .colophon { transition: opacity 200ms ease, transform 200ms ease; }
  .vector-art, .symbol-stage:hover .vector-art { transition: none; transform: none; }
}
