/* =============================================
   Design System — oklch, Geist, Eric template
   ============================================= */
:root {
  --bg:        oklch(0.16 0.005 270);
  --bg-2:      oklch(0.185 0.006 270);
  --fg:        oklch(0.96 0.005 270);
  --fg-dim:    oklch(0.74 0.008 270);
  --fg-mute:   oklch(0.54 0.01 270);
  --line:      oklch(1 0 0 / 0.07);
  --line-2:    oklch(1 0 0 / 0.12);
  --accent:    oklch(0.74 0.085 270);
  --accent-dim:oklch(0.74 0.085 270 / 0.18);
  --grid:      oklch(1 0 0 / 0.025);
  --shadow:    0 1px 0 oklch(1 0 0 / 0.04) inset;
  --ok:        oklch(0.78 0.13 145);
}
html[data-theme="light"] {
  --bg:        oklch(0.985 0.003 90);
  --bg-2:      oklch(0.965 0.004 90);
  --fg:        oklch(0.18 0.005 270);
  --fg-dim:    oklch(0.40 0.008 270);
  --fg-mute:   oklch(0.58 0.01 270);
  --line:      oklch(0 0 0 / 0.08);
  --line-2:    oklch(0 0 0 / 0.14);
  --accent:    oklch(0.50 0.13 270);
  --accent-dim:oklch(0.50 0.13 270 / 0.10);
  --grid:      oklch(0 0 0 / 0.025);
  --shadow:    0 1px 0 oklch(0 0 0 / 0.03) inset;
  --ok:        oklch(0.55 0.14 145);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--fg); }
body {
  font-family: "Geist", ui-sans-serif, system-ui, sans-serif;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: -0.005em;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.mono { font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-feature-settings: "zero"; }

/* Subtle grid background */
.bg-grid {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(to right, var(--grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, #000 30%, transparent 80%);
}

/* Page enter fade */
.fade-in { opacity: 0; transform: translateY(6px); animation: fadeUp 700ms cubic-bezier(.2,.7,.2,1) forwards; }
.fade-in[data-d="1"] { animation-delay: 60ms; }
.fade-in[data-d="2"] { animation-delay: 140ms; }
.fade-in[data-d="3"] { animation-delay: 220ms; }
.fade-in[data-d="4"] { animation-delay: 300ms; }
.fade-in[data-d="5"] { animation-delay: 380ms; }
.fade-in[data-d="6"] { animation-delay: 460ms; }
@keyframes fadeUp { to { opacity: 1; transform: none; } }

/* Selection */
::selection { background: var(--accent-dim); color: var(--fg); }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; }

/* Links & buttons */
a { color: inherit; text-decoration: none; }
.kbd {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 11px;
  padding: 2px 6px;
  border: 1px solid var(--line-2);
  border-radius: 5px;
  color: var(--fg-dim);
  background: oklch(1 0 0 / 0.02);
  line-height: 1;
}

.label {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--fg-mute);
}

.divider { height: 1px; background: var(--line); width: 100%; }

/* Container */
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 32px; position: relative; z-index: 1; }
@media (max-width: 720px) { .wrap { padding: 0 20px; } }

/* =============================================
   Nav
   ============================================= */
nav.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 0; border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  position: sticky; top: 0;
  background: color-mix(in oklch, var(--bg) 80%, transparent); z-index: 5;
}
nav.top .brand { display: flex; align-items: center; gap: 0; font-weight: 500; letter-spacing: -0.01em; }
nav.top .brand .dot { width: 8px; height: 8px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-dim); margin-right: 8px; }
nav.top .links { display: flex; align-items: center; gap: 28px; }
nav.top .links a { color: var(--fg-dim); font-size: 14px; transition: color 160ms ease; }
nav.top .links a:hover { color: var(--fg); }
nav.top .links a.active { color: var(--fg); }
nav.top .cmdk {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 8px 6px 10px; border: 1px solid var(--line);
  border-radius: 8px; color: var(--fg-dim); font-size: 12.5px;
  transition: border-color 160ms ease, color 160ms ease;
  cursor: pointer; background: transparent;
}
nav.top .cmdk:hover { border-color: var(--line-2); color: var(--fg); }

.nav-actions { display: flex; align-items: center; gap: 12px; }

