/* ==========================================================================
   sAÏmone — shared styles
   Tokens, nav, footer, primitives.
   Page-specific styles live in each page's <style> block.
   ========================================================================== */

:root {
  /* ── COLOUR TOKENS ── */
  --black: #1a1a2e;
  --white: #ffffff;
  --off-white: #fafafa;
  --cream: #f5f3ff;

  --accent: #d946ef;
  --accent-light: #e879f9;
  --accent-blue: #8b5cf6;
  --accent-deep: #6d28d9;     /* use for small accent text — passes AA on white */

  --text: #1a1a2e;
  --text-secondary: #55506a;  /* was #64607a — bumped for AA */
  --muted: #6b6680;           /* was #8882a0 — now ≈ 4.8:1 on white */
  --subtle: #f0ecf9;

  --card-bg: #ffffff;
  --border: #e8e4f0;
  --border-hover: #d4cee6;

  /* ── TYPE ── */
  --serif: 'Instrument Serif', serif;
  --sans: 'DM Sans', sans-serif;
  --mono: 'JetBrains Mono', monospace;

  /* ── MOTION ── */
  --ease-out-expo: cubic-bezier(0.23, 1, 0.32, 1);
}

/* ── DARK MODE — opt-in via .dark on <html> or OS preference ── */
@media (prefers-color-scheme: dark) {
  :root:not(.light) {
    --black: #f5f3ff;
    --white: #0f0c1e;
    --off-white: #14112a;
    --cream: #1a1638;
    --text: #f5f3ff;
    --text-secondary: #b5afc8;
    --muted: #8882a0;
    --subtle: #1e1940;
    --card-bg: #141129;
    --border: #2a2548;
    --border-hover: #3d3466;
  }
}

/* ── RESET ── */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  font-weight: 400;          /* was 300/inherit — body copy now 400 */
  background: var(--white);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ── FOCUS ── */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ── SKIP LINK ── */
.skip-link {
  position: absolute;
  top: -60px; left: 1rem;
  padding: 0.6rem 1rem;
  background: var(--text); color: var(--white);
  font-size: 0.85rem; font-weight: 500;
  border-radius: 6px; z-index: 1000;
  transition: top 0.2s;
}
.skip-link:focus { top: 1rem; }

/* ── GRAIN OVERLAY ── */
.grain {
  position: fixed; inset: 0;
  z-index: 2; pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.1 0 0 0 0 0.1 0 0 0 0 0.18 0 0 0 1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: multiply;
}
@media (prefers-color-scheme: dark) {
  :root:not(.light) ~ .grain, html:not(.light) ~ .grain, body > .grain { opacity: 0.08; mix-blend-mode: screen; }
}

/* ── BLOBS (softer than before) ── */
.blob-container {
  position: fixed; inset: 0;
  z-index: 0; pointer-events: none; overflow: hidden;
}

.blob {
  position: absolute;
  border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
  filter: blur(60px); opacity: 0.06; mix-blend-mode: multiply;
}
.blob-1 { width: 600px; height: 600px; background: var(--accent); top: -200px; left: -150px; animation: blobDrift 25s ease-in-out infinite; }
.blob-2 { width: 500px; height: 500px; background: var(--accent-blue); top: 40%; right: -150px; animation: blobDrift 30s ease-in-out infinite 5s; }
.blob-3 { width: 450px; height: 450px; background: var(--accent-light); bottom: -100px; left: 25%; animation: blobDrift 20s ease-in-out infinite 10s; }

@keyframes blobDrift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25%      { transform: translate(60px, -40px) scale(1.05); }
  50%      { transform: translate(-30px, 50px) scale(0.95); }
  75%      { transform: translate(-60px, -30px) scale(1.02); }
}

@media (prefers-color-scheme: dark) {
  :root:not(.light) .blob { mix-blend-mode: screen; opacity: 0.15; }
}

/* ── NAV ── */
nav.site-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  padding: 1.25rem 3rem;
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid rgba(232, 228, 240, 0.6);
  transition: padding 0.3s, box-shadow 0.3s;
}
@media (prefers-color-scheme: dark) {
  :root:not(.light) nav.site-nav {
    background: rgba(15, 12, 30, 0.75);
    border-bottom-color: rgba(42, 37, 72, 0.6);
  }
}
nav.site-nav.scrolled { padding: 0.8rem 3rem; box-shadow: 0 4px 30px rgba(139, 92, 246, 0.06); }

.logo {
  font-family: var(--serif);
  font-size: 1.5rem; letter-spacing: -0.04em;
  color: var(--text); text-decoration: none;
  display: flex; align-items: center; gap: 0.5rem;
}
.logo img { width: 32px; height: 32px; border-radius: 50%; }
.logo-text { display: inline; }
.logo .ai {
  color: var(--accent);
  letter-spacing: -0.06em; margin-left: -0.04em; margin-right: -0.04em;
}

