/* ============================================================
   XSTACK — Editorial Terminal
   A reader-first technical journal.
   Newsreader (serif display) · Hanken Grotesk (UI/body) · JetBrains Mono
   ============================================================ */

/* ── Theme tokens ── */
:root {
  --paper:      oklch(0.985 0.006 75);
  --paper-2:    oklch(0.963 0.008 75);
  --paper-3:    oklch(0.945 0.009 70);
  --ink:        oklch(0.24 0.014 55);
  --ink-soft:   oklch(0.36 0.012 55);
  --muted:      oklch(0.52 0.012 55);
  --faint:      oklch(0.64 0.01 55);
  --line:       oklch(0.90 0.008 70);
  --line-soft:  oklch(0.93 0.006 70);
  --accent:     oklch(0.565 0.18 32);
  --accent-ink: oklch(0.49 0.18 32);
  --accent-bg:  oklch(0.94 0.04 45);
  --on-accent:  oklch(0.99 0.01 75);
  --ok:         oklch(0.55 0.13 150);
  --ok-bg:      oklch(0.93 0.05 150);
  --warn:       oklch(0.56 0.17 32);
  --warn-bg:    oklch(0.93 0.05 40);
  --code-bg:    oklch(0.96 0.008 75);

  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --sans:  'Hanken Grotesk', system-ui, -apple-system, sans-serif;
  --mono:  'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

  --radius:    7px;
  --radius-lg: 12px;
  --shadow:    0 1px 2px oklch(0.24 0.01 55 / .05), 0 14px 40px oklch(0.24 0.01 55 / .08);
  --shadow-sm: 0 1px 2px oklch(0.24 0.01 55 / .06);
  --maxw: 1120px;
}

[data-theme="dark"] {
  --paper:      oklch(0.185 0.008 65);
  --paper-2:    oklch(0.225 0.009 65);
  --paper-3:    oklch(0.26 0.01 65);
  --ink:        oklch(0.94 0.006 75);
  --ink-soft:   oklch(0.82 0.008 75);
  --muted:      oklch(0.68 0.012 70);
  --faint:      oklch(0.56 0.012 70);
  --line:       oklch(0.31 0.009 65);
  --line-soft:  oklch(0.27 0.008 65);
  --accent:     oklch(0.71 0.15 40);
  --accent-ink: oklch(0.78 0.14 45);
  --accent-bg:  oklch(0.32 0.07 40);
  --on-accent:  oklch(0.16 0.02 50);
  --ok:         oklch(0.74 0.14 150);
  --ok-bg:      oklch(0.30 0.06 150);
  --warn:       oklch(0.74 0.15 45);
  --warn-bg:    oklch(0.32 0.07 40);
  --code-bg:    oklch(0.235 0.009 65);
  --shadow:     0 1px 2px oklch(0 0 0 / .3), 0 18px 48px oklch(0 0 0 / .4);
  --shadow-sm:  0 1px 2px oklch(0 0 0 / .35);
}

/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink);
  background-color: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .25s ease, color .25s ease;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