.theme-toggle {
  background: none; border: none; color: var(--fg-dim);
  cursor: pointer; padding: 6px; border-radius: 8px;
  transition: background 180ms ease, color 180ms ease;
  display: inline-flex; align-items: center; justify-content: center;
}
.theme-toggle:hover { background: oklch(1 0 0 / 0.03); color: var(--fg); }
html[data-theme="light"] .theme-toggle:hover { background: oklch(0 0 0 / 0.03); }

.auth-buttons { display: flex; align-items: center; gap: 8px; }
.btn-login, .btn-register {
  padding: 6px 14px; border-radius: 8px; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all 180ms ease; border: 1px solid var(--line);
  background: transparent; color: var(--fg-dim);
}
.btn-login:hover { border-color: var(--line-2); color: var(--fg); background: oklch(1 0 0 / 0.02); }
.btn-register { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn-register:hover { background: oklch(1 0 0 / 0.92); }
html[data-theme="light"] .btn-register:hover { background: oklch(0 0 0 / 0.85); }

.user-menu { position: relative; cursor: pointer; }
.user-menu.hidden { display: none; }
.user-name {
  font-size: 13px; font-weight: 500; color: var(--accent);
  padding: 6px 12px; border-radius: 8px; background: var(--accent-dim);
}
.user-dropdown {
  display: none; position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 8px; min-width: 140px; box-shadow: 0 20px 60px oklch(0 0 0 / 0.4); z-index: 1001;
}
.user-dropdown a {
  display: block; padding: 8px 12px; border-radius: 8px;
  color: var(--fg-dim); font-size: 13px; transition: all 160ms ease;
}
.user-dropdown a:hover { background: oklch(1 0 0 / 0.03); color: var(--fg); }
.user-menu:hover .user-dropdown { display: block; }

.nav-menu-btn {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: none; cursor: pointer; padding: 6px;
}
.nav-menu-btn span { display: block; width: 22px; height: 2px; background: var(--fg); border-radius: 2px; transition: all 0.3s; }

@media (max-width: 768px) {
  nav.top .links {
    display: none; position: absolute; top: 64px; left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--line);
    flex-direction: column; padding: 16px 24px; gap: 0; z-index: 4;
  }
  nav.top .links.open { display: flex; }
  nav.top .links a { padding: 12px 0; }
  .nav-menu-btn { display: flex; }
}

/* =============================================
   Hero
   ============================================= */
.hero { padding: 80px 0 64px; position: relative; }
.hero .meta-row { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.hero .meta-row .pulse {
  width: 7px; height: 7px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 0 oklch(0.78 0.16 145 / 0.6);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 oklch(0.78 0.16 145 / 0.5); }
  70% { box-shadow: 0 0 0 8px oklch(0.78 0.16 145 / 0); }
  100% { box-shadow: 0 0 0 0 oklch(0.78 0.16 145 / 0); }
}
.hero h1 {
  font-size: clamp(40px, 7vw, 88px);
  line-height: 0.96; letter-spacing: -0.045em; font-weight: 500;
  margin: 0 0 24px; max-width: 14ch;
}
.hero h1 .accent { color: var(--accent); font-style: italic; font-weight: 400; }
.hero p.lede {
  font-size: clamp(16px, 1.5vw, 19px);
  color: var(--fg-dim); margin: 0 0 36px;
  line-height: 1.5; letter-spacing: -0.01em;
}
.hero .cta-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 11px 16px; border-radius: 10px;
  font-size: 14px; letter-spacing: -0.005em;
  border: 1px solid var(--line-2); color: var(--fg);
  background: transparent; cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
}
.btn:hover { background: oklch(1 0 0 / 0.03); border-color: oklch(1 0 0 / 0.18); }
html[data-theme="light"] .btn:hover { background: oklch(0 0 0 / 0.03); }
.btn.primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn.primary:hover { background: oklch(1 0 0 / 0.92); }
html[data-theme="light"] .btn.primary:hover { background: oklch(0 0 0 / 0.85); }
.btn .arrow { transition: transform 200ms ease; display: inline-block; }
.btn:hover .arrow { transform: translateX(2px); }

/* =============================================
   Search
   ============================================= */
.search-container {
  max-width: 560px; margin: 0 0 28px;
  display: flex; gap: 10px; flex-wrap: wrap;
}
.search-box {
  flex: 1; display: flex; align-items: center; gap: 10px;
  padding: 0 14px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--bg-2);
  transition: border-color 180ms ease;
  min-width: 240px;
}
.search-box:focus-within { border-color: var(--line-2); }
.search-box input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--fg); font-size: 14px; padding: 12px 0; font-family: inherit;
}
.search-box input::placeholder { color: var(--fg-mute); }
.search-box .search-icon { color: var(--fg-mute); }

