/* ------------------------------------------------------------------
   Design system: shadcn/ui (neutral). Tokens, typography, and the
   component primitives (Card, Badge, Separator, Avatar, Button)
   recreated faithfully in plain CSS — no build step.
------------------------------------------------------------------ */

:root {
  --background: oklch(1 0 0);
  --foreground: oklch(0.145 0 0);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.145 0 0);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.145 0 0);
  --primary: oklch(0.205 0 0);
  --primary-foreground: oklch(0.985 0 0);
  --secondary: oklch(0.97 0 0);
  --secondary-foreground: oklch(0.205 0 0);
  --muted: oklch(0.97 0 0);
  --muted-foreground: oklch(0.556 0 0);
  --accent: oklch(0.97 0 0);
  --accent-foreground: oklch(0.205 0 0);
  --border: oklch(0.922 0 0);
  --input: oklch(0.922 0 0);
  --ring: oklch(0.708 0 0);
  --radius: 0.625rem;

  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SFMono-Regular", "Menlo", monospace;
}

.dark {
  --background: oklch(0.145 0 0);
  --foreground: oklch(0.985 0 0);
  --card: oklch(0.205 0 0);
  --card-foreground: oklch(0.985 0 0);
  --popover: oklch(0.205 0 0);
  --popover-foreground: oklch(0.985 0 0);
  --primary: oklch(0.985 0 0);
  --primary-foreground: oklch(0.205 0 0);
  --secondary: oklch(0.269 0 0);
  --secondary-foreground: oklch(0.985 0 0);
  --muted: oklch(0.269 0 0);
  --muted-foreground: oklch(0.708 0 0);
  --accent: oklch(0.269 0 0);
  --accent-foreground: oklch(0.985 0 0);
  --border: oklch(1 0 0 / 10%);
  --input: oklch(1 0 0 / 15%);
  --ring: oklch(0.556 0 0);
}

* { box-sizing: border-box; border-color: var(--border); }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-feature-settings: "cv11", "ss01";
  font-variation-settings: "opsz" 32;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--foreground); color: var(--background); }

a { color: inherit; text-decoration: none; }

.container { max-width: 720px; margin: 0 auto; padding: 0 24px; }

/* ---- top nav -------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(180%) blur(8px);
  background: color-mix(in oklch, var(--background) 80%, transparent);
  border-bottom: 1px solid var(--border);
}
.site-header .bar {
  display: flex; align-items: center; justify-content: space-between;
  height: 56px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -0.01em; }
.brand .dot {
  width: 22px; height: 22px; border-radius: 6px;
  background: var(--primary); color: var(--primary-foreground);
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
}
.nav-right { display: flex; align-items: center; gap: 4px; }

/* ---- button (ghost / outline / icon) -------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 12px;
  border-radius: calc(var(--radius) - 2px);
  font-size: 14px; font-weight: 500; font-family: inherit;
  background: transparent; color: var(--foreground);
  border: 1px solid transparent; cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.btn:hover { background: var(--accent); color: var(--accent-foreground); }
.btn-outline { border-color: var(--border); }
.btn-icon { width: 36px; padding: 0; justify-content: center; }
.btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.btn .moon { display: none; }
.dark .btn .sun { display: none; }
.dark .btn .moon { display: inline; }

/* ---- badge ---------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 9px; border-radius: 9999px;
  font-size: 12px; font-weight: 500; line-height: 1.4;
  border: 1px solid var(--border);
  background: var(--secondary); color: var(--secondary-foreground);
}
.badge-mono { font-family: var(--font-mono); letter-spacing: -0.02em; }

/* ---- separator ------------------------------------------------ */
.separator { height: 1px; width: 100%; background: var(--border); border: 0; margin: 0; }

/* ---- card ----------------------------------------------------- */
.card {
  display: block;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--card); color: var(--card-foreground);
  padding: 24px;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
a.card:hover { border-color: color-mix(in oklch, var(--foreground) 25%, var(--border)); }

/* ---- avatar --------------------------------------------------- */
.avatar {
  width: 36px; height: 36px; border-radius: 9999px;
  background: var(--muted); color: var(--muted-foreground);
  display: grid; place-items: center;
  font-size: 13px; font-weight: 600; flex: none;
  border: 1px solid var(--border);
}