p { margin: 0 0 1rem; color: var(--ink-soft); }
h1, h2, h3, h4 { margin: 0 0 .6rem; line-height: 1.08; color: var(--ink); font-weight: 600; }
::selection { background: var(--accent-bg); color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Layout primitives ── */
.container { width: min(var(--maxw), calc(100% - 2.5rem)); margin: 0 auto; }
.narrow { width: min(760px, calc(100% - 2.5rem)); margin: 0 auto; }
.narrow-wide { width: min(880px, calc(100% - 2.5rem)); margin: 0 auto; }
.section { padding: 4.5rem 0; }
.soft-section { background: var(--paper-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.site-shell { display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1; }

/* ── Eyebrow / mono labels ── */
.eyebrow, .mini-label {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-family: var(--mono);
  font-size: .7rem;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .9rem;
}

/* ── Header / masthead ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in oklab, var(--paper) 88%, transparent);
  backdrop-filter: saturate(150%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav-wrap { display: flex; align-items: center; justify-content: space-between; min-height: 70px; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .7rem; }
.brand-mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-weight: 700;
  font-size: .82rem;
  flex-shrink: 0;
  transition: background .2s;
}
.brand:hover .brand-mark { background: var(--accent); color: var(--on-accent); }
.brand strong { display: block; font-size: 1.02rem; font-weight: 700; letter-spacing: .02em; }
.brand small { display: block; font-family: var(--mono); font-size: .67rem; color: var(--faint); margin-top: .05rem; letter-spacing: .02em; }
.nav-cluster { display: flex; align-items: center; gap: .35rem; }
.site-nav { display: flex; align-items: center; gap: .15rem; }
.site-nav a {
  color: var(--muted);
  padding: .45rem .8rem;
  border-radius: var(--radius);
  font-size: .92rem;
  font-weight: 500;
  transition: color .15s, background .15s;
}
.site-nav a:hover { color: var(--ink); background: var(--paper-2); }
.site-nav a.is-active { color: var(--ink); }
.nav-cta {
  color: var(--on-accent) !important;
  background: var(--accent) !important;
  font-weight: 600 !important;
}
.nav-cta:hover { filter: brightness(1.05); }

/* theme toggle + menu buttons */
.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
  flex-shrink: 0;
}
.icon-btn:hover { color: var(--ink); border-color: var(--faint); background: var(--paper-2); }
.icon-btn svg { width: 18px; height: 18px; }
.theme-toggle .sun { display: none; }
[data-theme="dark"] .theme-toggle .sun { display: block; }
[data-theme="dark"] .theme-toggle .moon { display: none; }
.menu-toggle { display: none; font-size: 1.25rem; line-height: 1; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  border-radius: var(--radius);
  padding: .65rem 1.25rem;
  font-family: var(--sans);
  font-weight: 600;
  font-size: .92rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .12s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-secondary, .btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}
.btn-secondary:hover, .btn-ghost:hover { border-color: var(--ink); background: var(--paper-2); }

/* ── Pills / tags / chips ── */
.pill {
  display: inline-flex; align-items: center;
  font-family: var(--mono);
  font-size: .68rem; font-weight: 500; letter-spacing: .06em;
  text-transform: uppercase;
  background: var(--accent-bg);
  color: var(--accent-ink);
  border-radius: 100px;
  padding: .28rem .7rem;
}
.tag {
  display: inline-flex; align-items: center;
  font-family: var(--mono); font-size: .72rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: .28rem .7rem;
}
.tag::before { content: "#"; color: var(--faint); margin-right: .15rem; }
.chip {
  display: inline-flex; align-items: center;
  font-family: var(--mono); font-size: .76rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: .4rem .9rem;
  transition: border-color .15s, color .15s, background .15s;
  cursor: pointer;
}
.chip:hover { border-color: var(--faint); color: var(--ink); }
.chip.active { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* ── Generic card ── */
.card,
.post-card, .listing-card, .sidebar-card,
.table-card, .stat-card, .admin-auth-card,
.comments-card, .about-card, .feature-lead {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

/* ── Section header ── */
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}
.section-head h2 { font-family: var(--serif); font-size: clamp(1.6rem, 3vw, 2.1rem); font-weight: 500; letter-spacing: -0.01em; }
.compact-head { margin-bottom: 1.25rem; }
.text-link {
  color: var(--ink);
  font-family: var(--mono);
  font-size: .8rem;
  font-weight: 500;
  white-space: nowrap;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 2px;
  transition: color .15s;
}
.text-link:hover { color: var(--accent); }
.muted { color: var(--muted); }

/* ============================================================
   HOME — hero
   ============================================================ */
.hero-section { padding: 5rem 0 3rem; position: relative; overflow: hidden; }
.hero-rule { border: none; border-top: 1px solid var(--line); margin: 0; }
.hero-grid { display: grid; grid-template-columns: 1.35fr .65fr; gap: 3.5rem; align-items: end; }
.hero-lead h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.6rem, 6vw, 4.6rem);
  line-height: 1.02;
  letter-spacing: -0.025em;
  margin-bottom: 1.25rem;
}
.hero-lead h1 em { font-style: italic; color: var(--accent); }
.hero-copy { font-size: 1.18rem; line-height: 1.6; max-width: 54ch; color: var(--ink-soft); }
.hero-actions { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin-top: 2rem; }
.hero-metrics {
  display: grid;
  gap: 1.5rem;
  padding-left: 1.75rem;
  border-left: 1px solid var(--line);
}
.hero-metrics div { display: flex; flex-direction: column; gap: .2rem; }
.hero-metrics strong { font-family: var(--serif); font-size: 2.4rem; font-weight: 500; line-height: 1; color: var(--ink); }
.hero-metrics span { font-family: var(--mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }

/* ── Featured lead (big editorial card) ── */
.featured-block { display: grid; gap: 1.25rem; }
.feature-lead {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  overflow: hidden;
  transition: border-color .2s, box-shadow .2s;
}
.feature-lead:hover { box-shadow: var(--shadow); }
.feature-lead .media { position: relative; min-height: 320px; background: var(--paper-3); }
.feature-lead .media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.feature-lead .body { padding: 2.25rem; display: flex; flex-direction: column; justify-content: center; gap: .85rem; }
.feature-lead .body h3 { font-family: var(--serif); font-weight: 500; font-size: clamp(1.6rem, 3vw, 2.3rem); line-height: 1.1; letter-spacing: -0.015em; }
.feature-lead .body h3 a { background-image: linear-gradient(var(--accent), var(--accent)); background-size: 0% 1px; background-position: 0 100%; background-repeat: no-repeat; transition: background-size .3s; }
.feature-lead:hover .body h3 a { background-size: 100% 1px; }
.feature-lead .body p { font-size: 1.02rem; color: var(--ink-soft); }

/* ── Featured secondary grid ── */
.feature-secondary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }

/* ── Post cards (grid) ── */
.cards-grid { display: grid; gap: 1.25rem; }
.latest-grid { grid-template-columns: repeat(3, 1fr); }
.post-card { overflow: hidden; display: flex; flex-direction: column; transition: border-color .2s, box-shadow .2s, transform .2s; }
.post-card:hover { box-shadow: var(--shadow); transform: translateY(-3px); }
.post-card .media { aspect-ratio: 16 / 10; overflow: hidden; background: var(--paper-3); }
.post-card .media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.post-card:hover .media img { transform: scale(1.04); }
.post-card-body { padding: 1.35rem; display: flex; flex-direction: column; gap: .55rem; flex: 1; }
.post-card-body h3 { font-family: var(--serif); font-weight: 500; font-size: 1.3rem; line-height: 1.18; letter-spacing: -0.01em; }
.post-card-body h3 a:hover { color: var(--accent); }
.post-card-body p { font-size: .94rem; color: var(--muted); margin: 0; }
.card-top { display: flex; align-items: center; gap: .6rem; }

/* ── Meta rows ── */
.meta-row {
  display: flex; align-items: center; gap: .7rem; flex-wrap: wrap;
  color: var(--faint);
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .02em;
}
.meta-row .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .6; }
.stat-row { margin-top: auto; padding-top: .9rem; border-top: 1px solid var(--line); }