/* =============================================
   Tags filter (horizontal scroll)
   ============================================= */
.tags-filter {
  display: flex; flex-wrap: nowrap; gap: 8px;
  overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none; -ms-overflow-style: none;
  padding-bottom: 4px;
}
.tags-filter::-webkit-scrollbar { display: none; }

.tag-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border: 1px solid var(--line);
  border-radius: 999px; font-size: 13px; color: var(--fg-dim);
  background: transparent; cursor: pointer; white-space: nowrap;
  transition: all 180ms ease; font-family: inherit;
}
.tag-chip:hover, .tag-chip.active {
  border-color: var(--line-2); color: var(--fg); background: oklch(1 0 0 / 0.02);
}
html[data-theme="light"] .tag-chip:hover, html[data-theme="light"] .tag-chip.active { background: oklch(0 0 0 / 0.02); }

/* =============================================
   Section
   ============================================= */
section.block { padding: 48px 0; border-top: 1px solid var(--line); }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 32px;
}
.section-head h2 { font-size: 22px; font-weight: 500; letter-spacing: -0.015em; margin: 0; }
.section-head .label { display: flex; align-items: center; gap: 10px; }
.section-head .count { color: var(--fg-mute); font-size: 12px; }

/* =============================================
   Writing — editorial list
   ============================================= */
.writing-list { display: flex; flex-direction: column; }
.write-row {
  display: grid; grid-template-columns: 56px 1fr auto;
  gap: 28px; align-items: baseline;
  padding: 22px 0; border-top: 1px solid var(--line);
  transition: background 220ms ease, padding 220ms ease;
  cursor: pointer; text-decoration: none; color: inherit;
}
.write-row:first-child { border-top: none; }
.write-row:hover { padding-left: 10px; padding-right: 10px; background: oklch(1 0 0 / 0.015); border-radius: 10px; }
html[data-theme="light"] .write-row:hover { background: oklch(0 0 0 / 0.02); }
.write-row .num { font-family: "Geist Mono", monospace; font-size: 12px; color: var(--fg-mute); }
.write-row .body h3 {
  font-size: 18px; font-weight: 500; letter-spacing: -0.015em; margin: 0 0 6px;
  transition: color 200ms ease;
}
.write-row:hover .body h3 { color: var(--accent); }
.write-row .body p { margin: 0 0 10px; color: var(--fg-dim); font-size: 14px; max-width: 64ch; line-height: 1.5; }
.write-row .tags { display: flex; gap: 8px; flex-wrap: wrap; }
.write-row .tag {
  font-family: "Geist Mono", monospace; font-size: 10.5px;
  color: var(--fg-mute); letter-spacing: 0.04em;
}
.write-row .tag::before { content: "#"; opacity: 0.6; margin-right: 1px; }
.write-row .meta { color: var(--fg-mute); font-size: 12px; font-family: "Geist Mono", monospace; text-align: right; min-width: 92px; }

@media (max-width: 720px) {
  .write-row { grid-template-columns: 1fr; gap: 6px; }
  .write-row .num, .write-row .meta { font-size: 11px; }
  .write-row .meta { text-align: left; }
}

/* =============================================
   Article Detail
   ============================================= */
.article-detail-wrap {
  max-width: 760px; margin: 0 auto;
  padding: 48px 24px 80px;
}
.article-back {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--fg-dim); font-size: 13px; margin-bottom: 28px;
  transition: color 160ms ease; cursor: pointer; background: none;
  border: none; padding: 0; font-family: inherit;
}
.article-back:hover { color: var(--accent); }
.article-header { margin-bottom: 40px; }
.article-header h1 {
  font-size: clamp(28px, 4vw, 44px); font-weight: 500;
  line-height: 1.15; letter-spacing: -0.03em; margin: 0 0 18px;
}
.article-meta-bar {
  display: flex; flex-wrap: wrap; gap: 16px;
  color: var(--fg-mute); font-size: 13px; margin-bottom: 16px;
}
.article-detail-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.article-detail-tag {
  font-family: "Geist Mono", monospace; font-size: 11px;
  padding: 4px 10px; border: 1px solid var(--line);
  border-radius: 6px; color: var(--fg-dim); letter-spacing: 0.04em;
}

