/* ============================================================
   focusmark. — Hugo theme
   Built from the "Nagi Engineering" Claude Design system
   (calm, text-first engineer blog). OKLCH tokens parameterised
   by --th (tone hue) and --tc (tone chroma). Default tone:
   "focusmark" (warm terracotta, h27) — set via data-tone on <html>.

   Order: tokens (colors/themes/typography/spacing) → base → custom.
   ============================================================ */

/* ============================================================
   tokens/colors.css — light theme + tone hue/chroma overrides
   ============================================================ */
:root {
  --th: 152;
  --tc: 1;
  --bg:           oklch(0.985 0.004 var(--th));
  --bg-grad:      oklch(0.972 0.006 var(--th));
  --surface:      oklch(0.998 0.003 var(--th));
  --surface-2:    oklch(0.965 0.006 var(--th));
  --border:       oklch(0.905 0.007 var(--th));
  --border-soft:  oklch(0.935 0.005 var(--th));
  --text:         oklch(0.29 0.013 var(--th));
  --text-muted:   oklch(0.52 0.013 var(--th));
  --text-faint:   oklch(0.66 0.011 var(--th));
  --accent:       oklch(0.55 calc(0.072 * var(--tc)) var(--th));
  --accent-hover: oklch(0.49 calc(0.078 * var(--tc)) var(--th));
  --accent-weak:  oklch(0.945 calc(0.028 * var(--tc)) var(--th));
  --accent-line:  oklch(0.86 calc(0.04 * var(--tc)) var(--th));
  --accent-fg:    oklch(0.99 0.005 var(--th));
  --code-bg:      oklch(0.255 0.012 var(--th));
  --code-text:    oklch(0.9 0.008 var(--th));
  --shadow:       0 1px 2px oklch(0.5 0.02 var(--th) / 0.05), 0 8px 28px oklch(0.5 0.02 var(--th) / 0.06);
  --shadow-soft:  0 1px 2px oklch(0.5 0.02 var(--th) / 0.04);
}

:root[data-tone="focusmark"] { --th: 27;  --tc: 1.35; }
:root[data-tone="sage"]   { --th: 152; }
:root[data-tone="mist"]   { --th: 224; }
:root[data-tone="sakura"] { --th: 354; }
:root[data-tone="sand"]   { --th: 64;  }

/* ============================================================
   tokens/themes.css — dark theme overrides
   ============================================================ */
:root[data-theme="dark"] {
  --bg:           oklch(0.185 0.009 var(--th));
  --bg-grad:      oklch(0.21 0.011 var(--th));
  --surface:      oklch(0.225 0.011 var(--th));
  --surface-2:    oklch(0.26 0.012 var(--th));
  --border:       oklch(0.32 0.014 var(--th));
  --border-soft:  oklch(0.28 0.012 var(--th));
  --text:         oklch(0.925 0.008 var(--th));
  --text-muted:   oklch(0.7 0.012 var(--th));
  --text-faint:   oklch(0.55 0.012 var(--th));
  --accent:       oklch(0.78 calc(0.08 * var(--tc)) var(--th));
  --accent-hover: oklch(0.84 calc(0.085 * var(--tc)) var(--th));
  --accent-weak:  oklch(0.31 calc(0.04 * var(--tc)) var(--th));
  --accent-line:  oklch(0.42 calc(0.05 * var(--tc)) var(--th));
  --accent-fg:    oklch(0.17 0.012 var(--th));
  --code-bg:      oklch(0.155 0.01 var(--th));
  --code-text:    oklch(0.88 0.01 var(--th));
  --shadow:       0 1px 2px oklch(0 0 0 / 0.3), 0 10px 32px oklch(0 0 0 / 0.4);
  --shadow-soft:  0 1px 2px oklch(0 0 0 / 0.25);
}

/* ============================================================
   tokens/typography.css
   ============================================================ */
:root {
  --font-sans: "Zen Kaku Gothic New", system-ui, -apple-system, "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  --font-mincho: "Shippori Mincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --font-head: var(--font-sans);
  --maxw: 720px;
}
:root[data-font="mincho"] { --font-head: var(--font-mincho); }

/* ============================================================
   tokens/spacing.css — radius, spacing rhythm, layout
   ============================================================ */
:root {
  --radius-xs:   5px;
  --radius-sm:   8px;
  --radius-md:   10px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --radius-2xl:  18px;
  --radius-pill: 999px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 22px;
  --space-6: 26px;
  --space-7: 34px;
  --space-8: 54px;
  --space-9: 76px;

  --reading-width: 720px;
  --content-width: 940px;
  --header-height: 64px;
}

/* ============================================================
   base.css — reset, layout & component styling
   ============================================================ */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.85;
  font-feature-settings: "palt" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: 0.01em;
  transition: background-color 0.4s ease, color 0.4s ease;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }
