@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&display=swap');

:root {
  color-scheme: light dark;

  /* Light mode defaults */
  --bg-primary: #fafafa;
  --bg-secondary: #f0f0f0;
  --text-primary: #0a0a0b;
  --text-secondary: #52525b;
  --text-muted: #a1a1aa;
  --accent-1: #1a1a1a;
  --accent-2: #2e2e2e;
  --accent-3: #4a4a4a;
  --accent-4: #10b981;
  --font-main: 'Space Grotesk', system-ui, sans-serif;

  /* FABs */
  --fab-bg: rgba(250, 250, 250, 0.85);
  --fab-border: rgba(10, 10, 11, 0.12);
  --fab-shadow: rgba(0, 0, 0, 0.08);
  --fab-hover-bg: rgba(10, 10, 11, 0.05);
  --fab-hover-border: rgba(10, 10, 11, 0.25);
  --fab-hover-shadow: rgba(0, 0, 0, 0.12);
  --fab-lang-active-bg: rgba(10, 10, 11, 0.08);
  --fab-lang-active-border: rgba(10, 10, 11, 0.3);

  /* Modal */
  --modal-backdrop: rgba(10, 10, 11, 0.45);
  --modal-bg: rgba(250, 250, 250, 0.97);
  --modal-border: rgba(10, 10, 11, 0.12);
  --modal-shadow: rgba(0, 0, 0, 0.18);

  /* Notebook */
  --notebook-yellow: #fff9c4;
  --notebook-line: #e0d9a8;
  --highlight-color: rgba(232, 205, 120, 0.6);

  /* Map */
  --map-bg: #5bb3e0;
  --map-text-pill: rgba(255, 255, 255, 0.85);
  --divider-bg: #0a0a0b;
  --divider-illuminated: #ffffff;

  /* Sunset */
  --sunset-sky-0: #1a0510;
  --sunset-sky-1: #2d0a22;
  --sunset-sky-2: #4a1030;
  --sunset-sky-3: #6d1a3a;
  --sunset-sky-4: #8a2a40;
  --sunset-sky-5: #b84530;
  --sunset-sky-6: #d46025;
  --sunset-sky-7: #e88020;
  --sunset-sky-8: #e89040;
  --sunset-sky-9: #d9863a;
  --sunset-sky-10: #cc7830;
  --sunset-mountain-1: #0d0404;
  --sunset-mountain-2: #180808;
  --sunset-mountain-3: #250d0d;
  --sunset-mountain-4: #351212;
  --sunset-valley: #4d1818;
  --sunset-terrain-1: #702520;
  --sunset-terrain-2: #9a3525;
  --sunset-terrain-2-t90: rgba(154, 53, 37, 0.9);
  --sunset-terrain-2-t60: rgba(154, 53, 37, 0.6);
  --sunset-terrain-2-t30: rgba(154, 53, 37, 0.3);
  --sunset-terrain-2-t10: rgba(154, 53, 37, 0.1);
  --sunset-terrain-3: #c45030;
  --sunset-text: #f4c28a;

  /* ISO section */
  --iso-bg: #8b9a4a;
  --iso-floor: #b8cc5e;
  --iso-floor-shadow: rgba(42, 58, 10, 0.25);
  --iso-grid: rgba(42, 58, 10, 0.25);
  --iso-label: rgba(42, 58, 10, 0.45);
  --iso-tooltip-bg: rgba(122, 138, 58, 0.95);
  --iso-tooltip-border: rgba(42, 58, 10, 0.8);
  --iso-tooltip-text: #1a2800;
  --iso-profile-border: rgba(42, 58, 10, 0.6);
  --iso-cta-text: rgba(26, 40, 0, 0.75);
  --iso-cta-btn-text: #1a2800;
  --iso-cta-btn-border: #1a2800;
  --iso-cta-btn-shadow: rgba(42, 58, 10, 0.35);
  --iso-cta-btn-hover-bg: #1a2800;
  --iso-cta-btn-hover-text: #b8cc5e;
  --iso-contact-color: rgba(26, 40, 0, 0.8);
}

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

