/* CoSTA@NUS Lab — site-wide stylesheet.
 *
 * Loaded by every HTML page in the repo via:
 *   <link rel="stylesheet" href="/css/site.css">
 *
 * Contains:
 *   1. Design tokens (CSS custom properties).
 *   2. Global base resets and typography defaults.
 *   3. Static-page nav and footer (`.site-nav`, `.site-footer`) — for HTML
 *      pages that don't go through React (e.g. standalone blog posts under
 *      ds/blog-html/template.html).
 *   4. Article shell + prose styles (`.article-wrap`, `.post-*`, `.prose`).
 *
 * NOTE — token sync.
 * React components in site/*.jsx read palette/font values from the JS
 * constants `C` and `F` defined in site/_shared.jsx, NOT from these CSS
 * variables. Keep the two in sync when changing the palette: every value
 * under `:root` below has a peer in _shared.jsx.
 */

/* ── 1. Design tokens ───────────────────────────────────────────────── */
:root {
  --ink:        #003D7C;
  --secondary:  #002D5C;
  --accent:     #EF7C00;
  --paper:      #f5f1ea;
  --paper-warm: #ece4d3;
  --sand:       #f6d7b0;
  --fog:        #d7dde6;

  --f-display:   'Inter Tight', Inter, sans-serif;
  --f-editorial: 'Fraunces', 'Times New Roman', serif;
  --f-mono:      'JetBrains Mono', ui-monospace, monospace;
}

/* ── 2. Base resets ─────────────────────────────────────────────────── */
* { box-sizing: border-box; }
/* Avoid overflow-x: hidden on html/body — it forces a scroll container and
   breaks position: sticky on the Nav. Section-level overflow: hidden on
   Hero/Join clips their 100vw decorations instead. */
html, body { margin: 0; padding: 0; background: var(--paper); -webkit-font-smoothing: antialiased; }
body { scroll-behavior: smooth; color: var(--ink); }
a { color: inherit; }
::selection { background: var(--accent); color: var(--paper); }
button { cursor: pointer; font: inherit; }
img { max-width: 100%; height: auto; display: block; }

/* ── 3. Static-page nav (mirrors React Nav from site/nav.jsx) ───────── */
.site-nav {
  position: sticky; top: 0; z-index: 30;
  background: rgba(245, 241, 234, 0.6);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(0, 61, 124, 0.09);
}
.site-nav-inner {
  max-width: 1280px; margin: 0 auto; padding: 18px 40px;
  display: flex; align-items: center; justify-content: space-between;
}
.site-nav .brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.site-nav .brand-name {
  font-family: var(--f-display); font-weight: 700; font-size: 17px;
  letter-spacing: -0.02em; color: var(--ink); line-height: 1;
}
.site-nav .brand-name .accent { color: var(--accent); }
.site-nav .brand-name .at { opacity: 0.5; font-weight: 500; }
.site-nav .brand-tag {
  font-family: var(--f-mono); font-size: 8.5px; letter-spacing: 0.18em;
  color: var(--ink); opacity: 0.55; margin-top: 3px;
}
.site-nav-links { display: flex; align-items: center; gap: 28px; }
.site-nav-links a {
  font-family: var(--f-display); font-size: 13.5px; font-weight: 500;
  color: var(--ink); opacity: 0.75; text-decoration: none; letter-spacing: -0.005em;
}
.site-nav-links a.cta { color: var(--accent); opacity: 1; }

/* ── 4. Static-page footer (mirrors React Footer from site/footer.jsx) ── */
.site-footer {
  background: var(--paper); padding: 56px 0 36px;
  border-top: 1px solid rgba(0, 61, 124, 0.1);
}
.site-footer-inner {
  max-width: 1280px; margin: 0 auto; padding: 0 40px;
  display: flex; align-items: center; justify-content: space-between;
}
.site-footer .brand { display: flex; align-items: center; gap: 12px; }
.site-footer .brand-name {
  font-family: var(--f-display); font-weight: 700; font-size: 20px;
  letter-spacing: -0.02em; color: var(--ink); line-height: 1;
}
.site-footer .brand-name .accent { color: var(--accent); }
.site-footer .brand-name .at { opacity: 0.55; font-weight: 500; }
.site-footer .brand-tag {
  font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.18em;
  color: var(--ink); opacity: 0.6; margin-top: 4px;
}
.site-footer-meta {
  max-width: 1280px; margin: 40px auto 0; padding: 20px 40px 0;
  border-top: 1px solid rgba(0, 61, 124, 0.09);
  display: flex; justify-content: space-between;
  font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.12em;
  color: var(--ink); opacity: 0.55; text-transform: uppercase;
}

