/* =====================================================================
   MULTIVERSE — Federica Cabrera Doglio
   Design system + DOM overlay layout + reduced-motion / mobile modes
   ===================================================================== */

:root{
  /* sky, never pure black */
  --void:        #070A12;
  --void-2:      #0C111E;
  --void-edge:   #050510;

  /* type — warm off-white, never #FFF */
  --starlight:   #F4EEE3;
  --type-dim:    #8A90B5;
  --dust:        #5A6478;

  /* signature accent — cool platinum / pearl (no gold, amber, brown) */
  --platinum:     #C9D2E4;
  --platinum-lit: #ECEFF7;

  /* per-universe accents — cool jewel tones */
  --u-finspo:    #5FD0A3;
  --u-omnia:     #4D7CFF;
  --u-clarity:   #9FE7F0;
  --u-orbit:     #8B6CFF;
  --u-maria:     #E86A8E;
  --u-ordereat:  #F08C9E;
  --u-strike:    #3AE0C8;

  /* theme-edge hues */
  --edge-ai:        #8B6CFF;
  --edge-consumer:  #E0607A;
  --edge-b2b:       #9AA6D8;
  --edge-growth:    #5FD0A3;

  --accent: var(--platinum);

  /* spacing scale (8px base) */
  --s-1: 4px;  --s-2: 8px;  --s-3: 16px; --s-4: 24px;
  --s-5: 40px; --s-6: 64px; --s-7: 104px;

  /* fonts */
  --font-display: "Clash Display", system-ui, sans-serif;
  --font-serif:   "Newsreader", Georgia, serif;
  --font-mono:    "Space Mono", ui-monospace, monospace;

  --ease-space: cubic-bezier(0.65, 0, 0.35, 1);
}

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

html{ scroll-behavior: auto; -webkit-text-size-adjust: 100%; }

body{
  font-family: var(--font-serif);
  background: var(--void);
  color: var(--starlight);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  cursor: auto;
}

/* hide native cursor only when custom cursor is active (fine pointer, motion on) */
body.custom-cursor{ cursor: none; }

a{ color: inherit; text-decoration: none; }

.mono{
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.serif{ font-family: var(--font-serif) !important; font-weight: 500; }

/* ---------- skip link ---------- */
.skip-link{
  position: fixed; top: -100px; left: var(--s-3); z-index: 9999;
  background: var(--platinum); color: var(--void);
  padding: var(--s-2) var(--s-3); border-radius: 4px;
  font-family: var(--font-mono); font-size: 0.8rem;
  transition: top 0.2s var(--ease-space);
}
.skip-link:focus{ top: var(--s-3); }

/* ---------- canvas + grain ---------- */
#scene{
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: 0; display: block; background: var(--void);
}
#grain{
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  opacity: 0.05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- scroll track (provides fall distance) ---------- */
#scroll-track{ position: relative; width: 1px; height: 1400vh; pointer-events: none; }

/* =====================================================================
   CONTENT LAYER — in MOTION mode panels are fixed + driven by JS.
   ===================================================================== */
.content{
  position: fixed; inset: 0; z-index: 3;
  pointer-events: none; /* re-enabled per interactive element */
}
.content a, .content button{ pointer-events: auto; }

.beat{
  position: fixed; inset: 0;
  display: flex; align-items: center;
  padding: var(--s-7) clamp(var(--s-5), 7vw, 120px);
  opacity: 0; visibility: hidden;
  will-change: opacity, transform;
}

/* ---------- HERO ---------- */
.hero{ display: block; }
.hero-id{ position: absolute; top: var(--s-6); left: clamp(var(--s-5), 7vw, 120px); }
.hero-name{
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(1.1rem, 1.6vw, 1.4rem); letter-spacing: 0.01em;
}
.hero-role{ color: var(--type-dim); margin-top: var(--s-1); }

.hero-center{
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%); text-align: center; width: min(94vw, 1280px);
}
.hero-tagline{
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(1.6rem, 8.2vw, 7.25rem); line-height: 0.98;
  letter-spacing: -0.02em; color: #fff;
  text-shadow: 0 2px 34px rgba(7,10,18,0.55);
}
/* Each line stays on a single row so the title reads as exactly two lines
   ("Building AI products" / "end to end.") instead of wrapping to three. The
   font-size above is sized to keep the longest line inside .hero-center. */