@media (prefers-color-scheme: dark) {
  :root {
    /* Base */
    --bg-primary: #0e0e10;
    --bg-secondary: #1a1a1d;
    --text-primary: #f0f0ee;
    --text-secondary: #a1a1aa;
    --text-muted: #52525b;
    --accent-1: #e0e0e0;
    --accent-2: #c8c8c8;
    --accent-3: #b0b0b0;

    /* FABs */
    --fab-bg: rgba(20, 20, 22, 0.85);
    --fab-border: rgba(240, 240, 238, 0.12);
    --fab-shadow: rgba(0, 0, 0, 0.3);
    --fab-hover-bg: rgba(240, 240, 238, 0.08);
    --fab-hover-border: rgba(240, 240, 238, 0.25);
    --fab-hover-shadow: rgba(0, 0, 0, 0.4);
    --fab-lang-active-bg: rgba(240, 240, 238, 0.12);
    --fab-lang-active-border: rgba(240, 240, 238, 0.3);

    /* Modal */
    --modal-backdrop: rgba(0, 0, 0, 0.65);
    --modal-bg: rgba(22, 22, 26, 0.97);
    --modal-border: rgba(240, 240, 238, 0.1);
    --modal-shadow: rgba(0, 0, 0, 0.5);

    /* Notebook — muted amber on dark */
    --notebook-yellow: #2a2310;
    --notebook-line: #3a3218;
    --highlight-color: rgba(200, 170, 80, 0.5);

    /* Map — deeper ocean blue */
    --map-bg: #1e4a6e;
    --map-text-pill: rgba(255, 255, 255, 0.15);
    --divider-bg: #f0f0ee;
    --divider-illuminated: #0e0e10;

    /* Sunset — shift to deeper, cooler night tones */
    --sunset-sky-0: #000008;
    --sunset-sky-1: #05000f;
    --sunset-sky-2: #0a0020;
    --sunset-sky-3: #10002e;
    --sunset-sky-4: #1a0040;
    --sunset-sky-5: #2a0a5a;
    --sunset-sky-6: #3a1470;
    --sunset-sky-7: #4a2080;
    --sunset-sky-8: #5a3090;
    --sunset-sky-9: #4a285a;
    --sunset-sky-10: #3a1c40;
    --sunset-mountain-1: #02000a;
    --sunset-mountain-2: #05000f;
    --sunset-mountain-3: #080018;
    --sunset-mountain-4: #0d0022;
    --sunset-valley: #150030;
    --sunset-terrain-1: #200845;
    --sunset-terrain-2: #2e1060;
    --sunset-terrain-2-t90: rgba(46, 16, 96, 0.9);
    --sunset-terrain-2-t60: rgba(46, 16, 96, 0.6);
    --sunset-terrain-2-t30: rgba(46, 16, 96, 0.3);
    --sunset-terrain-2-t10: rgba(46, 16, 96, 0.1);
    --sunset-terrain-3: #3c1878;
    --sunset-text: #c8a8f0;

    /* ISO — darker moss */
    --iso-bg: #2a3018;
    --iso-floor: #3a4422;
    --iso-floor-shadow: rgba(0, 0, 0, 0.4);
    --iso-grid: rgba(0, 0, 0, 0.3);
    --iso-label: rgba(180, 200, 100, 0.5);
    --iso-tooltip-bg: rgba(40, 50, 20, 0.97);
    --iso-tooltip-border: rgba(140, 170, 60, 0.5);
    --iso-tooltip-text: #b8cc5e;
    --iso-profile-border: rgba(140, 170, 60, 0.4);
    --iso-cta-text: rgba(180, 200, 120, 0.85);
    --iso-cta-btn-text: #b8cc5e;
    --iso-cta-btn-border: #b8cc5e;
    --iso-cta-btn-shadow: rgba(0, 0, 0, 0.4);
    --iso-cta-btn-hover-bg: #b8cc5e;
    --iso-cta-btn-hover-text: #1a2800;
    --iso-contact-color: rgba(180, 200, 120, 0.8);
  }
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

::selection {
  background-color: var(--accent-1);
  color: var(--text-primary);
}

/* Notebook Background - Positioned inside notebook-section only */
.notebook-bg {
  --grid-size: 24px;
  
  position: absolute;
  top: 0;
  left: -25%;
  width: 150%;
  height: 100%;
  background-color: var(--notebook-yellow);
  background-image: 
    linear-gradient(var(--notebook-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--notebook-line) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
  z-index: 0;
  pointer-events: none;
  transform: rotate(3deg);
}

/* Timeline SVG */
.timeline-svg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  overflow: visible;
  pointer-events: none;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.timeline-svg.visible {
  opacity: 1;
}

/* Hero Section */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 2rem;
  padding-left: clamp(3rem, 15%, 15%);
  position: relative;
}

.hero-content {
  position: relative;
  z-index: 20;
}

.hero-title {
  text-align: left;
}

.greeting {
  display: block;
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  font-weight: 300;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.name-wrapper {
  position: relative;
  display: block;
  z-index: 10;
}

.origin-circle {
  position: absolute;
  left: -0.5em;
  top: 50%;
  transform: translate(-100%, -50%) scale(0);
  width: clamp(1rem, 4vw, 3rem);
  height: clamp(1rem, 4vw, 3rem);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  opacity: 0;
  transition: transform 1s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.5s ease;
  z-index: 15;
}

.origin-circle.visible {
  transform: translate(-100%, -50%) scale(1);
  opacity: 1;
}

.name {
  display: inline;
  font-size: clamp(4rem, 15vw, 12rem);
  font-weight: 700;
  line-height: 1;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2), var(--accent-3));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.name-cursor {
  position: relative;
  display: inline-block;
  width: 3px;
  background: var(--accent-1);
  margin-left: 6px;
  height: 1em;
  vertical-align: top;
  animation: cursor-blink 1.1s ease-in-out infinite;
}

/* Top serif */
.name-cursor::before,
/* Bottom serif */
.name-cursor::after {
  content: '';
  position: absolute;
  left: 50%;
  translate: -50% 0;
  width: 0.35em;
  height: 3px;
  background: var(--accent-1);
  border-radius: 1px;
}

.name-cursor::before { top: 0; }
.name-cursor::after  { bottom: 0; }

@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

.hero-subtitle {
  font-size: clamp(1.2rem, 2.5vw, 1.8rem);
  color: var(--text-secondary);
  margin-top: 2rem;
  font-weight: 300;
}

.scroll-indicator {
  position: absolute;
  bottom: 3rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.scroll-indicator.visible {
  opacity: 1;
  animation: pulse 2s ease-in-out infinite;
}

.scroll-arrow {
  width: 1px;
  height: 40px;
  background: linear-gradient(to bottom, var(--text-muted), transparent);
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* Story Sections */
.story-section {
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4rem 2rem;
}

/* Notebook Section - contains its own background */
.notebook-section {
  position: relative;
  min-height: 120vh; /* Taller to accommodate the scribble */
  background: transparent;
}

/* Container - no z-index to avoid creating stacking context */
.container {
  position: relative;
}

.story-section.tall {
  min-height: 100vh;
  gap: 4rem;
}

.story-content {
  position: relative;
  z-index: 20;
  max-width: 800px;
  padding: 2rem;
}

.story-content.left {
  margin-right: auto;
  margin-left: 10%;
}

.story-content.right {
  margin-left: auto;
  margin-right: 10%;
  text-align: right;
}

.story-content.center {
  margin: 0 auto;
  text-align: center;
}

.story-text {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  line-height: 1.4;
  color: var(--text-primary);
  font-weight: 400;
}

.story-text.large {
  font-size: clamp(2rem, 6vw, 4rem);
  font-weight: 600;
}

/* Story lines for animated highlight effect */
.story-line {
  display: block;
  padding: 0.05em 0.15em;
  margin: 0 -0.15em;
  border-radius: 3px;
}

/* Animated highlight effect - applied line by line */
.story-line.highlight-animated {
  --highlight-progress: 0%;
  background: linear-gradient(
    90deg,
    var(--highlight-color) 0%,
    var(--highlight-color) var(--highlight-progress),
    transparent var(--highlight-progress),
    transparent 100%
  );
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.story-text.small {
  font-size: clamp(1rem, 2vw, 1.2rem);
}

.story-text.muted {
  color: var(--text-muted);
}

.story-text.accent {
  color: var(--accent-2);
  font-style: italic;
}

.gradient-text {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2), var(--accent-3));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Reveal animations */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Iso Section ─────────────────────────────────────── */
.iso-section {
  position: relative;
  z-index: 20;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding: 6rem 2rem 54vh;
  background: var(--iso-bg);
  overflow: hidden;
}

/* subtle scanline texture — darker stripes over the LCD glass */
.iso-section::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0,0,0,0.10) 3px,
    rgba(0,0,0,0.10) 4px
  );
  pointer-events: none;
  z-index: 1;
}

