/* ──────────────────────────────────────────────────────────
   Brain Leak — site styles
   Tokens · base · navbar · footer · UI · animations
   ────────────────────────────────────────────────────────── */

:root {
  --navy: #1B4F8A;
  --navy-deep: #173e6e;
  --navy-darker: #0f2a4b;
  --accent: #E07B39;
  --accent-hover: #d06b29;
  --paper: #F8F7F4;
  --paper-warm: #F1EFE8;
  --dark: #1A1A2E;
  --gray: #6B7280;
  --rule: rgba(26,26,46,0.10);
  --rule-strong: rgba(26,26,46,0.16);

  --serif: 'Playfair Display', Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, sans-serif;
  --mono: 'DM Mono', ui-monospace, "SF Mono", Menlo, monospace;

  --shell-w: 1240px;
  --shell-pad: 32px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--dark);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

::selection { background: var(--accent); color: #fff; }

.shell {
  max-width: var(--shell-w);
  margin: 0 auto;
  padding: 0 var(--shell-pad);
  width: 100%;
}

/* ── Typography helpers ─────────────────────────────────── */
.kicker {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--accent);
}
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gray);
}
h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 700;
  color: var(--dark);
  letter-spacing: -0.3px;
  margin: 0;
  text-wrap: balance;
}
p { margin: 0 0 1em; text-wrap: pretty; }

/* ── Buttons / Inputs ───────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.2px;
  padding: 13px 22px;
  border-radius: 8px;
  border: none;
  transition: background .18s var(--ease), transform .18s var(--ease), box-shadow .18s var(--ease);
}
.btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(224,123,57,0.35);
}
.btn:active { transform: translateY(0); }
.btn--ghost {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.25);
  color: #fff;
}
.btn--ghost:hover { background: rgba(255,255,255,0.06); box-shadow: none; }

.subscribe-form {
  display: flex;
  gap: 8px;
  max-width: 480px;
  align-items: stretch;
}
.subscribe-form input[type="email"] {
  flex: 1;
  min-width: 0;
  font-family: var(--sans);
  font-size: 15px;
  padding: 13px 16px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
  color: #fff;
  transition: border .18s, background .18s;
}
.subscribe-form input::placeholder { color: rgba(255,255,255,0.45); }
.subscribe-form input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255,255,255,0.10);
}
/* On light backgrounds */
.on-paper .subscribe-form input[type="email"] {
  background: #fff;
  border-color: var(--rule-strong);
  color: var(--dark);
}
.on-paper .subscribe-form input::placeholder { color: var(--gray); }

/* ── Navbar ─────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--navy);
  border-bottom: 3px solid var(--accent);
  transition: padding .25s var(--ease), background .25s var(--ease), backdrop-filter .25s var(--ease);
}
.nav.is-shrunk {
  background: rgba(27,79,138,0.86);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
}
.nav-inner {
  max-width: var(--shell-w);
  margin: 0 auto;
  padding: 22px var(--shell-pad);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  transition: padding .25s var(--ease);
}
.nav.is-shrunk .nav-inner { padding: 14px var(--shell-pad); }
.nav-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #fff;
}
.nav-logo svg { height: 32px; width: auto; }
.nav-logo .word {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 22px;
  color: #fff;
  letter-spacing: 0.2px;
}
.nav-links {
  display: flex;
  justify-content: center;
  gap: 36px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.3px;
  color: rgba(255,255,255,0.85);
  position: relative;
  padding: 4px 0;
  transition: color .18s;
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: -2px;
  height: 2px;
  background: var(--accent);
  transition: right .25s var(--ease);
}
.nav-links a:hover,
.nav-links a.is-active { color: #fff; }
.nav-links a:hover::after,
.nav-links a.is-active::after { right: 0; }
.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.nav-burger {
  display: none;
  width: 40px; height: 40px;
  border: 1px solid rgba(255,255,255,0.2);
  background: transparent;
  border-radius: 6px;
  align-items: center; justify-content: center;
}
.nav-burger span {
  display: block; width: 18px; height: 2px; background: #fff;
  position: relative;
}
.nav-burger span::before, .nav-burger span::after {
  content: ""; position: absolute; left: 0; width: 18px; height: 2px; background: #fff;
}
.nav-burger span::before { top: -6px; }
.nav-burger span::after { top: 6px; }

/* ── Footer ─────────────────────────────────────────────── */
.footer {
  background: var(--dark);
  color: #F8F7F4;
  border-top: 3px solid var(--accent);
  padding: 56px 0 32px;
  margin-top: 96px;
}
.footer-inner {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 32px;
  align-items: center;
}
.footer-left { display: flex; align-items: center; gap: 14px; }
.footer-left .word {
  font-family: var(--serif); font-weight: 700; font-size: 20px; color: #fff;
}
.footer-links {
  list-style: none;
  margin: 0; padding: 0;
  display: flex; justify-content: center; gap: 28px;
}
.footer-links a {
  font-family: var(--sans); font-size: 14px;
  color: rgba(248,247,244,0.7);
  transition: color .18s;
}
.footer-links a:hover { color: var(--accent); }
.footer-right {
  text-align: right;
  font-family: var(--mono); font-size: 11px; letter-spacing: 2px;
  color: rgba(248,247,244,0.5);
  text-transform: uppercase;
}
.footer-credit {
  border-top: 1px solid rgba(248,247,244,0.08);
  margin-top: 40px; padding-top: 20px;
  display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 10px; letter-spacing: 2px;
  color: rgba(248,247,244,0.4);
  text-transform: uppercase;
}