/* ── Trending strip ── */
.editorial-strip { display: grid; grid-template-columns: .7fr 1.3fr; gap: 2.5rem; align-items: start; }
.editorial-strip > div:first-child h2 { font-family: var(--serif); font-weight: 500; font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -0.01em; }
.editorial-strip > div:first-child p { color: var(--muted); font-size: .96rem; }
.trending-list { display: grid; gap: 0; }
.trending-item {
  display: flex; align-items: baseline; gap: 1.1rem;
  padding: 1.1rem .25rem;
  border-top: 1px solid var(--line);
  transition: padding-left .2s;
}
.trending-item:last-child { border-bottom: 1px solid var(--line); }
.trending-item:hover { padding-left: .75rem; }
.trending-item .rank { font-family: var(--serif); font-size: 1.6rem; font-style: italic; color: var(--accent); line-height: 1; min-width: 1.6rem; }
.trending-item .ti-body strong { display: block; font-size: 1.02rem; font-weight: 600; margin-bottom: .25rem; transition: color .15s; }
.trending-item:hover .ti-body strong { color: var(--accent); }
.trending-item .ti-body span { font-family: var(--mono); font-size: .7rem; color: var(--faint); letter-spacing: .03em; }

/* ============================================================
   PAGE HERO (blog, about, article)
   ============================================================ */
