/* M&Info — site styles. Brand: navy #12233f + gold #c9a227 on cream #f6f1e4. */

:root {
  /* Brand constants */
  --navy: #12233f;
  --gold: #c9a227;
  --cream: #f6f1e4;

  /* Light theme (default) */
  color-scheme: light;
  --bg: #f6f1e4;
  --surface: #fffdf7;
  --surface-2: #efe7d3;
  --text: #12233f;
  --text-soft: #6b6552;
  --border: #e6dcc2;
  --border-strong: #d8cba8;
  --accent: #8f6f14;        /* legible gold — links, interactive text */
  --accent-hover: #6f5610;
  --gold-fill: #c9a227;     /* decorative gold — pill, ampersand, accents */
  --gold-ink: #12233f;      /* text/graphics on a gold fill */
  --shadow: 0 1px 2px rgba(18, 35, 63, 0.05), 0 10px 26px rgba(18, 35, 63, 0.08);
  --shadow-lg: 0 4px 10px rgba(18, 35, 63, 0.08), 0 20px 40px rgba(18, 35, 63, 0.14);

  --radius: 14px;
  --maxw: 1080px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
}

/* Dark theme — applied when the OS prefers dark (unless the user forced light) … */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1e36;
    --surface: #16294a;
    --surface-2: #213a5f;
    --text: #f2ecdd;
    --text-soft: #9aa3b5;
    --border: #294063;
    --border-strong: #3a5480;
    --accent: #d9b84a;
    --accent-hover: #e7ca6d;
    --gold-fill: #c9a227;
    --gold-ink: #0f1e36;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 6px 16px rgba(0, 0, 0, 0.5), 0 24px 48px rgba(0, 0, 0, 0.55);
  }
}
/* … or when the user explicitly chose dark via the toggle. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1e36;
  --surface: #16294a;
  --surface-2: #213a5f;
  --text: #f2ecdd;
  --text-soft: #9aa3b5;
  --border: #294063;
  --border-strong: #3a5480;
  --accent: #d9b84a;
  --accent-hover: #e7ca6d;
  --gold-fill: #c9a227;
  --gold-ink: #0f1e36;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 6px 16px rgba(0, 0, 0, 0.5), 0 24px 48px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }

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

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 24px;
  letter-spacing: 0.01em;
  color: var(--text);
}
.brand:hover { text-decoration: none; color: var(--text); }
.brand .amp { color: var(--gold-fill); font-style: italic; padding: 0 0.02em; }

.site-nav { display: flex; align-items: center; gap: 6px; }
.site-nav a {
  color: var(--text-soft);
  font-weight: 600;
  font-size: 15px;
  padding: 8px 12px;
  border-radius: 8px;
}
.site-nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }

/* Theme toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.theme-toggle:hover { color: var(--text); border-color: var(--accent); }
.theme-toggle svg { width: 18px; height: 18px; display: block; }

/* Which icon shows: moon in light, sun in dark */
.icon-sun { display: none; }
.icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: block; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }
:root[data-theme="light"] .icon-sun { display: none; }
:root[data-theme="light"] .icon-moon { display: block; }

/* ---------- Intro ---------- */
.intro { margin: 32px 0 8px; }
.tagline {
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}

/* ---------- Section titles ---------- */
.section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-soft);
  margin: 44px 0 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ---------- Pinned hero ---------- */
.pinned { margin-top: 28px; }
.hero {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  color: var(--text);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.hero:hover {
  text-decoration: none;
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--gold-fill);
}
.hero-media { position: relative; min-height: 280px; background: var(--surface-2); }
.hero-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-body { padding: 30px 32px; display: flex; flex-direction: column; justify-content: center; }
.hero-title {
  font-family: var(--serif);
  font-size: clamp(24px, 2.8vw, 34px);
  line-height: 1.18;
  letter-spacing: -0.01em;
  margin: 14px 0 10px;
}
.hero-excerpt { color: var(--text-soft); margin: 0 0 18px; font-size: 16px; }
.read-link { color: var(--accent); font-weight: 700; margin-top: 4px; }

.pill {
  align-self: flex-start;
  background: var(--gold-fill);
  color: var(--gold-ink);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 11px;
  border-radius: 999px;
}