/* Markdown content */
.article-content {
  font-size: 15.5px; line-height: 1.75; color: var(--fg);
}
.article-content h1, .article-content h2, .article-content h3,
.article-content h4, .article-content h5, .article-content h6 {
  margin-top: 2em; margin-bottom: 0.7em; font-weight: 600; color: var(--fg); line-height: 1.3; letter-spacing: -0.01em;
}
.article-content h1 { font-size: 1.7rem; border-bottom: 1px solid var(--line); padding-bottom: 0.3em; }
.article-content h2 { font-size: 1.4rem; border-bottom: 1px solid var(--line); padding-bottom: 0.2em; }
.article-content h3 { font-size: 1.2rem; }
.article-content p { margin-bottom: 1.2em; }
.article-content blockquote {
  margin: 1.5em 0; padding: 12px 18px;
  border-left: 3px solid var(--accent);
  background: oklch(1 0 0 / 0.02); border-radius: 0 8px 8px 0;
  color: var(--fg-dim);
}
html[data-theme="light"] .article-content blockquote { background: oklch(0 0 0 / 0.015); }
.article-content blockquote p:last-child { margin-bottom: 0; }
.article-content ul, .article-content ol { margin: 1em 0; padding-left: 1.8em; }
.article-content li { margin-bottom: 0.4em; }
.article-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.article-content img { max-width: 100%; border-radius: 10px; margin: 1.5em 0; }
.article-content table { width: 100%; border-collapse: collapse; margin: 1.5em 0; font-size: 0.95rem; }
.article-content th, .article-content td { border: 1px solid var(--line); padding: 10px 14px; text-align: left; }
.article-content th { background: var(--bg-2); font-weight: 600; }
.article-content code:not(pre code) {
  background: var(--accent-dim); color: var(--accent);
  padding: 2px 7px; border-radius: 5px; font-size: 0.88em;
  font-family: "Geist Mono", ui-monospace, monospace;
}
.article-content pre { margin: 1.5em 0; border-radius: 12px; overflow: hidden; position: relative; border: 1px solid var(--line); }
.article-content pre code {
  display: block; padding: 18px; font-size: 13px; line-height: 1.65;
  overflow-x: auto; font-family: "Geist Mono", ui-monospace, monospace;
  background: var(--bg-2) !important;
}
.article-content hr { border: none; height: 1px; background: var(--line); margin: 2em 0; }

/* =============================================
   Tags Page
   ============================================= */
.tags-page { padding: 48px 0 80px; }
.tags-page h1 { font-size: clamp(28px, 4vw, 40px); font-weight: 500; letter-spacing: -0.03em; margin: 0 0 8px; }
.tags-page .subtitle { color: var(--fg-dim); margin-bottom: 36px; font-size: 15px; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 10px; }
.cloud-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px;
  font-size: 14px; color: var(--fg-dim); background: transparent; cursor: pointer;
  transition: all 180ms ease; font-family: inherit;
}
.cloud-tag:hover { border-color: var(--line-2); color: var(--fg); background: oklch(1 0 0 / 0.015); }
.cloud-tag.active { background: var(--fg); color: var(--bg); border-color: var(--fg); }
html[data-theme="light"] .cloud-tag:hover { background: oklch(0 0 0 / 0.015); }

/* =============================================
   About Page
   ============================================= */
.about-page { max-width: 700px; margin: 0 auto; padding: 48px 24px 80px; }
.about-page h1 { font-size: clamp(28px, 4vw, 40px); font-weight: 500; letter-spacing: -0.03em; margin: 0 0 24px; }
.about-page p { font-size: 15px; line-height: 1.75; color: var(--fg-dim); margin-bottom: 1.2em; }
.about-card {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px;
  padding: 28px; margin: 20px 0;
}
.about-card h2 { font-size: 18px; font-weight: 500; margin-bottom: 14px; color: var(--fg); }
.about-card ul { list-style: none; padding: 0; }
.about-card li { padding: 7px 0; color: var(--fg-dim); display: flex; align-items: center; gap: 10px; font-size: 14px; }
.about-card li::before { content: "→"; color: var(--accent); font-weight: 600; }

/* =============================================
   Admin Dashboard
   ============================================= */
