/* ============ Design Tokens ============ */
:root {
  --green-950: #03331c;
  --green-900: #064e2c;
  --green-800: #0a6b3c;
  --green-700: #0d7a44;
  --green-600: #119a56;
  --green-500: #1bb56e;
  --green-400: #4dd199;
  --green-300: #8be7bd;
  --green-200: #c8f2dd;
  --green-100: #dff7ea;
  --green-50:  #edfbf3;

  --cream: #fbf8f1;
  --ink-900: #0b1f14;
  --ink-700: #2a3b31;
  --ink-600: #3d4f45;
  --ink-500: #55675c;
  --ink-400: #7c8b82;
  --line: rgba(11, 31, 20, 0.08);
  --line-2: rgba(11, 31, 20, 0.14);

  --shadow-1: 0 1px 2px rgba(6, 78, 44, .05), 0 6px 24px rgba(6, 78, 44, .06);
  --shadow-2: 0 10px 40px rgba(6, 78, 44, .12);

  --radius: 20px;
  --radius-sm: 12px;

  --font-body: "Inter", "Segoe UI", -apple-system, system-ui, sans-serif;
  --font-display: "Fraunces", "Georgia", serif;

  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-io:  cubic-bezier(.76, 0, .24, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; background: var(--cream); color: var(--ink-900); }
body {
  font-family: var(--font-body);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  line-height: 1.55;
}

/* ====== Living background ====== */
.bg-canvas {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
}
.bg-canvas::before,
.bg-canvas::after {
  content: ""; position: absolute; border-radius: 50%;
  filter: blur(80px); opacity: .5;
  transition: transform 1.2s var(--ease-out);
}
.bg-canvas::before {
  width: 55vw; height: 55vw;
  background: radial-gradient(circle, rgba(27, 181, 110, 0.30), transparent 60%);
  top: -20vw; right: -15vw;
}
.bg-canvas::after {
  width: 50vw; height: 50vw;
  background: radial-gradient(circle, rgba(13, 122, 68, 0.28), transparent 60%);
  bottom: -20vw; left: -15vw;
}
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  opacity: .35; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.04 0 0 0 0 0.27 0 0 0 0 0.17 0 0 0 0.06 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ====== Top Bar ====== */
.topbar {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px;
  backdrop-filter: blur(14px) saturate(140%);
  background: rgba(251, 248, 241, 0.72);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 600; color: var(--green-800); }
.brand .brand-title { font-size: 14px; letter-spacing: .02em; }
.brand .brand-sub { color: var(--ink-500); font-size: 12px; margin-left: 2px; font-weight: 500; }

.controls { display: flex; align-items: center; gap: 12px; }
.ctrl {
  appearance: none; background: transparent; border: 1px solid var(--line);
  height: 40px; padding: 0 16px; border-radius: 12px; cursor: pointer;
  display: flex; align-items: center; gap: 8px; color: var(--ink-700);
  transition: all .25s var(--ease-out);
  font-family: var(--font-body); font-weight: 600; font-size: 13px;
}
.ctrl:hover { background: var(--green-50); color: var(--green-800); border-color: var(--green-200); transform: translateY(-1px); }
.ctrl:active { transform: translateY(0); }
.ctrl svg { width: 16px; height: 16px; }
.counter {
  font-variant-numeric: tabular-nums; font-size: 13px; color: var(--ink-500); padding: 0 10px;
}

.progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 60;
  background: transparent;
}
.progress-bar {
  height: 100%; background: linear-gradient(90deg, var(--green-700), var(--green-400), var(--green-500));
  background-size: 200% 100%;
  width: 0%; transition: width .6s var(--ease-out);
  animation: shimmer 3s linear infinite;
}
@keyframes shimmer { 0% { background-position: 0% 0; } 100% { background-position: 200% 0; } }