/* ---------- Grid of cards ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 22px;
}
.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.card:hover {
  text-decoration: none;
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}
.card-media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--surface-2);
  overflow: hidden;
}
.card-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card-media-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  text-align: center;
  font-family: var(--serif);
  font-weight: 700;
  color: var(--text-soft);
}
.card-body { padding: 18px 18px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-title { font-family: var(--serif); font-size: 20px; line-height: 1.28; margin: 0; }
.card-excerpt { color: var(--text-soft); font-size: 14.5px; margin: 0; flex: 1; }

.meta { color: var(--text-soft); font-size: 13px; margin-top: 4px; }

.empty { color: var(--text-soft); margin: 48px 0; }
.empty code {
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.9em;
}

/* ---------- Article page ---------- */
.post { max-width: 720px; margin: 0 auto; padding: 8px 0 24px; }
.back {
  display: inline-block;
  color: var(--text-soft);
  font-weight: 600;
  font-size: 14px;
  margin: 24px 0;
}
.back:hover { color: var(--accent); text-decoration: none; }
.back-bottom { margin-top: 40px; border-top: 1px solid var(--border); padding-top: 24px; width: 100%; }
.post-title {
  font-family: var(--serif);
  font-size: clamp(30px, 4.5vw, 44px);
  line-height: 1.14;
  letter-spacing: -0.01em;
  margin: 8px 0 12px;
}
.post-meta { color: var(--text-soft); font-size: 14px; margin-bottom: 24px; }
.post-cover {
  width: 100%;
  aspect-ratio: 16 / 8;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  margin: 0 0 32px;
}
.post-content { font-family: var(--serif); font-size: 19px; line-height: 1.75; }
.post-content h2 { font-family: var(--serif); font-size: 27px; letter-spacing: -0.01em; margin: 42px 0 12px; }
.post-content h3 { font-family: var(--serif); font-size: 22px; margin: 32px 0 10px; }
.post-content p { margin: 0 0 22px; }
.post-content img { border-radius: 10px; border: 1px solid var(--border); margin: 24px 0; }
/* Inlined charts (SVG) — sized like an image, but part of the document so they
   follow the site's light/dark theme. */
.post-content svg.chart {
  display: block;
  width: 100%;
  height: auto;
  margin: 24px 0;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.post-content ul, .post-content ol { margin: 0 0 22px; padding-left: 26px; }
.post-content li { margin: 6px 0; }
.post-content blockquote {
  margin: 24px 0;
  padding: 6px 22px;
  border-left: 3px solid var(--gold-fill);
  color: var(--text-soft);
  font-style: italic;
}
.post-content blockquote p { margin: 12px 0; }
.post-content pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  overflow-x: auto;
  font-size: 14px;
}
.post-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86em;
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 6px;
}
.post-content pre code { background: none; padding: 0; }
.post-content a { text-decoration: underline; }
.post-content hr { border: none; border-top: 1px solid var(--border); margin: 32px 0; }

/* ---------- Inline citations (hover tooltips) ---------- */
.cite {
  position: relative;
  display: inline;
  white-space: nowrap;
}
.cite-num {
  font-family: var(--font);
  font-size: 0.72em;
  font-weight: 700;
  line-height: 1;
  vertical-align: super;
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
  padding: 0 1px;
}
.cite-num::before { content: "["; }
.cite-num::after  { content: "]"; }
.cite-num:hover { color: var(--accent-hover); text-decoration: none; }

.cite-pop {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 9px);
  transform: translateX(-50%) translateY(4px);
  z-index: 40;
  width: max-content;
  max-width: min(340px, 82vw);
  padding: 12px 14px;
  background: var(--surface);
  color: var(--text-soft);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 400;
  line-height: 1.5;
  text-align: left;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.14s ease, transform 0.14s ease;
}
.cite:hover .cite-pop,
.cite:focus-within .cite-pop {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.cite-pop::after {                 /* little pointer under the bubble */
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--border-strong);
}
.cite-pop-n {
  color: var(--accent);
  font-weight: 700;
  margin-right: 5px;
}
.cite-pop a { color: var(--accent); text-decoration: underline; }
.cite-pop a:hover { color: var(--accent-hover); }

/* ---------- Collapsible references / sources ---------- */
.references {
  margin: 44px 0 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.references-summary {
  cursor: pointer;
  list-style: none;                 /* hide the default disclosure triangle */
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 16px 20px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-soft);
  user-select: none;
}
.references-summary::-webkit-details-marker { display: none; }  /* Safari */
.references-summary::before {                /* chevron: right when closed, down when open */
  content: "";
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-top: -2px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}
.references[open] .references-summary::before { transform: rotate(45deg); }
.references-summary:hover { color: var(--text); }
.references-content {
  padding: 6px 20px 22px;
  border-top: 1px solid var(--border);
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-soft);
}
.references-content a { color: var(--accent); text-decoration: underline; }
.references-content a:hover { color: var(--accent-hover); }
.references-content h2 {
  font-family: var(--serif);
  font-size: 20px;
  margin: 22px 0 10px;
  color: var(--text);
}
.references-content h3 {
  font-family: var(--font);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text);
  margin: 22px 0 10px;
}
.references-content p { margin: 0 0 14px; }
.references-content ol, .references-content ul { margin: 0 0 14px; padding-left: 24px; }
.references-content li { margin: 5px 0; }
.references-content hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ---------- About / Team ---------- */
.post.about { max-width: 880px; }
.about .post-title { text-align: center; margin-bottom: 8px; }