::selection { background: var(--accent-weak); }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.wrap--wide { max-width: 940px; }

/* ---------- header ---------- */
.site-head {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in oklab, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease, background-color 0.3s ease;
}
.site-head[data-scrolled="1"] { border-bottom-color: var(--border-soft); }
.site-head__inner {
  max-width: 940px; margin: 0 auto; padding: 0 24px;
  height: 64px; display: flex; align-items: center; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 11px; cursor: pointer; flex-shrink: 0; }
.brand__mark {
  width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-fg);
  font-family: var(--font-mincho); font-size: 19px; font-weight: 600;
  line-height: 1; padding-bottom: 1px;
  box-shadow: var(--shadow-soft);
}
.brand__name { display: flex; flex-direction: column; line-height: 1.15; }
.brand__name b { font-size: 15px; font-weight: 700; letter-spacing: 0.02em; white-space: nowrap; text-transform: none; }
.brand__name span { font-size: 10.5px; color: var(--text-faint); letter-spacing: 0.14em; text-transform: uppercase; }

.nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.nav__link {
  position: relative; padding: 7px 13px; border-radius: 8px;
  font-size: 13.5px; font-weight: 500; color: var(--text-muted);
  transition: color 0.18s ease, background-color 0.18s ease;
}
.nav__link:hover { color: var(--text); background: var(--surface-2); }
.nav__link[data-active="1"] { color: var(--accent); }

.icon-btn {
  width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--border-soft);
  background: var(--surface); color: var(--text-muted);
  display: grid; place-items: center; cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
}
.icon-btn:hover { color: var(--text); border-color: var(--border); }
.icon-btn[data-active="1"] { color: var(--accent); border-color: var(--accent-line); background: var(--accent-weak); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 17px; height: 17px; }
.nav__divider { width: 1px; height: 22px; background: var(--border); margin: 0 6px; }

/* ---------- breadcrumbs ---------- */
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; font-size: 12.5px; color: var(--text-faint); }
.crumbs a { color: var(--text-muted); transition: color 0.16s ease; }
.crumbs a:hover { color: var(--accent); }
.crumbs__sep { opacity: 0.5; }
.crumbs__cur { color: var(--text-faint); max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- shared bits ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 500; letter-spacing: 0.04em;
  color: var(--accent); padding: 3px 9px; border-radius: 999px;
  background: var(--accent-weak);
}
.kicker { font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-faint); font-weight: 500; }
.meta-dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: 0.4; }