/* ====== Navigation arrows ====== */
.nav {
  position: fixed; top: 50%; transform: translateY(-50%);
  width: 52px; height: 52px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(255,255,255,.8);
  display: grid; place-items: center; cursor: pointer;
  color: var(--ink-700); z-index: 40;
  backdrop-filter: blur(10px);
  transition: all .3s var(--ease-out);
}
.nav:hover { background: white; color: var(--green-700); border-color: var(--green-200); box-shadow: var(--shadow-2); transform: translateY(-50%) scale(1.08); }
.nav.prev { left: 22px; }
.nav.next { right: 22px; }
.nav svg { width: 24px; height: 24px; }
.nav:disabled { opacity: .25; cursor: not-allowed; transform: translateY(-50%) scale(1); }

/* ====== Stage & Story Scene ====== */
.stage {
  position: relative; width: 100vw; height: 100vh;
  overflow: hidden; z-index: 2;
}

.scene {
  position: absolute; inset: 0;
  opacity: 0; pointer-events: none;
  display: flex; flex-direction: row; align-items: center; justify-content: space-between;
  padding: 10vh 8vw 8vh; gap: 4vw;
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
  transform: scale(0.95);
  box-sizing: border-box;
  height: 100vh;
}
.scene-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.scene-media {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}
.scene.active { opacity: 1; pointer-events: auto; transform: scale(1); }

.kicker {
  display: inline-flex; align-items: center; gap: 1vh;
  font-size: clamp(11px, 2vmin, 16px);
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--green-800); font-weight: 700;
  padding: 1.5vh 3vh; border-radius: 999px;
  background: var(--green-50); border: 1px solid var(--green-200);
  backdrop-filter: blur(6px);
  margin-bottom: 2.5vh;
  flex-shrink: 0;
}
.kicker::before {
  content: ""; width: 1vh; height: 1vh; border-radius: 999px; background: var(--green-600);
  box-shadow: 0 0 0 0.5vh rgba(27, 181, 110, .18);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0.5vh rgba(27, 181, 110, .18); }
  50% { box-shadow: 0 0 0 1.2vh rgba(27, 181, 110, 0); }
}

h1.title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(24px, 5.5vmin, 64px);
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 0 0 2.5vh;
  color: var(--ink-900);
  max-width: 20ch;
  flex-shrink: 0;
}

.visible-text {
  font-size: clamp(16px, 3.5vmin, 32px);
  color: var(--ink-700); 
  font-weight: 500;
  line-height: 1.4;
  margin: 0 0 3vh;
  max-width: 24ch;
  white-space: pre-wrap;
  background: rgba(255,255,255,.8);
  padding: 2.5vh 4vw;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
  backdrop-filter: blur(8px);
  flex-shrink: 0;
}

.placeholder-image {
  width: 100%;
  height: 100%;
  max-height: 80vh;
  background: linear-gradient(135deg, var(--green-100), var(--green-50));
  border: 2px dashed var(--green-300);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  color: var(--green-600);
  font-weight: 600;
  font-size: clamp(14px, 2.5vmin, 20px);
  box-shadow: var(--shadow-2);
}

.scene-image {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  /* Beautiful glassmorphism frame */
  border: 12px solid rgba(255, 255, 255, 0.85);
  border-radius: 32px;
  background-color: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(10px);
  padding: 8px;
  box-shadow: 
    0 24px 48px rgba(6, 78, 44, 0.15),
    0 12px 24px rgba(6, 78, 44, 0.10),
    0 4px 8px rgba(6, 78, 44, 0.05);
}

/* Animations for scene content */
.scene.active .kicker { animation: fadeInDown 0.6s 0.2s both var(--ease-out); }
.scene.active h1.title { animation: fadeInDown 0.6s 0.3s both var(--ease-out); }
.scene.active .visible-text { animation: fadeInUp 0.6s 0.4s both var(--ease-out); }
.scene.active .scene-media { animation: fadeInUp 0.6s 0.5s both var(--ease-out); }

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-2vh); }
  to { opacity: 1; transform: none; }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(2vh); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 768px) {
  .scene { padding: 12vh 4vw 8vh; gap: 2vw; }
  .scene-media { height: auto; max-height: 60vh; }
  .placeholder-image, .scene-image { max-height: 60vh; border-width: 6px; padding: 4px; border-radius: 20px; }
  .nav { width: 44px; height: 44px; }
  .nav.prev { left: 12px; }
  .nav.next { right: 12px; }
}