/* ── Reveal animations ──────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .8s var(--ease-out), transform .8s var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}
.reveal.is-in {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ── Custom cursor halo (desktop only) ───────────────────── */
.cursor-halo {
  position: fixed;
  top: 0; left: 0;
  width: 28px; height: 28px;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  mix-blend-mode: normal;
  display: none;
}
.cursor-halo .ring {
  width: 100%; height: 100%;
  border-radius: 50%;
  border: 1.5px solid var(--navy);
  transition: width .2s var(--ease), height .2s var(--ease), border-color .2s var(--ease), background .2s var(--ease);
}
.cursor-halo .drop {
  position: absolute;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  bottom: -2px; left: 50%;
  transform: translateX(-50%);
  transition: transform .2s var(--ease);
}
.cursor-halo.is-link .ring {
  width: 44px; height: 44px;
  border-color: var(--accent);
  background: rgba(224,123,57,0.08);
}
.cursor-halo.is-on-dark .ring { border-color: rgba(255,255,255,0.7); }
@media (hover: hover) and (pointer: fine) {
  html.cursor-on { cursor: none; }
  html.cursor-on a,
  html.cursor-on button,
  html.cursor-on input,
  html.cursor-on [role="button"] { cursor: none; }
  .cursor-halo { display: block; }
}

/* ── EEG inline animation ───────────────────────────────── */
@keyframes eegDash {
  from { stroke-dashoffset: 1200; }
  to { stroke-dashoffset: 0; }
}
@keyframes leakPulse {
  0%, 100% { opacity: 0.35; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.4); }
}
@keyframes synapseGlow {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 880px) {
  :root { --shell-pad: 20px; }
  .nav-inner { grid-template-columns: auto auto; }
  .nav-links { display: none; }
  .nav-cta .btn { padding: 10px 16px; font-size: 14px; }
  .nav-burger { display: none; } /* keep hidden — Subscribe button is enough on mobile */
  .footer-inner { grid-template-columns: 1fr; text-align: center; gap: 24px; }
  .footer-left { justify-content: center; }
  .footer-right { text-align: center; }
  .footer-links { flex-wrap: wrap; }
  .footer-credit { flex-direction: column; gap: 8px; text-align: center; }
}