/* ---------- page fade ---------- */
.page { animation: pageIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes pageIn { from { transform: translateY(10px); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .page { animation: none; } }

/* ---------- HOME hero ---------- */
.hero { padding: 76px 0 30px; }
.hero__kicker { margin-bottom: 20px; }
.hero h1 {
  font-family: var(--font-head); font-weight: 700;
  font-size: clamp(30px, 5.4vw, 46px); line-height: 1.32; margin: 0 0 20px;
  letter-spacing: 0.01em; text-wrap: balance;
}
.hero h1 em { font-style: normal; color: var(--accent); }
.hero__lead { font-size: 16px; color: var(--text-muted); max-width: 560px; margin: 0; text-wrap: pretty; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 54px 0 22px; gap: 16px; }
.section-head h2 { font-family: var(--font-head); font-size: 19px; font-weight: 700; margin: 0; letter-spacing: 0.03em; }
.section-head a { font-size: 13px; color: var(--text-muted); transition: color 0.16s ease; }
.section-head a:hover { color: var(--accent); }

/* ---------- author profile card ---------- */
.author-card {
  display: flex; gap: 20px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: 16px; padding: 24px; box-shadow: var(--shadow-soft);
}
.author-card__avatar {
  width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0;
  background:
    repeating-linear-gradient(135deg, var(--surface-2) 0 7px, var(--border-soft) 7px 14px);
  border: 1px solid var(--border); position: relative; overflow: hidden;
}
.author-card__avatar::after {
  content: "IMG"; position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 9px; color: var(--text-faint); letter-spacing: 0.1em;
}
.author-card__avatar img { width: 100%; height: 100%; object-fit: cover; }
.author-card__avatar:has(img)::after { content: none; }
.author-card__body { flex: 1; min-width: 0; }
.author-card__name { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.author-card__name b { font-size: 16px; font-weight: 700; }
.author-card__name span { font-size: 12px; color: var(--text-faint); }
.author-card__role { font-size: 12.5px; color: var(--accent); font-weight: 500; margin-bottom: 10px; }
.author-card__bio { font-size: 13.5px; color: var(--text-muted); line-height: 1.8; margin: 0 0 14px; }
.author-card__links { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-link {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted);
  padding: 5px 11px; border: 1px solid var(--border-soft); border-radius: 999px;
  transition: color 0.16s ease, border-color 0.16s ease;
}
.chip-link:hover { color: var(--accent); border-color: var(--accent-line); }
.chip-link svg { width: 13px; height: 13px; }

/* ---------- article list — list / card / grid ---------- */
.feed { list-style: none; margin: 0; padding: 0; }

.post { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.post > a { color: inherit; display: contents; }
.post__cat { color: var(--accent); }
.post__title {
  font-family: var(--font-head); font-weight: 700; letter-spacing: 0.01em;
  color: var(--text); transition: color 0.18s ease; text-wrap: pretty;
}
.post:hover .post__title { color: var(--accent); }
.post__excerpt { color: var(--text-muted); text-wrap: pretty; }
.post__meta { display: flex; align-items: center; gap: 9px; font-size: 12px; color: var(--text-faint); white-space: nowrap; }
.post__thumb {
  background:
    repeating-linear-gradient(135deg, var(--surface-2) 0 9px, var(--border-soft) 9px 18px);
  border: 1px solid var(--border-soft); position: relative; overflow: hidden; flex-shrink: 0;
}
.post__thumb::after {
  content: attr(data-label); position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 10px; color: var(--text-faint); letter-spacing: 0.1em;
}

/* LIST layout (default) */
.feed--list .post {
  display: grid; grid-template-columns: 1fr auto; gap: 8px 28px;
  padding: 26px 0; border-bottom: 1px solid var(--border-soft);
  align-items: center;
}
.feed--list .post:first-child { padding-top: 6px; }
.feed--list .post__head { display: flex; align-items: center; gap: 10px; font-size: 12px; margin-bottom: 9px; }
.feed--list .post__cat { font-weight: 600; letter-spacing: 0.03em; }
.feed--list .post__title { font-size: 21px; line-height: 1.45; margin: 0 0 9px; grid-column: 1; }
.feed--list .post__excerpt { font-size: 13.5px; line-height: 1.8; margin: 0 0 12px; grid-column: 1; max-width: 52ch; }
.feed--list .post__meta { grid-column: 1; }
.feed--list .post__thumb {
  grid-column: 2; grid-row: 1 / 4; width: 132px; height: 132px; border-radius: 12px; align-self: center;
}
.feed--list .post__textcol { grid-column: 1; grid-row: 1 / 4; }

/* CARD layout */
.feed--card { display: flex; flex-direction: column; gap: 16px; }
.feed--card .post {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: 16px;
  overflow: hidden; display: flex; gap: 0; box-shadow: var(--shadow-soft);
  transition: transform 0.22s cubic-bezier(0.22,1,0.36,1), box-shadow 0.22s ease, border-color 0.22s ease;
}
.feed--card .post:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border); }
.feed--card .post__thumb { width: 168px; height: auto; min-height: 158px; align-self: stretch; border: none; border-right: 1px solid var(--border-soft); }
.feed--card .post__textcol { padding: 22px 24px; flex: 1; min-width: 0; }
.feed--card .post__head { display: flex; align-items: center; gap: 10px; font-size: 12px; margin-bottom: 11px; }
.feed--card .post__cat { font-weight: 600; }
.feed--card .post__title { font-size: 19px; line-height: 1.45; margin: 0 0 9px; }
.feed--card .post__excerpt { font-size: 13.5px; margin: 0 0 14px; }

/* GRID layout */
.feed--grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.feed--grid .post {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: 16px;
  overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow-soft);
  transition: transform 0.22s cubic-bezier(0.22,1,0.36,1), box-shadow 0.22s ease, border-color 0.22s ease;
}
.feed--grid .post:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border); }
.feed--grid .post__thumb { width: 100%; height: 150px; border: none; border-bottom: 1px solid var(--border-soft); }
.feed--grid .post__textcol { padding: 20px 22px 22px; display: flex; flex-direction: column; flex: 1; }
.feed--grid .post__head { display: flex; align-items: center; gap: 10px; font-size: 11.5px; margin-bottom: 10px; }
.feed--grid .post__cat { font-weight: 600; }
.feed--grid .post__title { font-size: 17px; line-height: 1.5; margin: 0 0 8px; }
.feed--grid .post__excerpt { font-size: 13px; margin: 0 0 14px; flex: 1; }
.feed--grid .post__meta { font-size: 11.5px; }

@media (max-width: 680px) {
  .feed--grid { grid-template-columns: 1fr; }
  .feed--list .post { grid-template-columns: 1fr; }
  .feed--list .post__thumb { display: none; }
  .feed--card .post { flex-direction: column; }
  .feed--card .post__thumb { width: 100%; height: 150px; min-height: 0; border-right: none; border-bottom: 1px solid var(--border-soft); }
}