.admin-page { padding: 48px 0 80px; }
.admin-page h1 { font-size: clamp(24px, 3vw, 32px); font-weight: 500; letter-spacing: -0.02em; margin: 0 0 24px; }
.admin-toolbar { display: flex; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.admin-table { width: 100%; border-collapse: collapse; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.admin-table th, .admin-table td { padding: 12px 16px; text-align: left; font-size: 13px; border-bottom: 1px solid var(--line); }
.admin-table th { background: var(--bg); font-weight: 600; color: var(--fg-dim); font-family: "Geist Mono", monospace; font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table td { color: var(--fg-dim); }
.admin-table td:first-child { color: var(--fg-mute); font-family: "Geist Mono", monospace; }

.btn-sm { padding: 5px 12px; border-radius: 8px; font-size: 12px; font-weight: 500; cursor: pointer; border: none; margin-right: 6px; transition: all 160ms ease; }
.btn-edit { background: var(--accent-dim); color: var(--accent); }
.btn-edit:hover { background: var(--accent); color: var(--bg); }
.btn-delete { background: oklch(0.65 0.15 25 / 0.12); color: oklch(0.65 0.15 25); }
.btn-delete:hover { background: oklch(0.65 0.15 25); color: oklch(0.98 0.005 90); }
.btn-new { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--fg); color: var(--bg); font-weight: 500; font-size: 14px; cursor: pointer; transition: all 180ms ease; }
.btn-new:hover { opacity: 0.9; }

/* =============================================
   Editor
   ============================================= */
.editor-page { max-width: 800px; margin: 0 auto; padding: 48px 24px 80px; }
.editor-page h1 { font-size: clamp(24px, 3vw, 32px); font-weight: 500; letter-spacing: -0.02em; margin: 0 0 24px; }
.editor-actions { display: flex; gap: 12px; margin-top: 24px; }
.btn-secondary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--fg-dim); font-weight: 500; font-size: 14px;
  cursor: pointer; transition: all 180ms ease; font-family: inherit;
}
.btn-secondary:hover { border-color: var(--line-2); color: var(--fg); }

/* AI Assistant Box */
.ai-assistant-box {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px;
  padding: 20px; margin-bottom: 24px;
}
.ai-assistant-box h3 { font-size: 15px; font-weight: 500; color: var(--fg); margin-bottom: 12px; }
.ai-assistant-box textarea {
  width: 100%; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--fg); font-size: 14px; min-height: 80px;
  resize: vertical; box-sizing: border-box; font-family: inherit; outline: none;
  transition: border-color 180ms ease;
}
.ai-assistant-box textarea:focus { border-color: var(--line-2); }
.ai-actions { display: flex; gap: 10px; margin-top: 10px; align-items: center; flex-wrap: wrap; }
.ai-actions select {
  padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--fg); font-size: 14px; cursor: pointer; font-family: inherit;
}
.ai-btn { flex: 1; min-width: 140px; }
.ai-btn:disabled { opacity: 0.5; cursor: not-allowed; }
#aiStatus { margin-top: 8px; font-size: 13px; min-height: 20px; }

/* Forms */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--fg-dim); margin-bottom: 6px; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg-2); color: var(--fg); font-size: 14px; outline: none;
  transition: border-color 180ms ease; font-family: inherit;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: var(--line-2); }
.form-group textarea { min-height: 200px; resize: vertical; line-height: 1.6; }
.form-error { color: oklch(0.65 0.15 25); font-size: 13px; margin-top: 8px; min-height: 18px; }

/* =============================================
   Modal
   ============================================= */
