/* ============================================================
   SEBASTIAN GROES — Personal site
   Design system: "Marginalia" — humanist scholarship meets
   computational thinking. Main column = close reading.
   Margin column = structured annotation.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,400;0,9..144,500;0,9..144,600;0,9..144,700;1,9..144,400;1,9..144,500&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* ---- Color tokens ----
     Palette anchored on #C7DBE6: airy powder-blue on soft sky-white.
     Deep sky-blue carries text and dark panels; the powder blue is the
     pale background/tint; a mid sky-blue is the accent. */
  --paper: #EEF4F8;          /* soft sky near-white (also light text on dark blue) */
  --paper-raised: #FFFFFF;
  --ink: #1D3541;            /* deep sky-blue — text & dark panels */
  --ink-soft: #46606E;       /* soft blue-grey — secondary text */
  --brick: #2C6C82;          /* mid sky-blue — links/accents (AA on light) */
  --brick-dark: #1E5468;     /* deeper sky-blue — accent hover */
  --slate: #567685;          /* blue-grey — labels, mono notes */
  --slate-light: #C7DBE6;    /* the anchor powder-blue */
  --brass: #6FA6BC;          /* mid sky-blue — borders & dark-bg accents */
  --gold-light: #A9CFDE;     /* light powder-blue — hover/highlights */
  --rule: #CBDDE7;           /* powder-blue divider */
  --rule-soft: #DEEAF0;      /* faint powder-blue divider */

  /* ---- Background gradients ---- */
  --bg-page: linear-gradient(168deg, #F4F9FB 0%, #E1EEF4 55%, #C7DBE6 100%);
  --bg-raised: linear-gradient(180deg, #FFFFFF 0%, #E4EFF4 100%);
  --bg-navy: linear-gradient(135deg, #1D3541 0%, #2E5063 100%);

  /* ---- Type ---- */
  --font-display: 'Fraunces', 'Iowan Old Style', serif;
  --font-body: 'Source Sans 3', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* ---- Layout ---- */
  --content-max: 1180px;
  --margin-col: 220px;
  --gap-main: 64px;
  --radius: 3px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  overflow-x: clip;          /* guard against accidental sideways scroll */
}

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

body {
  margin: 0;
  background: var(--bg-page) fixed;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;          /* belt-and-braces with html */
}

/* Long words, headings and URLs wrap instead of forcing a wider page. */
h1, h2, h3, h4, p, a, li, td, blockquote, cite {
  overflow-wrap: break-word;
}

img { max-width: 100%; display: block; }

a {
  color: var(--brick);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  opacity: 0.92;
}
a:hover { opacity: 1; }

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--slate);
  outline-offset: 3px;
  border-radius: 2px;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
  line-height: 1.15;
  margin: 0;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--slate);
}

p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }

/* ============================================================
   NAV
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(238, 244, 248, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}

.nav-wrap {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 18px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  color: var(--ink);
  border-bottom: none;
  white-space: nowrap;
}
.brand .brand-sub {
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.07em;
  color: var(--slate);
  font-weight: 400;
  text-transform: uppercase;
  margin-top: 1px;
}

.main-nav {
  display: flex;
  gap: 28px;
  align-items: center;
}
.main-nav a {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-soft);
  border-bottom: none;
  padding: 4px 0;
  position: relative;
}
.main-nav a:hover { color: var(--ink); }
.main-nav a.active { color: var(--brick); }
.main-nav a.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 2px;
  background: var(--brass);
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  width: 40px;
  height: 36px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  content: "";
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  position: relative;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle span::before { position: absolute; top: -6px; }
.nav-toggle span::after { position: absolute; top: 6px; }

@media (max-width: 760px) {
  .nav-toggle { display: flex; }
  .main-nav {
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    flex-direction: column;
    align-items: flex-start;
    padding: 8px 32px 20px;
    gap: 14px;
    display: none;
  }
  .main-nav.open { display: flex; }
}

/* ============================================================
   MARGINALIA LAYOUT — the signature element
   Used for any content block that benefits from an annotation:
   dates, tags, figures, sources.
   ============================================================ */
.marginalia {
  display: grid;
  grid-template-columns: var(--margin-col) 1fr;
  gap: var(--gap-main);
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 32px;
}