/* ---------- ARTICLE page ---------- */
.article-top { padding: 28px 0 0; }
.article-head { padding: 22px 0 30px; }
.article-head .tag { margin-bottom: 18px; }
.article-head h1 {
  font-family: var(--font-head); font-weight: 700;
  font-size: clamp(27px, 4.6vw, 38px); line-height: 1.42; margin: 0 0 18px;
  letter-spacing: 0.01em; text-wrap: balance;
}
.article-head__lead { font-size: 15.5px; color: var(--text-muted); margin: 0; text-wrap: pretty; }

.article-meta {
  display: flex; align-items: center; gap: 14px; margin-top: 26px;
  padding: 16px 0; border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft);
}
.article-meta__avatar {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  background: repeating-linear-gradient(135deg, var(--surface-2) 0 6px, var(--border-soft) 6px 12px);
  border: 1px solid var(--border); overflow: hidden;
}
.article-meta__avatar img { width: 100%; height: 100%; object-fit: cover; }
.article-meta__who { line-height: 1.4; flex: 1; min-width: 0; }
.article-meta__who b { font-size: 13.5px; font-weight: 700; }
.article-meta__who div { font-size: 12px; color: var(--text-faint); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.article-meta__who div > span { white-space: nowrap; }

.article-hero {
  width: 100%; aspect-ratio: 16 / 8; border-radius: 16px; margin: 30px 0 8px;
  border: 1px solid var(--border-soft); overflow: hidden; background: var(--surface-2);
}
.article-hero img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- TOC ---------- */
.toc {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: 14px;
  padding: 18px 22px; margin: 34px 0; box-shadow: var(--shadow-soft);
}
.toc__title {
  display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 12px;
}
.toc__title svg { width: 14px; height: 14px; }
.toc ol, .toc ul { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0; }
.toc ul ul li, .toc ol ol li { padding-left: 20px; }
.toc a {
  display: block; padding: 5px 0; font-size: 13.5px; color: var(--text-muted);
  border-left: 2px solid transparent; padding-left: 12px; margin-left: -2px;
  transition: color 0.16s ease, border-color 0.16s ease;
  line-height: 1.5;
}
.toc a:hover { color: var(--accent); }
.toc a[data-active="1"] { color: var(--accent); border-left-color: var(--accent); font-weight: 500; }

/* ---------- prose ---------- */
.prose { font-size: 16px; line-height: 1.95; }
.prose > * { scroll-margin-top: 84px; }
.prose h2 {
  font-family: var(--font-head); font-size: 24px; font-weight: 700; line-height: 1.5;
  margin: 52px 0 18px; letter-spacing: 0.01em; padding-bottom: 0;
}
.prose h2::before {
  content: ""; display: block; width: 32px; height: 3px; border-radius: 2px;
  background: var(--accent); margin-bottom: 16px;
}
.prose h3 {
  font-family: var(--font-head); font-size: 18.5px; font-weight: 700; line-height: 1.55;
  margin: 38px 0 14px;
}
.prose h4 { font-family: var(--font-head); font-size: 16px; font-weight: 700; margin: 30px 0 12px; }
.prose p { margin: 0 0 22px; color: var(--text); text-wrap: pretty; }
.prose a { color: var(--accent); border-bottom: 1px solid var(--accent-line); transition: border-color 0.16s ease; }
.prose a:hover { border-bottom-color: var(--accent); }
.prose ul, .prose ol { margin: 0 0 22px; padding-left: 1.3em; }
.prose li { margin: 0 0 9px; padding-left: 4px; }
.prose li::marker { color: var(--accent); }
.prose strong { font-weight: 700; }
.prose hr { border: none; border-top: 1px solid var(--border-soft); margin: 40px 0; }

/* inline code (Hugo renders <code> outside <pre>) */
.prose :where(p, li, h2, h3, h4, td, th, blockquote, figcaption) code {
  font-family: var(--font-mono); font-size: 0.85em; background: var(--surface-2);
  border: 1px solid var(--border-soft); border-radius: 5px; padding: 1px 6px;
  color: var(--text); letter-spacing: 0;
}
.prose a code { color: inherit; }

/* blockquote */
.prose blockquote {
  margin: 30px 0; padding: 4px 0 4px 22px; border-left: 3px solid var(--accent);
  color: var(--text-muted); font-size: 16px;
}
.prose blockquote p { margin: 0 0 6px; }
.prose blockquote p:last-child { margin: 0; }
.prose blockquote cite { font-style: normal; font-size: 13px; color: var(--text-faint); }

/* images & figures */
.prose img { border-radius: 12px; margin: 28px auto; box-shadow: var(--shadow-soft); border: 1px solid var(--border-soft); }
.prose figure { margin: 30px 0; }
.prose figure img { margin: 0 auto; }
.prose figcaption { font-size: 12.5px; color: var(--text-faint); text-align: center; margin-top: 10px; }

/* tables */
.prose table { width: 100%; border-collapse: collapse; margin: 28px 0; font-size: 14px; }
.prose th, .prose td { border: 1px solid var(--border-soft); padding: 9px 13px; text-align: left; }
.prose th { background: var(--surface-2); font-weight: 700; color: var(--text); }
.prose td { color: var(--text-muted); }

/* code block — Hugo/Chroma wraps fenced code in div.highlight > pre.chroma */
.prose .highlight, .prose > pre {
  margin: 28px 0; border-radius: 12px; overflow: hidden; background: var(--code-bg);
  border: 1px solid color-mix(in oklab, var(--code-bg) 80%, var(--border));
  box-shadow: var(--shadow-soft);
}
.code__bar {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border-bottom: 1px solid oklch(1 0 0 / 0.06);
}
.code__dots { display: flex; gap: 6px; }
.code__dots i { width: 10px; height: 10px; border-radius: 50%; background: oklch(1 0 0 / 0.14); }
.code__lang { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: oklch(1 0 0 / 0.5); letter-spacing: 0.08em; text-transform: uppercase; }
.code__copy {
  border: none; background: oklch(1 0 0 / 0.06); color: oklch(1 0 0 / 0.6);
  font-size: 11px; padding: 4px 10px; border-radius: 6px; cursor: pointer; font-family: var(--font-sans);
  transition: background-color 0.16s ease, color 0.16s ease;
}
.code__copy:hover { background: oklch(1 0 0 / 0.12); color: oklch(1 0 0 / 0.9); }
.prose .highlight pre, .prose > pre { margin: 0; }
.prose .highlight pre.chroma { background: transparent !important; padding: 16px 18px; overflow-x: auto; }
.prose > pre { padding: 16px 18px; overflow-x: auto; }
.prose pre code {
  font-family: var(--font-mono); font-size: 13px; line-height: 1.8; color: var(--code-text);
  letter-spacing: 0; white-space: pre; background: none; border: none; padding: 0;
}
/* calm 5-token Chroma palette mapped to design tokens */
.prose .chroma { color: var(--code-text); }
.prose .chroma .k, .prose .chroma .kd, .prose .chroma .kn, .prose .chroma .kc, .prose .chroma .kr, .prose .chroma .kt, .prose .chroma .o, .prose .chroma .ow { color: oklch(0.78 0.11 var(--th)); }
.prose .chroma .s, .prose .chroma .s1, .prose .chroma .s2, .prose .chroma .sb, .prose .chroma .sc, .prose .chroma .sd, .prose .chroma .se, .prose .chroma .sx, .prose .chroma .sr, .prose .chroma .si { color: oklch(0.8 0.09 145); }
.prose .chroma .c, .prose .chroma .c1, .prose .chroma .cm, .prose .chroma .cp, .prose .chroma .cs { color: oklch(0.6 0.01 var(--th)); font-style: italic; }
.prose .chroma .m, .prose .chroma .mi, .prose .chroma .mf, .prose .chroma .mh, .prose .chroma .mo, .prose .chroma .il { color: oklch(0.82 0.1 60); }
.prose .chroma .nf, .prose .chroma .nb, .prose .chroma .fm { color: oklch(0.82 0.09 245); }
.prose .chroma .nt { color: oklch(0.78 0.11 var(--th)); }
.prose .chroma .na { color: oklch(0.82 0.09 245); }

/* ---------- share bar ---------- */
.share {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 44px 0; padding: 22px 0; border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft);
}
.share__label { font-size: 13px; color: var(--text-faint); margin-right: 4px; }
.share__btns { display: flex; gap: 8px; margin-left: auto; }
.share__btn {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 500;
  color: var(--text-muted); padding: 8px 14px; border: 1px solid var(--border-soft);
  border-radius: 9px; background: var(--surface); cursor: pointer;
  transition: color 0.16s ease, border-color 0.16s ease, background-color 0.16s ease, transform 0.16s ease;
}
.share__btn:hover { color: var(--accent); border-color: var(--accent-line); }
.share__btn:active { transform: scale(0.96); }
.share__btn svg { width: 15px; height: 15px; }