.page-hero { padding: 4rem 0 2.5rem; border-bottom: 1px solid var(--line); }
.page-hero h1 { font-family: var(--serif); font-weight: 500; font-size: clamp(2.2rem, 5vw, 3.4rem); letter-spacing: -0.02em; line-height: 1.05; }
.page-hero p { font-size: 1.12rem; max-width: 60ch; color: var(--ink-soft); margin-top: .75rem; }
.compact-hero { padding: 3.25rem 0 2.25rem; }

/* ── Filters ── */
.filters-bar { display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; flex-wrap: wrap; margin-bottom: 2rem; }
.search-form { display: flex; gap: .5rem; flex: 1 1 320px; max-width: 420px; }
.search-form input {
  flex: 1;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  padding: .65rem .9rem;
  font: inherit; font-size: .92rem;
  transition: border-color .15s, box-shadow .15s;
}
.search-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.search-form input::placeholder { color: var(--faint); }
.category-chips, .tag-row { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ── Blog layout ── */
.blog-layout, .article-layout { display: grid; grid-template-columns: 1fr 300px; gap: 3rem; align-items: start; }
.comments-layout { grid-template-columns: 1fr; max-width: 760px; }
.posts-column { display: grid; gap: 0; }

.listing-card {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.75rem;
  padding: 1.75rem 0;
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  align-items: center;
}
.posts-column .listing-card:first-child { padding-top: 0; }
.listing-card .media { aspect-ratio: 16 / 10; overflow: hidden; border-radius: var(--radius); background: var(--paper-3); }
.listing-card .media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.listing-card:hover .media img { transform: scale(1.04); }
.listing-card .body { display: flex; flex-direction: column; gap: .55rem; }
.listing-card h2 { font-family: var(--serif); font-weight: 500; font-size: 1.55rem; line-height: 1.14; letter-spacing: -0.015em; }
.listing-card h2 a:hover { color: var(--accent); }
.listing-card p { font-size: .98rem; color: var(--muted); margin: 0; }

/* ── Sidebar ── */
.sidebar-card { padding: 1.5rem; position: sticky; top: 92px; }
.sidebar-card + .sidebar-card { margin-top: 1.25rem; }
.sidebar-card h3 {
  font-family: var(--mono);
  font-size: .72rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--faint); font-weight: 500; margin-bottom: 1rem;
}
.sidebar-link { display: block; padding: .85rem 0; border-bottom: 1px solid var(--line); transition: color .15s; }
.sidebar-link:last-child { border-bottom: none; padding-bottom: 0; }
.sidebar-link:first-of-type { padding-top: 0; }
.sidebar-link span { display: block; font-family: var(--serif); font-weight: 500; font-size: 1.08rem; margin-bottom: .15rem; transition: color .15s; }
.sidebar-link small { display: block; color: var(--muted); font-size: .85rem; line-height: 1.45; }
.sidebar-link:hover span { color: var(--accent); }

/* ============================================================
   ARTICLE
   ============================================================ */
.article-hero { padding: 3.5rem 0 0; }
.article-header { max-width: 820px; margin: 0 auto; text-align: center; }
.article-header h1 { font-family: var(--serif); font-weight: 500; font-size: clamp(2.1rem, 5vw, 3.5rem); line-height: 1.06; letter-spacing: -0.02em; margin: 1rem 0; }
.article-excerpt { font-size: 1.2rem; line-height: 1.55; color: var(--ink-soft); max-width: 60ch; margin: 0 auto; }
.article-meta { justify-content: center; margin-top: 1.5rem; font-size: .76rem; }
.article-meta .byline { color: var(--ink); font-weight: 600; font-family: var(--sans); font-size: .9rem; }
.article-cover {
  width: min(1000px, calc(100% - 2.5rem));
  margin: 2.5rem auto 0;
  aspect-ratio: 16 / 8;
  object-fit: cover;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--paper-3);
}
.article-body-wrap { padding: 3.5rem 0; }
.article-content { max-width: 720px; margin: 0 auto; }

