:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-soft: #f1f5f9;
  --text: #111827;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --code: #0f172a;
  --code-text: #e2e8f0;
  --shadow: 0 18px 55px rgba(15,23,42,.08);
  --radius: 18px;
}

:root[data-theme="dark"] {
  --bg: #0b1120;
  --surface: #111827;
  --surface-soft: #172033;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --line: #263248;
  --accent: #60a5fa;
  --accent-strong: #93c5fd;
  --code: #020617;
  --code-text: #e2e8f0;
  --shadow: 0 18px 55px rgba(0,0,0,.28);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
img { max-width: 100%; height: auto; }
.shell { width: min(1180px, calc(100% - 36px)); margin: 0 auto; }
.shell-narrow { width: min(820px, calc(100% - 36px)); margin: 0 auto; }
.site-main { min-height: calc(100vh - 210px); }

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav-wrap { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 22px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.02em; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  color: #fff; background: #111827; font-size: .8rem; letter-spacing: .04em;
}
:root[data-theme="dark"] .brand-mark { color: #111827; background: #f8fafc; }
.main-nav { display: flex; gap: 20px; align-items: center; color: var(--muted); font-size: .95rem; font-weight: 600; }
.main-nav a:hover { color: var(--text); }
.theme-toggle { border: 1px solid var(--line); background: var(--surface); color: var(--text); width: 36px; height: 36px; border-radius: 50%; cursor: pointer; }

.hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 58px; align-items: center; padding: 92px 0 82px; }
.eyebrow { font-size: .75rem; letter-spacing: .16em; font-weight: 800; color: var(--accent); }
.hero h1, .page-hero h1, .article-header h1 { margin: 10px 0 18px; line-height: 1.04; letter-spacing: -.055em; }
.hero h1 { font-size: clamp(3rem, 7vw, 5.8rem); max-width: 850px; }
.hero p { font-size: 1.18rem; color: var(--muted); max-width: 700px; }
.hero-actions { display: flex; gap: 12px; margin-top: 30px; flex-wrap: wrap; }
.button { display: inline-flex; align-items: center; justify-content: center; padding: 11px 17px; border-radius: 10px; border: 1px solid var(--line); font-weight: 700; }
.button.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.button.primary:hover { opacity: .88; color: var(--bg); }
.button.secondary { background: var(--surface); }
.hero-card { background: var(--code); color: var(--code-text); border-radius: 22px; box-shadow: var(--shadow); padding: 18px 22px 26px; min-height: 330px; overflow: hidden; }
.hero-card pre { margin: 34px 0 0; background: transparent; padding: 0; overflow: visible; }
.hero-card code { font-size: .98rem; }
.terminal-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #64748b; margin-right: 6px; }

.section-block { padding: 34px 0 80px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 28px; }
.section-heading h2, .explore-block h2 { font-size: 2rem; margin: 4px 0 0; letter-spacing: -.04em; }
.section-heading > a { color: var(--muted); font-weight: 700; }
.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.post-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; min-height: 285px; display: flex; flex-direction: column; transition: transform .18s ease, border-color .18s ease; }
.post-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.post-card-meta { display: flex; gap: 10px; color: var(--muted); font-size: .82rem; }
.post-card h3 { font-size: 1.38rem; line-height: 1.25; margin: 16px 0 10px; letter-spacing: -.025em; }
.post-card p { color: var(--muted); margin: 0 0 20px; }
.read-more { margin-top: auto; color: var(--accent); font-weight: 700; }
.explore-block { margin-bottom: 90px; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 34px; display: grid; grid-template-columns: 280px 1fr; gap: 34px; align-items: center; }
.tag-cloud { display: flex; gap: 10px; flex-wrap: wrap; }
.tag-cloud a, .taxonomy-card { background: var(--surface-soft); border: 1px solid var(--line); border-radius: 999px; padding: 8px 13px; color: var(--muted); font-weight: 700; }
.tag-cloud small { opacity: .7; margin-left: 4px; }