/* author bio (article foot) */
.bio {
  display: flex; gap: 18px; align-items: flex-start; margin: 40px 0 10px;
  padding: 26px; background: var(--surface); border: 1px solid var(--border-soft); border-radius: 16px;
}

/* article nav (prev / next) */
.post-nav {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 36px 0 8px;
}
.post-nav a {
  display: flex; flex-direction: column; gap: 6px; padding: 16px 18px;
  border: 1px solid var(--border-soft); border-radius: 12px; background: var(--surface);
  box-shadow: var(--shadow-soft); transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.post-nav a:hover { transform: translateY(-2px); border-color: var(--border); box-shadow: var(--shadow); }
.post-nav a.is-next { text-align: right; }
.post-nav__dir { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-faint); }
.post-nav__title { font-size: 13.5px; font-weight: 600; color: var(--text); line-height: 1.5; }
.post-nav a:hover .post-nav__title { color: var(--accent); }
@media (max-width: 600px) { .post-nav { grid-template-columns: 1fr; } }

/* back link */
.back-link {
  display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-muted);
  margin: 36px 0 8px; transition: color 0.16s ease, gap 0.16s ease;
}
.back-link:hover { color: var(--accent); gap: 11px; }
.back-link svg { width: 16px; height: 16px; }

/* pagination */
.pager { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 48px 0 8px; flex-wrap: wrap; }
.pager a, .pager span {
  display: inline-flex; align-items: center; gap: 6px; min-width: 38px; height: 38px; padding: 0 13px;
  justify-content: center; border: 1px solid var(--border-soft); border-radius: 10px;
  background: var(--surface); color: var(--text-muted); font-size: 13px;
  transition: color 0.16s ease, border-color 0.16s ease, background-color 0.16s ease;
}
.pager a:hover { color: var(--accent); border-color: var(--accent-line); }
.pager span.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; }
.pager span.is-disabled { opacity: 0.4; }
.pager svg { width: 15px; height: 15px; }