.hero-tagline .line{ display: block; overflow: hidden; white-space: nowrap; }
.hero-tagline .line > span{ display: block; }
.hero-tagline .line:last-child > span{ color: #fff; }
.hero-whisper{ color: var(--platinum); margin-top: var(--s-5); text-shadow: 0 1px 16px rgba(7,10,18,0.8); }

.hero-instruction{
  position: absolute; bottom: var(--s-6); left: 50%;
  transform: translateX(-50%); color: var(--type-dim);
  text-shadow: 0 1px 16px rgba(7,10,18,0.85);
}

/* ---------- INTRO (who I am, before the projects) ---------- */
.intro{ justify-content: flex-start; }
.intro-inner{ max-width: 780px; position: relative; }
.intro .u-kicker{ color: var(--accent); margin-bottom: var(--s-3); }
.intro-heading{
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(2rem, 5vw, 3.8rem); line-height: 1.06;
  letter-spacing: -0.02em; color: var(--starlight); max-width: 17ch;
}
.intro-lede{
  font-size: clamp(1.1rem, 1.7vw, 1.5rem); line-height: 1.55;
  color: var(--starlight); margin-top: var(--s-5); max-width: 56ch;
}
.intro .how-i-work{ margin-top: var(--s-6); }
.intro-cue{
  color: var(--type-dim); margin-top: var(--s-6);
  display: inline-flex; align-items: center; gap: var(--s-2);
}
.intro-cue::after{
  content: "↓"; display: inline-block;
  animation: cue-fall 2.2s ease-in-out infinite;
}
@keyframes cue-fall{
  0%,100%{ transform: translateY(0); opacity: 0.5; }
  50%{ transform: translateY(4px); opacity: 1; }
}

/* ---------- UNIVERSE PANELS ---------- */
/* Left scrim keeps panel copy legible over bright clusters without hiding the
   galaxy. Applied to beats that hold left-aligned text. */
.universe::before, .about::before, .intro::before{
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(100deg,
    rgba(7,10,18,0.86) 0%,
    rgba(7,10,18,0.66) 26%,
    rgba(7,10,18,0.18) 48%,
    rgba(7,10,18,0) 64%);
}
/* Hero veil: darken the first screen so the white title + whisper read
   cleanly over bright star clusters, while the galaxy still breathes at
   the edges. Radial holds the center; the vertical pass lifts the name
   (top) and the scroll hint (bottom). */
.hero::before{
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse 112% 86% at 50% 47%,
      rgba(7,10,18,0.70) 0%,
      rgba(7,10,18,0.48) 40%,
      rgba(7,10,18,0.14) 72%,
      rgba(7,10,18,0) 100%),
    linear-gradient(180deg,
      rgba(7,10,18,0.34) 0%,
      rgba(7,10,18,0.08) 26%,
      rgba(7,10,18,0.08) 72%,
      rgba(7,10,18,0.36) 100%);
}
/* Gentle center veils for the other centered-text beats. */
.overview::before, .contact::before{
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse 92% 76% at 50% 50%,
    rgba(7,10,18,0.52) 0%,
    rgba(7,10,18,0.30) 46%,
    rgba(7,10,18,0) 82%);
}
.universe{ justify-content: flex-start; }
.panel{ max-width: 560px; position: relative; }
.u-kicker{ color: var(--accent); margin-bottom: var(--s-3); }
.u-title{
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(2.2rem, 6vw, 5rem); line-height: 1;
  letter-spacing: -0.02em; color: var(--starlight);
}
.u-title.serif{ font-weight: 500; letter-spacing: 0; color: var(--platinum-lit); }
.u-role{ color: var(--type-dim); margin-top: var(--s-3); }
.u-metric{
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(2rem, 5vw, 4rem); color: var(--accent);
  margin-top: var(--s-5); line-height: 1.05;
}
.metric-arrow{ color: var(--type-dim); font-weight: 400; }
.metric-to{ color: var(--platinum-lit); }