/* ── Isometric stage ──
   Top-down perspective: floor lies flat, camera looks down at an angle.
── */
.iso-stage {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50vh;
  perspective: 600px;
  perspective-origin: 50% -20%;
  overflow: visible;
}

/* The floor: a flat rectangle tilted away from the viewer */
.iso-floor {
  position: absolute;
  width: 320%;
  height: 320%;
  bottom: 0;
  left: 50%;
  translate: -50% 0;
  background: var(--iso-floor);
  transform: rotateX(55deg);
  transform-origin: center bottom;
  box-shadow: 0 -40px 120px var(--iso-floor-shadow);
}

/* Grid lines on the floor */
.iso-floor::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--iso-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--iso-grid) 1px, transparent 1px);
  background-size: 80px 80px;
}

/* ── Floor label: sits in the floor plane, counter-rotated to face viewer ── */
.iso-floor-label {
  position: absolute;
  bottom: 12%;
  left: 50%;
  translate: -50% 0;
  transform: rotateX(-55deg);
  transform-origin: center center;
  white-space: nowrap;
  pointer-events: none;

  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.9rem, 2vw, 1.4rem);
  color: var(--iso-label);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  user-select: none;
}

/* ── Icons sit on the floor, same transform as the floor,
   then counter-rotated to face the viewer ── */