.modal-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: oklch(0 0 0 / 0.55); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  animation: overlayIn 180ms ease;
}
@keyframes overlayIn { from { opacity: 0; } }
.modal {
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 16px;
  padding: 32px; width: 100%; max-width: 400px;
  box-shadow: 0 30px 80px oklch(0 0 0 / 0.5), 0 0 0 1px oklch(1 0 0 / 0.04) inset;
  animation: panelIn 220ms cubic-bezier(.2,.7,.2,1); position: relative;
}
@keyframes panelIn { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.modal h2 { margin-bottom: 24px; font-size: 18px; font-weight: 500; color: var(--fg); }
.modal-close { position: absolute; top: 16px; right: 16px; background: none; border: none; font-size: 22px; color: var(--fg-mute); cursor: pointer; transition: color 160ms ease; }
.modal-close:hover { color: var(--fg); }

.form-switch { text-align: center; margin-top: 16px; font-size: 13px; color: var(--fg-mute); }
.form-switch a { color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

/* =============================================
   Command Palette
   ============================================= */
.cmd-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: oklch(0 0 0 / 0.55); backdrop-filter: blur(6px);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 14vh; animation: overlayIn 180ms ease;
}
.cmd-panel {
  width: min(620px, calc(100% - 32px));
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 14px;
  box-shadow: 0 30px 80px oklch(0 0 0 / 0.5), 0 0 0 1px oklch(1 0 0 / 0.04) inset;
  overflow: hidden; animation: panelIn 220ms cubic-bezier(.2,.7,.2,1);
}
.cmd-input {
  width: 100%; padding: 18px 20px; background: transparent; border: none; outline: none;
  color: var(--fg); font-size: 15px; font-family: "Geist", sans-serif;
  border-bottom: 1px solid var(--line);
}
.cmd-input::placeholder { color: var(--fg-mute); }
.cmd-list { max-height: 380px; overflow: auto; padding: 8px; }
.cmd-group-label {
  font-family: "Geist Mono", monospace; font-size: 10px;
  color: var(--fg-mute); padding: 10px 12px 6px;
  text-transform: uppercase; letter-spacing: 0.12em;
}
.cmd-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px; border-radius: 8px;
  color: var(--fg-dim); font-size: 13.5px; cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.cmd-item.active { background: oklch(1 0 0 / 0.05); color: var(--fg); }
html[data-theme="light"] .cmd-item.active { background: oklch(0 0 0 / 0.05); }
.cmd-item .left { display: flex; align-items: center; gap: 12px; }
.cmd-item .hint { font-family: "Geist Mono", monospace; font-size: 10.5px; color: var(--fg-mute); }
.cmd-foot {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-top: 1px solid var(--line);
  font-family: "Geist Mono", monospace; font-size: 10.5px; color: var(--fg-mute);
}
.cmd-foot .grp { display: flex; gap: 16px; }

/* AI Chat in Command Palette */
.cmd-chat-messages {
  max-height: 400px;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}
.cmd-chat-welcome {
  padding: 20px 12px;
  font-size: 13px;
  color: var(--fg-mute);
  text-align: center;
  line-height: 1.5;
}
.cmd-chat-msg {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.65;
  max-width: 88%;
  word-break: break-word;
}
.cmd-chat-msg.user {
  align-self: flex-end;
  background: var(--fg);
  color: var(--bg);
  border-bottom-right-radius: 4px;
}
.cmd-chat-msg.ai {
  align-self: flex-start;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--fg);
  border-bottom-left-radius: 4px;
}
.cmd-chat-msg.ai p { margin: 0 0 8px; }
.cmd-chat-msg.ai p:last-child { margin-bottom: 0; }
.cmd-chat-msg.ai ol, .cmd-chat-msg.ai ul {
  margin: 8px 0;
  padding-left: 20px;
}
.cmd-chat-msg.ai li { margin-bottom: 4px; }
.cmd-chat-msg.ai code {
  background: var(--bg-2);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
  font-family: "Geist Mono", monospace;
}
.cmd-chat-msg.ai pre {
  background: var(--bg-2);
  border-radius: 8px;
  padding: 10px 12px;
  overflow-x: auto;
  font-size: 12px;
  margin: 8px 0;
}
.cmd-chat-msg.ai pre code {
  background: none;
  padding: 0;
}
.cmd-chat-msg.error {
  align-self: flex-start;
  background: oklch(0.95 0.05 25);
  color: oklch(0.5 0.15 25);
  border: 1px solid oklch(0.85 0.08 25);
}
.cmd-chat-cursor {
  color: var(--fg-mute);
  animation: cmd-blink 0.8s steps(2) infinite;
}
@keyframes cmd-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}
.cmd-chat-sources {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.cmd-chat-sources-label {
  font-size: 11px;
  color: var(--fg-mute);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.cmd-chat-source-link {
  display: block;
  padding: 7px 10px;
  border-radius: 6px;
  background: var(--bg-2);
  color: var(--fg);
  font-size: 12.5px;
  text-decoration: none;
  margin-bottom: 4px;
  cursor: pointer;
  transition: background 120ms ease;
}
.cmd-chat-source-link:hover {
  background: var(--line);
}

/* =============================================
   Footer
   ============================================= */
footer {
  border-top: 1px solid var(--line);
  padding: 56px 0 64px; margin-top: auto;
}
footer .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 40px; flex-wrap: wrap; }
footer h3 { font-size: 24px; font-weight: 500; letter-spacing: -0.025em; margin: 0 0 6px; max-width: 24ch; }
footer .tag { color: var(--fg-mute); font-size: 14px; max-width: 36ch; }
footer .links { display: flex; flex-direction: column; gap: 10px; min-width: 180px; }
footer .links a {
  display: flex; justify-content: space-between; align-items: center;
  font-family: "Geist Mono", monospace; font-size: 12.5px;
  color: var(--fg-dim); padding: 8px 0; border-bottom: 1px dashed var(--line);
  transition: color 180ms ease;
}
footer .links a:hover { color: var(--fg); }
footer .links a span:last-child { color: var(--fg-mute); }
footer .links a:hover span:last-child { color: var(--accent); }
footer .bottom {
  margin-top: 48px; display: flex; justify-content: space-between;
  color: var(--fg-mute); font-size: 11.5px; font-family: "Geist Mono", monospace;
  flex-wrap: wrap; gap: 10px;
}

/* =============================================
   Loading & Empty States
   ============================================= */
.loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 80px 24px; color: var(--fg-mute);
}
.spinner {
  width: 36px; height: 36px;
  border: 2px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite; margin-bottom: 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; padding: 60px 24px; color: var(--fg-mute); }
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 16px; }
.empty-state h3 { margin-bottom: 8px; color: var(--fg-dim); font-weight: 500; }

