:root {
  --bg: #faf8f4;
  --bg-alt: #f1ede4;
  --surface: #ffffff;
  --text: #17202e;
  --muted: #5b6575;
  --line: #e2dccf;
  --accent: #a8742a;
  --accent-strong: #8a5c1b;
  --navy: #0f1b2d;
  --on-navy: #f4efe6;
  --shadow: 0 1px 2px rgba(15, 27, 45, .06), 0 8px 24px rgba(15, 27, 45, .06);
  --radius: 14px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1420; --bg-alt: #121b2a; --surface: #172235; --text: #e9e4da; --muted: #9aa5b5;
    --line: #26334a; --accent: #e2b467; --accent-strong: #f0c983; --navy: #08101b; --on-navy: #f4efe6;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1420; --bg-alt: #121b2a; --surface: #172235; --text: #e9e4da; --muted: #9aa5b5;
  --line: #26334a; --accent: #e2b467; --accent-strong: #f0c983; --navy: #08101b; --on-navy: #f4efe6;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 17px/1.65 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-strong); text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 650; line-height: 1.15; letter-spacing: -.01em; margin: 0 0 .5em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); }
h2 { font-size: clamp(1.7rem, 3.2vw, 2.4rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
svg { width: 1em; height: 1em; }

.wrap { width: min(1140px, 100% - 32px); margin-inline: auto; }
.wrap-narrow { width: min(760px, 100% - 32px); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--navy); color: var(--on-navy); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .78rem; font-weight: 600; color: var(--accent); margin-bottom: .75em; }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 60ch; }
.lede strong { color: var(--text); }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(160%) blur(10px); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { font-family: var(--serif); font-weight: 650; font-size: 1.2rem; color: var(--text); text-decoration: none; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a { color: var(--text); text-decoration: none; font-size: .95rem; font-weight: 500; padding: 8px 12px; border-radius: 8px; }
.nav a:hover { background: var(--bg-alt); }
.nav .nav-cta { background: var(--navy); color: var(--on-navy); margin-left: 6px; }
:root[data-theme="dark"] .nav .nav-cta { background: var(--accent); color: #1a1206; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .nav .nav-cta { background: var(--accent); color: #1a1206; } }
.nav .nav-cta:hover { opacity: .9; background: var(--navy); }
.theme-btn { background: none; border: 1px solid var(--line); color: var(--text); border-radius: 8px; width: 36px; height: 36px; margin-left: 6px; cursor: pointer; display: grid; place-items: center; }
.menu-btn { display: none; background: none; border: 0; width: 44px; height: 44px; cursor: pointer; padding: 10px; }
.menu-btn span { display: block; height: 2px; background: var(--text); margin: 6px 0; border-radius: 2px; transition: transform .2s; }
.menu-btn[aria-expanded="true"] span:first-child { transform: translateY(4px) rotate(45deg); }
.menu-btn[aria-expanded="true"] span:last-child { transform: translateY(-4px) rotate(-45deg); }

@media (max-width: 900px) {
  .menu-btn { display: block; }
  .nav { position: fixed; inset: 64px 0 auto 0; flex-direction: column; align-items: stretch; background: var(--bg); border-bottom: 1px solid var(--line); padding: 12px 16px 20px; gap: 2px; transform: translateY(-8px); opacity: 0; pointer-events: none; transition: .2s; }
  .nav.open { transform: none; opacity: 1; pointer-events: auto; }
  .nav a { padding: 12px; }
  .nav .nav-cta { margin: 8px 0 0; text-align: center; }
  .theme-btn { margin: 8px 0 0; width: 100%; }
}

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px; border-radius: 999px; font-weight: 600; font-size: .95rem; text-decoration: none; border: 1px solid transparent; transition: transform .15s, background .15s; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--navy); color: var(--on-navy); }
:root[data-theme="dark"] .btn-primary { background: var(--accent); color: #1a1206; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-primary { background: var(--accent); color: #1a1206; } }
.btn-ghost { border-color: var(--line); color: var(--text); background: var(--surface); }
.btn-light { background: #fff; color: #0b1020; }

/* Hero */
.hero { padding: clamp(40px, 7vw, 96px) 0 40px; }
.hero-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: clamp(32px, 6vw, 80px); align-items: center; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0; }
.hero-photo { margin: 0; position: relative; }
.hero-photo::before { content: ""; position: absolute; inset: 18px -18px -18px 18px; border: 2px solid var(--accent); border-radius: 24px; z-index: 0; }
.hero-photo img { position: relative; z-index: 1; border-radius: 24px; aspect-ratio: 1; object-fit: cover; box-shadow: var(--shadow); }
.social { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.social a { display: inline-flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; }
.social svg { width: 18px; height: 18px; }
.social-hero a { border: 1px solid var(--line); background: var(--surface); padding: 8px 14px; border-radius: 999px; font-size: .9rem; font-weight: 500; }
.social-hero a:hover { border-color: var(--accent); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 64px 0 0; }
.stats div { background: var(--surface); padding: 22px 20px; }
.stats dt { font-family: var(--serif); font-size: 2.2rem; font-weight: 650; color: var(--accent); line-height: 1; }
.stats dd { margin: 8px 0 0; color: var(--muted); font-size: .92rem; }

@media (max-width: 800px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-photo { order: -1; max-width: 300px; }
  .stats { grid-template-columns: repeat(2, 1fr); margin-top: 40px; }
}

/* Sections */
.section { padding: clamp(56px, 8vw, 104px) 0; }
.section-tight { padding-top: 0; }
.section-alt { background: var(--bg-alt); }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }
.section-head h2 { margin: 0; }
.two-col { display: grid; grid-template-columns: 1fr 1.6fr; gap: clamp(32px, 6vw, 80px); }
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; } }
.prose { font-size: 1.05rem; }
.prose p { max-width: 68ch; }
.subhead { font-family: var(--sans); font-size: .85rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 36px 0 12px; }

/* Cards */
.cards { display: grid; gap: 20px; margin-top: 28px; }
.cards-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .cards-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .cards-3 { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.card h3 { margin-bottom: .4em; }
.card p { color: var(--muted); margin: 0; font-size: .97rem; }
.article-card { padding: 0; overflow: hidden; }
.article-card a { color: inherit; text-decoration: none; display: flex; flex-direction: column; height: 100%; }
.article-card img { aspect-ratio: 16/9; object-fit: cover; width: 100%; }
.article-card-body { padding: 20px 22px 24px; }
.article-card time { font-size: .82rem; color: var(--accent); font-weight: 600; }
.article-card h3 { margin: 6px 0 8px; }
.article-card:hover h3 { color: var(--accent-strong); }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 26px 24px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); }
.timeline .period { display: block; font-size: .82rem; color: var(--accent); font-weight: 600; }
.timeline strong { display: block; font-size: 1.02rem; }
.timeline .org { display: block; color: var(--muted); font-size: .95rem; }
.timeline p { margin: 6px 0 0; color: var(--muted); font-size: .95rem; }
.timeline-compact li { padding-bottom: 18px; }

/* Publications */
.pubs { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 14px; }
.pubs a { display: grid; grid-template-columns: 1fr auto; gap: 4px 20px; padding: 22px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: inherit; text-decoration: none; transition: border-color .15s; }
.pubs a:hover { border-color: var(--accent); }
.pub-topic { grid-column: 1; font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); font-weight: 600; }
.pub-title { grid-column: 1; font-family: var(--serif); font-size: 1.15rem; font-weight: 500; line-height: 1.35; }
.pub-venue { grid-column: 1; color: var(--muted); font-size: .92rem; }
.pub-arrow { grid-column: 2; grid-row: 1 / span 3; align-self: center; color: var(--accent); }
.pub-arrow svg { width: 22px; height: 22px; }