.iso-icons {
  position: absolute;
  width: 320%;
  height: 320%;
  bottom: 0;
  left: 50%;
  translate: -50% 0;
  transform: rotateX(55deg);
  transform-origin: center bottom;
}

.iso-icon {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  /* position, scale and rotation set randomly by JS */
  transform-origin: center center;
}

.iso-icon i {
  font-size: 5rem;
  /* Strip brand colours and tint to LCD olive */
  filter: brightness(0) sepia(1) saturate(2) hue-rotate(30deg) opacity(0.7)
          drop-shadow(0 0 8px rgba(42,58,10,0.45));
  transition: filter 0.3s;
}

.iso-icon:hover i {
  filter: brightness(0) sepia(1) saturate(2) hue-rotate(30deg) opacity(1)
          drop-shadow(0 0 18px rgba(42,58,10,0.9));
}

/* ── Billboard tooltip overlay (camera-facing, outside all CSS transforms) ── */
#iso-tooltip-overlay {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 9999;

  font-family: 'Press Start 2P', monospace;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--iso-tooltip-text);
  white-space: nowrap;

  background: var(--iso-tooltip-bg);
  border: 1px solid var(--iso-tooltip-border);
  padding: 4px 10px;
  box-shadow:
    0 0 10px rgba(42, 58, 10, 0.4),
    inset 0 0 6px rgba(42, 58, 10, 0.1);

  /* Positioned by JS via transform: translate(x, y) */
  opacity: 0;
  scale: 0.7;
  transition: opacity 0.12s ease, scale 0.12s ease;
}