.u-metric-grid{
  list-style: none; display: grid; grid-template-columns: repeat(2, 1fr);
  gap: var(--s-4) var(--s-5); margin-top: var(--s-5); max-width: 480px;
}
.u-metric-grid.two{ grid-template-columns: repeat(2, auto); }
.u-metric-grid li{ display: flex; flex-direction: column; gap: var(--s-1); }
.u-metric-grid .big{
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(1.6rem, 3.4vw, 2.6rem); color: var(--accent);
  line-height: 1; font-variant-numeric: tabular-nums;
}
.u-metric-grid .lbl{ color: var(--type-dim); }

.u-story{
  font-size: clamp(1rem, 1.4vw, 1.25rem); line-height: 1.55;
  color: var(--starlight); margin-top: var(--s-5); max-width: 46ch;
}
.u-link{
  display: inline-flex; align-items: center; gap: var(--s-2);
  margin-top: var(--s-5); padding: var(--s-2) 0;
  font-family: var(--font-mono); font-size: 0.85rem;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent);
  position: relative;
}
.u-link::after{
  content: ""; position: absolute; left: 0; bottom: 0; height: 1px;
  width: 100%; background: currentColor;
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.4s var(--ease-space);
}
.u-link:hover::after, .u-link:focus-visible::after{ transform: scaleX(1); }
.u-link span{ transition: transform 0.3s var(--ease-space); }
.u-link:hover span, .u-link:focus-visible span{ transform: translate(2px, -2px); }

/* row of multiple links (App Store + landing, etc.) */
.u-links{ display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-5); margin-top: var(--s-5); }
.u-links .u-link{ margin-top: 0; }

/* quiet qualitative highlight for universes without a hard number */
.u-metric.mini{
  font-family: var(--font-serif); font-style: italic; font-weight: 500;
  font-size: clamp(1.15rem, 2.2vw, 1.65rem); color: var(--platinum-lit);
  margin-top: var(--s-4); line-height: 1.2;
}

/* ---------- OVERVIEW ---------- */
.overview{ justify-content: center; text-align: center; }
.overview-inner{ width: min(90vw, 900px); }
.overview-overline{
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(1.4rem, 3.2vw, 2.6rem); line-height: 1.25;
  letter-spacing: -0.01em;
}
.overview-sub{
  font-family: var(--font-serif);
  font-size: clamp(1rem, 1.5vw, 1.3rem); line-height: 1.5;
  color: var(--type-dim); margin: var(--s-4) auto 0; max-width: 56ch;
}
.how-i-work{
  list-style: none; margin-top: var(--s-5);
  display: flex; flex-direction: column; gap: var(--s-2);
}
.how-i-work li{
  font-family: var(--font-serif);
  font-size: clamp(1rem, 1.5vw, 1.3rem); line-height: 1.45;
  color: var(--type-dim);
}
.how-i-work li::first-letter{ color: var(--starlight); }
.theme-legend{
  display: flex; gap: var(--s-3); justify-content: center; flex-wrap: wrap;
  margin-top: var(--s-6);
}
.theme-toggle{
  font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--type-dim);
  background: transparent; border: 1px solid var(--dust);
  border-radius: 999px; padding: var(--s-2) var(--s-4);
  cursor: pointer; transition: all 0.3s var(--ease-space);
}
.theme-toggle:hover{ color: var(--starlight); border-color: var(--t); }
.theme-toggle.active{ color: var(--void); background: var(--t); border-color: var(--t); }

/* ---------- ABOUT ---------- */
.about{ justify-content: flex-start; }
.about-panel{ max-width: 640px; }
.about-heading{
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(2.4rem, 6vw, 5rem); letter-spacing: -0.02em;
  margin-top: var(--s-2);
}
.about-bio{
  font-size: clamp(1.05rem, 1.5vw, 1.3rem); line-height: 1.6;
  margin-top: var(--s-5); max-width: 52ch; color: var(--starlight);
}
.chips{ list-style: none; display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-6); }
.chips li{
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--type-dim);
  border: 1px solid rgba(138,144,181,0.3); border-radius: 999px;
  padding: 6px var(--s-3);
}

