/* cotoaga-ai-site — structural styles. Brand-blind: consumes --brand-* only. */

* { box-sizing: border-box; }

body {
  background: var(--brand-surface);
  color: var(--brand-text-body);
  font-family: var(--font-primary);
  line-height: var(--leading-normal);
  margin: 0;
  padding: 0;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-2xl) var(--space-lg);
}

a {
  color: var(--brand-accent);
  transition: color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
a:hover { color: var(--brand-primary); }

/* ---------- The Curtain, Mk II (COT-119 · review round, Kurt 2026-07-31) ----------
   The 92svh void is dead — height is content-driven. Compact black masthead
   pinned at top:0 (z1) with the brand lockup + ambient tesseract; sticky
   black navbar above everything (z10) carries the links + a small
   time-driven tesseract; the sheet (z2) buries the masthead as you scroll.
   Lockup scrolls out under the sheet, the bar and its glyph stay. Pure
   position:sticky — every browser, including the fox. */

.site-masthead {
  position: sticky;
  top: 0;
  z-index: 1;
  overflow: clip;
  background: var(--brand-hero-bg);
}

.site-masthead-inner {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: clamp(3rem, 9vh, 5.5rem) var(--space-lg);
}

.site-masthead .site-brand { gap: var(--space-sm); }

.site-masthead .site-brand-name {
  font-size: clamp(2.5rem, 7vw, 5rem);
  line-height: var(--leading-tight);
}

.site-masthead .site-brand-tagline { font-size: 1rem; }

.site-masthead .site-brand-name,
.site-masthead .site-brand-tagline { color: var(--brand-hero-text); }

/* ambient brand mark — time-based idle spin, deliberately slow */
.hero-mark {
  position: absolute;
  top: 50%;
  right: min(-2rem, -4vw);
  width: clamp(200px, 30vh, 340px);
  aspect-ratio: 1;
  translate: 0 -50%;
  color: var(--brand-primary);
  opacity: .22;
  pointer-events: none;
}
.hero-mark svg { width: 100%; height: 100%; animation: spin 90s linear infinite; }

/* the sheet that rides over the masthead — carries main AND footer,
   so nothing ever exposes the pinned black plate at the page end */
.sheet {
  position: relative;
  z-index: 2;
  background: var(--brand-surface);
  box-shadow: 0 -32px 80px rgba(6, 10, 9, 0.4);
}

/* ---------- Sticky navbar — the persistent top edge ---------- */

.site-navbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--brand-hero-bg);
}

.site-navbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-sm) var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.site-navbar .site-nav { flex: 1; }

.site-navbar .site-nav a { color: var(--brand-hero-text); }
.site-navbar .site-nav a:hover { color: var(--brand-accent); }
.site-navbar .site-nav a[aria-current="page"] {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
}
.site-navbar .nav-toggle { border-color: var(--brand-hero-text); }
.site-navbar .nav-toggle-bar { background: var(--brand-hero-text); }

.navbar-mark {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  color: var(--brand-primary);
}

@media (max-width: 768px) {
  .site-navbar .site-nav a { border-bottom-color: rgba(250, 250, 247, 0.14); }
}

.site-brand {
  display: flex;
  flex-direction: column;
  text-decoration: none;
}

.site-brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  color: var(--brand-hero-color);
}

.site-brand-tagline {
  font-family: var(--font-primary);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--brand-text-secondary);
}

/* ---------- Navigation ---------- */

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-md);
}

.site-nav a {
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--brand-text-body);
  padding: var(--space-xs) 0;
  border-bottom: 2px solid transparent;
  transition: color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.site-nav a:hover { color: var(--brand-accent); }

.site-nav a[aria-current="page"] {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  padding: var(--space-sm);
  cursor: pointer;
}

.nav-toggle-bar {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--brand-text-body);
  margin: 4px 0;
}

@media (max-width: 768px) {
  .nav-toggle { display: block; }
  .site-nav { display: none; width: 100%; }
  .site-nav.is-open { display: block; }
  .site-nav ul { flex-direction: column; gap: 0; }
  .site-nav a {
    display: block;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--brand-border);
  }
  .site-nav a[aria-current="page"] { border-bottom-color: var(--brand-primary); }
  .container { padding: var(--space-lg) var(--space-md); }
}

/* ---------- Headings ---------- */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: var(--leading-tight);
}

h1 {
  font-size: 3rem;
  font-weight: 700;
  color: var(--brand-hero-color);
  letter-spacing: -0.02em;
}

h2 {
  font-size: 2rem;
  font-weight: 600;
  color: var(--brand-primary);
}

@media (max-width: 768px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }
}

/* ---------- Sticky section titles (COT-119 · review round) ----------
   Wrap a page section in <section class="topic"> and open it with the
   sectionHeader macro: the header pins below the navbar until the next
   section pushes in. Opaque surface so content ducks underneath.
   --nav-h is published by nav.js (measured; the bar can wrap to 2 rows). */

.topic { padding-top: var(--space-2xl); }

.topic > .section-header {
  position: sticky;
  top: var(--nav-h, 64px);
  z-index: 5;
  background: var(--brand-surface);
  margin: 0 0 var(--space-md);
  padding: var(--space-md) 0;
}

:where([id]) { scroll-margin-top: calc(var(--nav-h, 64px) + var(--space-sm)); }

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--brand-border);
  margin-top: var(--space-3xl);
}

.site-footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--brand-text-secondary);
}

.site-footer a {
  color: var(--brand-text-secondary);
  text-decoration: underline;
}
.site-footer a:hover { color: var(--brand-accent); }

.footer-legal a { margin-right: var(--space-md); }

/* ---------- Seams as behavior (COT-119) ----------
   Enhancement layer only — outside @supports the page is complete and calm.
   NB: animation-timeline must come AFTER the animation shorthand, or the
   shorthand resets it. Ask me how everyone learns that. */

@supports (animation-timeline: view()) {
  .reveal {
    animation: rise linear both;
    animation-timeline: view();
    animation-range: entry 5% entry 55%;
  }
}

@keyframes rise { from { opacity: 0; translate: 0 28px; } }
@keyframes spin { to { rotate: 360deg; } }

/* ---------- Stillness for those who asked for it ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
