/* ─── Theme tokens ─────────────────────────────────────────────────────── */
:root {
  /* Default = dark */
  --bg: #0a0a0a;
  --surface: #161616;
  --surface-alt: #121212;
  --border: #262626;
  --text: #ededed;
  --muted: #9aa0a6;
  --accent: #60a5fa;
  --accent-dark: #3b82f6;
  --accent-blue: #60a5fa;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4),
            0 12px 32px rgba(0, 0, 0, 0.4);

  /* Theme-reactive helpers */
  --inset-border: rgba(255, 255, 255, 0.06);
  --thumb-hover-shadow: 0 4px 12px rgba(0, 0, 0, 0.4),
                        0 14px 36px rgba(0, 0, 0, 0.5);
  --tag-bg: rgba(20, 20, 20, 0.78);
  --tag-color: var(--accent);
  --tag-border: rgba(96, 165, 250, 0.28);
  --modal-overlay: rgba(0, 0, 0, 0.65);
  --modal-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);

  --font-serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
                Roboto, Helvetica, Arial, sans-serif;
  --font-mono:  "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo,
                Consolas, monospace;

  --radius: 14px;
  --radius-sm: 8px;
  --max-w: 1180px;
}

[data-theme="light"] {
  --bg: #fafaf7;
  --surface: #ffffff;
  --surface-alt: #f0f0ea;
  --border: #d8d8d0;
  --text: #16181d;
  --muted: #5b6472;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-blue: #3b82f6;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04),
            0 8px 24px rgba(15, 23, 42, 0.06);

  --inset-border: rgba(15, 23, 42, 0.08);
  --thumb-hover-shadow: 0 4px 12px rgba(15, 23, 42, 0.08),
                        0 14px 36px rgba(15, 23, 42, 0.12);
  --tag-bg: rgba(255, 255, 255, 0.92);
  --tag-color: var(--accent-dark);
  --tag-border: rgba(37, 99, 235, 0.18);
  --modal-overlay: rgba(15, 23, 42, 0.45);
  --modal-shadow: 0 24px 80px rgba(15, 23, 42, 0.22);
}

html { color-scheme: dark; }
[data-theme="light"] { color-scheme: light; }

/* ─── Reset ────────────────────────────────────────────────────────────── */
*,
*::before,
*::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background 0.25s ease, color 0.25s ease;
}

img { display: block; max-width: 100%; height: auto; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; }

/* ─── Layout ───────────────────────────────────────────────────────────── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

/* ─── Header / Hero ────────────────────────────────────────────────────── */
.site-header {
  padding: 28px 0 8px;
}

.site-header .top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 20px;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.brand:hover { opacity: 0.78; }

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: -0.02em;
  transition: transform 0.4s ease;
}

.brand:hover .brand-mark { transform: translateY(-1px) rotate(-3deg); }

.nav-links {
  display: flex;
  gap: 28px;
  font-size: 14px;
  color: var(--muted);
}

.nav-links a {
  text-decoration: none;
  transition: color 0.2s ease;
}

.nav-links a:hover { color: var(--accent-dark); }

/* ─── Hamburger toggle (hidden on desktop) ─────────────────────────────── */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 38px;
  padding: 0 9px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
}

.nav-toggle-bar {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

.nav-toggle.open .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle.open .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.hero {
  padding: 64px 0 56px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.85fr);
  gap: 64px;
  align-items: center;
}

.hero-text { max-width: 560px; }

.hero-image {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius);
  overflow: hidden;
  background:
    radial-gradient(120% 100% at 0% 0%, rgba(96, 165, 250, 0.18), transparent 55%),
    radial-gradient(120% 100% at 100% 100%, rgba(96, 165, 250, 0.10), transparent 55%),
    var(--surface-alt);
  box-shadow: var(--shadow);
  position: relative;
  animation: heroFloat 0.8s ease both;
}

.hero-image::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 1px var(--inset-border);
  border-radius: inherit;
  pointer-events: none;
}

.hero-art {
  position: absolute;
  inset: 0;
  padding: 32px 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--text);
  line-height: 1.5;
}

