/* ==========================================================================
   DISTILL-INSPIRED ACADEMIC STYLE
   A warm, typographic-first design for an academic blog
   ========================================================================== */

/* ---------- RESET & ROOT ---------- */
:root {
  --bg:             #fafaf8;
  --surface:        #ffffff;
  --border:         #e8e4df;
  --text-primary:   #1a1a1a;
  --text-secondary: #555555;
  --text-light:     #888888;
  --accent:         #2563a8;
  --accent-light:   #dbeafe;
  --green:          #16a34a;
  --green-light:    #dcfce7;
  --red:            #dc2626;
  --red-light:      #fee2e2;
  --amber:          #d97706;
  --amber-light:    #fef3c7;
  --col-width:      720px;
  --side-width:     160px;
}

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

/* ---------- BODY ---------- */
body {
  background: var(--bg);
  color: var(--text-secondary);
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 18px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- LAYOUT ---------- */
.page-wrap {
  max-width: calc(var(--col-width) + var(--side-width) * 2 + 48px);
  margin: 0 auto;
  padding: 0 24px;
}

.col {
  max-width: var(--col-width);
  margin: 0 auto;
}

section {
  padding: 72px 0 32px;
  border-top: 1px solid var(--border);
}

section:first-of-type { border-top: none; }

/* ---------- TYPOGRAPHY ---------- */
h1 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text-primary);
  margin-bottom: 16px;
}

h2 {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

h3 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--text-primary);
  margin-top: 48px;
  margin-bottom: 16px;
}

h4 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 32px;
  margin-bottom: 12px;
}

p {
  margin-bottom: 20px;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: opacity 0.15s;
}

a:hover { opacity: 0.75; }

strong {
  font-weight: 600;
  color: var(--text-primary);
}

em { font-style: italic; }

blockquote {
  border-left: 3px solid var(--border);
  padding-left: 20px;
  margin: 24px 0;
  color: var(--text-light);
  font-style: italic;
}

hr, .divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 48px 0;
}

ul, ol {
  margin-bottom: 20px;
  padding-left: 24px;
}

li { margin-bottom: 8px; }

/* ---------- STICKY NAV ---------- */
nav.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 250, 248, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  height: 48px;
}

.nav-inner {
  max-width: calc(var(--col-width) + var(--side-width) * 2 + 48px);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  height: 100%;
  gap: 24px;
}

.nav-logo {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  text-decoration: none;
  margin-right: auto;
}

.nav-logo:hover { opacity: 0.75; text-decoration: none; }

.nav-links {
  display: flex;
  gap: 20px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s;
}

.nav-links a:hover,
.nav-links a.active { color: var(--accent); opacity: 1; }

/* ---------- HERO ---------- */
.hero {
  padding: 80px 0 64px;
}

.hero-tag {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 16px;
  display: block;
}

.hero h1 { margin-bottom: 20px; }

.hero-abstract {
  font-size: 19px;
  color: var(--text-secondary);
  margin-bottom: 32px;
  line-height: 1.7;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.hero-meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hero-meta-item span:first-child {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-light);
}

.hero-meta-item span:last-child {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ---------- CALLOUT BOXES ---------- */
.callout {
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 20px 24px;
  margin: 32px 0;
  background: var(--accent-light);
}

.callout.green  { border-left-color: var(--green); background: var(--green-light); }
.callout.amber  { border-left-color: var(--amber); background: var(--amber-light); }
.callout.red    { border-left-color: var(--red);   background: var(--red-light); }

.callout p:last-child { margin-bottom: 0; }

/* ---------- FIGURE ---------- */
.figure-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  margin: 40px 0;
}

.figure-wrap img {
  max-width: 100%;
  height: auto;
  display: block;
}

.figure-wrap figcaption {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 20px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ---------- STAT CARDS ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin: 32px 0;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
}

.stat-number {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--accent);
}

.stat-label {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-light);
  margin-top: 4px;
}

/* ---------- RESULT CARDS ---------- */
.result-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin: 32px 0;
}

.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
}

.result-card h4 { margin-top: 12px; font-size: 17px; }
.result-card p { font-size: 15px; margin-bottom: 0; }

.verdict {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 4px;
  display: inline-block;
}

