/* ════════════════════════════════════════════════════════════
   Universe shared styles — applies to all 5 sites.
   Per-site theme overrides live in theme/css/themes/<name>.css
   CSS custom properties (colors, fonts) are injected per-site
   via head.html, sourced from _data/brand.yml.
   ════════════════════════════════════════════════════════════ */

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

/* Screen reader only utility */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Skip link */
.skip-link { position: absolute; top: -100%; left: 1rem; background: var(--primary); color: #fff; padding: 0.5rem 1rem; border-radius: 0 0 4px 4px; z-index: 100; text-decoration: none; font-weight: 600; }
.skip-link:focus { top: 0; }

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  --content-width: min(65ch, 100% - 2rem);
  --space-xs: clamp(0.5rem, 1vw, 0.75rem);
  --space-s: clamp(0.75rem, 2vw, 1rem);
  --space-m: clamp(1rem, 3vw, 1.5rem);
  --space-l: clamp(1.5rem, 4vw, 2.5rem);
  --space-xl: clamp(2rem, 5vw, 3rem);
}

h1, h2, h3 { font-family: var(--font-heading); line-height: 1.2; margin: var(--space-l) 0 0.5rem; }
h1 { font-size: clamp(1.75rem, 3.5vw + 0.5rem, 2.25rem); }
h2 { font-size: clamp(1.25rem, 2vw + 0.5rem, 1.5rem); }
h3 { font-size: clamp(1.05rem, 1.5vw + 0.5rem, 1.25rem); }

a { color: var(--primary); }
a:hover { color: var(--primary-dark); }
a:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 2px; }

.subtitle { font-size: clamp(1rem, 1.5vw + 0.5rem, 1.125rem); color: var(--text-muted); margin-bottom: var(--space-l); }

.prose p { margin-bottom: 1rem; }
.prose ul, .prose ol { margin-bottom: 1rem; padding-left: 1.5rem; }
.prose blockquote { border-left: 3px solid var(--primary); padding-left: 1rem; color: var(--text-muted); margin: var(--space-m) 0; }
.prose strong { color: var(--secondary); }
.prose img { max-width: 100%; height: auto; }
.prose hr { border: none; border-top: 1px solid var(--border); margin: var(--space-l) 0; }

/* Sticky header — full bleed, content constrained */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg); border-bottom: 1px solid var(--border);
  padding: var(--space-xs) var(--space-m);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.site-header.is-hidden { transform: translateY(-100%); }
.site-header.is-scrolled { box-shadow: 0 1px 8px rgba(0,0,0,0.06); }

.site-header nav { display: flex; align-items: center; gap: 1rem; max-width: var(--content-width); margin: 0 auto; }
.site-header .site-name { font-family: var(--font-heading); font-weight: 700; font-size: 1.125rem; color: var(--text); text-decoration: none; white-space: nowrap; }
.header-links { display: flex; gap: 1rem; margin-left: auto; }
.header-links a { text-decoration: none; color: var(--text-muted); font-size: 0.9rem; white-space: nowrap; }
.header-links a:hover { color: var(--primary); }
.header-links a[aria-current="page"] { color: var(--primary); font-weight: 600; }
.header-cta { margin-left: 0.5rem; background: var(--primary); color: #fff !important; padding: 0.4rem 0.85rem; border-radius: 3px; font-size: 0.85rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.header-cta:hover { background: var(--primary-dark); color: #fff !important; }

/* Hamburger toggle */
.nav-toggle { display: none; background: none; border: 1px solid var(--border); border-radius: 4px; padding: 0.4rem 0.5rem; cursor: pointer; margin-left: auto; }
.nav-toggle-icon, .nav-toggle-icon::before, .nav-toggle-icon::after { display: block; width: 18px; height: 2px; background: var(--text); position: relative; transition: transform 0.2s; }
.nav-toggle-icon::before, .nav-toggle-icon::after { content: ''; position: absolute; left: 0; }
.nav-toggle-icon::before { top: -6px; }
.nav-toggle-icon::after { top: 6px; }

/* Mobile overlay */
.mobile-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg); overflow-y: auto;
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform 0.3s ease;
}
.mobile-overlay.is-open { transform: translateX(0); }
.mobile-overlay-header { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); }
.mobile-overlay-header .site-name { font-family: var(--font-heading); font-weight: 700; font-size: 1.125rem; color: var(--text); text-decoration: none; }
.mobile-close { background: none; border: none; font-size: 1.75rem; cursor: pointer; color: var(--text); padding: 0.25rem; line-height: 1; }
.mobile-nav-body { padding: 1rem; flex: 1; }
.mobile-link { display: block; padding: 0.6rem 0; text-decoration: none; color: var(--text); font-size: 1.05rem; border-bottom: 1px solid var(--border); }
.mobile-link:hover, .mobile-link[aria-current="page"] { color: var(--primary); }
.mobile-cta { display: block; margin: 1rem 0; padding: 0.65rem 1rem; background: var(--primary); color: #fff !important; text-align: center; text-decoration: none; border-radius: 4px; font-weight: 600; }
.mobile-cta:hover { background: var(--primary-dark); }
.mobile-columns { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border); display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.mobile-col h3 { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 0.4rem; }
.mobile-col a { display: block; padding: 0.25rem 0; text-decoration: none; color: var(--text); font-size: 0.9rem; }
.mobile-col a:hover { color: var(--primary); }

@media (max-width: 640px) {
  .header-links, .header-cta { display: none; }
  .nav-toggle { display: block; }
}
@media (max-width: 400px) {
  .footer-grid { grid-template-columns: 1fr; }
  .mobile-columns { grid-template-columns: 1fr; }
}

/* Mega footer — full bleed, fills remaining viewport */
.site-footer { margin-top: var(--space-xl); padding: var(--space-l) var(--space-m) var(--space-m); border-top: 2px solid var(--border); color: var(--text-muted); font-size: 0.85rem; flex-grow: 1; display: flex; flex-direction: column; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--space-m) var(--space-l); margin-bottom: var(--space-l); max-width: var(--content-width); margin-left: auto; margin-right: auto; }
.footer-col h3 { font-size: 0.75rem; font-weight: 600; color: var(--text); margin: 0 0 0.6rem; text-transform: uppercase; letter-spacing: 0.06em; }
.footer-col ul { list-style: none; padding: 0; }
.footer-col li { margin-bottom: 0.35rem; }
.footer-col a { text-decoration: none; color: var(--text-muted); transition: color 0.15s; }
.footer-col a:hover { color: var(--primary); }