/* ---- meta row ------------------------------------------------- */
.meta { display: flex; align-items: center; gap: 12px; color: var(--muted-foreground); font-size: 14px; }
.meta .author { color: var(--foreground); font-weight: 500; }
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---- landing -------------------------------------------------- */
.hero { padding: 80px 0 40px; }
.eyebrow { font-size: 13px; color: var(--muted-foreground); font-family: var(--font-mono); letter-spacing: -0.01em; }
.hero h1 {
  font-size: clamp(34px, 6vw, 52px); line-height: 1.05;
  letter-spacing: -0.03em; font-weight: 600; margin: 16px 0 18px;
}
.hero p { font-size: 18px; color: var(--muted-foreground); margin: 0; max-width: 56ch; }
.section-label {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted-foreground); font-weight: 500; margin: 56px 0 16px;
}
.post-card-title { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 8px; }
.post-card-dek { color: var(--muted-foreground); margin: 0 0 18px; font-size: 15.5px; }

/* ---- article -------------------------------------------------- */
.article-head { padding: 56px 0 8px; }
.article-head h1 {
  font-size: clamp(32px, 5.5vw, 46px); line-height: 1.08;
  letter-spacing: -0.03em; font-weight: 600; margin: 22px 0 18px;
}
.article-head .dek { font-size: 19px; color: var(--muted-foreground); margin: 0 0 28px; }
.byline { display: flex; align-items: center; gap: 12px; padding: 4px 0 24px; }
.byline .who { display: flex; flex-direction: column; line-height: 1.3; }
.byline .who .name { font-weight: 500; font-size: 14px; }
.byline .who .when { color: var(--muted-foreground); font-size: 13px; }

/* prose ---------------------------------------------------------- */
.prose { padding: 8px 0 40px; font-size: 17px; }
.prose p { margin: 0 0 22px; }
.prose h2 {
  font-size: 26px; font-weight: 600; letter-spacing: -0.02em;
  margin: 48px 0 16px; line-height: 1.2;
}
.prose h3 {
  font-size: 20px; font-weight: 600; letter-spacing: -0.01em;
  margin: 36px 0 12px;
}
.prose strong { font-weight: 600; }
.prose em { font-style: italic; }
.prose a.link { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border); }
.prose a.link:hover { text-decoration-color: var(--foreground); }

.prose blockquote {
  margin: 32px 0; padding: 4px 0 4px 22px;
  border-left: 3px solid var(--foreground);
  font-size: 21px; line-height: 1.4; letter-spacing: -0.01em;
  font-weight: 500;
}

.prose code:not(pre code) {
  font-family: var(--font-mono); font-size: 0.88em;
  background: var(--muted); color: var(--foreground);
  padding: 2px 6px; border-radius: 6px; border: 1px solid var(--border);
}

.codeblock {
  margin: 28px 0; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--card); overflow: hidden;
}
.codeblock .cb-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; border-bottom: 1px solid var(--border);
  background: var(--muted);
}
.codeblock .cb-lang {
  font-family: var(--font-mono); font-size: 12px; color: var(--muted-foreground);
  text-transform: lowercase; letter-spacing: 0;
}
.codeblock .cb-dots { display: flex; gap: 6px; }
.codeblock .cb-dots span { width: 10px; height: 10px; border-radius: 9999px; background: var(--border); }
.codeblock pre {
  margin: 0; padding: 16px 18px; overflow-x: auto;
  font-family: var(--font-mono); font-size: 13.5px; line-height: 1.7;
  color: var(--foreground);
}
.codeblock pre .k { color: var(--muted-foreground); }

/* ---- footer --------------------------------------------------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 40px; }
.site-footer .bar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; padding: 28px 0; color: var(--muted-foreground); font-size: 14px;
}
.site-footer a.link { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border); }
.site-footer a.link:hover { color: var(--foreground); }

.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted-foreground); font-size: 14px; margin-top: 8px; }
.back-link:hover { color: var(--foreground); }

@media (max-width: 600px) {
  .hero { padding: 56px 0 32px; }
  .prose { font-size: 16px; }
}