/* =============================================
   Semantic search badge
   ============================================= */
.semantic-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--accent-dim); color: var(--accent);
  font-size: 11px; padding: 3px 8px; border-radius: 6px;
  font-weight: 500; letter-spacing: 0.02em;
}

/* =============================================
   Page transition
   ============================================= */
.page-fade { animation: fadeUp 500ms cubic-bezier(.2,.7,.2,1) forwards; }

/* =============================================
   Mobile Responsive
   ============================================= */
@media (max-width: 768px) {
  .hero { padding: 56px 0 40px; }
  .hero h1 { font-size: clamp(32px, 10vw, 48px); }
  .search-container { flex-direction: column; }
  .article-detail-wrap { padding: 32px 20px 60px; }
  .article-header h1 { font-size: 26px; }
  .tags-page h1, .about-page h1, .admin-page h1, .editor-page h1 { font-size: 26px; }
  footer .top { flex-direction: column; gap: 24px; }
  footer h3 { font-size: 20px; }
  .admin-table { font-size: 12px; }
  .admin-table th, .admin-table td { padding: 10px 12px; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 32px; }
  .tag-chip { padding: 5px 12px; font-size: 12px; }
}

/* =============================================
   Podcast
   ============================================= */
.podcast-section {
  margin: 28px 0 36px;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-2);
}
.podcast-prompt-box {
  margin-bottom: 12px;
}
.podcast-prompt-box label {
  display: block;
  font-size: 12px;
  color: var(--fg-mute);
  margin-bottom: 6px;
}
.podcast-prompt-box textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  min-height: 52px;
  font-family: inherit;
  box-sizing: border-box;
}
.podcast-prompt-box textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.podcast-prompt-count {
  text-align: right;
  font-size: 11px;
  color: var(--fg-mute);
  margin-top: 4px;
}
.podcast-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: transparent;
  color: var(--fg);
  font-size: 13.5px;
  font-family: "Geist", sans-serif;
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease;
}
.podcast-btn:hover {
  background: oklch(1 0 0 / 0.03);
  border-color: var(--accent);
}
.podcast-loading {
  padding: 10px 0;
  font-size: 13.5px;
  color: var(--fg-dim);
}
.podcast-timer {
  font-family: "Geist Mono", monospace;
  font-size: 12px;
  color: var(--fg-mute);
  margin-left: 6px;
}
.podcast-dots {
  font-family: "Geist Mono", monospace;
  font-size: 12px;
  color: var(--fg-mute);
  margin-left: 2px;
  display: inline-block;
  width: 18px;
}
.podcast-player {
  padding: 4px 0;
}
.podcast-label {
  font-size: 11px;
  font-family: "Geist Mono", monospace;
  color: var(--fg-mute);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.podcast-player audio {
  filter: saturate(0.6);
}
html[data-theme="light"] .podcast-player audio {
  filter: none;
}
