/* ============================================================
   Builder-Agent Integration Kit — shared page base
   Design tokens + base layout + sections + reveal + buttons.
   Nav markup/styles are injected by shared.js; footer by footer.css.
   Mirrors the tokens used across synorb.com (index/streams).
   ============================================================ */
:root {
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Space Grotesk", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;

  --h1-size: clamp(2.5rem, 5vw, 4rem);
  --h2-size: clamp(1.75rem, 3vw, 2.25rem);
  --body-size: 1.0625rem;
  --small-size: 0.9375rem;
  --micro-size: 0.8125rem;
  --mono-size: 0.75rem;

  --bg: #fafafa;
  --bg-subtle: #f0f0f0;
  --text: #1a1a1a;
  --text-secondary: #484848;
  --text-tertiary: #999999;
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.12);
  --accent: #1a1a1a;
  --selection-bg: rgba(0, 0, 0, 0.08);

  --measure: 64ch;
  --page-max: 1240px;
  --page-pad: clamp(1rem, 3vw, 2rem);
  --section-space: clamp(4rem, 10vh, 7rem);
  --header-h: 3.75rem;

  --ease-out-smooth: cubic-bezier(0.25, 0.1, 0.25, 1);
  --ease-out-gentle: cubic-bezier(0.22, 0.61, 0.36, 1);
}

[data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-subtle: #111111;
  --text: #ededed;
  --text-secondary: #999999;
  --text-tertiary: #666666;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.12);
  --accent: #ededed;
  --selection-bg: rgba(255, 255, 255, 0.15);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-body);
  font-size: var(--body-size);
  line-height: 1.65;
  color: var(--text-secondary);
  background: var(--bg);
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

::selection { background: var(--selection-bg); color: var(--text); }
a { color: inherit; text-decoration: none; }

.page { max-width: var(--page-max); margin: 0 auto; padding: 0 var(--page-pad); }

/* ---- Hero ---- */
.hero {
  padding: clamp(3rem, 10vh, 6rem) 0 var(--section-space);
  border-bottom: 1px solid var(--line);
}
.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: var(--mono-size);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 1rem;
}
.hero-eyebrow a { color: var(--text-tertiary); transition: color 0.2s var(--ease-out-smooth); }
.hero-eyebrow a:hover { color: var(--text); }
.hero-headline {
  font-family: var(--font-display);
  font-size: var(--h1-size);
  font-weight: 400;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 1.25rem;
  max-width: 22ch;
  text-wrap: balance;
}
.hero-sub { font-size: var(--body-size); line-height: 1.7; max-width: var(--measure); }
.hero-sub strong { color: var(--text); font-weight: 500; }
.hero-ctas { display: flex; align-items: center; gap: 1.25rem; margin-top: 2rem; flex-wrap: wrap; }

/* ---- Sections ---- */
.section { padding: var(--section-space) 0; border-bottom: 1px solid var(--line); }
.section:last-of-type { border-bottom: none; }
.section-label {
  font-family: var(--font-mono);
  font-size: var(--mono-size);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 0.875rem;
}
.section-title {
  font-family: var(--font-display);
  font-size: var(--h2-size);
  font-weight: 400;
  color: var(--text);
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin-bottom: 1.25rem;
}
.section > p { max-width: var(--measure); margin-bottom: 1.25rem; }
.section > p:last-child { margin-bottom: 0; }

/* ---- Buttons ---- */
.btn-primary {
  display: inline-block;
  padding: 0.6rem 1.4rem;
  font-size: var(--small-size);
  font-weight: 500;
  border-radius: 4px;
  background: var(--text);
  color: var(--bg);
  border: 1px solid var(--text);
  transition: opacity 0.2s var(--ease-out-smooth), transform 0.2s var(--ease-out-smooth);
}
.btn-primary:hover { opacity: 0.85; transform: translateY(-1px); }
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--small-size);
  color: var(--text-secondary);
  border-bottom: 1px solid var(--text-tertiary);
  padding-bottom: 1px;
  transition: color 0.2s var(--ease-out-smooth), border-color 0.2s var(--ease-out-smooth), gap 0.2s var(--ease-out-smooth);
}
.btn-ghost:hover { color: var(--text); border-color: var(--text); gap: 0.6rem; }

/* ---- Reveal ----
   Content is VISIBLE by default. It is only hidden-then-animated once JS adds
   html.bk-anim (i.e. when we know the observer is wired). If JS/observer never
   runs, nothing is hidden — so logos/cards/text always show. ---- */