.nav-links { display: flex; gap: 2.5rem; align-items: center; list-style: none; }

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none; font-size: 0.85rem;
  font-weight: 500; letter-spacing: 0.05em; text-transform: uppercase;
  transition: font-weight 0.3s, font-variation-settings 0.3s, color 0.3s;
  font-variation-settings: 'wght' 500;
  padding: 0.4rem 0;
  position: relative;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  font-variation-settings: 'wght' 700;
}
.nav-links a.active::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -2px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-blue));
  border-radius: 2px;
}

.nav-cta {
  background: linear-gradient(135deg, var(--accent), var(--accent-blue)) !important;
  color: var(--white) !important; padding: 0.6rem 1.5rem !important;
  border-radius: 6px;
  transition: opacity 0.3s, transform 0.3s !important;
  text-transform: none !important; font-variation-settings: 'wght' 600 !important;
  letter-spacing: 0 !important;
}
.nav-cta:hover { opacity: 0.92; transform: translateY(-1px); }
.nav-cta.active::after { display: none; }

/* ── MOBILE NAV ── */
.nav-toggle {
  display: none;
  width: 44px; height: 44px;
  border: 1px solid var(--border); border-radius: 10px;
  background: transparent; cursor: pointer;
  align-items: center; justify-content: center;
  color: var(--text);
}
.nav-toggle svg { width: 20px; height: 20px; }

.mobile-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(320px, 85vw);
  background: var(--card-bg);
  border-left: 1px solid var(--border);
  z-index: 200;
  transform: translateX(100%);
  transition: transform 0.4s var(--ease-out-expo);
  padding: 5rem 2rem 2rem;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.mobile-drawer.open { transform: translateX(0); }
.mobile-drawer a {
  padding: 1rem 0;
  color: var(--text);
  text-decoration: none;
  font-family: var(--serif);
  font-size: 1.3rem;
  border-bottom: 1px solid var(--border);
  transition: color 0.2s;
}
.mobile-drawer a:hover, .mobile-drawer a.active { color: var(--accent); }
.mobile-drawer a.nav-cta {
  margin-top: 1rem;
  font-family: var(--sans) !important;
  font-size: 0.9rem !important;
  text-align: center;
  border-bottom: none;
  font-weight: 600 !important;
}
.drawer-overlay {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(26, 26, 46, 0.4);
  backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s;
}
.drawer-overlay.open { opacity: 1; pointer-events: all; }

/* ── PRIMARY / GHOST BUTTONS ── */
.btn-primary {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent), var(--accent-blue));
  color: var(--white); padding: 1rem 2.5rem;
  text-decoration: none; font-weight: 600; font-size: 0.95rem;
  border-radius: 8px;
  transition: all 0.3s var(--ease-out-expo);
  border: none; box-shadow: 0 4px 16px rgba(217, 70, 239, 0.25);
  position: relative; overflow: hidden;
  cursor: pointer;
}
.btn-primary::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent);
  opacity: 0; transition: opacity 0.3s;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(217, 70, 239, 0.35); }
.btn-primary:hover::after { opacity: 1; }

.btn-ghost {
  display: inline-block; color: var(--text-secondary); text-decoration: none;
  font-weight: 500; font-size: 0.9rem; padding: 1rem 0;
  transition: color 0.3s; border-bottom: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--text); }

/* ── SCROLL REVEAL ── */
.reveal {
  opacity: 0; transform: translateY(40px);
  transition: opacity 0.8s var(--ease-out-expo), transform 0.8s var(--ease-out-expo);
}
.reveal.visible { opacity: 1; transform: translateY(0); }

.stagger-children .reveal-child {
  opacity: 0; transform: translateY(30px);
  transition: opacity 0.6s var(--ease-out-expo), transform 0.6s var(--ease-out-expo);
}
.stagger-children.visible .reveal-child { opacity: 1; transform: translateY(0); }

/* ── FOOTER ── */
footer.site-footer {
  padding: 3rem; max-width: 1400px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center;
  border-top: 1px solid var(--border); position: relative; z-index: 1;
}

.footer-brand {
  font-family: var(--serif); font-size: 1.1rem; color: var(--text-secondary);
  display: flex; align-items: center; gap: 0.5rem;
}
.footer-brand img { width: 24px; height: 24px; border-radius: 50%; opacity: 0.8; }
.footer-logo-text { display: inline; }
.footer-brand .gradient-text {
  background: linear-gradient(135deg, var(--accent), var(--accent-blue));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  letter-spacing: -0.06em; margin-left: -0.04em; margin-right: -0.04em;
  font-feature-settings: 'liga' 0;
  -webkit-font-smoothing: antialiased;
  display: inline-block;
  padding-top: 0.08em;
  line-height: 1;
  vertical-align: baseline;
  text-rendering: geometricPrecision;
  font-size: 1.08em;
}
.footer-meta { font-size: 0.78rem; color: var(--text-secondary); font-weight: 400; }
.footer-meta a { color: var(--text-secondary); text-decoration: none; transition: color 0.3s; }
.footer-meta a:hover { color: var(--text); }

