/* ========================================================================
   Yaaa News — design tokens & globals
   ======================================================================== */
:root {
  --bg: #f6f2e8;
  --bg-elev: #fbf9f1;
  --paper: #fbf9f1;
  --ink: #2a2620;
  --ink-soft: #4a4640;
  --ink-faint: #6e6a62;
  --muted: #8e897e;
  --line: #e4ddc9;
  --line-strong: #cdc4ac;
  --accent: #a86d24;
  --accent-hover: #8e591a;
  --accent-soft: #f1e4c5;
  --accent-tint: #f6ebd0;
  --link: #8e591a;
  --code-bg: #ede5cf;
  --shadow-sm: 0 1px 2px rgba(28, 27, 26, 0.04);
  --shadow-md: 0 2px 6px rgba(28, 27, 26, 0.06), 0 1px 2px rgba(28, 27, 26, 0.04);
  --shadow-lg: 0 8px 24px rgba(28, 27, 26, 0.08), 0 2px 6px rgba(28, 27, 26, 0.04);

  --maxw-prose: 720px;
  --maxw-wide: 1100px;
  --gutter: clamp(16px, 4vw, 32px);

  --serif: ui-serif, "Source Han Serif TC", "Noto Serif TC", "Songti TC", "PingFang TC", "Iowan Old Style", "Cambria", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "Helvetica Neue", Roboto, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Monaco, Consolas, monospace;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Warm dark — referenced from Material #121212 + warm tint, NYT/Substack reading comfort.
       Avoids pure black to prevent halation; avoids cool blue to keep editorial warmth. */
    --bg: #1a1714;            /* base — warm charcoal, 8% lighter than #121212 */
    --bg-elev: #221e1a;       /* elevated surfaces (cards, AI summary box) */
    --paper: #221e1a;
    --ink: #d8d1be;            /* high-emphasis text — ~87% warm off-white, 11:1 ratio on bg */
    --ink-soft: #a39c8b;       /* medium-emphasis — ~60% */
    --ink-faint: #807865;      /* meta / dates — ~45% */
    --muted: #645d4f;          /* disabled / muted — ~33% */
    --line: #2c2820;           /* dividers, soft */
    --line-strong: #3a3528;    /* stronger borders */
    --accent: #d4a45a;          /* desaturated gold, easier on dark bg */
    --accent-hover: #e6b86c;
    --accent-soft: #2e2616;     /* accent-soft = 8% accent overlaid on bg */
    --accent-tint: #241e14;     /* accent-tint = 4% accent overlay */
    --link: #d4a45a;
    --code-bg: #25211a;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.3);
  }
  /* Dark-mode body anti-aliasing tweak — sans on warm-dark renders heavier,
     compensate with grayscale smoothing for thinner perceived weight */
  body { -webkit-font-smoothing: antialiased; }
  /* Reduce strong color of bold text in dark mode (#fff on warm-dark looks neon) */
  .body strong, .body b { color: #ece5d1; }
  .ai-summary {
    border-left-color: var(--accent);
    background: linear-gradient(to right, var(--accent-soft) 0%, transparent 100%);
    padding-left: 18px;
    padding-top: 10px;
    padding-bottom: 10px;
  }
}

* { box-sizing: border-box; }
*::selection { background: var(--accent-soft); color: var(--ink); }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: clamp(16px, 1.05vw, 18.5px);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern", "liga", "calt";
}

a {
  color: var(--link);
  text-decoration: none;
  transition: color .15s var(--ease);
}
a:hover { color: var(--accent-hover); }
img, svg, video { max-width: 100%; height: auto; display: block; }

main {
  flex: 1 1 auto;
  width: 100%;
}

.container {
  width: 100%;
  max-width: var(--maxw-prose);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.container-wide {
  width: 100%;
  max-width: var(--maxw-wide);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ========================================================================
   Topbar
   ======================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.topbar-inner {
  max-width: var(--maxw-wide);
  margin: 0 auto;
  padding: 12px var(--gutter);
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 56px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.2px;
  white-space: nowrap;
}
.brand:hover { color: var(--ink); }
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 3px;
  font-weight: 700;
  font-size: 16px;
  font-family: var(--serif);
  flex-shrink: 0;
}
.brand-name { font-family: var(--sans); }

.top-spacer { flex: 1 1 auto; }

.top-nav {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.top-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: background .15s var(--ease), color .15s var(--ease);
  white-space: nowrap;
}
.top-link:hover {
  background: var(--accent-tint);
  color: var(--ink);
}

.lang-switch {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  margin-left: 6px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
}
.flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  opacity: 0.55;
  transition: opacity .15s var(--ease), border-color .15s var(--ease), background .15s var(--ease);
  width: 36px;
  height: 28px;
}
.flag:hover { opacity: 1; background: var(--accent-tint); }
.flag.active {
  opacity: 1;
  border-color: var(--line-strong);
  background: var(--paper);
}
.flag svg { display: block; }

/* Mobile: hide labels, keep icons */
@media (max-width: 600px) {
  .topbar-inner { gap: 0; padding: 10px var(--gutter); min-height: 52px; }
  .brand-name { font-size: 16px; }
  .top-link {
    padding: 8px 10px;
    font-size: 13px;
  }
  .lang-switch { margin-left: 4px; padding-left: 6px; }
}

@media (max-width: 380px) {
  .top-link { padding: 6px 7px; font-size: 12.5px; }
}

/* ========================================================================
   Hero / Index header
   ======================================================================== */
.hero {
  padding: 48px 0 28px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}
.hero h1 {
  font-family: var(--serif);
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.12;
  font-weight: 700;
  margin: 0 0 12px;
  letter-spacing: -0.6px;
  color: var(--ink);
}
.hero p {
  margin: 0;
  color: var(--ink-soft);
  font-size: clamp(15px, 1.2vw, 19px);
  max-width: 620px;
  line-height: 1.6;
}
.hero .stats {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* ========================================================================
   Post list (home / tag / search)
   ======================================================================== */
.post-list {
  list-style: none;
  margin: 0 0 56px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.post-list li {
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}
.post-list li:first-child { padding-top: 18px; }
.post-list li:last-child { border-bottom: none; }

.post-card a {
  display: block;
  color: var(--ink);
}
.post-card a:hover { color: var(--ink); }
.post-card a:hover .post-title { color: var(--accent); }

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}
.post-meta .sep { opacity: 0.6; }
.post-meta .post-id {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  background: var(--accent-tint);
  color: var(--accent);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.post-title {
  font-family: var(--serif);
  font-size: clamp(19px, 1.7vw, 24px);
  line-height: 1.35;
  font-weight: 600;
  margin: 0 0 8px;
  letter-spacing: -0.2px;
  color: var(--ink);
  transition: color .15s var(--ease);
}
.post-excerpt {
  color: var(--ink-soft);
  font-size: clamp(14.5px, 1.05vw, 17px);
  line-height: 1.7;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
/* Tag pill — icon-text alignment via vertical-align (the canonical pattern
   used by Lucide, Tailwind UI, Bootstrap). Flex align-items:center centers
   the line-box, NOT the glyph optical center, so Latin labels look off; the
   classic fix is inline-block + vertical-align:-0.15em on the icon. */
.tag {
  display: inline-block;
  vertical-align: middle;
  padding: 4px 11px 4px 9px;
  background: var(--accent-tint);
  color: var(--link);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: background .15s var(--ease), color .15s var(--ease);
  white-space: nowrap;
  line-height: 1.4;
}
.tag:hover {
  background: var(--accent-soft);
  color: var(--accent-hover);
}
.tag-icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.15em;
  margin-right: 0.4em;
}
.tag-label {
  display: inline;
}
.tag .count {
  display: inline-block;
  margin-left: 6px;
  padding-left: 8px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  font-size: 0.92em;
  vertical-align: baseline;
}
.tag-hero-icon {
  display: inline-block;
  vertical-align: -3px;
  margin-right: 10px;
  color: var(--accent);
}

/* ========================================================================
   Pagination — plain editorial: text links, no buttons, no boxes
   ======================================================================== */
.pager {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 32px 0 64px;
  border-top: 1px solid var(--line);
  margin-top: 12px;
  font-family: var(--serif);
}
.pager a,
.pager span {
  font-size: 14.5px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 0;
  min-height: auto;
  letter-spacing: 0.01em;
}
.pager a {
  color: var(--ink);
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 1px;
  transition: border-color .15s var(--ease), color .15s var(--ease);
}
.pager a:hover {
  background: transparent;
  border-bottom-color: var(--ink);
  color: var(--ink);
}
.pager .disabled {
  opacity: 0.3;
  border: none;
  color: var(--muted);
  cursor: default;
}
.pager > span:not(.disabled) {
  font-family: var(--sans);
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ========================================================================
   Article
   ======================================================================== */
.article {
  padding: 36px 0 32px;
}
.article > header {
  margin-bottom: 24px;
}
.article h1 {
  font-family: var(--serif);
  font-size: clamp(26px, 3.2vw, 40px);
  line-height: 1.25;
  font-weight: 700;
  margin: 0 0 16px;
  letter-spacing: -0.4px;
  color: var(--ink);
}
.article .article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  color: var(--ink-faint);
  font-size: clamp(13px, 0.95vw, 15px);
  font-variant-numeric: tabular-nums;
}
.article .article-meta a {
  color: var(--ink-faint);
  border-bottom: 1px dotted var(--line-strong);
  padding-bottom: 1px;
}
.article .article-meta a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* TL;DR — sober, no gradient, no card chrome */
.ai-summary {
  border-left: 2px solid var(--ink);
  padding: 4px 0 4px 18px;
  margin: 22px 0 28px;
}
.ai-summary .label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 6px;
  display: block;
}
.ai-summary p {
  margin: 0;
  font-size: clamp(15.5px, 1.05vw, 17.5px);
  line-height: 1.75;
  color: var(--ink);
  font-style: italic;
  font-family: var(--sans);
}

/* Article body — sans-serif for screen comfort, slightly relaxed letter-spacing */
.body {
  font-family: var(--sans);
  font-size: clamp(16.5px, 1.2vw, 19px);
  line-height: 1.85;
  letter-spacing: 0.005em;
  color: var(--ink);
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.body strong, .body b { color: var(--ink); font-weight: 700; }
.body em, .body i { color: var(--ink); }
.body a {
  color: var(--link);
  border-bottom: 1px solid var(--accent-soft);
  padding-bottom: 1px;
  transition: background .15s var(--ease), border-color .15s var(--ease);
}
.body a:hover {
  background: var(--accent-tint);
  border-bottom-color: var(--accent);
}
.body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 20px auto;
  display: block;
  box-shadow: var(--shadow-md);
}
.body code {
  background: var(--code-bg);
  padding: 2px 7px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 0.88em;
  color: var(--ink);
  word-break: break-all;
}
.body pre {
  background: var(--code-bg);
  padding: 14px 16px;
  border-radius: var(--radius);
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.6;
}
.body pre code {
  background: transparent;
  padding: 0;
  font-size: inherit;
}
.body blockquote {
  border-left: 3px solid var(--line-strong);
  margin: 18px 0;
  padding: 4px 18px;
  color: var(--ink-soft);
  font-style: italic;
}

/* Photos attached to a post (appended below body) */
.post-photos {
  margin: 28px 0 8px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
.post-photos a { display: block; }
.post-photos img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
  border: 1px solid var(--line);
  transition: border-color .15s var(--ease);
}
.post-photos a:hover img { border-color: var(--ink-faint); }
@media (min-width: 768px) {
  .post-photos { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
  .post-photos:has(> a:only-child) { grid-template-columns: 1fr; }
}

/* Adjacent post nav — editorial, no card chrome */
.adjacent-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px 36px;
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.adjacent-nav a {
  display: block;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.45;
  transition: color .15s var(--ease);
}
.adjacent-nav a:hover {
  background: transparent;
  border: none;
  transform: none;
  color: var(--accent);
}
.adjacent-nav a:hover .dir { color: var(--accent); }
.adjacent-nav .dir {
  display: block;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 11px;
  margin-bottom: 8px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transition: color .15s var(--ease);
}
.adjacent-nav .next { text-align: right; }
.adjacent-nav .empty {
  visibility: hidden;
  pointer-events: none;
}

@media (max-width: 600px) {
  .adjacent-nav { grid-template-columns: 1fr; gap: 20px; }
  .adjacent-nav .next { text-align: left; }
  .adjacent-nav .empty { display: none; }
  .adjacent-nav a { font-size: 16px; }
}

/* ========================================================================
   Search
   ======================================================================== */
.search-box {
  position: relative;
  width: 100%;
  margin: 18px 0 22px;
}
.search-box input {
  width: 100%;
  border: 1.5px solid var(--line);
  background: var(--paper);
  border-radius: var(--radius);
  outline: none;
  padding: 14px 18px;
  font-size: 16px;
  font-family: var(--sans);
  color: var(--ink);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
  box-shadow: var(--shadow-sm);
  -webkit-appearance: none;
  appearance: none;
}
.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}
.search-box input::placeholder { color: var(--muted); }
.search-meta {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 14px;
  font-variant-numeric: tabular-nums;
}

/* ========================================================================
   Tag cloud
   ======================================================================== */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 24px 0 40px;
}
.tag-cloud .tag,
.tag-large {
  font-size: 14.5px;
  padding: 7px 16px 7px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  line-height: 1.4;
  transition: border-color .15s var(--ease), color .15s var(--ease), background .15s var(--ease);
}
.tag-cloud .tag:hover,
.tag-large:hover {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--ink);
}
.tag-cloud .tag .count,
.tag-large .count {
  font-size: 12.5px;
}
.tag-cloud .tag:hover .count,
.tag-large:hover .count { color: var(--ink-faint); }

.icon-credit {
  margin: 12px 0 56px;
  font-size: 12.5px;
  color: var(--muted);
  font-style: italic;
}
.icon-credit a {
  color: var(--ink-soft);
  border-bottom: 1px dotted var(--line-strong);
}
.icon-credit a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ========================================================================
   Footer
   ======================================================================== */
.footer {
  border-top: 1px solid var(--line);
  padding: 28px 0 36px;
  padding-bottom: calc(36px + env(safe-area-inset-bottom));
  color: var(--ink-soft);
  font-size: 14px;
  margin-top: 36px;
  background: var(--bg);
  line-height: 1.7;
}
.footer-inner {
  max-width: var(--maxw-wide);
  margin: 0 auto;
  padding: 0 var(--gutter);
  text-align: center;
  display: block;
}
.footer-inner > span {
  display: inline;
  font-style: normal;
  color: var(--ink-soft);
}
.footer-inner > span + span::before {
  content: " · ";
  margin: 0 4px;
  color: var(--line-strong);
}
.footer a {
  color: var(--ink);
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 1px;
  font-weight: 500;
  transition: color .15s var(--ease), border-color .15s var(--ease);
}
.footer a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ========================================================================
   Mobile refinements
   ======================================================================== */
@media (max-width: 640px) {
  body { font-size: 16px; line-height: 1.7; }
  .hero { padding: 32px 0 22px; }
  .hero h1 { font-size: 28px; }
  .hero p { font-size: 15px; }
  .post-list li { padding: 18px 0; }
  .post-list li:first-child { padding-top: 14px; }
  .post-title { font-size: 18.5px; }
  .post-excerpt { font-size: 15px; line-height: 1.65; -webkit-line-clamp: 3; line-clamp: 3; }
  .article { padding: 24px 0 28px; }
  .article h1 { font-size: 24px; line-height: 1.3; }
  .ai-summary { padding: 12px 0 12px 16px; margin: 22px 0 26px; }
  .ai-summary p { font-size: 15.5px; line-height: 1.75; }
  .body { font-size: 17px; line-height: 1.85; }
  .pager { padding: 22px 0 48px; }
}

@media (max-width: 380px) {
  .hero h1 { font-size: 25px; }
  .post-title { font-size: 17.5px; }
  .body { font-size: 16.5px; }
}

/* ========================================================================
   Tablet & Desktop (≥768px) — editorial digest layout
   Mobile stays as-is. Desktop drops cards entirely and uses typographic
   hierarchy: first item gets featured treatment, subsequent items shrink
   into a tight list. No grid. No card chrome. No gradients.
   ======================================================================== */
@media (min-width: 768px) {
  /* Feed pages widen, but the list itself remains a single column with
     left-aligned headline column + right-aligned meta. */
  .container:has(.post-list),
  .container:has(.tag-cloud),
  .container:has(.search-box) {
    max-width: 880px;
  }

  /* Hero rule: thin rule under the masthead, like a print paper. */
  .hero {
    padding: 56px 0 22px;
    border-bottom: 2px solid var(--ink);
    margin-bottom: 0;
  }
  .hero h1 { font-size: clamp(32px, 4vw, 44px); margin-bottom: 8px; }
  .hero p { font-style: italic; color: var(--ink-soft); }
  .hero .stats {
    margin-top: 16px;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
  }

  /* Editorial flat list — single column, no cards */
  .post-list {
    display: block;
    margin: 0 0 56px;
  }
  .post-list li,
  .post-list li:first-child {
    position: relative;
    display: block;
    padding: 22px 0 22px 18px;
    margin-left: -18px;
    border: none;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    transition: none;
  }
  /* Vertical accent rule that slides in on hover — the only hover signal. */
  .post-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 22px;
    bottom: 22px;
    width: 2px;
    background: var(--ink);
    opacity: 0;
    transition: opacity .12s var(--ease);
  }
  .post-list li:hover::before { opacity: 1; }
  .post-list li:hover .post-title { color: var(--ink); }
  .post-list li:hover .post-meta { color: var(--ink-soft); }
  .post-list li:last-child { border-bottom: 1px solid var(--line); }

  /* The anchor wraps the whole click surface; restore block layout. */
  .post-card a {
    display: block;
    color: var(--ink);
    text-decoration: none;
  }
  .post-card a:hover { color: var(--ink); }

  .post-meta {
    margin-bottom: 8px;
    font-size: 11.5px;
    color: var(--muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    transition: color .12s var(--ease);
  }
  .post-meta .post-id {
    background: transparent;
    color: var(--muted);
    padding: 0;
    font-size: 11.5px;
    font-weight: 500;
    letter-spacing: 0.06em;
  }
  .post-meta .sep { opacity: 0.5; }

  .post-title {
    font-size: 20px;
    line-height: 1.4;
    margin: 0 0 6px;
    color: var(--ink);
    transition: color .12s var(--ease);
  }
  .post-excerpt {
    font-size: 14.5px;
    color: var(--ink-soft);
    margin: 0;
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }
  .tag-row { margin-top: 10px; }

  /* First post — featured editorial treatment. */
  .post-list li:first-child {
    padding: 28px 0 32px 18px;
    border-bottom: 1px solid var(--line);
  }
  .post-list li:first-child::before {
    top: 28px;
    bottom: 32px;
    width: 2px;
    background: var(--accent);
    opacity: 1;
  }
  .post-list li:first-child:hover::before { background: var(--ink); }
  .post-list li:first-child .post-title {
    font-size: clamp(24px, 2.6vw, 30px);
    line-height: 1.25;
    font-weight: 700;
    letter-spacing: -0.3px;
    margin-bottom: 10px;
  }
  .post-list li:first-child .post-excerpt {
    font-size: 16px;
    line-height: 1.7;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    color: var(--ink-soft);
  }

  /* Search results: same flat list, no grid */
  #results.post-list {
    display: block;
    grid-template-columns: none;
  }
  .search-box { max-width: none; }

  /* Pager unchanged */
  .pager {
    background: transparent;
  }
  .pager a {
    background: transparent;
    border: none;
    border-bottom: 1px solid transparent;
    border-radius: 0;
    padding: 6px 0;
    color: var(--ink);
  }
  .pager a:hover {
    background: transparent;
    border-bottom-color: var(--accent);
    color: var(--accent);
  }
}

/* ========================================================================
   Desktop (≥1024px) — comfortable rhythm
   ======================================================================== */
@media (min-width: 1024px) {
  .container:has(.post-list),
  .container:has(.tag-cloud),
  .container:has(.search-box) {
    max-width: 960px;
  }
  .post-list li,
  .post-list li:first-child {
    padding: 26px 0 26px 22px;
    margin-left: -22px;
  }
  .post-list li::before {
    top: 26px;
    bottom: 26px;
  }
  .post-list li:first-child {
    padding: 36px 0 40px 22px;
  }
  .post-list li:first-child::before {
    top: 36px;
    bottom: 40px;
  }
  /* Article prose stays at a comfortable measure even on huge screens */
  .article > *,
  .container:not(:has(.post-list)):not(:has(.tag-cloud)):not(:has(.search-box)) {
    max-width: 760px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* ========================================================================
   Wide desktop (≥1280px) — bigger type for 2K/QHD readability.
   The single-column editorial layout holds.
   ======================================================================== */
@media (min-width: 1280px) {
  .container:has(.post-list),
  .container:has(.tag-cloud),
  .container:has(.search-box) {
    max-width: 1000px;
  }
  .hero { padding: 72px 0 24px; }
}

/* ========================================================================
   2K and above (≥1920px) — let type breathe to ~19-21px, container widens.
   ======================================================================== */
@media (min-width: 1920px) {
  body { font-size: 18.5px; }
  .container:has(.post-list),
  .container:has(.tag-cloud),
  .container:has(.search-box) {
    max-width: 1080px;
  }
  .article > *,
  .container:not(:has(.post-list)):not(:has(.tag-cloud)):not(:has(.search-box)) {
    max-width: 820px;
  }
  .post-list li:first-child .post-title {
    font-size: 32px;
  }
}

/* ========================================================================
   Footer reuse note
   ======================================================================== */
.footer-note { color: var(--ink-soft); }
@media (max-width: 600px) {
  .footer { font-size: 13.5px; line-height: 1.8; }
  .footer-inner > span + span::before { content: " · "; }
}

/* ========================================================================
   Focus states (a11y)
   ======================================================================== */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

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