/* ---------- footer ---------- */
.site-foot { margin-top: 90px; border-top: 1px solid var(--border-soft); background: var(--bg-grad); }
.site-foot__inner {
  max-width: 940px; margin: 0 auto; padding: 44px 24px 50px;
  display: flex; justify-content: space-between; gap: 30px; flex-wrap: wrap;
}
.site-foot__brand { max-width: 280px; }
.site-foot__brand p { font-size: 12.5px; color: var(--text-faint); margin: 12px 0 0; line-height: 1.8; }
.site-foot__social { display: flex; gap: 10px; margin-top: 18px; }
.site-foot__social a {
  width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center;
  border: 1px solid var(--border-soft); background: var(--surface); color: var(--text-muted);
  transition: color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}
.site-foot__social a:hover { color: var(--accent); border-color: var(--accent-line); transform: translateY(-1px); }
.site-foot__social svg { width: 17px; height: 17px; }
.site-foot__cols { display: flex; gap: 56px; flex-wrap: wrap; }
.foot-col h4 { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-faint); margin: 0 0 14px; font-weight: 600; }
.foot-col a { display: block; font-size: 13px; color: var(--text-muted); padding: 4px 0; transition: color 0.16s ease; }
.foot-col a:hover { color: var(--accent); }
.site-foot__copy {
  max-width: 940px; margin: 0 auto; padding: 18px 24px 40px; font-size: 12px; color: var(--text-faint);
  border-top: 1px solid var(--border-soft); display: flex; gap: 8px 18px; flex-wrap: wrap; align-items: baseline;
}
.site-foot__note { color: var(--text-faint); opacity: 0.72; }