.margin-note {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--slate);
  padding-top: 6px;
  border-left: 2px solid var(--rule);
  padding-left: 16px;
}
.margin-note .note-label {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  font-size: 11px;
  margin-bottom: 3px;
}
.margin-note .note-value {
  display: block;
  margin-bottom: 10px;
  color: var(--slate);
}
.margin-note .note-value:last-child { margin-bottom: 0; }
.margin-note .note-value.brick { color: var(--brick); }
.margin-note .note-value.brass { color: #3D7C93; }

.main-col { min-width: 0; }

@media (max-width: 880px) {
  .marginalia {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .margin-note {
    border-left: none;
    border-top: 2px solid var(--rule);
    padding-left: 0;
    padding-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 14px 20px;
  }
  .margin-note .note-label { margin-bottom: 0; display: inline; }
  .margin-note .note-value { display: inline; margin-bottom: 0; }
  .margin-note > div { display: flex; gap: 6px; align-items: baseline; }
}

/* ============================================================
   SECTIONS / GENERIC LAYOUT
   ============================================================ */
.section {
  padding: 72px 0;
  border-bottom: 1px solid var(--rule-soft);
}
.section:last-of-type { border-bottom: none; }
.section--tight { padding: 48px 0; }
.section--raised { background: var(--bg-raised); }

.section-head {
  margin-bottom: 40px;
}
.section-head h2 {
  font-size: 30px;
  margin-top: 6px;
}

/* Sub-page hero heading — fluid so it never overwhelms a narrow screen. */
.page-title {
  font-size: clamp(27px, 6vw, 38px);
  margin-top: 10px;
  max-width: 760px;
}

.lede {
  font-family: var(--font-display);
  font-weight: 400;
  font-style: italic;
  font-size: 22px;
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 640px;
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  padding: 64px 0 80px;
  background: radial-gradient(120% 90% at 88% -10%, rgba(111, 166, 188, 0.16), transparent 55%);
}
.hero-grid {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 32px;
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 56px;
  align-items: center;
}
.hero-eyebrow {
  margin-bottom: 18px;
}
.hero h1 {
  font-size: 46px;
  letter-spacing: -0.01em;
  margin-bottom: 22px;
}
.hero h1 em {
  font-style: italic;
  color: var(--brick);
}
.hero-dek {
  font-size: 19px;
  color: var(--ink-soft);
  max-width: 560px;
  margin-bottom: 30px;
}
.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.hero-photo-wrap {
  position: relative;
}
.hero-photo {
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  width: 100%;
  aspect-ratio: 4/5;
  object-fit: cover;
  filter: grayscale(8%) contrast(1.02);
}
.hero-photo-tag {
  position: absolute;
  bottom: -14px;
  left: -14px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.05em;
  padding: 8px 12px;
  border-radius: var(--radius);
}

@media (max-width: 880px) {
  .hero-grid { grid-template-columns: 1fr; gap: 36px; }
  .hero-grid { padding: 0 24px; }
  .hero h1 { font-size: 34px; }
  .hero-photo-wrap { max-width: 320px; }
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  padding: 12px 22px;
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.2;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }

.btn--primary {
  background: var(--brass);
  color: var(--ink);
}
.btn--primary:hover { background: var(--gold-light); }

.btn--ghost {
  background: transparent;
  border-color: var(--ink);
  color: var(--ink);
}
.btn--ghost:hover { background: var(--ink); color: var(--paper); }

.btn--slate {
  background: var(--slate);
  color: var(--paper);
}
.btn--slate:hover { background: #17303B; }

.btn--sm { padding: 8px 16px; font-size: 13.5px; }

/* ============================================================
   CARDS
   ============================================================ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.card-grid--2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 880px) {
  .card-grid,
  .card-grid--2 { grid-template-columns: 1fr; }
}

.card {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card h3 {
  font-size: 19px;
}
.card p {
  color: var(--ink-soft);
  font-size: 15.5px;
}
.card-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brick);
}
.card-link {
  margin-top: auto;
  font-size: 14px;
  font-weight: 600;
}

/* ============================================================
   PUBLICATIONS LIST
   ============================================================ */
.pub-list { display: flex; flex-direction: column; }
.pub-item {
  display: grid;
  grid-template-columns: var(--margin-col) 1fr;
  gap: var(--gap-main);
  padding: 22px 0;
  border-top: 1px solid var(--rule-soft);
}
.pub-item:first-child { border-top: none; }
.pub-item .pub-year {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--slate);
  padding-top: 3px;
}
.pub-item .pub-body p { margin-bottom: 0.4em; }
.pub-item .pub-title {
  font-weight: 600;
  color: var(--ink);
}
.pub-item .pub-meta {
  font-size: 14.5px;
  color: var(--ink-soft);
}
.pub-item .pub-links {
  margin-top: 6px;
  display: flex;
  gap: 14px;
  font-size: 13.5px;
}

@media (max-width: 880px) {
  .pub-item { grid-template-columns: 1fr; gap: 6px; }
  .pub-item .pub-year { padding-top: 0; }
}

/* ============================================================
   GRANTS / TRACK RECORD
   ============================================================ */
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin: 32px 0 8px;
}
@media (max-width: 760px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); }
}
.stat {
  border-top: 2px solid var(--brass);
  padding-top: 14px;
}
.stat .stat-num {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 600;
  color: var(--ink);
  display: block;
}
.stat .stat-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.grant-table { width: 100%; border-collapse: collapse; }
.grant-table tr { border-top: 1px solid var(--rule-soft); }
.grant-table tr:first-child { border-top: none; }
.grant-table td {
  padding: 14px 10px 14px 0;
  vertical-align: top;
  font-size: 15px;
}
.grant-table td.amount {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--brick);
  white-space: nowrap;
  text-align: right;
  padding-right: 0;
}
.grant-table td.date {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--slate);
  white-space: nowrap;
  width: 90px;
}
@media (max-width: 700px) {
  .grant-table, .grant-table tbody, .grant-table tr, .grant-table td {
    display: block;
    width: auto;
  }
  .grant-table tr { padding: 14px 0; }
  .grant-table td { padding: 2px 0; text-align: left !important; }
}

