:root {
  --bg: #fbfbfa;
  --surface: #ffffff;
  --text: #1c2430;
  --muted: #5b6673;
  --accent: #0f766e;
  --accent-soft: #e6f2f1;
  --border: #e5e7eb;
  --code-bg: #f3f4f6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 0.85rem 0;
}
.site-header .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.site-home {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent);
  text-decoration: none;
}
.site-tag {
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 500;
}

main { padding: 2.5rem 0 3rem; }

/* Typography */
h1 { font-size: 1.9rem; font-weight: 800; line-height: 1.25; letter-spacing: -0.02em; margin: 0.4rem 0 1rem; }
h2 { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.01em; margin-top: 2.4rem; padding-top: 1.2rem; border-top: 1px solid var(--border); }
h3 { font-size: 1.08rem; font-weight: 700; margin-top: 1.8rem; }
a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }
blockquote {
  margin: 1.4rem 0;
  padding: 0.15rem 1.1rem;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 8px 8px 0;
  color: #134e4a;
}
blockquote p { margin: 0.6rem 0; }

/* Hero (homepage) */
.hero { margin-bottom: 0.5rem; }
.hero .kicker {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.4rem;
}
.hero h1 { font-size: 2.15rem; margin: 0 0 0.6rem; }
.hero .byline { color: var(--muted); font-size: 0.98rem; margin: 0; }

/* Pinned abstract card */
.pinned {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.4rem 1.6rem;
  margin: 1.8rem 0;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.04);
}
.pinned h2 { border: 0; margin-top: 0.8rem; padding-top: 0; font-size: 1.05rem; }
.pinned h2:first-child { margin-top: 0; }

/* Post list */
.post-list { list-style: none; padding: 0; margin: 1rem 0; }
.post-list li {
  display: flex;
  gap: 1.2rem;
  align-items: baseline;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}
.post-list .post-date { flex: 0 0 7.2rem; }
.post-list time {
  color: var(--muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.post-list a { font-weight: 600; text-decoration: none; }
.post-list a:hover { text-decoration: underline; }
.post-list .week {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 400;
}

/* Posts */
.post-meta { color: var(--muted); font-size: 0.88rem; margin-bottom: 0; }
.post img, .post video { max-width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--border); }
.post figure { margin: 1.6rem 0; }
.post figure img, .post figure video { display: block; width: 100%; }
.post figcaption { margin-top: 0.65rem; color: var(--muted); font-size: 0.88rem; line-height: 1.6; }
.draft-notice { padding: 0.8rem 1rem; border-left: 3px solid var(--accent); background: var(--accent-soft); font-size: 0.88rem; }
.video-embed { position: relative; aspect-ratio: 16 / 9; margin: 1.5rem 0; }
.video-embed iframe { width: 100%; height: 100%; border: 0; }
.post-nav { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; padding-top: 1.2rem; border-top: 1px solid var(--border); font-size: 0.92rem; }
.post-nav a { text-decoration: none; font-weight: 600; }
.post-nav .next { margin-left: auto; text-align: right; }

/* Tables */
table { width: 100%; border-collapse: collapse; margin: 1.4rem 0; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.55rem 0.75rem; border: 1px solid var(--border); vertical-align: top; }
th { background: var(--accent-soft); font-weight: 700; }
tr:nth-child(even) td { background: #fafafa; }

/* Code */
code {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.84em;
  background: var(--code-bg);
  padding: 0.12em 0.35em;
  border-radius: 4px;
}
pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 1rem 1.2rem;
  border-radius: 10px;
  overflow-x: auto;
  line-height: 1.55;
}
pre code { background: none; padding: 0; color: inherit; font-size: 0.82rem; }

.mermaid { margin: 1.5rem 0; text-align: center; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 1.4rem 0 1.6rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.site-footer p { margin: 0.3rem 0; }

@media (max-width: 560px) {
  .hero h1 { font-size: 1.7rem; }
  .post-list li { flex-direction: column; gap: 0.1rem; }
  .post-list .post-date { flex-basis: auto; }
}

/* Evidence library and accessible navigation */
.wrap-wide { max-width: 1040px; }
main.wrap { padding-top: 2.5rem; padding-bottom: 3rem; }
.site-nav { display: flex; flex-wrap: wrap; gap: 1.1rem; font-size: 0.86rem; }
.site-nav a { text-decoration: none; font-weight: 600; }
.site-nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 0.3em; }
a:focus-visible, video:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.skip-link { position: absolute; z-index: 10; left: 1rem; top: -5rem; padding: 0.6rem 1rem; background: var(--surface); border: 2px solid var(--accent); }
.skip-link:focus { top: 0.5rem; }
.warehouse-preview { margin: 1.8rem 0; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); background: var(--surface); }
.warehouse-preview img { display: block; width: 100%; height: auto; }
.warehouse-preview figcaption { padding: 0.85rem 1rem; font-size: 0.85rem; color: var(--muted); }
.section-links { display: flex; flex-wrap: wrap; gap: 0.65rem; margin-top: 1.5rem; }
.section-links a { padding: 0.35rem 0.8rem; border: 1px solid var(--border); border-radius: 50px; background: var(--surface); text-decoration: none; font-size: 0.88rem; }
.evidence-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem; }
.evidence-card { margin: 1.2rem 0; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); overflow: hidden; }
.evidence-grid .evidence-card { margin: 0; }
.evidence-card img, .evidence-card video { display: block; width: 100%; height: auto; }
.evidence-card figcaption { padding: 1rem 1.15rem; font-size: 0.87rem; line-height: 1.6; border-top: 1px solid var(--border); }
.evidence-card figcaption strong, .evidence-card figcaption span { display: block; }
.evidence-card figcaption strong { color: var(--text); font-size: 1rem; }
.evidence-card figcaption span { color: var(--muted); margin: 0.25rem 0 0.6rem; }
.evidence-source { color: var(--muted); font-size: 0.88rem; }
.post { overflow-wrap: anywhere; }
.post table { display: block; max-width: 100%; overflow-x: auto; }
.mermaid { max-width: 100%; overflow-x: auto; }
.mermaid svg { max-width: 100%; height: auto; }
.post-nav > a { min-width: 0; }

/* Homepage schedule: keep the dated chart readable and its text alternative available. */
.timeline-chart, .timeline-table {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  margin: 1.2rem 0;
}
.timeline-chart { padding: 0.7rem; }
.timeline-chart .mermaid { margin: 0; overflow: visible; min-width: 960px; }
.timeline-chart .mermaid svg { min-width: 960px; height: auto; }
.timeline-chart:focus-visible, .timeline-table:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}
.timeline-note { padding-left: 1rem; border-left: 3px solid var(--accent); font-size: 0.94rem; }
.timeline-table table { margin: 0; min-width: 640px; font-size: 0.85rem; }
.timeline-table caption { text-align: left; padding: 0.85rem; color: var(--muted); font-size: 0.85rem; }
.timeline-table th[scope="row"] { width: 23%; }
.timeline-table td:nth-child(2) { width: 27%; }

@media (max-width: 660px) {
  .site-header .wrap { align-items: flex-start; flex-direction: column; gap: 0.45rem; }
  .evidence-grid { grid-template-columns: 1fr; }
  .pinned { padding: 1.15rem; }
}