/* ---------- CONTACT ---------- */
.contact{ justify-content: center; text-align: center; }
.contact-inner{ width: min(90vw, 760px); }
.contact-heading{
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(2.4rem, 7vw, 5.5rem); letter-spacing: -0.02em;
}
.contact-links{
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: var(--s-3) var(--s-5); margin-top: var(--s-6);
}
.contact-mail{
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(1.1rem, 2.4vw, 1.8rem); color: var(--platinum-lit);
  border-bottom: 1px solid transparent; transition: border-color 0.3s var(--ease-space);
}
.contact-mail:hover{ border-color: var(--platinum); }
.copy-chip{
  font-family: var(--font-mono); font-size: 0.7rem; color: var(--type-dim);
  background: transparent; border: 1px solid var(--dust); border-radius: 999px;
  padding: 4px var(--s-2); cursor: pointer; transition: all 0.25s var(--ease-space);
}
.copy-chip:hover{ color: var(--starlight); border-color: var(--platinum); }
.copy-chip.done{ color: var(--u-finspo); border-color: var(--u-finspo); }
.contact-link, .rewind{
  font-family: var(--font-mono); font-size: 0.85rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--type-dim);
  background: transparent; border: none; cursor: pointer;
  transition: color 0.3s var(--ease-space);
}
.contact-link:hover, .rewind:hover{ color: var(--starlight); }
.footer{ color: var(--dust); margin-top: var(--s-7); }

/* =====================================================================
   LOADER
   ===================================================================== */
#loader{
  position: fixed; inset: 0; z-index: 50; background: var(--void);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--s-4); transition: opacity 0.9s var(--ease-space);
}
#loader.done{ opacity: 0; pointer-events: none; }
.loader-star{
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--platinum-lit);
  box-shadow: 0 0 24px 6px rgba(236,239,247,0.55);
  animation: breathe 2.4s ease-in-out infinite;
}
@keyframes breathe{
  0%,100%{ transform: scale(1); opacity: 0.7; }
  50%{ transform: scale(1.5); opacity: 1; }
}
.loader-readout{ font-family: var(--font-mono); font-size: 0.9rem; letter-spacing: 0.3em; color: var(--type-dim); }
.loader-name{
  font-family: var(--font-display); font-weight: 600; font-size: clamp(1.2rem, 3vw, 2rem);
  letter-spacing: 0.08em; color: var(--starlight); min-height: 1.2em; text-align: center; padding: 0 var(--s-4);
}

/* =====================================================================
   CUSTOM CURSOR
   ===================================================================== */
#cursor{
  position: fixed; top: 0; left: 0; z-index: 60; pointer-events: none;
  width: 12px; height: 12px; border: 1px solid var(--accent); border-radius: 50%;
  transform: translate(-50%, -50%);
  display: none; align-items: center; justify-content: center;
  transition: width 0.25s var(--ease-space), height 0.25s var(--ease-space),
              background-color 0.25s var(--ease-space), border-color 0.25s;
}
body.custom-cursor #cursor{ display: flex; }
#cursor.grow{ width: 54px; height: 54px; }
#cursor.filled{ background: var(--platinum); border-color: var(--platinum); }
#cursor-label{
  font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.06em;
  text-transform: lowercase; color: var(--starlight); opacity: 0;
  transition: opacity 0.2s; white-space: nowrap;
}
#cursor.grow #cursor-label{ opacity: 1; }

/* =====================================================================
   PERSISTENT CHROME
   ===================================================================== */
.rewind-sky, .sound-toggle{
  position: fixed; z-index: 40; pointer-events: auto;
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--type-dim);
  background: rgba(7,10,18,0.5); backdrop-filter: blur(6px);
  border: 1px solid rgba(138,144,181,0.25); border-radius: 999px;
  padding: var(--s-2) var(--s-3); cursor: pointer;
  transition: all 0.3s var(--ease-space); opacity: 0;
}
.rewind-sky.visible, .sound-toggle.visible{ opacity: 1; }
.rewind-sky{ top: var(--s-4); right: var(--s-4); }
.sound-toggle{ bottom: var(--s-4); left: var(--s-4); opacity: 1; }
.rewind-sky:hover, .sound-toggle:hover{ color: var(--starlight); border-color: var(--platinum); }
.sound-toggle[aria-pressed="true"]{ color: var(--platinum-lit); border-color: var(--platinum); }