.hero-art-line {
  opacity: 0;
  animation: typeIn 0.6s ease forwards;
}

.hero-art-line:nth-child(1) { animation-delay: 0.25s; }
.hero-art-line:nth-child(2) { animation-delay: 0.55s; color: var(--accent-dark); }
.hero-art-line:nth-child(3) { animation-delay: 0.95s; }
.hero-art-line:nth-child(4) { animation-delay: 1.25s; color: var(--accent-dark); }
.hero-art-line:nth-child(5) { animation-delay: 1.65s; }

.hero-art-line em {
  font-style: normal;
  display: inline-block;
  width: 8px;
  background: var(--accent-dark);
  color: transparent;
  animation: blink 1s steps(1) infinite;
  margin-left: 2px;
}

@keyframes typeIn {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: none; }
}

@keyframes blink {
  50% { opacity: 0; }
}

@keyframes heroFloat {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

.hero .eyebrow {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-dark);
  margin-bottom: 18px;
}

.hero h1 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(30px, 4.5vw, 48px);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0 0 20px;
}

.hero h1 em {
  font-style: italic;
  font-weight: 500;
  color: var(--accent-dark);
}

.hero p {
  font-size: 16px;
  color: var(--muted);
  max-width: 56ch;
  margin: 0;
}

/* ─── Section heading ──────────────────────────────────────────────────── */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 24px 0 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.section-head-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.section-head h2 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.01em;
  margin: 0;
}

.section-head .count {
  font-size: 14px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ─── Article grid ─────────────────────────────────────────────────────── */
.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 36px 24px;
  padding-bottom: 96px;
}

.card {
  border-radius: var(--radius);
  transition: transform 0.25s ease;
}

.card:hover { transform: translateY(-2px); }

.card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-alt);
  box-shadow: var(--shadow);
  transition: box-shadow 0.25s ease;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}

.card:hover .thumb img { transform: scale(1.03); }

.card:hover .thumb {
  box-shadow: var(--thumb-hover-shadow);
}

.thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 1px var(--inset-border);
  border-radius: inherit;
  pointer-events: none;
}

.thumb-1 { background: linear-gradient(135deg, #3b82f6, #1e3a8a); }
.thumb-2 { background: linear-gradient(135deg, #14b8a6, #0f766e); }
.thumb-3 { background: linear-gradient(135deg, #8b5cf6, #5b21b6); }
.thumb-4 { background: linear-gradient(135deg, #ec4899, #9d174d); }

.thumb-tag {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--tag-bg);
  backdrop-filter: blur(6px);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--tag-color);
  border: 1px solid var(--tag-border);
}

.card-body { padding: 16px 4px 0; }

.card-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 17px;
  line-height: 1.3;
  letter-spacing: -0.005em;
  color: var(--text);
  margin: 0 0 8px;
  transition: color 0.2s ease;
}

.card-link:hover .card-title { color: var(--accent-dark); }

.card-desc {
  font-size: 14.5px;
  color: var(--muted);
  margin: 0 0 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ─── Modal ────────────────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  background: var(--modal-overlay);
  backdrop-filter: blur(8px);
  display: none;
  z-index: 50;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fade 0.25s ease;
}

.modal.open { display: flex; }

.modal-inner {
  width: min(760px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--modal-shadow);
  animation: rise 0.3s ease;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  z-index: 2;
  transition: background 0.2s ease;
}

.modal-close:hover { background: var(--border); }

.modal-close svg { width: 16px; height: 16px; stroke: var(--text); }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

/* ─── About modal ──────────────────────────────────────────────────────── */
.about-inner {
  position: relative;
  max-width: 760px;
  padding: 40px 44px 44px;
  background: var(--surface);
}

.about-layout {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}

.about-image {
  flex: 0 0 auto;
  width: 168px;
  height: 168px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-alt);
  box-shadow: var(--shadow);
  position: relative;
}

.about-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.about-image::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--inset-border);
  pointer-events: none;
}

.about-body { flex: 1; min-width: 0; }

.about-eyebrow {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-dark);
  margin-bottom: 8px;
}

.about-body h2 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin: 0 0 4px;
}