#iso-tooltip-overlay.visible {
  opacity: 1;
  scale: 1;
}

/* ── Scroll-block overlay: swallows all input during scroll-to-top animation ── */
#scroll-block-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  pointer-events: none;
}

#scroll-block-overlay.active {
  pointer-events: all;
  background: rgba(255, 0, 0, 0.3);
}

/* ── Profile ── */
.iso-profile {
  position: relative;
  z-index: 2;
}

.profile-image {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--iso-profile-border);
  box-shadow: 0 0 20px var(--iso-floor-shadow);
}

.profile-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #7a8a3a;
  font-size: 3.5rem;
  font-weight: 400;
  color: #1a2800;
  font-family: 'Press Start 2P', monospace;
}

/* ── CTA ── */
.iso-cta {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  text-align: center;
  margin-bottom: 8rem;
}

.iso-cta .story-text {
  color: var(--iso-cta-text);
  max-width: 480px;
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.5rem, 1.2vw, 0.7rem);
  line-height: 2;
}

.cta-button {
  display: inline-block;
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.75rem, 1.8vw, 1rem);
  color: var(--iso-cta-btn-text);
  text-decoration: none;
  padding: 0.9rem 2rem;
  border: 2px solid var(--iso-cta-btn-border);
  box-shadow: 4px 4px 0 var(--iso-cta-btn-shadow);
  background: transparent;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  line-height: 1;
}

.cta-button:hover {
  background: var(--iso-cta-btn-hover-bg);
  color: var(--iso-cta-btn-hover-text);
  box-shadow: 2px 2px 0 var(--iso-cta-btn-shadow);
}

.cta-arrow {
  display: inline-block;
  animation: arrow-bounce-idle 1.8s ease-in-out infinite;
}

.cta-button.is-scrolling .cta-arrow {
  animation: arrow-bounce-scroll 0.5s cubic-bezier(0.34, 1.8, 0.64, 1) infinite;
}

@keyframes arrow-bounce-idle {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-4px); }
}

@keyframes arrow-bounce-scroll {
  0%   { transform: translateY(0) scale(1); }
  40%  { transform: translateY(-8px) scale(1.1); }
  70%  { transform: translateY(2px) scale(0.95); }
  100% { transform: translateY(0) scale(1); }
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
}

.contact-link {
  color: var(--iso-contact-color);
  text-decoration: none;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.65rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid transparent;
  transition: all 0.3s ease;
}

.contact-link:hover {
  color: var(--iso-cta-btn-text);
  border-bottom-color: var(--iso-cta-btn-border);
  text-shadow: 0 0 10px var(--iso-cta-btn-shadow);
}

/* ── Hero arrows overlay ─────────────────────────────────────── */
.hero-arrows-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 150; /* above hero content but below FABs (200) */
  overflow: visible;
}

.hero-arrow,
.hero-arrowhead {
  /* stroke-dasharray and stroke-dashoffset set by JS after measuring path length */
  opacity: 0;
  transition: opacity 0.4s ease;
  stroke: var(--text-primary);
}

.hero-arrow.ready,
.hero-arrowhead.ready {
  opacity: 1;
}

.hero-arrow-label {
  font-family: 'Caveat', cursive;
  font-size: 2.6px; /* in viewBox units (100 = 100vw) */
  font-weight: 400;
  fill: var(--text-secondary);
  opacity: 0;
  transition: opacity 0.5s ease;
}

.hero-arrow-label.ready {
  opacity: 1;
}

