/* ============================================================
   PPEBBL.com · Pop-Art × Gold-Black Luxury
   Palette: #457B9D · #E63946 · #F5E6B8 · #1A1A1A
            #D4AF37 · #FAF3E0 · #FFD60A · #0A0A0A
   Fonts:  Permanent Marker · Instrument Serif · Overpass Mono · Bangers
   Primary Interaction**: cursor-follow generative pebble spawning.
   ============================================================ */

:root {
  --obsidian: #0A0A0A;
  --gold:     #D4AF37;
  --champagne:#F5E6B8;
  --red:      #E63946;
  --blue:     #457B9D;
  --parch:    #FAF3E0;
  --charcoal: #1A1A1A;
  --comic:    #FFD60A;

  --gold-grad: linear-gradient(135deg, #D4AF37 0%, #F5E6B8 45%, #D4AF37 100%);

  --ff-title:  "Permanent Marker", "Marker Felt", cursive;
  --ff-body:   "Instrument Serif", "Cormorant Garamond", Georgia, serif;
  --ff-mono:   "Overpass Mono", "JetBrains Mono", ui-monospace, monospace;
  --ff-pop:    "Bangers", "Impact", sans-serif;
}

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

html, body {
  width: 100%;
  height: 100%;
  background: var(--obsidian);
  color: var(--parch);
  font-family: var(--ff-body);
  overflow: hidden;
}

html { scroll-behavior: smooth; }

body {
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   Scroll container + strata
   ============================================================ */
#scroll-container {
  width: 100vw;
  height: 100vh;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
#scroll-container::-webkit-scrollbar { display: none; }

.stratum {
  position: relative;
  width: 100vw;
  height: 100vh;
  scroll-snap-align: start;
  overflow: hidden;
  display: block;
}

/* Dark-dominant (gold on black) */
.stratum-dark  { background: radial-gradient(ellipse at 30% 40%, #151515 0%, var(--obsidian) 72%); color: var(--champagne); }
/* Light-dominant (black on gold/cream) */
.stratum-light { background: radial-gradient(ellipse at 70% 40%, #FBF5DF 0%, var(--parch) 70%); color: var(--obsidian); }

/* Per-section tonal tints */
#section-0 { background: radial-gradient(ellipse at 25% 55%, #171310 0%, #0A0A0A 70%); }
#section-1 { background: radial-gradient(ellipse at 78% 40%, #FFF7DE 0%, var(--parch) 68%); }
#section-2 { background: radial-gradient(ellipse at 20% 62%, #0E1418 0%, var(--obsidian) 70%); }
#section-3 { background: radial-gradient(ellipse at 72% 48%, #FFF1C6 0%, var(--champagne) 70%); }
#section-4 { background: radial-gradient(ellipse at 28% 52%, #1A1008 0%, var(--obsidian) 72%); }
#section-5 { background: radial-gradient(ellipse at 75% 50%, #FFFBEC 0%, var(--parch) 70%); }

/* ============================================================
   Ben-Day Dot halftone overlay (Lichtenstein)
   ============================================================ */
.ben-day-overlay {
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 3;
  opacity: 0.08;
  background-image: radial-gradient(circle, var(--obsidian) 1px, transparent 1.2px);
  background-size: 8px 8px;
  mix-blend-mode: multiply;
}
.stratum-dark .ben-day-overlay {
  background-image: radial-gradient(circle, var(--gold) 1px, transparent 1.2px);
  opacity: 0.06;
  mix-blend-mode: screen;
}
.ben-day-overlay.overlay-red   { background-image: radial-gradient(circle, var(--red)   1.2px, transparent 1.4px); opacity: 0.1; }
.ben-day-overlay.overlay-blue  { background-image: radial-gradient(circle, var(--blue)  1.2px, transparent 1.4px); opacity: 0.09; }
.ben-day-overlay.overlay-gold  { background-image: radial-gradient(circle, var(--gold)  1.2px, transparent 1.4px); opacity: 0.12; }

/* ============================================================
   Background textures (parallax micro-shift target)
   ============================================================ */
.bg-texture {
  position: absolute; inset: -4% -2%;
  z-index: 1;
  pointer-events: none;
  opacity: 0.35;
  transform: translateY(0);
  transition: transform 0.6s cubic-bezier(.2,.8,.2,1);
}
.texture-obsidian {
  background:
    repeating-linear-gradient(115deg, rgba(212,175,55,0.04) 0 2px, transparent 2px 60px),
    repeating-linear-gradient(25deg,  rgba(245,230,184,0.03) 0 1px, transparent 1px 80px);
}
.texture-cream {
  background:
    repeating-linear-gradient(115deg, rgba(10,10,10,0.05) 0 2px, transparent 2px 40px),
    repeating-linear-gradient(25deg,  rgba(212,175,55,0.07) 0 1px, transparent 1px 70px);
}
.texture-champagne {
  background:
    repeating-linear-gradient(140deg, rgba(230,57,70,0.05) 0 1px, transparent 1px 36px),
    repeating-linear-gradient(40deg,  rgba(212,175,55,0.1) 0 2px, transparent 2px 60px);
}
.texture-parchment {
  background:
    repeating-linear-gradient(120deg, rgba(10,10,10,0.04) 0 1px, transparent 1px 48px),
    repeating-linear-gradient(30deg,  rgba(69,123,157,0.06) 0 2px, transparent 2px 80px);
}

/* ============================================================
   Canvas (generative art, mid-ground)
   ============================================================ */
.gen-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  pointer-events: none;
  transform: translateY(0);
  transition: filter 0.4s ease;
}
.stratum.leaving .gen-canvas { filter: grayscale(1) opacity(0.6); }

/* ============================================================
   Section content (layered depth, 60/40 split, side-anchored)
   ============================================================ */
.section-content {
  position: relative;
  z-index: 10;
  width: 60%;
  max-width: 820px;
  padding: clamp(40px, 7vh, 110px) clamp(40px, 6vw, 120px);
  pointer-events: none;
}
.anchor-left {
  margin-right: auto;
  margin-left: 0;
  text-align: left;
  padding-top: 14vh;
}
.anchor-right {
  margin-left: auto;
  margin-right: 0;
  text-align: right;
  padding-top: 14vh;
}

.lesson-label {
  display: inline-block;
  font-family: var(--ff-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--gold);
  text-transform: uppercase;
  padding: 6px 12px;
  border: 1px solid var(--gold);
  border-radius: 2px;
  margin-bottom: 28px;
  background: rgba(10,10,10,0.35);
  opacity: 0;
  transform: translateY(14px);
  animation: fadeSlideIn 0.6s ease forwards;
  animation-delay: 0.15s;
}
.dark-label {
  color: var(--obsidian);
  border-color: var(--obsidian);
  background: rgba(245,230,184,0.4);
}

/* ===== Lesson Titles — Permanent Marker, pop-art scrawl ===== */
.lesson-title {
  font-family: var(--ff-title);
  font-weight: 400;
  font-size: clamp(48px, 8.4vw, 108px);
  line-height: 0.94;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--parch);
  margin-bottom: 36px;
  text-shadow:
    3px 3px 0 var(--gold),
    6px 6px 0 rgba(212,175,55,0.35);
  opacity: 0;
  animation: fadeSlideIn 1.2s cubic-bezier(.2,.8,.2,1) forwards;
  animation-delay: 0.4s;
}
.lesson-title.rot-left  { transform: rotate(-1deg); transform-origin: left center; }
.lesson-title.rot-right { transform: rotate(1deg);  transform-origin: right center; }

.lesson-title-dark {
  color: var(--obsidian);
  text-shadow:
    3px 3px 0 var(--red),
    6px 6px 0 rgba(230,57,70,0.35);
}

/* Per-section coloured shadow variation */
#section-0 .lesson-title { text-shadow: 3px 3px 0 var(--gold),  6px 6px 0 rgba(212,175,55,.35); }
#section-1 .lesson-title { text-shadow: 3px 3px 0 var(--red),   6px 6px 0 rgba(230,57,70,.35); }
#section-2 .lesson-title { text-shadow: 3px 3px 0 var(--blue),  6px 6px 0 rgba(69,123,157,.45); }
#section-3 .lesson-title { text-shadow: 3px 3px 0 var(--comic), 6px 6px 0 rgba(255,214,10,.4); }
#section-4 .lesson-title { text-shadow: 3px 3px 0 var(--red),   6px 6px 0 rgba(230,57,70,.4); }
#section-5 .lesson-title { text-shadow: 3px 3px 0 var(--blue),  6px 6px 0 rgba(69,123,157,.4); }

/* Gold-foil background-clip on accent words */
.gold-foil {
  background: var(--gold-grad);
  background-size: 200% 200%;
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
          color: transparent;
  animation: goldShimmer 3s linear infinite;
  text-shadow: none;
  filter: drop-shadow(2px 2px 0 rgba(0,0,0,0.55));
}

/* ===== Body / Instructional Text — Instrument Serif ===== */
.lesson-body {
  font-family: var(--ff-body);
  font-size: clamp(17px, 1.45vw, 22px);
  line-height: 1.85;
  color: var(--champagne);
  max-width: 560px;
  margin-bottom: 18px;
  opacity: 0;
  transform: translateY(18px);
  animation: fadeSlideIn 0.9s ease forwards;
}
.anchor-right .lesson-body { margin-left: auto; }

.lesson-body:nth-of-type(1) { animation-delay: 0.7s; }
.lesson-body:nth-of-type(2) { animation-delay: 1.0s; }

.lesson-body em {
  font-style: italic;
  color: var(--gold);
  font-weight: 400;
}
.dark-body { color: var(--obsidian); }
.dark-body em { color: var(--red); }

/* ===== Mono annotation row ===== */
.annotation-row {
  margin-top: 26px;
  display: block;
  opacity: 0;
  animation: fadeSlideIn 0.7s ease forwards;
  animation-delay: 1.3s;
}
.mono-annot {
  display: inline-block;
  font-family: var(--ff-mono);
  font-size: 13px;
  letter-spacing: 0.05em;
  color: var(--gold);
  background: rgba(10,10,10,0.55);
  border: 1px solid rgba(212,175,55,0.45);
  padding: 10px 16px;
  border-radius: 3px;
  white-space: pre-wrap;
}
.mono-annot.dark-annot {
  color: var(--obsidian);
  background: rgba(250,243,224,0.55);
  border-color: rgba(10,10,10,0.4);
}

/* ============================================================
   Speech Bubbles (hand-drawn wobbly SVG, Bangers text)
   ============================================================ */
.speech-bubble {
  position: absolute;
  width: clamp(220px, 22vw, 330px);
  height: auto;
  z-index: 12;
  pointer-events: none;
  filter: drop-shadow(4px 4px 0px var(--gold));
  opacity: 0;
  transform: scale(0.4) rotate(-2deg);
  animation: bubblePop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  animation-delay: 1.6s;
}
/* default: left-anchored sections put bubble bottom-right */
.align-left .speech-bubble { right: 6vw; bottom: 18vh; transform-origin: bottom right; }
/* right-anchored sections put bubble bottom-left */
.align-right .speech-bubble { left: 6vw; bottom: 18vh; transform-origin: bottom left; }
.speech-bubble.bubble-right-pos.align-left,
.align-left .speech-bubble.bubble-right-pos { left: 6vw; right: auto; transform-origin: bottom left; }

.bubble-path {
  fill: var(--parch);
  stroke: var(--obsidian);
  stroke-width: 3;
  stroke-linejoin: round;
}
.bubble-text {
  font-family: var(--ff-pop);
  font-size: 32px;
  fill: var(--obsidian);
  letter-spacing: 0.04em;
  dominant-baseline: middle;
}

/* ============================================================
   Pop-art exclamations (Bangers, outlined)
   ============================================================ */
.pop-exclaim {
  position: absolute;
  z-index: 11;
  font-family: var(--ff-pop);
  font-size: clamp(54px, 8vw, 120px);
  letter-spacing: 0.03em;
  color: var(--comic);
  -webkit-text-stroke: 3px var(--obsidian);
  text-stroke: 3px var(--obsidian);
  text-shadow: 5px 5px 0 var(--obsidian), 10px 10px 0 var(--red);
  transform: rotate(-8deg);
  opacity: 0;
  animation: popJitter 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  animation-delay: 1.9s;
  pointer-events: none;
}
.pop-stack      { top: 12vh;  left: 8vw;  color: var(--red);   text-shadow: 5px 5px 0 var(--obsidian); transform: rotate(-10deg); }
.pop-pow        { top: 16vh;  left: 7vw;  color: var(--comic); text-shadow: 5px 5px 0 var(--obsidian), 10px 10px 0 var(--red); transform: rotate(-6deg); }
.pop-monumental { top: 12vh;  right: 6vw; color: var(--gold);  text-shadow: 4px 4px 0 var(--obsidian); transform: rotate(4deg); font-size: clamp(40px, 6vw, 88px); }
.pop-again      { top: 14vh;  left: 7vw;  color: var(--blue);  text-shadow: 5px 5px 0 var(--obsidian), 10px 10px 0 var(--red); transform: rotate(-5deg); }

/* ============================================================
   Pebble counter (bottom corner)
   ============================================================ */
.pebble-counter {
  position: absolute;
  z-index: 11;
  bottom: clamp(24px, 4vh, 56px);
  display: flex;
  flex-direction: column;
  gap: 2px;
  pointer-events: none;
}
.align-left  .pebble-counter { right: clamp(60px, 6vw, 120px); align-items: flex-end; text-align: right; }
.align-right .pebble-counter { left: clamp(24px, 4vw, 60px);   align-items: flex-start; text-align: left; }

.counter-label {
  font-family: var(--ff-mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.75;
}
.counter-value {
  font-family: var(--ff-title);
  font-size: clamp(40px, 6.5vw, 84px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  background: var(--gold-grad);
  background-size: 200% 200%;
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: goldShimmer 3s linear infinite;
  filter: drop-shadow(2px 2px 0 rgba(0,0,0,0.55));
}
.dark-counter {
  background: linear-gradient(135deg, #0A0A0A 0%, #333 50%, #0A0A0A 100%);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(2px 2px 0 rgba(212,175,55,0.8));
  animation: none;
}
.counter-sub {
  font-family: var(--ff-mono);
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--champagne);
  opacity: 0.55;
  margin-top: 2px;
}
.dark-label + .dark-counter + .counter-sub { color: var(--obsidian); }

/* ============================================================
   Progress indicator (vertical, right edge)
   ============================================================ */
#progress-indicator {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  pointer-events: auto;
}
.progress-label {
  font-family: var(--ff-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.35em;
  color: var(--gold);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  margin-bottom: 8px;
  opacity: 0.75;
}
.pebble-dot {
  width: 14px;
  height: 18px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  border: 2px solid var(--gold);
  background: transparent;
  cursor: pointer;
  transition: transform 0.35s ease, background 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
}
.pebble-dot:hover {
  transform: scale(1.25) rotate(-6deg);
  border-color: var(--comic);
}
.pebble-dot.active {
  background: var(--gold-grad);
  background-size: 200% 200%;
  animation: goldShimmer 3s linear infinite;
  transform: scale(1.3);
  box-shadow: 0 0 14px rgba(212,175,55,0.65);
}
.progress-depth {
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--champagne);
  opacity: 0.6;
  margin-top: 10px;
}

/* ============================================================
   Brand mark (top-left fixed)
   ============================================================ */
#brand-mark {
  position: fixed;
  top: 24px;
  left: 28px;
  z-index: 1001;
  display: flex;
  align-items: baseline;
  gap: 10px;
  pointer-events: none;
  mix-blend-mode: difference;
}
.brand-glyph {
  font-size: 14px;
  color: var(--gold);
}
.brand-text {
  font-family: var(--ff-title);
  font-size: 22px;
  letter-spacing: 0.14em;
  color: var(--parch);
  transform: rotate(-1deg);
}
.brand-tag {
  font-family: var(--ff-mono);
  font-size: 10px;
  letter-spacing: 0.25em;
  color: var(--champagne);
  text-transform: uppercase;
  opacity: 0.7;
}

/* ============================================================
   Procedural gold separator lines between sections
   ============================================================ */
#separator-lines {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 50;
  pointer-events: none;
}
.sep-line {
  position: absolute;
  left: 0;
  width: 0%;
  height: 4px;
  background: var(--gold-grad);
  background-size: 200% 200%;
  animation: goldShimmer 3s linear infinite;
  transition: width 1.4s cubic-bezier(.2,.8,.2,1);
  opacity: 0;
}
.sep-line.active { width: 100%; opacity: 1; }
.sep-line[data-sep="1"] { top: calc(100vh - 2px); }
.sep-line[data-sep="2"] { top: calc(200vh - 2px); }
.sep-line[data-sep="3"] { top: calc(300vh - 2px); }
.sep-line[data-sep="4"] { top: calc(400vh - 2px); }
.sep-line[data-sep="5"] { top: calc(500vh - 2px); }

/* Because the scroll container is fixed at 100vh, we reposition the bars
   absolutely inside it — the element stays visible across the transition. */
#separator-lines {
  position: absolute;
  top: 0;
  display: none; /* scroll container sections handle separator locally */
}

/* ============================================================
   Colophon (tail of final stratum)
   ============================================================ */
.colophon {
  position: absolute;
  right: clamp(24px, 4vw, 60px);
  bottom: 24px;
  z-index: 11;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--ff-mono);
  font-size: 10px;
  letter-spacing: 0.24em;
  color: var(--obsidian);
  text-transform: uppercase;
  opacity: 0.55;
}
.colophon-dot { color: var(--gold); font-size: 12px; }

/* ============================================================
   Keyframes
   ============================================================ */
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes goldShimmer {
  0%   { background-position:   0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position:   0% 50%; }
}
@keyframes bubblePop {
  0%   { opacity: 0; transform: scale(0.25) rotate(-10deg); }
  60%  { opacity: 1; transform: scale(1.08) rotate(-2deg); }
  100% { opacity: 1; transform: scale(1) rotate(-2deg); }
}
.align-right .speech-bubble { transform-origin: bottom left; }
.align-right .speech-bubble { animation-name: bubblePopRight; }
@keyframes bubblePopRight {
  0%   { opacity: 0; transform: scale(0.25) rotate(6deg); }
  60%  { opacity: 1; transform: scale(1.08) rotate(2deg); }
  100% { opacity: 1; transform: scale(1) rotate(2deg); }
}
@keyframes popJitter {
  0%   { opacity: 0; transform: scale(0.3) rotate(-20deg); }
  55%  { opacity: 1; transform: scale(1.15) rotate(-6deg); }
  100% { opacity: 1; transform: scale(1) rotate(-8deg); }
}

/* Entry re-trigger class */
.stratum.in-view .lesson-label,
.stratum.in-view .lesson-title,
.stratum.in-view .lesson-body,
.stratum.in-view .annotation-row,
.stratum.in-view .speech-bubble,
.stratum.in-view .pop-exclaim {
  animation-play-state: running;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .section-content {
    width: 82%;
    padding: 10vh 22px 22px;
  }
  .anchor-left, .anchor-right { text-align: left; }
  .align-right .lesson-body { margin-left: 0; }
  .pop-exclaim { font-size: clamp(36px, 11vw, 64px); }
  .speech-bubble { width: 60vw; }
  .align-left .speech-bubble, .align-right .speech-bubble {
    left: 6vw; right: auto; bottom: 14vh;
  }
  .pebble-counter {
    bottom: 16px;
  }
  .align-left .pebble-counter  { right: 22px; }
  .align-right .pebble-counter { left: 22px; }
  #brand-mark .brand-tag { display: none; }
  .counter-value { font-size: 48px; }
  .progress-label { display: none; }
  #progress-indicator { right: 10px; gap: 10px; }
  .pebble-dot { width: 10px; height: 14px; }
}

@media (max-width: 540px) {
  .lesson-title { font-size: clamp(42px, 12vw, 72px); }
  .mono-annot  { font-size: 11px; padding: 8px 10px; }
  #brand-mark { top: 14px; left: 14px; }
  .brand-text { font-size: 18px; }
}