.reveal { transition: opacity 0.6s var(--ease-out-gentle), transform 0.6s var(--ease-out-gentle); }
html.bk-anim .reveal { opacity: 0; transform: translateY(12px); }
html.bk-anim .reveal.visible { opacity: 1; transform: translateY(0); }
html.bk-anim .reveal .section-label { opacity: 0; }
html.bk-anim .reveal .section-title { opacity: 0; }
html.bk-anim .reveal.visible .section-label { animation: slide-in-left 0.5s var(--ease-out-gentle) forwards; }
html.bk-anim .reveal.visible .section-title { animation: dissolve-up 0.6s var(--ease-out-gentle) 0.12s forwards; }
html.bk-anim .reveal.visible > p { animation: dissolve-in 0.6s var(--ease-out-gentle) 0.25s both; }

html.bk-anim .hero-eyebrow, html.bk-anim .hero-headline, html.bk-anim .hero-sub, html.bk-anim .hero-ctas { opacity: 0; }
html.bk-anim .hero-eyebrow.animate { animation: dissolve-in 0.7s var(--ease-out-gentle) forwards; }
html.bk-anim .hero-headline.animate { animation: dissolve-up 0.8s var(--ease-out-gentle) 0.12s forwards; }
html.bk-anim .hero-sub.animate { animation: dissolve-in 0.7s var(--ease-out-gentle) 0.3s forwards; }
html.bk-anim .hero-ctas.animate { animation: dissolve-up 0.6s var(--ease-out-gentle) 0.5s forwards; }

@keyframes dissolve-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes dissolve-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-in-left { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } }

/* ---- Site nav (shared.js injects the markup; pages own the styles) ---- */
.site-header { padding: 1.25rem 0; border-bottom: 1px solid var(--line); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; }
.nav-brand { display: flex; align-items: center; gap: 0.375rem; font-family: "IBM Plex Sans", var(--font-body); font-size: 1.0625rem; font-weight: 600; color: var(--text); letter-spacing: 0.12em; text-transform: uppercase; }
.nav-brand svg { flex-shrink: 0; }
.nav-links { display: flex; align-items: center; gap: 1.75rem; }
.nav-links a { font-size: var(--small-size); color: var(--text-tertiary); white-space: nowrap; transition: color 0.2s var(--ease-out-smooth), transform 0.2s var(--ease-out-smooth); }
.nav-links a:hover { color: var(--text); transform: translateY(-1px); }
.nav-links a.active { color: var(--text); }
.theme-toggle { background: none; border: 1px solid var(--line-strong); border-radius: 50%; width: 2.25rem; height: 2.25rem; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-tertiary); font-size: 0.875rem; padding: 0; line-height: 1; flex-shrink: 0; transition: color 0.2s var(--ease-out-smooth), border-color 0.2s var(--ease-out-smooth), opacity 0.2s var(--ease-out-smooth); }
.theme-toggle:hover { color: var(--text); border-color: var(--text-secondary); }
.theme-toggle.switching { opacity: 0; }

/* ---- Mobile nav overlay (pages own the overlay styles) ---- */
.nav-menu-btn { display: none; align-items: center; justify-content: center; background: none; border: none; cursor: pointer; color: var(--text); padding: 0.5rem; min-width: 2.75rem; min-height: 2.75rem; -webkit-tap-highlight-color: transparent; }
.nav-overlay { position: fixed; inset: 0; z-index: 999; background: var(--bg); display: flex; flex-direction: column; padding: 1.5rem var(--page-pad); opacity: 0; pointer-events: none; transition: opacity 0.25s ease; }
.nav-overlay.open { opacity: 1; pointer-events: auto; }
.nav-overlay-header { display: flex; align-items: center; justify-content: space-between; padding-bottom: 1.5rem; border-bottom: 1px solid var(--line); }
.nav-overlay-close { background: none; border: none; cursor: pointer; color: var(--text); padding: 0.25rem; -webkit-tap-highlight-color: transparent; }
.nav-overlay-body { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 2.5rem; padding: 2rem 0; }
.nav-overlay-group { display: flex; flex-direction: column; gap: 1rem; }
.nav-overlay-label { font-family: var(--font-mono); font-size: var(--mono-size); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-tertiary); }
.nav-overlay-group a { font-family: var(--font-display); font-size: 1.75rem; color: var(--text); line-height: 1.2; transition: color 0.15s ease; }
.nav-overlay-group a:hover { color: var(--text-secondary); }

@media (max-width: 720px) {
  .nav-links > a { display: none; }
  .nav-menu-btn { display: flex; }
}

a:focus-visible, button:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal, .hero-eyebrow, .hero-headline, .hero-sub, .hero-ctas,
  .reveal .section-label, .reveal .section-title, .reveal.visible > p {
    opacity: 1 !important; transform: none !important; animation: none !important;
  }
}