/* ── Floating Action Buttons (top-right, scoped to hero) ─────── */
.floating-actions {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 200;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.fab {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.8rem;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-primary);
  background: var(--fab-bg);
  border: 1px solid var(--fab-border);
  box-shadow: 0 1px 4px var(--fab-shadow);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, color 0.15s;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.fab:hover {
  background: var(--fab-hover-bg);
  border-color: var(--fab-hover-border);
  box-shadow: 0 2px 8px var(--fab-hover-shadow);
}

.fab-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.fab-label {
  /* visible on all sizes for now */
}

.fab-stars {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-left: 0.15rem;
}

.fab-stars:not(:empty)::before {
  content: '★ ';
}

/* Language toggle buttons */
.fab-lang {
  padding: 0.45rem 0.55rem;
  font-size: 1rem;
  line-height: 1;
  border: none;
  background: var(--fab-bg);
  border: 1px solid var(--fab-border);
}

.fab-lang.active {
  background: var(--fab-lang-active-bg);
  border-color: var(--fab-lang-active-border);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

/* Responsive */
@media (max-width: 768px) {
  .hero {
    padding-left: clamp(3.5rem, 10vw, 8rem);
    align-items: flex-start;
    padding-bottom: 8rem; /* room for scroll-indicator at bottom */
  }

  .origin-circle {
    /* On mobile keep the circle visible — don't let it clip off the left edge */
    left: -0.3em;
  }

  /* Hide FAB text labels on mobile — icon only so they stay top-right */
  .fab-label,
  .fab-stars {
    display: none;
  }

  /* Scroll indicator: move up slightly so it doesn't overlap the subtitle */
  .scroll-indicator {
    bottom: 2rem;
  }
  
  .story-content.left,
  .story-content.right {
    margin-left: auto;
    margin-right: auto;
    text-align: center;
    width: 100%;
    max-width: 100%;
    padding: 1rem 1.5rem;
    box-sizing: border-box;
  }

  .story-text.large {
    font-size: clamp(1.5rem, 7vw, 2rem);
  }

  .notebook-section {
    min-height: 100vh;
    padding: 3rem 0;
  }
}

/* Pencil Icon */
.pencil-icon {
  position: relative;
  z-index: 25;
  width: clamp(180px, 30vw, 300px);
  height: auto;
  margin-bottom: -8rem;
  display: block;
  margin-left: auto;
}

/* Map Section - Treasure Map Style */
.map-section {
  position: relative;
  min-height: 200vh;
  background-color: var(--map-bg);
}

/* Extend blue background upward to cover gap from rotated notebook section */
.map-section::before {
  content: '';
  position: absolute;
  top: -150px;
  left: 0;
  width: 100%;
  height: 150px;
  background-color: var(--map-bg);
  z-index: -1;
}

.map-bg {
  position: absolute;
  top: -150px; /* Extend upward to cover gap from rotated notebook section */
  left: 0;
  width: 100%;
  height: calc(100% + 150px);
  z-index: 0;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.map-bg.visible {
  opacity: 1;
}

.map-path-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  pointer-events: none;
}

#treasure-path {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.1s ease-out;
}

#compass-icon {
  position: absolute;
  width: 360px;
  height: 360px;
  z-index: 30;
  pointer-events: none;
  transform: rotate(30deg);
}

#compass-icon .compass-needles {
  transform-origin: 256px 320px;
  transition: transform 1.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#compass-icon.animate .compass-needles {
  transform: rotate(720deg);
}

