:root {
  --bg: #f7f6f1;
  --surface: #fffefa;
  --surface-2: #edf2eb;
  --text: #172a27;
  --muted: #63736e;
  --accent: #176b65;
  --accent-2: #0e514c;
  --border: #dce4dc;
  --code: #11201f;
  --shadow: 0 12px 38px rgba(18, 38, 34, 0.07);
}

[data-theme="dark"] {
  --bg: #0e1716;
  --surface: #14201e;
  --surface-2: #1a2a27;
  --text: #e9efea;
  --muted: #9aacaa;
  --accent: #4fc1b5;
  --accent-2: #85e3d8;
  --border: #293c38;
  --code: #0a1110;
  --shadow: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.75 -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", Arial, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }
.container { width: min(1120px, calc(100% - 40px)); margin: 0 auto; }
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}
.header-inner { min-height: 76px; display: flex; align-items: center; gap: 26px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); margin-right: auto; }
.brand:hover { color: var(--text); }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: var(--accent);
  color: var(--surface);
  font: bold 25px Georgia, serif;
}
.brand strong { display: block; font-size: 18px; line-height: 1.2; }
.brand small { display: block; color: var(--muted); font-size: 12px; line-height: 1.4; }
.nav { display: flex; align-items: center; gap: 20px; }
.nav a { color: var(--muted); font-size: 15px; }
.nav a:hover, .nav a.active { color: var(--text); }
.theme-toggle {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 22px;
  padding: 6px;
  display: flex;
  cursor: pointer;
}
.theme-toggle span { padding: 1px 8px; border-radius: 14px; font-size: 13px; }
[data-theme="light"] .theme-toggle .sun,
[data-theme="dark"] .theme-toggle .moon { background: var(--surface-2); color: var(--accent); }
.main { padding: 58px 0 80px; min-height: calc(100vh - 150px); }
.hero {
  padding: 68px clamp(26px, 7vw, 80px);
  margin-bottom: 58px;
  border: 1px solid var(--border);
  border-radius: 30px;
  background: linear-gradient(120deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow);
}
.eyebrow { color: var(--accent); font-weight: 700; letter-spacing: .18em; font-size: 12px; }
.hero h1 { font-size: clamp(34px, 5vw, 52px); line-height: 1.25; max-width: 720px; margin: 14px 0; letter-spacing: -.04em; }
.hero > p:not(.eyebrow) { max-width: 580px; color: var(--muted); font-size: 18px; }
.hero-actions { display: flex; gap: 14px; margin-top: 34px; }
.button {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  padding: 10px 25px;
  font-weight: 600;
}
.button:hover { color: #fff; background: var(--accent-2); }
.button.secondary { color: var(--text); background: var(--surface); border: 1px solid var(--border); }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.section-heading h2 { margin: 0; font-size: 26px; }
.post-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.post-card {
  padding: 27px 28px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.post-meta { display: flex; gap: 12px; color: var(--muted); font-size: 13px; }
.post-card h3 { font-size: 21px; line-height: 1.4; margin: 12px 0 8px; }
.post-card h3 a { color: var(--text); }
.post-card h3 a:hover { color: var(--accent); }
.post-card p { color: var(--muted); margin: 0 0 16px; }
.read-more { font-weight: 600; font-size: 14px; }
.page-header { margin: 0 auto 36px; max-width: 780px; }
.page-header h1 { font-size: 40px; margin: 0 0 8px; letter-spacing: -.04em; }
.page-header p { color: var(--muted); margin: 0; }
.post-list { max-width: 780px; display: grid; gap: 18px; margin: 0 auto; }
.pagination { display: flex; justify-content: center; gap: 8px; margin: 38px auto 0; padding: 0; list-style: none; }
.page-link { display: block; padding: 4px 13px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.active .page-link { background: var(--accent); color: #fff; }
.terms { max-width: 780px; margin: auto; display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.terms a { display: flex; justify-content: space-between; padding: 18px 22px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); }
.terms small { color: var(--muted); }
.article { max-width: 780px; margin: auto; }
.article-header { margin-bottom: 34px; }
.article-meta { display: flex; gap: 14px; align-items: center; color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.article-meta a { background: var(--surface-2); padding: 1px 10px; border-radius: 14px; }
.article h1 { font-size: clamp(34px, 5vw, 46px); line-height: 1.3; margin: 0 0 12px; letter-spacing: -.04em; }
.lead { color: var(--muted); font-size: 18px; margin: 0; }
.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 34px;
}
.toc ul { margin: 8px 0 0; padding-left: 22px; }
.content h2 { font-size: 27px; line-height: 1.4; margin-top: 50px; }
.content h3 { margin-top: 34px; }
.content p, .content li { color: var(--text); }
.content img { display: block; max-width: 100%; border-radius: 12px; border: 1px solid var(--border); }
.content code { font: .9em Consolas, "SFMono-Regular", monospace; background: var(--surface-2); padding: .15em .4em; border-radius: 5px; }
.highlight {
  overflow-x: auto;
  border-radius: 12px;
  margin: 22px 0;
  background: var(--code);
}
.highlight pre { padding: 18px 20px; margin: 0; line-height: 1.6; }
.highlight code { color: #e6eded; background: transparent; padding: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 50px; padding-top: 22px; border-top: 1px solid var(--border); }
.tags a { background: var(--surface-2); border-radius: 18px; padding: 3px 14px; font-size: 14px; }
.comments { max-width: 780px; margin: 60px auto 0; border-top: 1px solid var(--border); padding-top: 26px; }
.comments h2 { margin: 0 0 22px; }
.search-panel { max-width: 780px; margin: auto; }
.search-input {
  width: 100%;
  font: inherit;
  font-size: 17px;
  padding: 15px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
}
.search-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.search-hint { color: var(--muted); margin: 16px 0 23px; }
.search-results { margin: 0; }
.sr-only { position: absolute; height: 1px; width: 1px; overflow: hidden; clip-path: inset(50%); }
.site-footer { border-top: 1px solid var(--border); color: var(--muted); }
.footer-inner { min-height: 74px; display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.footer-inner p { margin: 0; }

@media (max-width: 860px) {
  .header-inner { flex-wrap: wrap; padding: 13px 0; gap: 14px; }
  .brand { margin-right: 0; flex: 1; }
  .nav { order: 3; width: 100%; overflow-x: auto; gap: 18px; padding-bottom: 3px; }
  .main { padding-top: 34px; }
  .hero { padding: 38px 24px; margin-bottom: 40px; }
  .post-grid, .terms { grid-template-columns: 1fr; }
}