/* ---------- POLICY / generic page ---------- */
.policy-head { padding: 64px 0 4px; }
.policy-head .kicker { margin-bottom: 16px; }
.policy-head h1 {
  font-family: var(--font-head); font-weight: 700;
  font-size: clamp(26px, 4vw, 36px); line-height: 1.36; margin: 0 0 12px;
  letter-spacing: 0.01em; text-wrap: balance;
}
.policy-head__meta { font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); margin: 0 0 18px; }
.policy-head__lead { font-size: 15px; color: var(--text-muted); margin: 0; line-height: 1.9; text-wrap: pretty; max-width: 64ch; }
.policy-body { margin-top: 40px; }
.policy-body h2 { font-size: 18px; margin: 38px 0 12px; }
.policy-body p { font-size: 14.5px; }
.policy-note {
  margin-top: 32px; padding: 14px 16px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border-soft);
  font-size: 12.5px; color: var(--text-faint); line-height: 1.7;
}

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); font-size: 13px; font-weight: 500;
  padding: 11px 20px; border-radius: 999px; box-shadow: var(--shadow); z-index: 100;
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast[data-show="1"] { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- SEARCH page ---------- */
.search-head { padding: 64px 0 6px; }
.search-head .kicker { margin-bottom: 16px; }
.search-head h1 {
  font-family: var(--font-head); font-weight: 700;
  font-size: clamp(28px, 4.6vw, 40px); line-height: 1.34; margin: 0 0 14px;
  letter-spacing: 0.01em; text-wrap: balance;
}
.search-head__lead { font-size: 15px; color: var(--text-muted); margin: 0; text-wrap: pretty; }

.search-field { position: relative; margin-top: 28px; }
.search-field > svg {
  position: absolute; left: 18px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; color: var(--text-faint); pointer-events: none;
}
.search-field input {
  width: 100%; height: 58px; padding: 0 54px 0 50px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  font-family: inherit; font-size: 16px; color: var(--text); letter-spacing: 0.01em;
  box-shadow: var(--shadow-soft);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.search-field input::placeholder { color: var(--text-faint); }
.search-field input:focus {
  outline: none; border-color: var(--accent-line);
  box-shadow: 0 0 0 4px var(--accent-weak);
}
.search-field__clear {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border-radius: 9px; border: none; cursor: pointer;
  background: var(--surface-2); color: var(--text-muted);
  display: grid; place-items: center;
  transition: color 0.16s ease, background-color 0.16s ease;
}
.search-field__clear:hover { color: var(--text); background: var(--border-soft); }
.search-field__clear svg { width: 16px; height: 16px; }

.search-filters { display: flex; flex-direction: column; gap: 14px; margin: 26px 0 4px; padding: 22px 0 0; }
.filter-row { display: flex; align-items: flex-start; gap: 16px; }
.filter-row__label {
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-faint); font-weight: 600; width: 64px; flex-shrink: 0;
  padding-top: 8px; line-height: 1.4;
}
.chip-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.fchip {
  display: inline-flex; align-items: center; font-family: inherit; white-space: nowrap;
  font-size: 12.5px; font-weight: 500; line-height: 1; color: var(--text-muted);
  padding: 8px 14px; border: 1px solid var(--border-soft); border-radius: 999px;
  background: var(--surface); cursor: pointer;
  transition: color 0.16s ease, border-color 0.16s ease, background-color 0.16s ease;
}
.fchip:hover { color: var(--text); border-color: var(--accent-line); }
.fchip[data-on="1"] { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.fchip__hash { opacity: 0.5; margin-right: 2px; }
.fchip[data-on="1"] .fchip__hash { opacity: 0.7; }

.search-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap; margin: 32px 0 20px;
  padding-top: 22px; border-top: 1px solid var(--border-soft);
}
.search-meta__count { font-size: 13.5px; color: var(--text-muted); display: flex; align-items: center; gap: 14px; }
.search-meta__count b { color: var(--text); font-size: 15px; font-weight: 700; }
.search-reset {
  display: inline-flex; align-items: center; gap: 5px; font-family: inherit;
  font-size: 12.5px; color: var(--text-faint); background: none; border: none;
  cursor: pointer; padding: 0; transition: color 0.16s ease;
}
.search-reset:hover { color: var(--accent); }

.seg {
  display: inline-flex; background: var(--surface-2); border: 1px solid var(--border-soft);
  border-radius: 11px; padding: 3px; gap: 2px;
}
.seg button {
  border: none; background: transparent; font-family: inherit; font-size: 12.5px;
  font-weight: 500; padding: 7px 13px; border-radius: 8px; color: var(--text-muted);
  cursor: pointer; transition: color 0.16s ease, background-color 0.16s ease;
}
.seg button:hover { color: var(--text); }
.seg button[data-on="1"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-soft); }

.post mark { background: var(--accent-weak); color: var(--accent); border-radius: 3px; padding: 0 2px; font-weight: 600; }

.search-empty { text-align: center; padding: 64px 0 40px; }
.search-empty__icon {
  width: 52px; height: 52px; border-radius: 50%; margin: 0 auto 18px;
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border-soft); color: var(--text-faint);
}
.search-empty__icon svg { width: 22px; height: 22px; }
.search-empty__title { font-size: 16px; font-weight: 700; color: var(--text); margin: 0 0 6px; }
.search-empty__sub { font-size: 13.5px; color: var(--text-faint); margin: 0; }

@media (max-width: 680px) {
  .filter-row { flex-direction: column; gap: 8px; }
  .filter-row__label { padding-top: 0; }
  .search-meta { gap: 12px; }
}

/* ---------- ABOUT page ---------- */
.about-head { padding: 64px 0 8px; }
.about-head .kicker { margin-bottom: 18px; }
.about-head h1 {
  font-family: var(--font-head); font-weight: 700;
  font-size: clamp(28px, 4.6vw, 40px); line-height: 1.4; margin: 0 0 18px;
  letter-spacing: 0.01em; text-wrap: balance;
}
.about-head h1 em { font-style: normal; color: var(--accent); }
.about-head__lead { font-size: 15.5px; color: var(--text-muted); margin: 0; text-wrap: pretty; max-width: 60ch; }

.about-profile {
  display: flex; gap: 24px; align-items: flex-start; margin: 40px 0 8px;
  padding: 28px; background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: 18px; box-shadow: var(--shadow-soft);
}
.about-profile__avatar {
  width: 84px; height: 84px; border-radius: 50%; flex-shrink: 0;
  background: repeating-linear-gradient(135deg, var(--surface-2) 0 8px, var(--border-soft) 8px 16px);
  border: 1px solid var(--border); position: relative; overflow: hidden;
}
.about-profile__avatar::after {
  content: "IMG"; position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 10px; color: var(--text-faint); letter-spacing: 0.1em;
}
.about-profile__avatar img { width: 100%; height: 100%; object-fit: cover; }
.about-profile__avatar:has(img)::after { content: none; }
.about-profile__body { flex: 1; min-width: 0; }
.about-profile__name { display: flex; align-items: baseline; gap: 11px; margin-bottom: 5px; }
.about-profile__name b { font-size: 19px; font-weight: 700; }
.about-profile__name span { font-size: 12.5px; color: var(--text-faint); }
.about-profile__role { font-size: 13px; color: var(--accent); font-weight: 500; margin-bottom: 12px; }
.about-profile__bio { font-size: 14px; color: var(--text-muted); line-height: 1.85; margin: 0 0 16px; }
.about-profile__links { display: flex; gap: 8px; flex-wrap: wrap; }