/* ── Markdown ── */
.markdown-body { font-size: 1.16rem; line-height: 1.75; color: var(--ink-soft); }
.markdown-body > h1:first-child { display: none; } /* title already in hero */
.markdown-body h2 { font-family: var(--serif); font-weight: 500; font-size: 1.85rem; letter-spacing: -0.01em; margin: 2.75rem 0 1rem; color: var(--ink); }
.markdown-body h3 { font-family: var(--serif); font-weight: 500; font-size: 1.4rem; margin: 2.25rem 0 .75rem; color: var(--ink); }
.markdown-body p { color: var(--ink-soft); margin: 0 0 1.4rem; }
.markdown-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.markdown-body a:hover { text-decoration-thickness: 2px; }
.markdown-body ul, .markdown-body ol { color: var(--ink-soft); padding-left: 1.4rem; margin: 0 0 1.4rem; }
.markdown-body li { margin-bottom: .5rem; padding-left: .3rem; }
.markdown-body li::marker { color: var(--accent); }
.markdown-body strong { color: var(--ink); font-weight: 700; }
.markdown-body blockquote {
  margin: 2rem 0; padding: .5rem 0 .5rem 1.5rem;
  border-left: 3px solid var(--accent);
  font-family: var(--serif); font-style: italic; font-size: 1.3rem;
  color: var(--ink);
}
.markdown-body img { border-radius: var(--radius); margin: 1.75rem 0; border: 1px solid var(--line); }
.markdown-body hr { border: none; border-top: 1px solid var(--line); margin: 2.5rem 0; }
.markdown-body table { width: 100%; border-collapse: collapse; margin: 1.75rem 0; font-size: .98rem; }
.markdown-body th, .markdown-body td { border: 1px solid var(--line); padding: .6rem .85rem; text-align: left; }
.markdown-body th { background: var(--paper-2); font-family: var(--mono); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }

/* inline + block code */
.markdown-body code {
  font-family: var(--mono);
  font-size: .86em;
  background: var(--code-bg);
  border: 1px solid var(--line);
  padding: .12rem .4rem;
  border-radius: 5px;
  color: var(--accent-ink);
}
.markdown-body pre {
  position: relative;
  overflow: auto;
  padding: 1.4rem 1.5rem;
  border-radius: var(--radius-lg);
  background: var(--code-bg);
  border: 1px solid var(--line);
  margin: 1.75rem 0;
  font-size: .92rem;
  line-height: 1.7;
}
.markdown-body pre::before {
  content: "";
  position: absolute; top: 1rem; left: 1.25rem;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--warn);
  box-shadow: 18px 0 0 color-mix(in oklab, var(--warn) 55%, var(--paper-3)), 36px 0 0 var(--line);
  opacity: .85;
}
.markdown-body pre { padding-top: 2.75rem; }
.markdown-body pre code { background: none; border: none; padding: 0; color: var(--ink); font-size: 1em; }

.source-note {
  max-width: 720px; margin: 2.5rem auto 0;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--faint);
  color: var(--muted);
  font-size: .92rem;
}
.source-note strong { color: var(--ink-soft); font-family: var(--mono); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.tag-row { max-width: 720px; margin: 2.5rem auto 0; padding-top: 2rem; border-top: 1px solid var(--line); }

/* related row */
.related-section { border-top: 1px solid var(--line); background: var(--paper-2); }

/* ── Comments ── */
.comments-section { border-top: 1px solid var(--line); }
.comments-card { padding: 2.25rem; }
.comments-card h2 { font-family: var(--serif); font-weight: 500; font-size: 1.7rem; }
.comment-form { display: grid; gap: 1rem; margin: 1.75rem 0 2.5rem; }
.comment-list { display: grid; gap: 0; }
.comment-item { padding: 1.5rem 0; border-top: 1px solid var(--line); }
.comment-head { display: flex; align-items: baseline; gap: .75rem; margin-bottom: .5rem; }
.comment-head strong { font-size: 1rem; font-weight: 600; }
.comment-head span { font-family: var(--mono); font-size: .72rem; color: var(--faint); }
.comment-item p { margin: 0; color: var(--ink-soft); }

/* ── Forms ── */
label { display: grid; gap: .45rem; font-size: .9rem; font-weight: 600; color: var(--ink); }
.admin-form input, .admin-form textarea, .admin-form select,
.admin-auth-card input,
.comment-form input, .comment-form textarea {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  padding: .7rem .9rem;
  font: inherit; font-size: .95rem; font-weight: 400;
  transition: border-color .15s, box-shadow .15s;
}
.admin-form textarea { font-family: var(--mono); font-size: .88rem; line-height: 1.6; }
.comment-form textarea { font-family: inherit; }
.admin-form input:focus, .admin-form textarea:focus, .admin-form select:focus,
.admin-auth-card input:focus,
.comment-form input:focus, .comment-form textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg);
}
input::placeholder, textarea::placeholder { color: var(--faint); }
textarea { resize: vertical; }