.verdict.yes     { background: var(--green-light); color: var(--green); }
.verdict.no      { background: var(--red-light);   color: var(--red); }
.verdict.partial { background: var(--amber-light); color: var(--amber); }

/* ---------- PIPELINE ---------- */
.pipeline-scroll { overflow-x: auto; margin: 32px 0; }

.pipeline {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: max-content;
}

.pipeline-step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  text-align: center;
  min-width: 120px;
}

.pipeline-step.highlight {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.pipeline-step.highlight .step-label,
.pipeline-step.highlight .step-sub { color: inherit; }

.step-icon { font-size: 24px; margin-bottom: 8px; }

.step-label {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.step-sub {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 11px;
  color: var(--text-light);
  margin-top: 4px;
}

.pipeline-arrow {
  font-size: 20px;
  color: var(--text-light);
  flex-shrink: 0;
}

/* ---------- TABLES ---------- */
.table-wrap { overflow-x: auto; margin: 32px 0; }

table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
}

thead th {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  text-align: left;
  padding: 12px 16px;
  border-bottom: 2px solid var(--border);
}

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

tbody tr:hover { background: #f5f5f2; }

td.num { text-align: right; font-variant-numeric: tabular-nums; }

.badge {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 3px;
  display: inline-block;
}

.badge-yes  { background: var(--green-light); color: var(--green); }
.badge-no   { background: var(--red-light);   color: var(--red); }
.badge-part { background: var(--amber-light); color: var(--amber); }
.badge-star { background: var(--accent-light); color: var(--accent); }

/* ---------- CODE ---------- */
code {
  background: #f0ede8;
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 0.85em;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

pre {
  background: #1e1e2e;
  color: #cdd6f4;
  border-radius: 8px;
  padding: 20px 24px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
  margin: 32px 0;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

/* ---------- BLOG POST LIST (HOME) ---------- */
.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.post-item {
  padding: 32px 0;
  border-bottom: 1px solid var(--border);
}

.post-item:first-child { padding-top: 0; }

.post-item-tag {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 6px;
  display: block;
}

.post-item-title {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin-bottom: 8px;
}

.post-item-title a {
  color: var(--text-primary);
  text-decoration: none;
}

.post-item-title a:hover { color: var(--accent); opacity: 1; }

.post-item-excerpt {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 10px;
}

.post-item-meta {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  color: var(--text-light);
}

/* ---------- POST ARTICLE ---------- */
.post-header {
  padding: 80px 0 40px;
}

.post-header .post-tag {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 16px;
  display: block;
}

.post-header h1 { margin-bottom: 20px; }

.post-header .post-subtitle {
  font-size: 19px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.7;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  color: var(--text-light);
}

.post-meta a { font-size: 13px; }

.post-body {
  padding: 48px 0;
}

.post-body h2 {
  margin-top: 56px;
}

.post-body h3 {
  margin-top: 48px;
}

.post-body img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

/* ---------- SCROLL TO TOP ---------- */
.scroll-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  z-index: 50;
}

.scroll-top.visible { opacity: 1; visibility: visible; }
.scroll-top:hover { opacity: 0.85; }

/* ---------- FOOTER ---------- */
footer.site-footer {
  border-top: 1px solid var(--border);
  padding: 40px 0;
  text-align: center;
}

.footer-inner {
  max-width: calc(var(--col-width) + var(--side-width) * 2 + 48px);
  margin: 0 auto;
  padding: 0 24px;
}

.footer-inner p {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 8px;
}

.footer-inner a {
  color: var(--text-light);
  text-decoration: none;
}

.footer-inner a:hover { color: var(--accent); }

.footer-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 12px;
  list-style: none;
  padding: 0;
}

.footer-links a {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
}

/* ---------- PAGE (About / Projects) ---------- */
.page-content {
  padding: 48px 0;
}

.page-content h1 {
  margin-bottom: 24px;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 800px) {
  .nav-links { display: none; }
  body { font-size: 17px; }
  .figure-wide { margin: 40px 0; }
  .hero { padding: 60px 0 48px; }
  .post-header { padding: 60px 0 32px; }
}

@media (max-width: 580px) {
  .result-grid { grid-template-columns: 1fr; }
  h1 { font-size: 26px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .hero-meta { flex-direction: column; gap: 16px; }
}