/* Book */
.book { display: grid; grid-template-columns: 260px 1fr; gap: clamp(28px, 5vw, 64px); align-items: center; margin-top: 28px; }
.book-cover { aspect-ratio: 2/3; border-radius: 6px 14px 14px 6px; background: linear-gradient(150deg, #13233b 0%, #0b1424 60%, #2a1a08 100%); color: #f4efe6; padding: 28px 24px; display: flex; flex-direction: column; box-shadow: -8px 0 0 -2px #e2b467 inset, 0 24px 48px rgba(15,27,45,.28); }
.book-kicker { font-size: .72rem; letter-spacing: .2em; text-transform: uppercase; color: #e2b467; font-weight: 600; }
.book-title { font-family: var(--serif); font-size: 1.6rem; font-weight: 650; line-height: 1.15; margin-top: 18px; }
.book-author { margin-top: auto; font-size: .9rem; letter-spacing: .08em; text-transform: uppercase; opacity: .85; }
.book-sub { font-family: var(--serif); font-style: italic; color: var(--muted); font-size: 1.05rem; }
.book-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
@media (max-width: 700px) { .book { grid-template-columns: 1fr; } .book-cover { max-width: 220px; } }

/* Cogniata band */
.cogniata-band { background: #0b1020; color: #f4efe6; }
.cogniata-band h2 { color: #fff; }
.eyebrow-light { color: #ec1c24; }
.cogniata-band-inner { display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; }
.cogniata-band p { color: #b8c0cf; margin: 0; }

/* Contact */
.form-frame { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.form-frame iframe { width: 100%; height: 900px; border: 0; display: block; }
.form-placeholder { padding: 48px 32px; text-align: center; }

/* Articles */
.page-head { padding-bottom: 24px; }
.back { display: inline-block; margin-bottom: 18px; text-decoration: none; font-weight: 500; }
.article-meta { color: var(--muted); }
.article-hero { border-radius: var(--radius); margin: 8px 0 32px; width: 100%; }
.article-body { padding-bottom: 80px; }
.article-body h2 { margin-top: 1.6em; font-size: 1.7rem; }
.article-body h3 { margin-top: 1.4em; }
.article-body img { border-radius: 10px; margin: 24px 0; }
.article-body blockquote { margin: 24px 0; padding: 4px 20px; border-left: 3px solid var(--accent); color: var(--muted); font-style: italic; }
.article-body pre { background: var(--navy); color: #e9e4da; padding: 18px; border-radius: 10px; overflow-x: auto; font-size: .9rem; }
.article-body code { font-size: .92em; }
.video { position: relative; aspect-ratio: 16/9; margin: 24px 0; border-radius: 12px; overflow: hidden; background: #000; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Footer */
.footer { border-top: 1px solid var(--line); padding: 36px 0; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 20px; }
.footer-name { font-family: var(--serif); font-weight: 650; font-size: 1.1rem; margin: 0; }
.footer p { margin: 0; }
.footer .social a { width: 40px; height: 40px; justify-content: center; border: 1px solid var(--line); border-radius: 50%; }
.footer .social a:hover { border-color: var(--accent); color: var(--accent); }

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

/* Contact form */
.contact-form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(20px, 4vw, 32px); box-shadow: var(--shadow); display: grid; gap: 16px; }
.contact-form label { display: grid; gap: 6px; font-weight: 500; font-size: .95rem; }
.contact-form input, .contact-form select, .contact-form textarea { font: inherit; font-weight: 400; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; width: 100%; }
.contact-form input:focus, .contact-form select:focus, .contact-form textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.contact-form textarea { resize: vertical; min-height: 140px; }
.contact-form .btn { justify-self: start; border: 0; cursor: pointer; }
.contact-form p { margin: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .field-row { grid-template-columns: 1fr; } }
.optional { color: var(--muted); font-weight: 400; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.form-status { padding: 12px 14px; border-radius: 10px; font-weight: 500; }
.form-status.is-ok { background: color-mix(in srgb, #1f9d55 14%, transparent); color: var(--text); border: 1px solid color-mix(in srgb, #1f9d55 45%, transparent); }
.form-status.is-error { background: color-mix(in srgb, #d33 12%, transparent); color: var(--text); border: 1px solid color-mix(in srgb, #d33 45%, transparent); }

/* ---------- Cogniata page (always dark, matches the white logo) ---------- */
.cg { --cg-bg: #0b1020; --cg-alt: #10172b; --cg-tile: #141c33; --cg-line: #232d4a; --cg-text: #eef1f7; --cg-muted: #9ba6bf; --cg-red: #ec1c24; background: var(--cg-bg); color: var(--cg-text); font-family: var(--sans); }
.cg h1, .cg h2, .cg h3 { font-family: var(--sans); font-weight: 700; letter-spacing: -.02em; color: #fff; }
.cg h1 { font-size: clamp(2rem, 5vw, 3.2rem); max-width: 20ch; }
.cg a { color: #fff; }
.cg-hero { position: relative; overflow: hidden; padding: clamp(40px, 7vw, 96px) 0 clamp(48px, 7vw, 80px); border-bottom: 1px solid var(--cg-line); }
.cg-hero .wrap { position: relative; }
.cg-glow { position: absolute; width: 700px; height: 700px; right: -220px; top: -260px; background: radial-gradient(circle, rgba(236,28,36,.28), transparent 65%); pointer-events: none; }
.cg-back { display: inline-block; color: var(--cg-muted) !important; text-decoration: none; font-weight: 500; margin-bottom: 36px; }
.cg-back:hover { color: #fff !important; }
.cg-logo { width: min(340px, 80%); margin-bottom: 36px; }
.cg-lede { color: var(--cg-muted); font-size: 1.12rem; max-width: 64ch; }
.cg-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.cg-btn { display: inline-flex; padding: 13px 22px; border-radius: 10px; background: var(--cg-red); border: 1px solid var(--cg-red); color: #fff; font-weight: 600; text-decoration: none; }
.cg-btn:hover { filter: brightness(1.1); }
.cg-btn-outline { background: transparent; border-color: var(--cg-line); }
.cg-stats { display: flex; flex-wrap: wrap; gap: 40px; margin: 48px 0 0; }
.cg-stats dt { font-size: 1.8rem; font-weight: 700; color: #fff; line-height: 1; }
.cg-stats dd { margin: 6px 0 0; color: var(--cg-muted); font-size: .9rem; }
.cg-section { padding: clamp(56px, 8vw, 96px) 0; }
.cg-alt { background: var(--cg-alt); border-block: 1px solid var(--cg-line); }
.cg-eyebrow { color: var(--cg-red); text-transform: uppercase; letter-spacing: .16em; font-size: .78rem; font-weight: 700; margin-bottom: .6em; }
.cg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 28px; }
.cg-tile { background: var(--cg-tile); border: 1px solid var(--cg-line); border-radius: 14px; padding: 24px; }
.cg-tile p { color: var(--cg-muted); margin: 0; font-size: .96rem; }
.cg-num { display: block; color: var(--cg-red); font-weight: 700; font-size: .85rem; letter-spacing: .1em; margin-bottom: 16px; }
.cg-projects { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-top: 28px; }
@media (max-width: 860px) { .cg-projects { grid-template-columns: 1fr; } }
.cg-project { background: var(--cg-tile); border: 1px solid var(--cg-line); border-top: 3px solid var(--cg-red); border-radius: 14px; padding: clamp(22px, 3vw, 30px); display: flex; flex-direction: column; }
.cg-sector { color: var(--cg-red); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 8px; }
.cg-project h3 { font-size: 1.3rem; }
.cg-summary { color: var(--cg-text); opacity: .9; }
.cg-highlights { margin: 0 0 20px; padding-left: 1.1em; color: var(--cg-muted); font-size: .95rem; }
.cg-highlights li { margin-bottom: 6px; }
.cg-highlights li::marker { color: var(--cg-red); }
.cg-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.cg-tags { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.cg-tags li { font-size: .8rem; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--cg-line); color: var(--cg-muted); }
.cg-tags-lg { margin-top: 20px; gap: 10px; }
.cg-tags-lg li { font-size: .95rem; padding: 8px 14px; color: var(--cg-text); }
.cg-more { font-weight: 600; text-decoration: none; white-space: nowrap; }
.cg-two { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px, 6vw, 80px); }
@media (max-width: 800px) { .cg-two { grid-template-columns: 1fr; } }
.cg-contact p { color: var(--cg-muted); }
.cg-social { list-style: none; padding: 0; margin: 16px 0; display: flex; flex-wrap: wrap; gap: 10px; }
.cg-social a { display: inline-block; padding: 8px 14px; border: 1px solid var(--cg-line); border-radius: 999px; text-decoration: none; font-size: .92rem; }
.cg-social a:hover { border-color: var(--cg-red); }
.cg-founder a { color: #fff; }
@media (max-width: 900px) { .cg-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .cg-grid { grid-template-columns: 1fr; } }