.footer-universe { padding: 1.25rem 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin-bottom: 1rem; margin-top: auto; max-width: var(--content-width); margin-left: auto; margin-right: auto; }
.footer-universe-label { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 0.4rem; }
.footer-universe-links { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; }
.footer-universe-links a { text-decoration: none; color: var(--text-muted); font-size: 0.85rem; }
.footer-universe-links a:hover { color: var(--primary); }
.universe-current { font-weight: 600; color: var(--text); font-size: 0.85rem; }

.footer-legal { color: var(--text-muted); font-size: 0.8rem; max-width: var(--content-width); margin-left: auto; margin-right: auto; }

main { padding: var(--space-m) var(--space-m) 0; max-width: var(--content-width); margin: 0 auto; width: 100%; }

.cta { background: var(--muted); padding: var(--space-m); margin: var(--space-l) 0; border-radius: 4px; }
.cta a { display: inline-block; margin-top: 0.5rem; padding: 0.5rem 1rem; background: var(--primary); color: white; text-decoration: none; border-radius: 3px; }
.cta a:hover { background: var(--primary-dark); color: white; }
/* Full-bleed utility for CTA in themed layouts */
.cta--bleed { width: 100vw; position: relative; left: 50%; right: 50%; margin-left: -50vw; margin-right: -50vw; padding: var(--space-l) var(--space-m); border-radius: 0; }
.cta--bleed > * { max-width: var(--content-width); margin-left: auto; margin-right: auto; }

.article-list { list-style: none; padding: 0; }
.article-list li { padding: 0.75rem 0; border-bottom: 1px solid var(--border); }
.article-list a { text-decoration: none; font-weight: 500; }
.article-list time { display: block; font-size: 0.85rem; color: var(--text-muted); }

.expert-list { list-style: none; padding: 0; margin-top: var(--space-l); }
.expert-list li { padding: 0.85rem 0; border-bottom: 1px solid var(--border); }
.expert-list a { text-decoration: none; }
.expert-list strong { font-weight: 600; }
.expert-list .expert-company { color: var(--text-muted); font-weight: 400; }
.expert-list .expert-subtitle { font-size: 0.9rem; color: var(--text-muted); margin: 0.2rem 0 0; }

/* Related concepts panel — auto-rendered when current page matches a System Seed concept */
.related-concepts { margin: var(--space-xl) 0 0; padding: var(--space-m) 0 0; border-top: 1px solid var(--border); }
.related-concepts h2 { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin: 0 0 0.75rem; }
.related-concepts ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem 0.85rem; }
.related-concepts li { font-size: 0.9rem; }
.related-concepts a { text-decoration: none; color: var(--text-muted); }
.related-concepts a:hover { color: var(--primary); }
.related-concepts .cross-site { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.35rem; display: block; }