/* ── Navbar ─────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--navy);
  border-bottom: 3px solid var(--accent);
  transition: padding .25s var(--ease), box-shadow .25s var(--ease);
}
.nav-inner {
  max-width: var(--shell-w);
  margin: 0 auto;
  padding: 0 var(--shell-pad);
  height: 72px;
  display: flex;
  align-items: center;
  gap: 32px;
}
.nav.is-shrunk { box-shadow: 0 4px 24px rgba(0,0,0,0.18); }
.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}
.nav-logo .word {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 20px;
  color: #fff;
  letter-spacing: -0.2px;
}
.nav nav { flex: 1; display: flex; justify-content: center; }
.nav-links {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  gap: 32px;
}
.nav-links a {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  letter-spacing: 0.2px;
  transition: color .18s;
  position: relative;
  padding-bottom: 4px;
}
.nav-links a:hover { color: #fff; }
.nav-links a.is-active { color: #fff; }
.nav-links a.is-active::after {
  content: "";
  position: absolute;
  bottom: -4px; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}
.nav-cta { flex-shrink: 0; }

/* ── Subscribe form ─────────────────────────────────────── */
.subscribe-form {
  display: flex;
  gap: 10px;
  max-width: 480px;
}
.subscribe-form input[type="email"] {
  flex: 1;
  font-family: var(--sans);
  font-size: 15px;
  padding: 13px 18px;
  border-radius: 8px;
  border: 1.5px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.1);
  color: #fff;
  outline: none;
  transition: border .18s, background .18s;
}
.subscribe-form input::placeholder { color: rgba(255,255,255,0.5); }
.subscribe-form input:focus { border-color: var(--accent); background: rgba(255,255,255,0.15); }

/* ── Footer ─────────────────────────────────────────────── */
.footer {
  background: var(--dark);
  border-top: 3px solid var(--accent);
  padding: 48px 0 32px;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
  margin-bottom: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.footer-left {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.footer-left .word {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 18px;
  color: #fff;
}
.footer-links {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  gap: 24px;
}
.footer-links a {
  font-size: 14px;
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  transition: color .18s;
}
.footer-links a:hover { color: var(--accent); }
.footer-right {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
}
.footer-credit {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.3);
}
.footer-credit a { color: rgba(255,255,255,0.3); text-decoration: none; }
.footer-credit a:hover { color: var(--accent); }

/* ── Reveal animations ──────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .6s var(--ease-out), transform .6s var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}
.reveal.is-in { opacity: 1; transform: translateY(0); }

/* ── Cursor halo ────────────────────────────────────────── */
.cursor-halo { position: fixed; top: 0; left: 0; pointer-events: none; z-index: 9999; }
.cursor-on * { cursor: none !important; }
.cursor-halo .ring {
  width: 28px; height: 28px;
  border: 1.5px solid var(--navy);
  border-radius: 50%;
  position: absolute;
  top: -14px; left: -14px;
  transition: width .2s, height .2s, border-color .2s, top .2s, left .2s;
}
.cursor-halo .drop {
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  position: absolute;
  top: -3px; left: -3px;
}
.cursor-halo.is-link .ring { width: 44px; height: 44px; top: -22px; left: -22px; border-color: var(--accent); }
.cursor-halo.is-on-dark .ring { border-color: rgba(255,255,255,0.6); }

@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-inner { justify-content: space-between; }
}

/* ── Ghost kg-width classes (required) ──────────────────── */
.kg-width-wide {
  margin-left: calc(50% - 50vw + 32px);
  margin-right: calc(50% - 50vw + 32px);
  max-width: none;
}
.kg-width-full {
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  max-width: none;
}
.kg-image { max-width: 100%; height: auto; border-radius: 8px; }
.kg-gallery-container { display: flex; flex-direction: column; max-width: 100%; }
.kg-gallery-row { display: flex; gap: 8px; margin-bottom: 8px; }
.kg-gallery-image { flex: 1; }
.kg-gallery-image img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; }
.kg-embed-card { display: flex; flex-direction: column; align-items: center; }
.kg-embed-card iframe { max-width: 100%; }
.kg-bookmark-card { border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
.kg-bookmark-content { display: flex; flex-direction: column; gap: 8px; padding: 16px; }
.kg-bookmark-title { font-weight: 600; color: var(--dark); }
.kg-bookmark-description { font-size: 14px; color: var(--gray); }
.kg-bookmark-url { font-family: var(--mono); font-size: 12px; color: var(--gray); }

/* ── Members / Portal ───────────────────────────────────── */
.gh-portal-trigger { display: none; }

