/* ECHIVO — base.css · design tokens + shared components. OWNED BY: foundation (architect). */

:root {
  /* Palette — mirrors the iOS app */
  --night: #05070d;
  --ink: #0b1020;
  --midnight: #141d33;
  --gold: #f5c882;
  --amber: #d4a560;
  --sky: #4fb3ff;
  --terracotta: #ff8a5b;
  --violet: #9d7bff;
  --mint: #5ee6b5;
  --rose: #ff7a8a;
  --white: #ffffff;
  --text: #f3f1ec;
  --text-2: rgba(243, 241, 236, 0.66);
  --text-3: rgba(243, 241, 236, 0.42);
  --hairline: rgba(255, 255, 255, 0.10);

  /* Mode tints */
  --explore: var(--gold);
  --taste: var(--terracotta);
  --live: var(--violet);
  --echo: var(--sky);

  /* Type — Apple's SF Pro where available (the app's font), Inter elsewhere */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;

  /* Fluid type scale */
  --t-hero: clamp(3.2rem, 9vw, 9.5rem);
  --t-h1: clamp(2.6rem, 6.2vw, 6.4rem);
  --t-h2: clamp(2rem, 4.2vw, 4.2rem);
  --t-h3: clamp(1.25rem, 2vw, 1.75rem);
  --t-body: clamp(1rem, 1.15vw, 1.15rem);
  --t-small: 0.875rem;
  --t-eyebrow: 0.75rem;

  /* Layout */
  --gutter: clamp(16px, 4vw, 56px);
  --maxw: 1320px;
  --radius: 28px;
  --radius-lg: 40px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--night);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--t-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img, video, canvas, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
::selection { background: var(--gold); color: var(--night); }