/* ── 5. Article shell (used on /blogs/ post view + standalone posts) ── */
.article-wrap {
  max-width: 720px; margin: 0 auto; padding: 64px 40px 120px;
}
.back-link {
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink); opacity: 0.6;
  text-decoration: none; display: inline-block; margin-bottom: 32px;
}
.back-link:hover { opacity: 1; }

.post-kicker {
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.16em;
  color: var(--ink); opacity: 0.55; text-transform: uppercase; font-weight: 500;
}
.post-title {
  font-family: var(--f-display); font-weight: 700;
  font-size: clamp(32px, 5.5vw, 52px); letter-spacing: -0.035em;
  line-height: 1.06; color: var(--ink);
  margin: 14px 0 20px; text-wrap: balance;
}
.post-lede {
  font-family: var(--f-editorial); font-style: italic; font-weight: 400;
  font-size: clamp(17px, 2.1vw, 21px); line-height: 1.5;
  color: var(--ink); opacity: 0.75; margin: 0 0 36px; text-wrap: pretty;
}
.post-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 36px; }
.post-tags span {
  font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase; padding: 4px 9px;
  border: 1px solid rgba(0, 61, 124, 0.3); color: var(--ink); opacity: 0.7;
  font-weight: 500;
}
.post-signoff {
  font-family: var(--f-editorial); font-style: italic;
  color: var(--ink); opacity: 0.6; margin-top: 3em;
}

/* ── 6. Prose — used by .prose blocks AND markdown rendered into them ── */
.prose {
  font-family: var(--f-editorial); font-size: 19px; line-height: 1.65;
  color: var(--ink);
}
.prose > * + * { margin-top: 1.4em; }
.prose p { margin: 0; text-wrap: pretty; }
.prose h2 {
  font-family: var(--f-display); font-weight: 700;
  font-size: 28px; letter-spacing: -0.025em; line-height: 1.15;
  margin: 2em 0 0.6em; color: var(--ink);
}
.prose h3 {
  font-family: var(--f-display); font-weight: 600;
  font-size: 21px; letter-spacing: -0.02em; line-height: 1.2;
  margin: 1.6em 0 0.5em; color: var(--ink);
}
.prose a {
  color: var(--accent); text-decoration: none;
  border-bottom: 1px solid rgba(239, 124, 0, 0.4);
  transition: border-color 0.15s;
}
.prose a:hover { border-bottom-color: var(--accent); }
.prose strong { font-weight: 600; }
.prose em { font-style: italic; }
.prose ul, .prose ol { margin: 0; padding-left: 1.4em; }
.prose li { margin: 0.45em 0; }
.prose li::marker { color: var(--accent); }
.prose code {
  font-family: var(--f-mono); font-size: 0.86em;
  background: var(--paper-warm); padding: 2px 6px; border-radius: 3px;
}
.prose pre {
  font-family: var(--f-mono); font-size: 14px; line-height: 1.55;
  background: var(--secondary); color: var(--paper);
  padding: 18px 20px; border-radius: 4px; overflow-x: auto;
  margin: 1.6em 0;
}
.prose pre code { background: transparent; padding: 0; color: inherit; font-size: inherit; }
.prose blockquote {
  margin: 1.6em 0; padding: 4px 0 4px 20px;
  border-left: 2px solid var(--accent);
  font-style: italic; color: rgba(0, 61, 124, 0.8);
}
.prose figure { margin: 2em 0; }
.prose figure img {
  border: 1px solid rgba(0, 61, 124, 0.13);
  background: var(--paper-warm);
}
.prose figcaption {
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink); opacity: 0.55;
  margin-top: 10px;
}
.prose hr {
  border: none; border-top: 1px solid rgba(0, 61, 124, 0.18);
  margin: 2.4em 0;
}

/* ── 7. Mobile ──────────────────────────────────────────────────────── */
@media (max-width: 767px) {
  .site-nav-inner { padding: 14px 20px; }
  .site-nav .brand-name { font-size: 15px; }
  .site-nav .brand-tag { font-size: 7.5px; }
  .site-nav-links { display: none; }

  .site-footer-inner { padding: 0 20px; flex-direction: column; align-items: flex-start; gap: 24px; }
  .site-footer-meta { padding: 20px 20px 0; flex-direction: column; gap: 8px; }

  .article-wrap { padding: 40px 20px 80px; }
  .prose { font-size: 17.5px; }
}