/* Map section text with highlight effect */
.map-text .story-line {
  background: var(--map-text-pill);
  padding: 0.1em 0.3em;
  margin: 0.1em -0.3em;
  border-radius: 4px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* Section Divider - black bar between map and sunset */
.section-divider {
  width: 100%;
  height: 100px;
  background-color: var(--divider-bg);
  position: relative;
  z-index: 50;
  overflow: visible;
  transition: background-color 0.3s ease-out;
}

/* Divider illumination: reversible with transition */
.section-divider.illuminating {
  background-color: var(--divider-illuminated);
}

/* Sparkle container - positioned at bottom edge of divider, extends downward */
.sparkle-container {
  position: absolute;
  top: 100%; /* Start at bottom edge of divider */
  left: 0;
  width: 100%;
  height: 500vh; /* Extend deep into sunset section */
  pointer-events: none;
  z-index: 55; /* Above divider so sparkles are visible */
  overflow: visible;
  /* Hide content above Y=0 (sparkles waiting to emerge) */
  clip-path: inset(0 0 0 0);
}

/* Sparkle wrapper - handles position and fall (NO rotation) */
/* Now controlled by JS for reversible animation */
.sparkle-wrapper {
  position: absolute;
  pointer-events: none;
  will-change: transform, opacity;
}

/* Trail - triangular tail that follows movement direction */
.sparkle-trail {
  position: absolute;
  bottom: 50%; /* Start from center of sparkle */
  left: 50%;
  transform: translateX(-50%);
  transform-origin: center bottom; /* Pivot from base for flip effect */
  width: 50%; /* Half the sparkle width */
  height: 400%;
  background: linear-gradient(to top, rgba(255, 255, 255, 0.8) 0%, transparent 100%);
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  pointer-events: none;
}

/* Four-pointed star sparkle (rotates independently via JS) */
.sparkle {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
  will-change: transform;
}

.sparkle::before,
.sparkle::after {
  content: '';
  position: absolute;
  background: #ffffff;
}

/* Vertical diamond */
.sparkle::before {
  width: 30%;
  height: 100%;
  left: 35%;
  top: 0;
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

/* Horizontal diamond */
.sparkle::after {
  width: 100%;
  height: 30%;
  left: 0;
  top: 35%;
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

/* Sunset Section */
.sunset-section {
  position: relative;
  min-height: 200vh;
  overflow: hidden;
}

.sunset-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  background: linear-gradient(
    to bottom,
    var(--sunset-sky-0)  0%,
    var(--sunset-sky-1)  15%,
    var(--sunset-sky-2)  28%,
    var(--sunset-sky-3)  40%,
    var(--sunset-sky-4)  50%,
    var(--sunset-sky-5)  60%,
    var(--sunset-sky-6)  70%,
    var(--sunset-sky-7)  80%,
    var(--sunset-sky-8)  88%,
    var(--sunset-sky-9)  95%,
    var(--sunset-sky-10) 100%
  );
}

.sunset-mountains-svg {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: auto;
  z-index: 1;
  object-fit: cover;
  object-position: bottom;
}

.sunset-mountains-svg .layer-bg {
  fill: transparent;
}

.sunset-mountains-svg .layer-mountain-1 {
  fill: var(--sunset-mountain-1);
}

.sunset-mountains-svg .layer-mountain-2 {
  fill: var(--sunset-mountain-2);
}

.sunset-mountains-svg .layer-mountain-3 {
  fill: var(--sunset-mountain-3);
}

.sunset-mountains-svg .layer-mountain-4 {
  fill: var(--sunset-mountain-4);
}

.sunset-mountains-svg .layer-valley-trees {
  fill: var(--sunset-valley);
}

.sunset-mountains-svg .layer-terrain-1 {
  fill: var(--sunset-terrain-1);
}

.sunset-mountains-svg .layer-terrain-2 {
  fill: var(--sunset-terrain-2);
}

.sunset-mountains-svg .layer-terrain-3 {
  fill: var(--sunset-terrain-3);
}

.sunset-section .story-content {
  z-index: 10;
}

.sunset-section .story-text.accent {
  color: var(--sunset-text);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

/* Startups Section - with silhouette figures */
.startups-section {
  position: relative;
  min-height: 120vh; /* Taller to allow silhouettes to animate in */
  overflow: hidden;
}

/* Silhouette Figures System */
.silhouette-container {
  position: absolute;
  bottom: 10%;
  left: 2%;
  z-index: 5;
  display: flex;
  align-items: flex-end;
  gap: 0;
  pointer-events: none;
}

.silhouette {
  background-repeat: no-repeat;
  background-size: contain;
  opacity: 0;
  transform: translateY(20px);
}

/* Individual sprite images - extracted from spritesheet */
/* Negative margins to overlap sprites by ~50% of their width */
.silhouette[data-sprite="1"] {
  width: 564px;
  height: 1088px;
  background-image: url('assets/sprite_1.png');
  margin-right: -282px;
}

.silhouette[data-sprite="2"] {
  width: 500px;
  height: 1120px;
  background-image: url('assets/sprite_2.png');
  margin-right: -250px;
}

.silhouette[data-sprite="3"] {
  width: 675px;
  height: 1003px;
  background-image: url('assets/sprite_3.png');
  margin-right: -337px;
}

.silhouette[data-sprite="4"] {
  width: 740px;
  height: 1053px;
  background-image: url('assets/sprite_4.png');
  margin-right: -370px;
}

.silhouette[data-sprite="5"] {
  width: 420px;
  height: 1016px;
  background-image: url('assets/sprite_5.png');
  margin-right: -210px;
}

/* Responsive scaling for silhouettes */
.silhouette-container {
  transform: scale(0.15);
  transform-origin: bottom left;
}

@media (min-width: 900px) {
  .silhouette-container {
    transform: scale(0.2);
  }
}

@media (min-width: 1400px) {
  .silhouette-container {
    transform: scale(0.25);
  }
}

/* Freelance Section - 3D Model */
.freelance-section {
  position: relative;
  overflow: hidden;
}

#freelance-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: auto;
}

.freelance-section .story-content {
  position: relative;
  z-index: 2;
  pointer-events: none;
}

.freelance-section .story-text {
  color: white;
}

/* Videogames Section */
.videogames-section {
  position: relative;
  overflow: hidden;
  min-height: 150vh; /* 50% longer than default */
}

.videogames-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  background-image: url('assets/necrodancer_gif.gif');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* Crossfade gradient from sunset to videogames */
.videogames-bg::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 50%; /* Fade zone at top */
  z-index: 3; /* Above the GIF and overlay */
  background: linear-gradient(
    to bottom,
    var(--sunset-terrain-2) 0%,
    var(--sunset-terrain-2-t90) 15%,
    var(--sunset-terrain-2-t60) 35%,
    var(--sunset-terrain-2-t30) 55%,
    var(--sunset-terrain-2-t10) 75%,
    transparent 100%
  );
  pointer-events: none;
}

.videogames-bg::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  background: rgba(0, 0, 0, 0.5); /* Dark overlay for text readability */
  pointer-events: none;
}

.videogames-section .story-content {
  z-index: 10;
}

.videogames-section .story-text {
  color: #ffffff;
  text-shadow: 0 2px 15px rgba(0, 0, 0, 0.8);
}

/* ── Email Modal ───────────────────────────────────────────── */
.email-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.email-modal[hidden] {
  display: none;
}

.email-modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--modal-backdrop);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  cursor: pointer;
}

.email-modal-card {
  position: relative;
  background: var(--modal-bg);
  border: 1px solid var(--modal-border);
  box-shadow: 0 8px 32px var(--modal-shadow);
  border-radius: 4px;
  padding: 2.5rem 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  min-width: 260px;
  text-align: center;
  animation: email-modal-in 0.18s ease;
}

@keyframes email-modal-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

.email-modal-close {
  position: absolute;
  top: 0.6rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-secondary, #666);
  padding: 0.2rem 0.3rem;
  transition: color 0.15s;
}

.email-modal-close:hover {
  color: var(--text-primary, #0a0a0b);
}

.email-modal-label {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 0.8rem;
  color: var(--text-secondary, #666);
  margin: 0;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.email-modal-address {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary, #0a0a0b);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.email-modal-address:hover {
  text-decoration: underline;
}