.progress-debug{
  position: fixed; bottom: var(--s-4); right: var(--s-4); z-index: 40;
  color: var(--dust); font-size: 0.7rem;
}

/* =====================================================================
   REDUCED MOTION + NO-WEBGL  →  calm static scrolling document
   (class .static-mode set by JS; media query covers no-JS users via CSS)
   ===================================================================== */
@media (prefers-reduced-motion: reduce){
  .loader-star{ animation: none; }
  #grain{ display: none; }
}

body.static-mode{ cursor: auto; overflow-x: hidden; }
body.static-mode #grain{ display: none; }
body.static-mode #cursor{ display: none !important; }
body.static-mode #scroll-track{ display: none; }
body.static-mode #scene{ position: fixed; opacity: 0.5; }
body.static-mode .content{
  position: relative; pointer-events: auto;
  max-width: 820px; margin: 0 auto; padding: 0 var(--s-5);
}
body.static-mode .beat{
  position: relative; inset: auto; opacity: 1 !important; visibility: visible !important;
  transform: none !important; min-height: auto;
  padding: clamp(var(--s-6), 12vh, 160px) 0;
  border-bottom: 1px solid rgba(138,144,181,0.12);
  display: block;
}
body.static-mode .hero{ min-height: 90vh; display: flex; flex-direction: column; justify-content: center; }
body.static-mode .hero-id{ position: relative; top: auto; left: auto; }
body.static-mode .hero-center{ position: relative; top: auto; left: auto; transform: none; text-align: left; width: 100%; margin-top: var(--s-6); }
body.static-mode .hero-tagline{ font-size: clamp(1.8rem, 7vw, 4.25rem); }
body.static-mode .hero-instruction{ display: none; }
body.static-mode .panel{ max-width: 100%; }
body.static-mode .overview, body.static-mode .contact{ text-align: left; }
body.static-mode .theme-legend, body.static-mode .contact-links{ justify-content: flex-start; }
body.static-mode .rewind-sky{ display: none; }

/* =====================================================================
   TABLET
   ===================================================================== */
@media (max-width: 1024px) and (min-width: 761px){
  .beat{ padding: var(--s-6) var(--s-6); }
  .panel{ max-width: 60vw; }
  .about-panel{ max-width: 64vw; }
}

/* =====================================================================
   MOBILE
   ===================================================================== */
@media (max-width: 760px){
  .beat{ padding: var(--s-5) var(--s-4); align-items: flex-end; padding-bottom: 16vh; }
  /* On a narrow screen the panel runs full-width at the bottom, so the
     left-to-right scrim no longer covers the text. Swap to a bottom-up scrim
     so copy stays legible over bright clusters. */
  .universe::before, .about::before, .intro::before{
    background: linear-gradient(0deg,
      rgba(7,10,18,0.92) 0%,
      rgba(7,10,18,0.78) 32%,
      rgba(7,10,18,0.32) 62%,
      rgba(7,10,18,0) 86%);
  }
  .hero{ align-items: stretch; }
  .hero-id{ top: var(--s-5); left: var(--s-4); }
  .hero-center{ width: 90vw; }
  .hero-whisper{ margin-top: var(--s-4); }
  .hero-instruction{ bottom: var(--s-5); font-size: 0.7rem; }
  .panel, .about-panel{ max-width: 100%; }
  .u-story, .about-bio{ max-width: 100%; }
  .u-metric-grid, .u-metric-grid.two{ grid-template-columns: 1fr 1fr; gap: var(--s-3) var(--s-4); max-width: 100%; }
  .overview-overline{ font-size: clamp(1.3rem, 6vw, 2rem); }
  .theme-legend{ margin-top: var(--s-5); gap: var(--s-2); }
  .contact-links{ gap: var(--s-3) var(--s-4); }
  .rewind-sky{ top: var(--s-3); right: var(--s-3); }
  .sound-toggle{ bottom: var(--s-3); left: var(--s-3); }
}

/* very small phones */
@media (max-width: 380px){
  .u-title{ font-size: clamp(2rem, 11vw, 2.8rem); }
}