/* ---------- Typography (the app's look: SF Pro Bold, caps) ---------- */
.caps {
  text-transform: uppercase;
  letter-spacing: 0.015em;
  font-weight: 800;
  line-height: 0.95;
}
.t-hero { font-size: var(--t-hero); }
.t-h1 { font-size: var(--t-h1); }
.t-h2 { font-size: var(--t-h2); }
.t-h3 { font-size: var(--t-h3); font-weight: 700; line-height: 1.15; }
.eyebrow {
  font-size: var(--t-eyebrow);
  font-weight: 650;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
}
.muted { color: var(--text-2); }
.gold { color: var(--gold); }
.gradient-text {
  background: linear-gradient(100deg, #fff 0%, var(--gold) 45%, #fff 90%);
  background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}

/* ---------- Layout ---------- */
.section {
  position: relative;
  padding: clamp(96px, 14vh, 180px) var(--gutter);
}
.container { max-width: var(--maxw); margin: 0 auto; position: relative; }
.center { text-align: center; }

/* ---------- Liquid-glass surfaces ---------- */
.glass {
  background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04));
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 20px 60px rgba(0,0,0,0.35);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
}
.pill {
  display: inline-flex; align-items: center; gap: 0.5em;
  padding: 0.55em 1em;
  border-radius: 999px;
  font-size: var(--t-small); font-weight: 600;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6em;
  padding: 1em 1.6em; border-radius: 999px;
  font-weight: 650; font-size: 1rem;
  transition: transform .5s var(--ease-spring), background .3s, box-shadow .3s;
  will-change: transform;
}
.btn:hover { transform: translateY(-2px) scale(1.02); }
.btn-gold { background: var(--gold); color: #1a1206; box-shadow: 0 10px 40px rgba(245,200,130,0.35); }
.btn-glass { color: var(--text); }

/* ---------- Phone mockup (iPhone 17 Pro-ish) ----------
   <div class="phone"><img class="phone__screen" src="assets/img/app/02_explore_sheet.webp" alt="…"></div>
   Size with --phone-w (default 300px). Screenshots are 1206×2622 (≈ 0.46 aspect). */
.phone {
  --phone-w: 300px;
  position: relative;
  width: var(--phone-w);
  aspect-ratio: 1206 / 2622;
  border-radius: calc(var(--phone-w) * 0.165);
  padding: calc(var(--phone-w) * 0.032);
  background: linear-gradient(145deg, #3a3a40, #121216 40%, #2a2a30 70%, #0c0c0f);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.08) inset,
    0 0 0 2px #050507,
    0 50px 120px -20px rgba(0,0,0,0.75),
    0 30px 60px -30px rgba(245,200,130,0.18);
  flex: none;
}
.phone__screen {
  width: 100%; height: 100%;
  object-fit: cover; object-position: top;
  border-radius: calc(var(--phone-w) * 0.135);
  background: #000;
}
.phone::after { /* subtle glass glare */
  content: ""; position: absolute; inset: calc(var(--phone-w) * 0.032);
  border-radius: calc(var(--phone-w) * 0.135);
  background: linear-gradient(120deg, rgba(255,255,255,0.10) 0%, rgba(255,255,255,0) 30%);
  pointer-events: none;
}

/* ---------- Reveal helper (handled in main.js) ---------- */
[data-reveal] { opacity: 0; transform: translateY(40px); }
.no-js [data-reveal], .reduced-motion [data-reveal] { opacity: 1; transform: none; }

/* ---------- Nav ---------- */
.nav {
  position: fixed; top: 16px; left: 50%; z-index: 100;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px;
  padding: 6px 6px 6px 14px; border-radius: 999px;
  width: max-content; max-width: calc(100vw - 24px);
  transition: transform .6s var(--ease-out), opacity .4s;
}
.nav.is-hidden { transform: translate(-50%, -220%); opacity: 0; pointer-events: none; }
.nav.is-hidden .btn-gold { box-shadow: none; }
.nav__logo { display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: .28em; font-size: 0.8rem; padding-right: 8px; }
.nav__logo img { width: 22px; height: 22px; }
.nav__links { display: flex; gap: 2px; }
.nav__links a { padding: 8px 12px; border-radius: 999px; font-size: 0.85rem; font-weight: 600; color: var(--text-2); transition: color .2s, background .2s; }
.nav__links a:hover { color: #fff; background: rgba(255,255,255,0.08); }
.nav__cta { padding: 9px 16px; font-size: 0.85rem; }
@media (max-width: 760px) { .nav__links { display: none; } }

/* ---------- Perf: off-screen sections stop their CSS loops (toggled by main.js) ---------- */
.section.is-asleep *, .section.is-asleep *::before, .section.is-asleep *::after { animation-play-state: paused !important; }

/* ---------- Grain overlay (premium film texture) ---------- */
.grain {
  position: fixed; inset: -10%; z-index: 90; pointer-events: none; opacity: .05;
  will-change: transform; contain: strict;
  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='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain 1.2s steps(6) infinite;
}
@keyframes grain { 0%{transform:translate(0,0)} 25%{transform:translate(-3%,2%)} 50%{transform:translate(2%,-3%)} 75%{transform:translate(-2%,-1%)} 100%{transform:translate(0,0)} }

@media (max-width: 760px) { .grain { animation: none; } }
@media (prefers-reduced-motion: reduce) {
  .grain { animation: none; }
  * { scroll-behavior: auto !important; }
}

/* ---------- Low-power tier (html.lp: phones, tablets, weak hardware — set by assets/js/perf.js) ----------
   Same look, cheaper pixels: no live backdrop blur (re-blurred every scrolled frame), no full-screen grain
   layer, no permanently promoted buttons. Sections add their own `.lp #id …` rules. */
.lp .grain { display: none; }
.lp .glass {
  background: linear-gradient(180deg, rgba(54, 62, 86, 0.86), rgba(30, 36, 54, 0.84)); /* ≈ the blurred night-blue it replaces */
  -webkit-backdrop-filter: none; backdrop-filter: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.16), 0 14px 36px rgba(0,0,0,0.35);
}
.lp .btn { will-change: auto; }
/* off-screen sections skip rendering (toggled by main.js; height is pinned inline so nothing shifts) */
.section.is-cv { content-visibility: auto; }