.page-hero { padding: 72px 0 38px; }
.page-hero.compact h1 { font-size: clamp(2.5rem, 7vw, 4.4rem); }
.page-hero p, .page-intro { color: var(--muted); max-width: 760px; }
.list-stack { padding-bottom: 80px; }
.list-item { display: grid; grid-template-columns: 125px 1fr; gap: 28px; padding: 28px 0; border-top: 1px solid var(--line); }
.list-date { color: var(--muted); font-size: .9rem; }
.list-item h2 { margin: 0 0 8px; font-size: 1.6rem; letter-spacing: -.03em; }
.list-item p { margin: 0 0 10px; color: var(--muted); }
.inline-tags { display: flex; flex-wrap: wrap; gap: 8px; font-size: .86rem; color: var(--accent); }
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding-top: 28px; border-top: 1px solid var(--line); color: var(--muted); }
.taxonomy-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; padding-bottom: 90px; }
.taxonomy-card { border-radius: 14px; display: flex; justify-content: space-between; align-items: center; color: var(--text); background: var(--surface); }
.taxonomy-card small { color: var(--muted); }

.article { padding: 74px 0 90px; }
.article-header { margin-bottom: 44px; }
.article-header h1 { font-size: clamp(2.6rem, 7vw, 4.8rem); }
.article-lead { font-size: 1.2rem; color: var(--muted); }
.article-meta, .article-taxonomy { display: flex; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: .9rem; }
.article-taxonomy { margin-top: 16px; }
.article-taxonomy a { border: 1px solid var(--line); padding: 4px 9px; border-radius: 999px; background: var(--surface); }
.article-content { font-size: 1.06rem; }
.article-content h2 { margin-top: 2.3em; font-size: 1.8rem; letter-spacing: -.03em; }
.article-content h3 { margin-top: 1.9em; font-size: 1.35rem; }
.article-content p, .article-content li { color: color-mix(in srgb, var(--text) 89%, var(--muted)); }
.article-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.article-content blockquote { margin: 24px 0; padding: 2px 0 2px 18px; border-left: 3px solid var(--accent); color: var(--muted); }
.article-content code:not(pre code) { background: var(--surface-soft); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; font-size: .92em; }
pre { position: relative; background: var(--code); color: var(--code-text); border-radius: 14px; padding: 20px; overflow-x: auto; line-height: 1.5; }
pre code { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: .9rem; }
.copy-code { position: absolute; top: 10px; right: 10px; border: 1px solid #334155; border-radius: 7px; background: #172033; color: #cbd5e1; padding: 5px 8px; font-size: .72rem; cursor: pointer; }
.article-footer { border-top: 1px solid var(--line); margin-top: 52px; padding-top: 22px; font-weight: 700; color: var(--accent); }

.search-box { margin-top: 26px; }
.search-box input { width: 100%; font: inherit; font-size: 1.05rem; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 15px 17px; outline: none; }
.search-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.search-count { min-height: 24px; color: var(--muted); }
.search-results { padding-bottom: 80px; }
.search-result { padding: 24px 0; border-top: 1px solid var(--line); }
.search-result-date { color: var(--muted); font-size: .85rem; }
.search-result h2 { margin: 5px 0 7px; }
.search-result p { color: var(--muted); }
.search-empty { padding: 34px 0; color: var(--muted); }
.not-found { padding: 110px 0; text-align: center; }
.error-code { display: block; font-size: 6rem; font-weight: 900; letter-spacing: -.08em; color: var(--accent); }

.site-footer { border-top: 1px solid var(--line); background: var(--surface); }
.footer-grid { padding: 36px 0 22px; display: flex; justify-content: space-between; gap: 30px; }
.footer-grid p { margin: 5px 0 0; color: var(--muted); }
.footer-links { display: flex; gap: 16px; align-items: flex-start; color: var(--muted); }
.footer-bottom { border-top: 1px solid var(--line); padding: 15px 0 22px; display: flex; justify-content: space-between; color: var(--muted); font-size: .82rem; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 64px; gap: 34px; }
  .hero-card { min-height: auto; }
  .post-grid { grid-template-columns: 1fr 1fr; }
  .explore-block { grid-template-columns: 1fr; }
  .taxonomy-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 680px) {
  .nav-wrap { align-items: flex-start; padding: 14px 0; }
  .brand-name { display: none; }
  .main-nav { gap: 11px; flex-wrap: wrap; justify-content: flex-end; font-size: .86rem; }
  .main-nav a:nth-child(2), .main-nav a:nth-child(3) { display: none; }
  .hero { padding: 58px 0 58px; }
  .hero h1 { font-size: 3.3rem; }
  .post-grid, .taxonomy-grid { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .list-item { grid-template-columns: 1fr; gap: 5px; }
  .article { padding-top: 54px; }
  .footer-grid, .footer-bottom { flex-direction: column; }
}
