/* =========================================================================
   AI & Humanities Initiatives — shared styles
   Bound to the user's MEPoP palette tokens and Aeonik Pro type stack.
   Page-specific overrides live inside each page's own <style> block.
   ========================================================================= */

:root {
  --bg: #000000;
  --surface: #0a0a0a;
  --fg: #ffffff;
  --muted: #737373;
  --border: #242424;
  --accent: #000000;
  --accent-secondary: #0000ee;
  --radius: 8px;
  --rule: 1px;
  --max: 1440px;
  --gutter: clamp(20px, 4vw, 56px);
  --display-1: clamp(40px, 7vw, 96px);
  --display-2: clamp(32px, 4.6vw, 56px);
  --h2: clamp(24px, 2.6vw, 36px);
  --h3: clamp(18px, 1.6vw, 22px);
  --body: 17px;
  --meta: 13px;
  --label: 11px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--fg); }
body {
  font-family: "Aeonik Pro Regular", system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
  font-size: var(--body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, p, a, button, dd { overflow-wrap: anywhere; }
img { display: block; max-width: 100%; height: auto; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: var(--accent-secondary); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 4px; }

:focus-visible {
  outline: 2px solid var(--accent-secondary);
  outline-offset: 3px;
  border-radius: var(--radius);
}

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: var(--rule) solid var(--border);
}
.nav-row {
  max-width: var(--max);
  margin: 0 auto;
  padding: 16px var(--gutter);
  display: flex;
  align-items: center;
  gap: 24px;
}
.wordmark {
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.01em;
  font-size: 16px;
}
.wordmark .mark { font-weight: 700; }
.wordmark .sub {
  color: var(--muted);
  font-size: var(--label);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.primary-nav {
  display: none;
  margin-left: auto;
  align-items: center;
  gap: 4px;
}
.primary-nav a {
  color: var(--fg);
  font-size: 14px;
  padding: 8px 12px;
  border-radius: var(--radius);
  text-decoration: none;
}
.primary-nav a:hover { color: var(--accent-secondary); text-decoration: none; }
.primary-nav a[aria-current="page"] { color: var(--accent-secondary); }

.nav-cta {
  display: none;
  margin-left: 12px;
  padding: 10px 16px;
  border: var(--rule) solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  font-size: 14px;
}
.nav-cta:hover { border-color: var(--accent-secondary); color: var(--accent-secondary); text-decoration: none; }

.menu-toggle {
  margin-left: auto;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: var(--radius);
  border: var(--rule) solid var(--border);
  color: var(--fg);
}
.menu-toggle .bars { display: inline-block; width: 18px; height: 12px; position: relative; }
.menu-toggle .bars::before,
.menu-toggle .bars::after,
.menu-toggle .bars span {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 1.5px;
  background: currentColor;
}
.menu-toggle .bars::before { top: 0; }
.menu-toggle .bars span { top: 50%; transform: translateY(-50%); display: block; }
.menu-toggle .bars::after { bottom: 0; }

@media (min-width: 1180px) {
  .primary-nav { display: flex; }
  .nav-cta { display: inline-flex; }
  .menu-toggle { display: none; }
}

/* ===== Mobile overlay ===== */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: none;
  flex-direction: column;
  padding: 24px var(--gutter);
}
.overlay[data-open="true"] { display: flex; }
.overlay-top { display: flex; align-items: center; justify-content: space-between; }
.overlay-close {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: var(--radius);
  border: var(--rule) solid var(--border);
}
.overlay nav { margin-top: 48px; display: grid; gap: 8px; }
.overlay nav a {
  color: var(--fg);
  font-size: clamp(28px, 6vw, 44px);
  text-decoration: none;
  padding: 8px 0;
  border-bottom: var(--rule) solid var(--border);
}
.overlay-menu {
  overflow-y: auto;
  padding-bottom: var(--space-4);
}
.overlay-menu-group {
  display: grid;
  gap: 6px;
}
.overlay-menu-group + .overlay-menu-group { margin-top: 24px; }
.overlay-menu h2 {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: var(--label);
  font-weight: 500;
  letter-spacing: 0.18em;
  line-height: 1.2;
  text-transform: uppercase;
}
.overlay-menu .overlay-menu-group a {
  font-size: clamp(18px, 3.8vw, 28px);
}
.overlay-foot { margin-top: auto; color: var(--muted); font-size: var(--meta); }

/* ===== Layout primitives ===== */
.eyebrow {
  color: var(--muted);
  font-size: var(--label);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.rule { height: var(--rule); background: var(--border); border: 0; margin: 0; }
.meta {
  font-size: var(--meta);
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  letter-spacing: 0.08em;
}
.arrow::after { content: " →"; transition: transform 0.18s ease; display: inline-block; }
a:hover .arrow::after { transform: translateX(4px); }

/* ===== Footer ===== */
.site-footer {
  border-top: var(--rule) solid var(--border);
  background: var(--bg);
  padding: 80px var(--gutter) 48px;
}
.footer-grid {
  max-width: var(--max);
  margin: 0 auto;
  display: grid;
  gap: 32px;
  grid-template-columns: 1fr;
}
@media (min-width: 1024px) { .footer-grid { grid-template-columns: 1.4fr repeat(3, 1fr); } }
.footer-brand .mark {
  font-size: clamp(40px, 6vw, 72px);
  letter-spacing: -0.02em;
  line-height: 1;
  margin: 0 0 16px;
}
.footer-brand address { font-style: normal; color: var(--muted); font-size: var(--meta); line-height: 1.6; }
.footer-col h4 {
  font-size: var(--label);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
  font-weight: 500;
}
.footer-col ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.footer-col a { color: var(--fg); font-size: 14px; text-decoration: none; }
.footer-col a:hover { color: var(--accent-secondary); text-decoration: none; }
.footer-bottom {
  max-width: var(--max);
  margin: 48px auto 0;
  padding-top: 24px;
  border-top: var(--rule) solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  color: var(--muted);
  font-size: var(--meta);
}

/* ===== Skip link ===== */
.skip {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip:focus {
  position: fixed;
  left: 16px; top: 16px;
  width: auto; height: auto;
  padding: 10px 14px;
  background: var(--fg);
  color: var(--bg);
  border-radius: var(--radius);
  z-index: 200;
}

/* ===== Visually hidden helper ===== */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ===== Motion: respect user preference ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ===== Reveal-on-scroll (data-reveal) ===== */
[data-reveal] {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  will-change: opacity, transform;
}
[data-reveal].is-revealed {
  opacity: 1;
  transform: none;
}

/* ===== Placeholder tag ===== */
.placeholder-tag {
  font-size: var(--label);
  color: var(--muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border: var(--rule) dashed var(--border);
  padding: 4px 8px;
  border-radius: var(--radius);
  display: inline-block;
}

/* =========================================================================
   Slide-out panel ("slidebar")
   Right-edge panel that slides in over a dark backdrop. Opens via
   data-card-id on .news-card or .init-tile buttons, or via deep-link
   ?card=<id>. Backdrop click and Esc both close. Focus is trapped
   inside the panel; on close, focus returns to the originating card.
   ========================================================================= */
.slidebar-backdrop {
  position: fixed;
  inset: 0;
  background: color-mix(in oklab, var(--bg) 84%, transparent);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease-out;
  z-index: 90;
}
@media (max-width: 720px) {
  .slidebar-backdrop { background: color-mix(in oklab, var(--bg) 92%, transparent); }
}
.slidebar-backdrop[data-open="true"] {
  opacity: 1;
  pointer-events: auto;
}
.slidebar {
  position: fixed;
  top: 0;
  right: 0;
  height: 100svh;
  width: min(560px, 100vw);
  background: var(--surface);
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  transform: translateX(100%);
  transition: transform 220ms ease-out;
  overflow-y: auto;
  z-index: 91;
  display: flex;
  flex-direction: column;
}
.slidebar[data-open="true"] {
  transform: translateX(0);
}
.slidebar-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px var(--gutter);
  background: var(--surface);
  border-bottom: var(--rule) solid var(--border);
}
.slidebar-close {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: var(--rule) solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  background: transparent;
  cursor: pointer;
}
.slidebar-close:hover {
  border-color: var(--accent-secondary);
  color: var(--accent-secondary);
}
.slidebar-eyebrow {
  font-size: var(--label);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.slidebar-body {
  padding: var(--space-5) var(--gutter) var(--space-6);
  display: grid;
  gap: var(--space-4);
}
.slidebar-body h3 {
  font-size: var(--display-2);
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0;
}
.slidebar-body dl {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: var(--space-4);
  row-gap: var(--space-2);
  margin: 0;
}
@media (max-width: 520px) {
  .slidebar-body dl { grid-template-columns: 1fr; }
}
.slidebar-body dt {
  font-size: var(--label);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}
.slidebar-body dd {
  margin: 0;
  font-size: 16px;
  line-height: 1.4;
}
.slidebar-body .placeholder-tag { justify-self: start; }
.slidebar-body a.more {
  color: var(--accent-secondary);
  text-decoration: none;
  border-bottom: var(--rule) solid transparent;
  padding-bottom: 2px;
}
.slidebar-body a.more:hover {
  border-bottom-color: var(--accent-secondary);
}
body[data-slidebar-open="true"] { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .slidebar, .slidebar-backdrop { transition: none; }
}