/* ── BACK TO TOP ── */
.back-to-top {
  position: fixed; bottom: 2rem; right: 2rem;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-blue));
  color: var(--white);
  display: flex; align-items: center; justify-content: center;
  border: none; cursor: pointer; z-index: 90;
  box-shadow: 0 6px 24px rgba(139, 92, 246, 0.25);
  opacity: 0; transform: translateY(20px); pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
}
.back-to-top.visible { opacity: 1; transform: translateY(0); pointer-events: all; }
.back-to-top:hover { transform: translateY(-2px) scale(1.04); }
.back-to-top svg { width: 18px; height: 18px; }

/* ── SECTION SHARED ── */
section {
  padding: 7rem 3rem; max-width: 1400px;
  margin: 0 auto; position: relative; z-index: 1;
}

.section-label {
  font-family: var(--mono); font-size: 0.72rem;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--accent-deep);       /* was --accent — now passes AA on white */
  margin-bottom: 1rem; font-weight: 500;
}

.section-title {
  font-family: var(--serif); font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.15; letter-spacing: -0.02em; margin-bottom: 1.5rem; max-width: 650px;
}

.section-desc {
  color: var(--text-secondary); font-size: 1.05rem;
  max-width: 560px; line-height: 1.7; font-weight: 400;
}

.divider {
  max-width: 1400px; margin: 0 auto; padding: 0 3rem;
  position: relative; z-index: 1;
}
.divider hr { border: none; height: 1px; background: var(--border); }

/* ── PROGRESS RAIL ── */
.progress-rail {
  position: fixed;
  left: 1.5rem; top: 50%;
  transform: translateY(-50%);
  z-index: 80;
  display: none;
  flex-direction: column; gap: 0.75rem;
  pointer-events: none;
}
.progress-rail .rail-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--border);
  transition: all 0.3s var(--ease-out-expo);
  pointer-events: all;
  cursor: pointer;
  border: none;
  padding: 0;
  position: relative;
}
.progress-rail .rail-dot::after {
  content: attr(data-label);
  position: absolute; left: 18px; top: 50%;
  transform: translateY(-50%) translateX(-4px);
  font-family: var(--mono); font-size: 0.62rem;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-secondary);
  white-space: nowrap;
  opacity: 0; transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  /* readable backdrop so the label never appears to bleed into content */
  background: var(--white);
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  box-shadow: 0 6px 18px rgba(26, 26, 46, 0.06);
}
/* Show the label ONLY on hover/focus, not for the active state.
   The active dot stays scaled + coloured, which is enough as a "you are here"
   marker without permanently floating a tooltip into the content column. */
.progress-rail .rail-dot:hover::after,
.progress-rail .rail-dot:focus-visible::after {
  opacity: 1; transform: translateY(-50%) translateX(0);
}
.progress-rail .rail-dot.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-blue));
  transform: scale(1.6);
}
@media (prefers-color-scheme: dark) {
  :root:not(.light) .progress-rail .rail-dot::after {
    background: var(--card-bg);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  }
}
/* On narrower screens (but still ≥1200px where the rail shows) the tooltip
   may briefly overlap the content column — the white pill backdrop above
   keeps it readable and clearly separated from body copy. */
@media (min-width: 1200px) {
  .progress-rail { display: flex; }
}

/* ── PAGE HEADER (subpages) ── */
.page-header {
  padding: 10rem 3rem 4rem;
  max-width: 1400px; margin: 0 auto;
  position: relative; z-index: 1;
}
.page-label {
  font-family: var(--mono);
  font-size: 0.72rem; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--accent-deep);
  margin-bottom: 1rem; font-weight: 500;
}
.page-title {
  font-family: var(--serif);
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  letter-spacing: -0.03em; line-height: 1.1;
  margin-bottom: 1.2rem;
}
.page-desc {
  font-size: 1.05rem; color: var(--text-secondary);
  max-width: 640px; font-weight: 400; line-height: 1.7;
}

/* ── REDUCED MOTION ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .blob { display: none; }
  .grain { display: none; }
}

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  nav.site-nav { padding: 1rem 1.5rem; }
  nav.site-nav.scrolled { padding: 0.8rem 1.5rem; }
  section { padding: 5rem 1.5rem; }
  .divider { padding: 0 1.5rem; }
  .page-header { padding: 8rem 1.5rem 3rem; }
  footer.site-footer {
    flex-direction: column; gap: 1rem; text-align: center; padding: 2rem 1.5rem;
  }
  .nav-links { display: none; }
  .nav-toggle { display: flex; }
}
