/* Social Pain Institute — site styles
   Ported from the original socialpain.org landing page brand and extended
   for a multi-page Zola site. Minimal, typographic, light/dark aware. */

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

:root {
  --ink:     #26215C;
  --ink-dim: rgba(38, 33, 92, 0.08);
  --muted:   #888780;
  --bg:      #FAFAF8;
  --rule:    #E8E6DF;
  --accent:  #5247C7;
  --maxw:    44rem;
  color-scheme: light;
}

/* Dark theme tokens. Applied when the visitor's system prefers dark (unless
   they've forced light via the toggle)... */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink:     #CECBF6;
    --ink-dim: rgba(206, 203, 246, 0.10);
    --muted:   #8B8A98;
    --bg:      #0F0E18;
    --rule:    #1E1C2E;
    --accent:  #A99CFF;
    color-scheme: dark;
  }
}

/* ...or whenever they choose dark with the toggle. */
:root[data-theme="dark"] {
  --ink:     #CECBF6;
  --ink-dim: rgba(206, 203, 246, 0.10);
  --muted:   #8B8A98;
  --bg:      #0F0E18;
  --rule:    #1E1C2E;
  --accent:  #A99CFF;
  color-scheme: dark;
}

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  font-size: 16px;
  font-weight: 400;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--bg);
  padding: 0.5rem 1rem;
  z-index: 100;
}
.skip-link:focus { left: 0; }

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  flex: 1 0 auto;
}

/* ---------- Header / nav ---------- */
.site-header {
  width: 100%;
  border-bottom: 1px solid var(--rule);
}
.nav {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.1rem 1.5rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--ink);
  margin-right: auto;
}
.nav-brand .mark { width: 24px; height: 24px; display: block; color: var(--ink); }
.nav-brand .mark svg { width: 100%; height: 100%; display: block; }
.nav-brand .wordmark {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
}
.nav-toggle {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 24px;
  height: 18px;
  background: none;
  border: none;
  box-shadow: none;
  border-radius: 0;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--muted);
  border-radius: 2px;
}
/* Hamburger menu at all widths: links stay collapsed until toggled open. */
.nav-links {
  order: 1;
  width: 100%;
  display: none;
  flex-direction: column;
  gap: 0;
  list-style: none;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--rule);
}
.nav-links.is-open { display: flex; }
/* CSS-only toggle: the hidden checkbox reveals the menu with no script, so
   navigation degrades gracefully when the enhancement JS doesn't run. */
.nav-toggle-checkbox:checked ~ .nav-links { display: flex; }
/* The checkbox is visually hidden, so surface its focus ring on the label. */
.nav-toggle-checkbox:focus-visible ~ .nav-toggle {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}
.nav-links li { width: 100%; }
.nav-links a {
  display: block;
  padding: 0.6rem 0;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}
.nav-links a:hover,
.nav-links a[aria-current="page"] { color: var(--ink); }

/* ---------- Theme toggle (ported from bpd.fyi) ---------- */
.theme-toggle-nav {
  position: relative;
  width: 2rem;
  height: 2rem;
  padding: 0;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s;
}
.theme-toggle-nav:hover { color: var(--ink); }
.theme-toggle-nav:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.theme-toggle-nav .theme-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.theme-toggle-nav svg { display: block; width: 18px; height: 18px; }
[data-theme="light"] .theme-icon--light { opacity: 1; transform: scale(1) rotate(0deg); }
[data-theme="light"] .theme-icon--dark  { opacity: 0; transform: scale(0.6) rotate(25deg); }
[data-theme="dark"]  .theme-icon--light { opacity: 0; transform: scale(0.6) rotate(-25deg); }
[data-theme="dark"]  .theme-icon--dark  { opacity: 1; transform: scale(1) rotate(0deg); }

/* ---------- Typography ---------- */
main { padding-top: 3.5rem; padding-bottom: 4rem; }