.about-section { margin-top: 56px; }
.about-section.prose { font-size: 15.5px; }
.about-section.prose h2 { margin-top: 0; }
.about-section.prose blockquote { margin: 26px 0; }

.topic-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.topic {
  display: flex; flex-direction: column; gap: 10px; cursor: pointer;
  padding: 22px; background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: 14px; box-shadow: var(--shadow-soft);
  transition: transform 0.22s cubic-bezier(0.22,1,0.36,1), box-shadow 0.22s ease, border-color 0.22s ease;
}
.topic:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border); }
.topic__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.topic__name { font-family: var(--font-head); font-size: 16px; font-weight: 700; color: var(--text); }
.topic:hover .topic__name { color: var(--accent); }
.topic__count { font-size: 11.5px; color: var(--text-faint); font-family: var(--font-mono); white-space: nowrap; }
.topic__desc { font-size: 13px; color: var(--text-muted); line-height: 1.8; margin: 0; flex: 1; text-wrap: pretty; }
.topic__go { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-faint); transition: gap 0.16s ease, color 0.16s ease; }
.topic:hover .topic__go { color: var(--accent); gap: 9px; }

.about-contact {
  display: flex; align-items: center; justify-content: space-between; gap: 28px; flex-wrap: wrap;
  margin: 56px 0 10px; padding: 30px 32px; border-radius: 18px;
  background: var(--accent-weak); border: 1px solid var(--accent-line);
}
.about-contact__text h3 { font-family: var(--font-head); font-size: 18px; font-weight: 700; margin: 0 0 7px; color: var(--text); }
.about-contact__text p { font-size: 13.5px; color: var(--text-muted); margin: 0; max-width: 46ch; text-wrap: pretty; }
.about-contact__actions { display: flex; gap: 10px; flex-shrink: 0; }
.btn {
  display: inline-flex; align-items: center; gap: 7px; font-family: inherit;
  font-size: 13.5px; font-weight: 500; padding: 10px 18px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; transition: transform 0.16s ease, border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease;
}
.btn:hover { border-color: var(--text-faint); }
.btn:active { transform: scale(0.97); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

@media (max-width: 680px) {
  .topic-list { grid-template-columns: 1fr; }
  .about-profile { flex-direction: column; gap: 18px; }
  .about-contact { flex-direction: column; align-items: flex-start; }
  .about-contact__actions { width: 100%; }
  .nav__link { padding: 7px 9px; font-size: 13px; }
  .brand__name span { display: none; }
}

/* ---------- header nav: icon group + mobile hamburger ---------- */
.nav__icons { display: inline-flex; align-items: center; gap: 4px; }
.nav__burger { display: none; }

@media (max-width: 680px) {
  /* show the hamburger, push it to the right of the bar */
  .nav__burger { display: grid; margin-left: auto; }
  .nav__burger[aria-expanded="true"] { color: var(--accent); border-color: var(--accent-line); background: var(--accent-weak); }

  /* the nav becomes a dropdown panel under the sticky header */
  .nav {
    position: absolute; top: var(--header-height); left: 0; right: 0;
    margin: 0; padding: 10px 16px 16px;
    flex-direction: column; align-items: stretch; gap: 2px;
    background: color-mix(in oklab, var(--bg) 96%, transparent);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    backdrop-filter: blur(16px) saturate(140%);
    border-bottom: 1px solid var(--border-soft);
    box-shadow: var(--shadow);
    /* collapsed state */
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  }
  .site-head[data-menu="1"] .nav {
    opacity: 1; visibility: visible; transform: none; pointer-events: auto;
  }
  @media (prefers-reduced-motion: reduce) {
    .nav { transition: none; }
  }

  .nav__link {
    padding: 12px 12px; font-size: 15px; border-radius: 10px;
    border-bottom: 1px solid var(--border-soft);
  }
  .nav__link:last-of-type { border-bottom: none; }
  .nav__divider { display: none; }
  .nav__icons { padding-top: 10px; gap: 8px; }
}

/* affiliate / notice banner (site-specific) */
.notice {
  display: flex; gap: 10px; align-items: flex-start;
  margin: 0 0 30px; padding: 13px 16px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border-soft);
  font-size: 12.5px; color: var(--text-faint); line-height: 1.7;
}
.notice svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 3px; }
