/* Compact, Hacker News layout — kav.co.id palette & typography. */
:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --fg: #1c1917;          /* stone-900 */
  --muted: #78716c;       /* stone-500 */
  --accent: #ef4444;      /* kav red */
  --accent-strong: #dc2626;
  --accent-tint: #fef2f2;
  --rule: rgba(0, 0, 0, 0.08);
  --content: 740px;       /* shared centered column width */
}
/* Light is the default theme. Dark applies only when the visitor opts in
   via the toggle (persisted as data-theme="dark"). */
:root[data-theme="dark"] {
  --bg: #18181b;
  --surface: #1f1f23;
  --fg: #fafafa;
  --muted: #a1a1aa;
  --accent: #ef4444;
  --accent-strong: #f87171;
  --accent-tint: rgba(239, 68, 68, 0.12);
  --rule: rgba(255, 255, 255, 0.09);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.5 "Inter", system-ui, -apple-system, sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
a { color: var(--fg); text-decoration: none; }
a:hover { color: var(--accent); }

/* Centered column shared by header, content and footer. */
.bar {
  max-width: var(--content);
  margin: 0 auto;
  padding: 0 16px;
  width: 100%;
}
.topbar {
  background: var(--surface);
  padding: 11px 0;
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .bar {
  display: flex;
  align-items: baseline;
  gap: 14px;
}
.topbar .logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--fg);
}
.topbar .logo-img {
  height: 22px;
  width: auto;
  display: block;
}
.topbar .logo-text {
  font-family: "IBM Plex Serif", Georgia, serif;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.topbar .logo-mark { color: var(--accent); }
.topbar .logo:hover { color: var(--fg); }
.topbar .logo:hover .logo-mark { color: var(--accent-strong); }
.topbar nav { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.navlink { color: var(--muted); font-size: 13px; }
.navlink:hover { color: var(--accent); }
/* Language switcher: segmented pill — active locale highlighted. */
.langsw {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 3px;
  font-size: 13px;
  line-height: 1;
}
.langsw .lng {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.langsw a.lng:hover { color: var(--fg); }
/* Active locale: filled accent segment, bold. */
.langsw .lng.is-active {
  color: #fff;
  background: var(--accent);
  font-weight: 700;
}
/* Icon-only buttons (theme toggle) */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  color: var(--muted);
  background: none;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0;
  cursor: pointer;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.icon-btn svg { display: block; }

main { max-width: var(--content); margin: 0 auto; padding: 20px 16px 40px; }

/* Article list */
ol.items { list-style: none; margin: 0; padding: 0; counter-reset: rank; }
ol.items > li {
  counter-increment: rank;
  padding: 9px 0 9px 32px;
  position: relative;
  border-bottom: 1px solid var(--rule);
}
ol.items > li:last-child { border-bottom: 0; }
ol.items > li::before {
  content: counter(rank);
  position: absolute; left: 0; top: 10px;
  color: var(--muted); font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right; width: 20px;
}
/* Month separators in the article list */
ol.items > li.month-sep {
  counter-increment: none;
  padding: 22px 0 7px;
  border-bottom: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
ol.items > li.month-sep::before { content: none; }
ol.items > li.month-sep:first-child { padding-top: 2px; }

.line { line-height: 1.35; }
.line .title { font-size: 15px; font-weight: 500; }
.line .title:hover { color: var(--accent); }

/* Read / unread state (set client-side from localStorage) */
ol.items > li.is-unread > .line .title::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 1px;
}
ol.items > li.is-read { opacity: 0.42; }
ol.items > li.is-read .line .title { color: var(--muted); font-weight: 400; }
ol.items > li.is-read::before { color: var(--muted); }
ol.items > li.is-read:hover { opacity: 0.75; }
.host { color: var(--muted); font-size: 12px; margin-left: 5px; }
.sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.sub a { color: var(--muted); }
.sub a:hover { color: var(--accent); }
.sub .cat { font-weight: 600; color: var(--accent-strong); }

/* Article page */
.post h1 {
  font-family: "IBM Plex Serif", Georgia, serif;
  font-size: 26px; font-weight: 500;
  line-height: 1.25; margin: 4px 0 6px;
}
.post .meta { color: var(--muted); font-size: 12px; margin: 0 0 22px; }
.post .meta a { color: var(--muted); }
.post .meta a:hover { color: var(--accent); }
.post .meta .cat { color: var(--accent-strong); font-weight: 600; }
.post .body { font-size: 15px; line-height: 1.7; }
.post .body p, .post .body ul, .post .body ol { margin: 0 0 14px; }
.post .body h2 {
  font-family: "IBM Plex Serif", Georgia, serif;
  font-size: 19px; font-weight: 500; margin: 26px 0 8px;
}
.post .body h3 { font-size: 16px; font-weight: 600; margin: 20px 0 8px; }
.post .body a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.post .body a:hover { color: var(--accent-strong); }
.post .body img { max-width: 100%; height: auto; border-radius: 4px; }
.post .body pre {
  background: var(--surface); border: 1px solid var(--rule);
  padding: 12px; overflow: auto; font-size: 13px; border-radius: 6px;
}
.post .body code {
  font-size: 13px;
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
.post .body blockquote {
  margin: 0 0 14px; padding: 2px 0 2px 14px;
  border-left: 3px solid var(--accent); color: var(--muted);
}
.post .tags { margin: 24px 0 0; font-size: 12px; }
.post .tags a {
  display: inline-block; color: var(--muted);
  border: 1px solid var(--rule); background: var(--surface);
  padding: 2px 9px; margin: 0 6px 6px 0; border-radius: 999px;
}
.post .tags a:hover {
  color: var(--accent-strong); border-color: var(--accent);
  background: var(--accent-tint);
}
.back { margin-top: 24px; font-size: 13px; }
.back a { color: var(--muted); }
.back a:hover { color: var(--accent); }
/* Article back link sits above the title instead of after the body. */
.back-top { margin-top: 0; margin-bottom: 18px; }

/* Home list pagination */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 28px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  font-size: 13px;
}
.pager > a { color: var(--muted); }
.pager > a:hover { color: var(--accent); }
.pager .is-off { color: var(--rule); pointer-events: none; }
.pager-nums { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; }
.pager-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
a.pager-num:hover { color: var(--accent); border-color: var(--accent); }
.pager-num.is-current {
  color: var(--surface);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}
.pager-gap { color: var(--muted); font-size: 12px; padding: 0 2px; }

/* Tag index */
h1 { font-size: 18px; font-weight: 600; margin: 4px 0 18px; }
ul.taglist { list-style: none; padding: 0; margin: 0; columns: 2; }
@media (min-width: 560px) { ul.taglist { columns: 3; } }
ul.taglist li { padding: 4px 0; break-inside: avoid; }
ul.taglist .count {
  color: var(--muted); font-size: 11px;
  font-variant-numeric: tabular-nums;
}

footer {
  padding: 18px 0 36px;
  border-top: 1px solid var(--rule);
  color: var(--muted); font-size: 12px; text-align: center;
}
footer a { color: var(--muted); }
footer a:hover { color: var(--accent); }