.about-section { margin: 44px 0; }
.about-heading {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-soft);
  font-weight: 700;
  margin: 0 0 22px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.about-heading::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.about-aim {
  font-family: var(--serif);
  font-size: clamp(19px, 2.4vw, 24px);
  line-height: 1.5;
  margin: 0;
}
.about-empty { color: var(--text-soft); margin: 0; }

.about-divider {
  border: none;
  height: 1px;
  background: var(--border-strong);
  margin: 56px 0;
}

/* Cards wrap and stay centered whatever the count (1 contributor or 12). */
.team-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 22px;
}
.person-card {
  position: relative;
  flex: 1 1 260px;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px 24px;
}

/* Clickable card: a stretched cover link makes the whole card open the
   profile, while the contact/affiliation links inside stay individually
   clickable by sitting above the cover (z-index). */
.person-card--link {
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.person-card--link:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--gold-fill);
}
.person-card-cover {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: var(--radius);
}
.person-card--link .person-contact,
.person-card--link a.affil-link {
  position: relative;
  z-index: 1;
}
.person-more {
  margin-top: auto;
  padding-top: 14px;
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
}
.person-card--link:hover .person-more { color: var(--accent-hover); }

.person-role {
  background: var(--gold-fill);
  color: var(--gold-ink);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 18px;
}

.person-photo {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border-strong);
  margin-bottom: 16px;
}
.person-photo--fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy), #274a80);
  color: var(--cream);
  font-family: var(--serif);
  font-weight: 700;
  font-size: 34px;
  letter-spacing: 0.02em;
}

.person-name {
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.2;
  margin: 0 0 4px;
}
.person-contacts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 4px 14px;
  margin-bottom: 16px;
}
.person-contact {
  font-size: 14px;
  font-weight: 600;
  word-break: break-word;
}

.person-affils {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.affil { margin: 0; }
.affil-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
}
a.affil-link:hover {
  text-decoration: none;
  border-color: var(--gold-fill);
  color: var(--text);
}
.affil-link--static { cursor: default; }

.affil-logo {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
}
.affil-logo img { width: 100%; height: 100%; object-fit: contain; }
.affil-logo--icon { color: var(--accent); }
.affil-logo svg { width: 16px; height: 16px; }
.affil-text { flex: 1; }

/* ---------- Article byline (writers / reviewers) ---------- */
.post-byline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin: -12px 0 26px;
  font-size: 14px;
  color: var(--text-soft);
}
.byline-group { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.byline-label {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px;
  font-weight: 700;
}
.byline-name { font-weight: 600; }
a.byline-name { color: var(--accent); }
a.byline-name:hover { color: var(--accent-hover); }

/* ---------- Profile page ---------- */
.profile-head {
  display: flex;
  align-items: center;
  gap: 24px;
  margin: 8px 0 28px;
}
.profile-photo {
  flex: 0 0 auto;
  width: 128px;
  height: 128px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border-strong);
}
.profile-photo--fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy), #274a80);
  color: var(--cream);
  font-family: var(--serif);
  font-weight: 700;
  font-size: 42px;
  letter-spacing: 0.02em;
}
.profile-id { min-width: 0; }
.profile-id .person-role { display: inline-block; margin-bottom: 10px; }
.profile-name { margin: 0 0 8px; }
.profile-id .person-contacts { justify-content: flex-start; margin-bottom: 0; }
.profile-bio {
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.7;
  color: var(--text);
  margin: 0 0 8px;
}
.profile .about-section { margin: 36px 0; }
.profile .person-affils { max-width: 460px; }

@media (max-width: 560px) {
  .profile-head { flex-direction: column; text-align: center; gap: 16px; }
  .profile-id .person-contacts { justify-content: center; }
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 64px;
  border-top: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 14px;
}
.site-footer .wrap { padding-top: 24px; padding-bottom: 40px; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; }
  .hero-media { min-height: 200px; aspect-ratio: 16 / 9; }
}

@media (prefers-reduced-motion: reduce) {
  .hero, .card, .theme-toggle, .references-summary::before, .cite-pop { transition: none; }
}