/* ── About ── */
.about-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.about-card { padding: 1.75rem; }
.about-card h2 { font-family: var(--serif); font-weight: 500; font-size: 1.35rem; margin-bottom: .65rem; }
.about-card p { color: var(--muted); font-size: .96rem; margin: 0; }
.about-num { font-family: var(--mono); font-size: .72rem; color: var(--accent); letter-spacing: .1em; display: block; margin-bottom: 1rem; }

/* ============================================================
   ADMIN
   ============================================================ */
.admin-header-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.25rem; flex-wrap: wrap; margin-bottom: 2rem; }
.admin-header-row h1 { font-family: var(--serif); font-weight: 500; font-size: clamp(2rem, 4vw, 2.8rem); letter-spacing: -0.02em; }
.admin-actions-inline { display: flex; gap: .65rem; flex-wrap: wrap; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { padding: 1.4rem 1.5rem; }
.stat-card strong { display: block; font-family: var(--serif); font-weight: 500; font-size: 2.4rem; line-height: 1; color: var(--ink); margin-bottom: .4rem; }
.stat-card span { font-family: var(--mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); }
.admin-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 1.25rem; margin-bottom: 1.25rem; }
.table-card { padding: 1.5rem; }
.table-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.table-head h2 { font-family: var(--serif); font-weight: 500; font-size: 1.4rem; margin: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { font-family: var(--mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 500; padding: .7rem .8rem; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
td { padding: .85rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; font-size: .92rem; }
tr:last-child td { border-bottom: none; }
td strong { font-weight: 600; }
.table-actions { display: flex; gap: .85rem; flex-wrap: wrap; align-items: center; }
.table-actions form { margin: 0; }
.table-actions a, .table-actions button {
  color: var(--muted); background: none; border: none; padding: 0;
  font-family: var(--mono); font-size: .78rem; cursor: pointer; transition: color .15s;
}
.table-actions a:hover { color: var(--accent); }
.table-actions button:hover { color: var(--warn); }
.category-stack { display: grid; gap: 0; }
.category-item { display: flex; justify-content: space-between; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.category-item:last-child { border-bottom: none; }
.category-item:first-child { padding-top: 0; }
.category-item strong { font-family: var(--serif); font-weight: 500; font-size: 1.1rem; }
.category-item p { font-size: .88rem; color: var(--muted); margin: .15rem 0 0; }
.status-badge { padding: .25rem .6rem; border-radius: 100px; font-family: var(--mono); font-size: .66rem; text-transform: uppercase; letter-spacing: .06em; }
.status-badge.published { background: var(--ok-bg); color: var(--ok); }
.status-badge.draft { background: var(--paper-2); color: var(--muted); border: 1px solid var(--line); }
.admin-form { display: grid; gap: 1.1rem; }
.form-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: .5rem; }
.form-head-row h1 { font-family: var(--serif); font-weight: 500; font-size: 1.9rem; letter-spacing: -0.01em; }
.form-grid { display: grid; gap: 1.1rem; }
.two-col { grid-template-columns: repeat(2, 1fr); }
.checkbox-row { display: flex; align-items: center; gap: .65rem; font-weight: 500; }
.checkbox-row input { width: auto; accent-color: var(--accent); width: 18px; height: 18px; }
.cover-preview { display: grid; gap: .65rem; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper-2); }
.cover-preview span { font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
.cover-preview img { width: 100%; max-width: 400px; aspect-ratio: 16/9; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); }
.upload-note { font-size: .88rem; }
.upload-note code { background: var(--code-bg); border: 1px solid var(--line); padding: .12rem .4rem; border-radius: 4px; font-family: var(--mono); color: var(--accent-ink); font-size: .85em; }
.admin-auth-wrap { min-height: 70vh; display: grid; place-items: center; padding: 3rem 0; }
.admin-auth-card { display: grid; gap: 1rem; padding: 2.25rem; width: 100%; }
.admin-auth-card h1 { font-family: var(--serif); font-weight: 500; font-size: 2rem; }
.admin-auth-card p { color: var(--muted); font-size: .95rem; margin: 0; }
.comments-admin-card { margin-top: 1.25rem; }

/* ── Flash ── */
.flash-stack { position: fixed; top: 84px; left: 50%; transform: translateX(-50%); z-index: 50; width: min(640px, calc(100% - 2.5rem)); display: grid; gap: .5rem; }
.flash { padding: .8rem 1.1rem; border-radius: var(--radius); font-size: .92rem; border: 1px solid var(--line); box-shadow: var(--shadow); background: var(--paper); display: flex; align-items: center; gap: .6rem; }
.flash::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.flash-success { color: var(--ink); }
.flash-success::before { background: var(--ok); }
.flash-error { color: var(--ink); }
.flash-error::before { background: var(--warn); }

/* ── Empty state ── */
.empty-state { padding: 3rem; border: 1px dashed var(--line); border-radius: var(--radius-lg); text-align: center; }
.empty-state h3 { font-family: var(--serif); font-weight: 500; font-size: 1.3rem; }
.empty-state p { color: var(--muted); margin: 0; }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer { padding: 4rem 0 2rem; border-top: 1px solid var(--line); margin-top: 3rem; background: var(--paper-2); }
.footer-grid { display: grid; grid-template-columns: 1.5fr .75fr .75fr; gap: 2rem; }
.footer-brand .brand { margin-bottom: 1rem; }
.footer-grid h3 { font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: var(--ink); font-weight: 500; margin-bottom: 1rem; }
.footer-grid h4 { font-family: var(--mono); font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: var(--faint); font-weight: 500; margin-bottom: 1rem; }
.footer-grid a { display: block; color: var(--muted); margin: .5rem 0; font-size: .94rem; transition: color .15s; }
.footer-grid a:hover { color: var(--accent); }
.footer-grid p { font-size: .94rem; color: var(--muted); max-width: 40ch; }
.footer-signals { display: grid; gap: .4rem; }
.footer-signals p { font-family: var(--mono); font-size: .82rem; color: var(--muted); margin: 0; }
.footer-signals strong { color: var(--ink); }
.footer-bottom { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line); color: var(--faint); font-family: var(--mono); font-size: .74rem; }
.footer-admin-link { color: var(--faint); transition: color .15s; }
.footer-admin-link:hover { color: var(--accent); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 920px) {
  .hero-grid { grid-template-columns: 1fr; gap: 2rem; align-items: start; }
  .hero-metrics { grid-template-columns: repeat(3, 1fr); padding-left: 0; padding-top: 1.5rem; border-left: none; border-top: 1px solid var(--line); }
  .feature-lead { grid-template-columns: 1fr; }
  .feature-lead .media { min-height: 220px; }
  .feature-secondary { grid-template-columns: 1fr; }
  .latest-grid { grid-template-columns: repeat(2, 1fr); }
  .editorial-strip { grid-template-columns: 1fr; gap: 1.5rem; }
  .blog-layout, .article-layout { grid-template-columns: 1fr; gap: 2.5rem; }
  .sidebar-card { position: static; }
  .about-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 620px) {
  body { font-size: 1rem; }
  .section { padding: 3rem 0; }
  .latest-grid { grid-template-columns: 1fr; }
  .listing-card { grid-template-columns: 1fr; gap: 1rem; }
  .listing-card .media { aspect-ratio: 16/9; }
  .two-col { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .menu-toggle { display: grid; }
  .site-nav {
    display: none;
    position: absolute; top: 70px; right: 1.25rem; left: 1.25rem;
    background: var(--paper); padding: .6rem; border: 1px solid var(--line);
    border-radius: var(--radius-lg); flex-direction: column; align-items: stretch;
    gap: .1rem; box-shadow: var(--shadow);
  }
  .site-nav.open { display: flex; }
  .article-header { text-align: left; }
  .article-meta { justify-content: flex-start; }
  .article-cover { aspect-ratio: 16/10; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