.about-role {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 18px;
  font-style: italic;
}

.about-body p {
  margin: 0 0 14px;
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--text);
}

.about-body p strong {
  font-weight: 500;
  color: var(--accent-dark);
}

@media (max-width: 620px) {
  .about-inner { padding: 32px 24px 28px; }
  .about-layout {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 20px;
  }
  .about-image { width: 132px; height: 132px; }
  .about-body h2 { font-size: 28px; }
}

/* ─── Footer ───────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0 40px;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.site-footer a {
  color: var(--accent-dark);
  text-decoration: none;
}

.site-footer a:hover { text-decoration: underline; }

/* ─── Reduced motion ───────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ─── Small screens ────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 36px;
    padding: 48px 0 40px;
  }
  .hero-image { aspect-ratio: 16 / 10; max-height: 360px; }
  .hero-art { padding: 24px 28px; font-size: 14px; }
}

@media (max-width: 540px) {
  .hero { padding: 40px 0 32px; gap: 28px; }
  .hero-image { aspect-ratio: 4 / 3; }
  .hero-art { padding: 20px 22px; font-size: 13px; gap: 8px; }
  .nav-links { gap: 18px; }
  .article-grid { gap: 28px 16px; }
}

/* ─── Mobile header & single-column layout ─────────────────────────────── */
@media (max-width: 600px) {
  .container { padding: 0 18px; }

  .site-header .top {
    flex-wrap: wrap;
    gap: 14px;
  }

  /* Show the hamburger; collapse the nav into a dropdown */
  .nav-toggle { display: inline-flex; }

  .nav-links {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
    padding: 6px 2px 4px;
  }
  .nav-links.open { display: flex; }

  /* Let the section heading wrap instead of squeezing */
  .section-head {
    flex-wrap: wrap;
    gap: 12px;
  }

  /* One column — avoids the 300px min-track overflow on narrow phones */
  .article-grid { grid-template-columns: 1fr; }
}

/* ─── Category filter pills ────────────────────────────────────────────── */
.category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -4px 0 24px;
}

.pill {
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.pill:hover {
  color: var(--text);
  border-color: var(--text);
}

.pill.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

/* ─── View toggle (grid / list) ────────────────────────────────────────── */
.view-toggle {
  display: inline-flex;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}

.view-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 28px;
  border-radius: 7px;
  color: var(--muted);
  transition: color 0.2s ease, background 0.2s ease;
}

.view-btn:hover { color: var(--text); }

.view-btn.is-active {
  background: var(--accent);
  color: #ffffff;
}

.view-btn svg { width: 14px; height: 14px; }

/* ─── List view layout ─────────────────────────────────────────────────── */
.article-grid.is-list {
  grid-template-columns: 1fr;
  gap: 14px;
}

.article-grid.is-list .card-link {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 20px;
  align-items: center;
  padding: 16px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.article-grid.is-list .card-link:hover {
  border-color: var(--accent);
}

.article-grid.is-list .card-link:hover .card-title {
  color: var(--accent);
}

.article-grid.is-list .card-body {
  order: 1;
  padding: 0;
}

.article-grid.is-list .thumb {
  order: 2;
  width: 100%;
  aspect-ratio: 16 / 9;
  box-shadow: none;
}

.article-grid.is-list .card-title { margin-bottom: 6px; }
.article-grid.is-list .card-desc { -webkit-line-clamp: 2; margin-bottom: 8px; }

.article-grid.is-list .thumb-tag {
  top: 8px;
  left: 8px;
  padding: 2px 8px;
  font-size: 10px;
}

@media (max-width: 540px) {
  .article-grid.is-list .card-link {
    grid-template-columns: 1fr 110px;
    gap: 14px;
    padding: 12px;
  }
}

/* ─── Theme toggle ─────────────────────────────────────────────────────── */
.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.theme-toggle svg { width: 15px; height: 15px; }

.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }

[data-theme="light"] .theme-toggle .icon-sun  { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }
