/* Hacker Blog Posts — a quiet reading-list design. */
:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --ink: #1c1a17;
  --ink-2: #3b3732;
  --muted: #6e6860;
  --faint: #a49d93;
  --line: #ebe6de;
  --line-2: #ddd6cb;
  --chip: #f3efe8;
  --accent: #f0652f;
  --accent-ink: #b8441a;
  --accent-soft: #fdeee6;
  --visited: #7c6f86;
  --serif: "Charter", "Bitstream Charter", "Sitka Text", "Iowan Old Style", "Palatino Linotype", Cambria, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 10px;
  --wrap: 1120px;
  --shadow: 0 1px 2px rgba(28, 26, 23, .04), 0 6px 24px -12px rgba(28, 26, 23, .12);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15130f;
    --surface: #1c1a16;
    --ink: #eeeae3;
    --ink-2: #d4cec4;
    --muted: #a39c91;
    --faint: #6f695f;
    --line: #2a2722;
    --line-2: #39352e;
    --chip: #25221d;
    --accent: #ff7a45;
    --accent-ink: #ff9b70;
    --accent-soft: #2e1f17;
    --visited: #b3a3c2;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px -14px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration-color: var(--line-2); text-underline-offset: .18em; }
a:hover { color: var(--accent-ink); text-decoration-color: currentColor; }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.2; margin: 0; text-wrap: balance; }
p { margin: 0; }
code, kbd { font-family: var(--mono); font-size: .88em; background: var(--chip); padding: .1em .35em; border-radius: 4px; }
kbd { border: 1px solid var(--line-2); border-bottom-width: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--bg); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 22px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.brand:hover { color: var(--ink); }
.logo { width: 28px; height: 28px; flex: none; }
.brand-name { font-family: var(--serif); font-size: 1.12rem; }
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { text-decoration: none; color: var(--muted); padding: 6px 10px; border-radius: 8px; font-size: .94rem; white-space: nowrap; }
.nav a:hover { color: var(--ink); background: var(--chip); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--chip); font-weight: 600; }
.search { margin-left: auto; }
.search input {
  width: 230px; height: 36px; padding: 0 12px; border-radius: 9px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: inherit; font-size: .92rem;
}
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- hero ---------- */
.hero { padding: 56px 0 28px; max-width: 760px; }
.hero h1 { font-family: var(--serif); font-size: clamp(2.1rem, 5vw, 3.3rem); letter-spacing: -.025em; font-weight: 700; }
.lede { margin-top: 14px; font-size: 1.14rem; color: var(--ink-2); max-width: 680px; }
.hero-search { display: flex; gap: 8px; margin-top: 24px; max-width: 600px; }
.hero-search input {
  flex: 1; min-width: 0; height: 48px; padding: 0 16px; font: inherit; font-size: 1.02rem;
  border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
}
.hero-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.hero-search button {
  height: 48px; padding: 0 20px; border: 0; border-radius: 12px; background: var(--ink); color: var(--bg);
  font: inherit; font-weight: 600; cursor: pointer;
}
.hero-search button:hover { background: var(--accent-ink); }
.hero-search.inline { margin-top: 18px; }
.hero-search.inline input, .hero-search.inline button { height: 44px; }
.hero-links { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .95rem; }
.hero-links a { color: var(--muted); }

/* ---------- panels / home ---------- */
.panel { margin: 30px 0; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; border-bottom: 2px solid var(--ink); padding-bottom: 8px; margin-bottom: 6px; }
.panel-head h2 { font-family: var(--serif); font-size: 1.32rem; letter-spacing: -.01em; }
.panel-head a { font-size: .9rem; color: var(--muted); text-decoration: none; white-space: nowrap; }
.panel-head a:hover { color: var(--accent-ink); }
.panel-note { color: var(--muted); font-size: .92rem; margin: 8px 0 4px; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 40px; }
.home-grid.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.blogs-panel .blog-list { list-style: none; margin: 6px 0 0; padding: 0; counter-reset: b; }
.blog-list li a {
  display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--line); text-decoration: none;
}
.blog-list .b-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.blog-list .b-stat { color: var(--muted); font-size: .84rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty { color: var(--muted); padding: 18px 0; }

.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; margin-top: 12px; }
.topic-tile {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  text-decoration: none; font-weight: 600; font-size: .95rem; transition: border-color .15s, transform .15s;
}
.topic-tile:hover { border-color: var(--accent); color: var(--ink); transform: translateY(-1px); }
.topic-tile .n, .chip .n, .drop-menu .n { color: var(--muted); font-weight: 500; font-size: .84rem; font-variant-numeric: tabular-nums; }
.year-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.year-strip a {
  display: flex; flex-direction: column; align-items: center; min-width: 76px; padding: 9px 10px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-decoration: none;
}
.year-strip a:hover { border-color: var(--accent); }
.year-strip strong { font-family: var(--serif); font-size: 1.08rem; }
.year-strip span { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }

/* ---------- post rows ---------- */
.post { display: flex; gap: 14px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.post:last-child { border-bottom: 0; }
.post.compact { padding: 11px 0; }
.rank {
  flex: none; width: 2.1em; text-align: right; color: var(--faint); font-variant-numeric: tabular-nums;
  font-size: .92rem; padding-top: .22em;
}
.post-body { min-width: 0; flex: 1; }
.post-title { font-family: var(--serif); font-size: 1.14rem; font-weight: 600; letter-spacing: -.005em; line-height: 1.3; }
.post.compact .post-title { font-size: 1.04rem; }
.post-title a { text-decoration: none; overflow-wrap: anywhere; }
.post-title a:visited { color: var(--visited); }
.post-title a:hover { color: var(--accent-ink); text-decoration: underline; text-decoration-thickness: 1px; }
.post-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px 0; margin-top: 5px;
  color: var(--muted); font-size: .84rem; font-variant-numeric: tabular-nums;
}
.post-meta > * + *::before { content: "·"; margin: 0 7px; color: var(--faint); }
.post-meta a { text-decoration: none; }
.post-meta a:hover { text-decoration: underline; }
.post-meta .site { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-weight: 600; max-width: 100%; }
.post-meta .site span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.post-meta .pts { color: var(--accent-ink); font-weight: 600; }
.post-meta .cited { color: var(--ink-2); }
.post-meta .details { color: var(--faint); }
.post-desc {
  margin-top: 6px; color: var(--ink-2); font-size: .93rem; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.favicon { width: 16px; height: 16px; border-radius: 4px; flex: none; vertical-align: -3px; object-fit: contain; }
.favicon.letter {
  --s: 16px; width: var(--s); height: var(--s); display: inline-grid; place-items: center;
  background: var(--chip); color: var(--muted); font: 700 calc(var(--s) * .62)/1 var(--sans); border: 1px solid var(--line-2);
}
img.favicon[width="20"], .favicon.letter[style*="20px"] { width: 20px; height: 20px; }
img.favicon[width="18"] { width: 18px; height: 18px; }
img.favicon[width="40"] { width: 40px; height: 40px; border-radius: 9px; }

/* ---------- page heads, filters, pager ---------- */
.page-head { padding: 40px 0 8px; max-width: 760px; }
.page-head h1 { font-family: var(--serif); font-size: clamp(1.9rem, 4vw, 2.6rem); letter-spacing: -.02em; }
.intro { margin-top: 10px; color: var(--ink-2); font-size: 1.04rem; }
.intro.small { font-size: .93rem; color: var(--muted); }
.count { color: var(--muted); }
.crumbs { font-size: .9rem; color: var(--muted); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.crumbs a { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.badge { font-size: .74rem; padding: 2px 8px; border-radius: 99px; background: var(--chip); color: var(--muted); }
.year-nav { display: flex; justify-content: space-between; font-size: .92rem; margin-bottom: 8px; }
.year-nav a { color: var(--muted); text-decoration: none; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 18px 0 6px; padding-bottom: 12px; border-bottom: 2px solid var(--ink); }
.seg { display: inline-flex; background: var(--chip); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg a { padding: 5px 11px; border-radius: 8px; font-size: .88rem; text-decoration: none; color: var(--muted); white-space: nowrap; }
.seg a:hover { color: var(--ink); }
.seg a.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.drop { position: relative; }
.drop summary {
  list-style: none; cursor: pointer; padding: 6px 30px 6px 12px; border-radius: 10px; font-size: .88rem;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); white-space: nowrap; position: relative;
}
.drop summary::-webkit-details-marker { display: none; }
.drop summary::after { content: ""; position: absolute; right: 12px; top: 50%; width: 6px; height: 6px; border: solid var(--muted); border-width: 0 1.5px 1.5px 0; transform: translateY(-70%) rotate(45deg); }
.drop[open] summary { border-color: var(--accent); }
.drop-menu {
  position: absolute; z-index: 4; top: calc(100% + 6px); left: 0; min-width: 250px; max-height: 360px; overflow: auto;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow); padding: 6px;
}
.drop-menu a { display: flex; justify-content: space-between; gap: 12px; padding: 6px 10px; border-radius: 7px; text-decoration: none; font-size: .9rem; }
.drop-menu a:hover { background: var(--chip); color: var(--ink); }
.drop-menu a.on { font-weight: 700; color: var(--accent-ink); }
.drop-menu.years { display: grid; grid-template-columns: repeat(4, 1fr); min-width: 300px; }
.drop-menu.years a:first-child { grid-column: 1 / -1; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 0 10px; padding-top: 16px; border-top: 1px solid var(--line); font-size: .94rem; }
.pager a { text-decoration: none; padding: 8px 14px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); }
.pager a:hover { border-color: var(--accent); }
.pager .off { color: var(--faint); padding: 8px 14px; }
.pager-pos { color: var(--muted); }

/* ---------- post page ---------- */
.post-page { max-width: 780px; padding: 36px 0 12px; }
.post-h1 { font-family: var(--serif); font-size: clamp(1.8rem, 4.2vw, 2.55rem); letter-spacing: -.02em; line-height: 1.15; }
.post-h1 a { text-decoration: none; }
.post-h1 a:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.byline { margin-top: 12px; color: var(--muted); font-size: .93rem; display: flex; flex-wrap: wrap; }
.byline > * + *::before { content: "·"; margin: 0 8px; color: var(--faint); }
.summary { margin: 22px 0 0; padding: 4px 0 4px 18px; border-left: 3px solid var(--accent); font-family: var(--serif); font-size: 1.12rem; color: var(--ink-2); line-height: 1.55; }
.actions, .blog-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 24px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 10px 16px; border-radius: 10px; text-decoration: none;
  font-weight: 600; font-size: .94rem; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
}
.btn:hover { border-color: var(--accent); color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
.btn.ghost { background: transparent; color: var(--muted); }
.note { margin-top: 12px; font-size: .9rem; color: var(--muted); }
.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 26px 0 0; }
.stat-row div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat-row dt { font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stat-row dd { margin: 2px 0 0; font-family: var(--serif); font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-row dd small { font-family: var(--sans); font-size: .78rem; font-weight: 500; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 99px; background: var(--chip); text-decoration: none; font-size: .86rem; color: var(--ink-2); border: 1px solid transparent; }
.chip:hover { border-color: var(--accent); color: var(--ink); }
.chip.on { background: var(--accent-soft); border-color: var(--accent); }
.block { margin-top: 38px; }
.block h2 { font-family: var(--serif); font-size: 1.3rem; margin-bottom: 10px; }
.block .panel-head h2 { margin: 0; }
.block p { color: var(--ink-2); }
.block p + p { margin-top: 8px; }
.hn-table, .blog-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.hn-table th, .blog-table th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 8px 10px 8px 0; border-bottom: 2px solid var(--ink); }
.hn-table td, .blog-table td { padding: 10px 10px 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.hn-table td:first-child { white-space: nowrap; color: var(--muted); }
.hn-table .by { color: var(--faint); font-size: .84rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hn-table th.num, .blog-table th.num { text-align: right; }
.mentions { margin: 10px 0; padding-left: 18px; color: var(--ink-2); }
.mentions li { margin: 3px 0; }

/* ---------- blogs ---------- */
.blog-head { padding: 34px 0 6px; max-width: 820px; }
.blog-title { display: flex; align-items: center; gap: 16px; }
.blog-title h1 { font-family: var(--serif); font-size: clamp(1.8rem, 4vw, 2.5rem); letter-spacing: -.02em; }
.blog-title .favicon.letter { --s: 40px; border-radius: 9px; }
.blog-domain { color: var(--muted); font-size: .95rem; margin-top: 2px; }
.blog-desc { margin-top: 14px; color: var(--ink-2); font-size: 1.04rem; max-width: 680px; }
.blog-table { margin-top: 8px; }
.blog-table .rank { width: 3em; color: var(--faint); }
.blog-cell { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.blog-cell span { display: flex; flex-direction: column; min-width: 0; }
.blog-cell strong { overflow: hidden; text-overflow: ellipsis; }
.blog-cell small { color: var(--muted); font-size: .8rem; }
.top-post a { color: var(--ink-2); text-decoration: none; font-family: var(--serif); }
.top-post a:hover { text-decoration: underline; }
.blog-matches { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.blog-chip { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border: 1px solid var(--line-2); border-radius: 99px; background: var(--surface); text-decoration: none; font-weight: 600; font-size: .9rem; }
.blog-chip small { color: var(--muted); font-weight: 500; }
.blog-chip:hover { border-color: var(--accent); }

/* ---------- topics & years ---------- */
.topic-cards, .year-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; margin: 22px 0; }
.topic-card, .year-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; }
.topic-card h2, .year-card h2 { font-family: var(--serif); font-size: 1.25rem; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.topic-card h2 a, .year-card h2 a { text-decoration: none; }
.topic-card h2 .n { color: var(--muted); font: 500 .85rem var(--sans); }
.topic-card ol, .year-card ol { margin: 12px 0 0; padding-left: 18px; }
.topic-card li, .year-card li { margin: 7px 0; font-size: .93rem; line-height: 1.4; }
.topic-card li a, .year-card li a { text-decoration: none; font-family: var(--serif); font-weight: 600; }
.topic-card li a:hover, .year-card li a:hover { text-decoration: underline; }
.topic-card li .muted, .year-card li .muted { font-size: .82rem; }
.more-link { display: inline-block; margin-top: 10px; font-size: .88rem; color: var(--muted); text-decoration: none; }
.bar { position: relative; margin-top: 10px; height: 22px; border-radius: 6px; background: var(--chip); overflow: hidden; }
.bar::before { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--accent-soft); border-right: 2px solid var(--accent); }
.bar span { position: relative; padding-left: 8px; font-size: .8rem; line-height: 22px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ---------- prose ---------- */
.prose { max-width: 700px; padding: 40px 0 20px; }
.prose h1 { font-family: var(--serif); font-size: clamp(2rem, 4vw, 2.6rem); letter-spacing: -.02em; }
.prose h2 { font-family: var(--serif); font-size: 1.35rem; margin: 32px 0 10px; }
.prose p, .prose li { color: var(--ink-2); font-size: 1.02rem; line-height: 1.65; }
.prose p + p { margin-top: 12px; }
.prose ul, .prose ol { padding-left: 22px; margin: 10px 0; }
.prose li { margin: 6px 0; }
.not-found { padding-bottom: 60px; }
.not-found p:last-child { margin-top: 18px; }

/* ---------- footer ---------- */
.site-footer { margin-top: 60px; border-top: 1px solid var(--line); background: var(--surface); }
.footer-inner { padding: 28px 20px 40px; color: var(--muted); font-size: .9rem; display: grid; gap: 8px; max-width: var(--wrap); }
.footer-inner p { max-width: 760px; }
.footer-links a { color: var(--muted); }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .search input { width: 170px; }
  .home-grid, .home-grid.even { grid-template-columns: minmax(0, 1fr); gap: 0; }
}
@media (max-width: 760px) {
  .wrap { padding: 0 16px; }
  .header-inner { flex-wrap: wrap; height: auto; padding: 10px 16px 0; gap: 8px 14px; }
  .brand { order: 1; }
  .search { order: 2; margin-left: auto; }
  .search input { width: 150px; height: 34px; }
  .nav { order: 3; width: 100%; margin: 0; padding: 2px 0 8px; }
  .nav a:first-child { padding-left: 0; }
  .hero { padding-top: 34px; }
  .lede { font-size: 1.04rem; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hide-sm { display: none; }
  .rank { width: 1.7em; font-size: .85rem; }
  .post { gap: 10px; }
  .post-title { font-size: 1.07rem; }
  .post-meta .site span { max-width: 180px; }
  .topic-cards, .year-cards { grid-template-columns: minmax(0, 1fr); }
  .drop-menu { position: fixed; left: 16px; right: 16px; top: auto; bottom: 16px; max-height: 60vh; min-width: 0; }
  .drop-menu.years { min-width: 0; }
}
@media (max-width: 420px) {
  .brand-name { font-size: 1.02rem; }
  .search input { width: 120px; }
  .hero-search button { padding: 0 14px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