/* ============================================================
   PULL QUOTE
   ============================================================ */
.pull-quote {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: 26px;
  line-height: 1.45;
  color: var(--ink);
  border-left: 3px solid var(--brass);
  padding-left: 28px;
  max-width: 760px;
}
.pull-quote cite {
  display: block;
  margin-top: 14px;
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 13px;
  letter-spacing: 0.03em;
  color: var(--slate);
}

/* ============================================================
   LOGO / PARTNER STRIP
   ============================================================ */
.partner-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.partner-tag {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-soft);
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  padding: 7px 12px;
  border-radius: var(--radius);
}

/* ============================================================
   CTA BANNER
   ============================================================ */
.cta-banner {
  background: var(--bg-navy);
  color: var(--paper);
  border-radius: var(--radius);
  padding: 44px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 32px;
  flex-wrap: wrap;
}
.cta-banner h3 {
  color: var(--paper);
  font-size: 24px;
  margin-bottom: 8px;
}
.cta-banner p { color: #BAD2DE; margin: 0; max-width: 480px; }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  background: var(--bg-navy);
  color: #AEC8D5;
  padding: 56px 0 36px;
}
.footer-grid {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 32px;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 40px;
}
.footer-grid h4 {
  color: var(--paper);
  font-size: 14px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
}
.footer-grid a {
  color: #AEC8D5;
  border-bottom: none;
  display: block;
  margin-bottom: 8px;
  font-size: 14.5px;
}
.footer-grid a:hover { color: var(--paper); }
.footer-bottom {
  max-width: var(--content-max);
  margin: 40px auto 0;
  padding: 20px 32px 0;
  border-top: 1px solid #26424F;
  font-size: 13px;
  color: #7891A0;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
@media (max-width: 760px) {
  .footer-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   UTILITIES
   ============================================================ */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 32px;
}
.text-soft { color: var(--ink-soft); }
.mt-0 { margin-top: 0; }
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* Fade-in on scroll (subtle, respects reduced motion).
   IMPORTANT: content is visible by default in all cases (no-JS,
   slow-JS, headless rendering, print, reduced-motion). JS only
   ADDS a brief entrance animation for elements as they scroll
   into view; it never depends on JS running to become visible. */
.reveal {
  animation: none;
}
.js-reveal-enabled .reveal:not(.is-visible) {
  opacity: 0.001; /* never fully 0, avoids any flash-of-invisible edge case */
  transform: translateY(10px);
}
.js-reveal-enabled .reveal {
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.js-reveal-enabled .reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .js-reveal-enabled .reveal:not(.is-visible) { opacity: 1; transform: none; }
}