h1, h2, h3 { color: var(--ink); font-weight: 500; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 1.9rem; margin-bottom: 0.75rem; }
h2 { font-size: 1.3rem; margin: 2.75rem 0 0.9rem; }
h3 { font-size: 1.02rem; margin: 1.75rem 0 0.5rem; }

p { margin-bottom: 1.1rem; max-width: 38rem; }
a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 2px; text-decoration-color: var(--accent); transition: color 0.15s, text-decoration-color 0.15s; }
a:hover { color: var(--ink); text-decoration-color: var(--ink); }

strong { font-weight: 500; color: var(--ink); }
em { font-style: italic; }

ul, ol { margin: 0 0 0 1.25rem; max-width: 38rem; }
li { margin-bottom: 0.4rem; }

hr { border: none; border-top: 1px solid var(--rule); margin: 2.5rem 0; }

.lede {
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--ink);
  max-width: 40rem;
  margin-bottom: 1.5rem;
}

.eyebrow {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
}

.muted { color: var(--muted); }
small { font-size: 0.82rem; color: var(--muted); }

/* ---------- Hero (home) ---------- */
.hero { padding: 0 0 0.5rem; }
/* Center the mark + kicker as a flex column (same robust approach as the
   contact card), so they stay aligned at every width. */
.hero-head { display: flex; flex-direction: column; align-items: center; text-align: center; }
.hero .mark { width: 88px; display: block; color: var(--ink); margin-bottom: 1.75rem; }
.hero .mark svg { width: 100%; height: auto; display: block; }
.hero h1 { font-size: 2rem; max-width: 24ch; }

/* ---------- Cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
  margin: 1.75rem 0;
}
.card {
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 1.25rem 1.35rem;
  background: var(--ink-dim);
}
.card h3 { margin: 0 0 0.35rem; font-size: 0.98rem; }
.card p { font-size: 0.9rem; color: var(--muted); margin: 0; max-width: none; }
.card a { text-decoration: none; }

/* ---------- Buttons / CTAs ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 1.25rem;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--ink-dim);
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--rule); text-decoration: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.5rem 0; }

/* Inline action link with arrow */
.action { font-weight: 500; text-decoration: none; }
.action:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Footer ---------- */
.site-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--rule);
  padding: 2rem 1.5rem;
  margin-top: 2rem;
}
.site-footer .footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--muted);
}
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--ink); }
.site-footer .footer-links { display: flex; gap: 1.25rem; flex-wrap: wrap; justify-content: center; }
.site-footer .footer-copyright {
  max-width: var(--maxw);
  margin: 0.75rem auto 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- Responsive ---------- */
@media (max-width: 34rem) {
  main { padding-top: 2.5rem; padding-bottom: 3rem; }
  .hero h1 { font-size: 1.8rem; }
}

/* ---------- Nav submenu (Research → Autism) ---------- */
/* The submenu is just an indented item inside the open hamburger menu. */
.nav-sublinks { list-style: none; margin: 0; padding: 0; }
.nav-sublinks a { padding-left: 1.1rem; opacity: 0.85; }

/* ---------- Research / paper cards ---------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.papers {
  display: grid;
  gap: 1rem;
  margin: 1.75rem 0 2.5rem;
}

.paper-card {
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 1.2rem 1.35rem;
  background: var(--ink-dim);
  scroll-margin-top: 1.25rem;
}

/* Featured papers get an accent edge rather than the bpd.fyi gold glow. */
.paper-card.featured {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.paper-header { margin-bottom: 0.55rem; }

.paper-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.35;
}
.paper-title a {
  color: var(--ink);
  text-decoration: none;
}
.paper-title a:hover { color: var(--accent); }

.paper-authors {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  max-width: none;
}

.paper-meta {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 0.8rem;
  max-width: none;
}
.paper-meta strong { color: var(--ink); }

.doi-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  max-width: none;
  font-size: 0.8rem;
}
.doi-label { font-weight: 500; color: var(--ink); }
.doi-row a {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  word-break: break-all;
}
