/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Variables ── */
:root {
  /* core palette (DARK — default) */
  --bg:         #0e0c0a;
  --bg-2:       #161410;
  --bg-3:       #1e1b16;
  --line:       rgba(255,255,255,0.07);
  --hover:      rgba(255,255,255,0.025);
  --nav-bg:     rgba(14,12,10,0.92);
  --on-gold:    #0e0c0a;
  --gold-hover: #e0b97a;

  --gold-rgb:   212,169,106;
  --green-rgb:  90,138,94;
  --red-rgb:    192,97,74;

  --gold:     rgb(var(--gold-rgb));
  --gold-dim: rgba(var(--gold-rgb), 0.55);
  --line-h:   rgba(var(--gold-rgb), 0.3);
  --green:    rgb(var(--green-rgb));
  --red:      rgb(var(--red-rgb));

  --text:     #ede8e0;
  --text-mid: #9a9186;
  --text-dim: #5a5248;

  --radius:   8px;
  --t:        0.2s ease;
  --serif:    'Playfair Display', Georgia, serif;
  --sans:     'DM Sans', system-ui, sans-serif;
  --mono:     'JetBrains Mono', monospace;
  --col:      680px;

  color-scheme: dark;
}

/* LIGHT — warm ivory, kept editorial */
:root[data-theme="light"] {
  --bg:         #faf7f1;
  --bg-2:       #f3eee5;
  --bg-3:       #ebe4d6;
  --line:       rgba(0,0,0,0.08);
  --hover:      rgba(0,0,0,0.03);
  --nav-bg:     rgba(250,247,241,0.92);
  --on-gold:    #faf7f1;
  --gold-hover: #9d7233;

  --gold-rgb:   181,136,67;
  --green-rgb:  74,125,77;
  --red-rgb:    176,72,48;

  --text:     #2a2520;
  --text-mid: #5c544a;
  --text-dim: #8c8276;

  color-scheme: light;
}

html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* Theme toggle button (in nav) */
.theme-toggle {
  background: none; border: 1px solid var(--line);
  color: var(--text-mid);
  width: 30px; height: 30px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: color var(--t), border-color var(--t), background var(--t);
  position: relative;
  padding: 0;
  font-size: 14px; line-height: 1;
}
.theme-toggle:hover { color: var(--gold); border-color: var(--gold-dim); }
.theme-toggle .theme-ico-sun,
.theme-toggle .theme-ico-moon {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  transition: opacity var(--t), transform var(--t);
}
.theme-toggle .theme-ico-sun  { opacity: 0; transform: translate(-50%, -50%) rotate(-90deg); }
.theme-toggle .theme-ico-moon { opacity: 1; }
:root[data-theme="light"] .theme-toggle .theme-ico-sun  { opacity: 1; transform: translate(-50%, -50%) rotate(0); }
:root[data-theme="light"] .theme-toggle .theme-ico-moon { opacity: 0; transform: translate(-50%, -50%) rotate(90deg); }

/* ── Nav ── */
nav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 40px; height: 60px;
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--line);
}
.logo {
  font-family: var(--serif); font-size: 17px; font-weight: 600;
  color: var(--text); text-decoration: none; letter-spacing: -0.01em;
}
.logo em { color: var(--gold); font-style: normal; }
.nav-r { display: flex; gap: 28px; list-style: none; align-items: center; }
.nav-r a {
  color: var(--text-mid); font-size: 13px; text-decoration: none;
  transition: color var(--t); letter-spacing: 0.01em;
}
.nav-r a:hover, .nav-r a.on { color: var(--text); }

/* ── Admin bar (shown when logged in) ── */
.adminbar {
  border-bottom: 1px solid rgba(212,169,106,0.08);
  padding: 9px 40px;
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--text-dim);
  background: rgba(212,169,106,0.02);
}
.adminbar-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 6px var(--green);
  flex-shrink: 0;
}
.adminbar-btn {
  margin-left: auto; font-family: var(--mono); font-size: 11px;
  color: var(--gold); background: rgba(212,169,106,0.07);
  border: 1px solid rgba(212,169,106,0.2);
  padding: 4px 13px; border-radius: 5px; cursor: pointer; transition: var(--t);
  text-decoration: none;
}
.adminbar-btn:hover { background: rgba(212,169,106,0.14); color: var(--gold); }

/* ── Section divider ── */
.sec {
  padding: 0 0 20px;
  display: flex; align-items: center; gap: 16px;
}
.sec-label {
  font-family: var(--mono); font-size: 11px;
  color: var(--text-dim); letter-spacing: 0.14em; text-transform: uppercase;
  white-space: nowrap;
}
.sec-line { flex: 1; height: 1px; background: var(--line); }
.sec-count { font-family: var(--mono); font-size: 11px; color: var(--text-dim); }

/* ── Footer ── */
footer {
  border-top: 1px solid var(--line);
  max-width: 820px; margin: 0 auto; padding: 28px 40px;
  display: flex; align-items: center; justify-content: space-between;
}
.footer-col {
  max-width: var(--col); margin: 0 auto; padding: 28px 40px;
}
.footer-l { font-family: var(--mono); font-size: 11px; color: var(--text-dim); }
.footer-l a { color: var(--gold-dim); text-decoration: none; }
.footer-r { display: flex; gap: 20px; }
.footer-r a { font-size: 12px; color: var(--text-dim); text-decoration: none; transition: color var(--t); }
.footer-r a:hover { color: var(--text); }

/* ══════════════════════════════════════
   HOME PAGE
══════════════════════════════════════ */
.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 56px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 40px;
  align-items: start;
}
.home-main { min-width: 0; }
.home-aside { min-width: 0; }

.aside-sec {
  display: flex; align-items: center; gap: 12px;
  padding: 0 0 14px;
}
.aside-sec-spaced { padding-top: 36px; }
.aside-more {
  font-family: var(--mono); font-size: 10px; color: var(--gold-dim);
  text-decoration: none; letter-spacing: 0.04em;
  transition: color var(--t);
}
.aside-more:hover { color: var(--gold); }

.aside-list { list-style: none; padding: 0; margin: 0; }
.aside-list li {
  border-bottom: 1px solid var(--line);
}
.aside-list li:last-child { border-bottom: none; }

.aside-link {
  display: block; text-decoration: none; color: inherit;
  padding: 14px 0;
  transition: opacity var(--t);
}
.aside-link:hover .aside-title { color: var(--gold); }
.aside-date {
  display: block;
  font-family: var(--mono); font-size: 10px; color: var(--text-dim);
  letter-spacing: 0.06em; margin-bottom: 5px;
}
.aside-title {
  display: block;
  font-family: var(--serif); font-size: 15px; font-weight: 500;
  line-height: 1.3; color: var(--text);
  letter-spacing: -0.005em;
  transition: color var(--t);
}
.aside-meta {
  display: block;
  font-family: var(--mono); font-size: 10px; color: var(--text-dim);
  margin-top: 6px; letter-spacing: 0.04em;
}
.aside-empty {
  font-family: var(--serif); font-style: italic;
  font-size: 13px; color: var(--text-dim);
  padding: 14px 0;
}

@media (max-width: 960px) {
  .home-grid {
    grid-template-columns: 1fr;
    max-width: 820px;
    gap: 0;
  }
  .home-aside { padding-top: 20px; padding-bottom: 60px; }
  .home-aside-inner { position: static; }
}

.hero {
  max-width: 820px;
  margin: 0 auto;
  padding: 88px 40px 72px;
}

/* Full-viewport hero (B plan): hero takes ~85vh, content vertically centered,
   bottom shows a subtle scroll-down affordance. */
.hero-fullscreen {
  position: relative;
  min-height: calc(100vh - 60px);   /* nav is 60px */
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 0;
  padding-bottom: 0;
}
.hero-fullscreen .hero-inner { padding: 80px 0; }

.scroll-down {
  position: absolute;
  left: 50%; bottom: 36px;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--text-dim);
  text-decoration: none;
  transition: color var(--t);
}
.scroll-down:hover { color: var(--gold); }
.scroll-down .scroll-arrow {
  font-size: 14px;
  animation: scroll-bounce 2s ease-in-out infinite;
}
@keyframes scroll-bounce {
  0%, 100% { transform: translateY(0);    opacity: 0.6; }
  50%      { transform: translateY(6px);  opacity: 1;   }
}

/* Scroll-reveal animation for items below the fold */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.55s ease, transform 0.55s ease;
  will-change: opacity, transform;
}
.reveal.is-revealed {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .scroll-down .scroll-arrow { animation: none; }
}

@media (max-width: 720px) {
  .hero-fullscreen { min-height: calc(100svh - 60px); }
  .scroll-down { bottom: 24px; }
}
.hero-name {
  font-family: var(--mono); font-size: 12px;
  color: var(--text-dim); letter-spacing: 0.14em; text-transform: uppercase;
  margin-bottom: 24px;
}
.hero-title {
  font-family: var(--serif); font-size: clamp(44px, 7vw, 84px);
  font-weight: 600; line-height: 1.05; letter-spacing: -0.025em;
  margin-bottom: 28px;
}
.hero-title em { font-style: italic; color: var(--gold); }
.hero-bio {
  font-size: 16px; color: var(--text-mid); line-height: 1.8;
  max-width: 520px; margin-bottom: 32px;
}
.hero-live {
  display: inline-flex; align-items: center; gap: 14px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 11px; color: var(--text-dim);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 9px 16px; letter-spacing: 0.04em; background: var(--bg-2);
}
.live-sep { color: var(--bg-3); }
.live-val { color: var(--text-mid); }
.live-val.warm { color: var(--gold); }

/* Project cards */
.project-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding: 0 0 80px;
}
@media (min-width: 1200px) {
  .project-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .project-list { grid-template-columns: 1fr; }
}
.project-item {
  position: relative;
  display: flex; flex-direction: column;
  padding: 26px 26px 60px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-2);
  cursor: pointer;
  transition: border-color var(--t), transform var(--t), background var(--t);
  text-decoration: none; color: inherit;
}
.project-item:hover {
  border-color: var(--line-h);
  background: var(--bg-3);
  transform: translateY(-2px);
}
.proj-num {
  position: absolute; top: 18px; right: 22px;
  font-family: var(--mono); font-size: 11px; color: var(--text-dim);
  letter-spacing: 0.06em;
}
.proj-title {
  font-family: var(--serif); font-size: 22px; font-weight: 600;
  letter-spacing: -0.015em; margin: 0 64px 8px 0; line-height: 1.2;
  transition: color var(--t);
}
.project-item:hover .proj-title { color: var(--gold); }
.proj-story {
  font-size: 13px; color: var(--text-mid); line-height: 1.65;
  margin-bottom: 14px; max-width: none;
}
.proj-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.status {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em;
}
.status-dot { width: 6px; height: 6px; border-radius: 50%; }
.status.live  .status-dot { background: var(--green); box-shadow: 0 0 5px var(--green); }
.status.live  { color: var(--green); }
.status.exp   .status-dot { background: var(--gold); }
.status.exp   { color: var(--gold-dim); }
.status.arch  .status-dot { background: var(--text-dim); }
.status.arch  { color: var(--text-dim); }
.proj-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  font-family: var(--mono); font-size: 10px; color: var(--text-dim);
  border: 1px solid var(--line); padding: 2px 7px; border-radius: 3px;
}
.proj-arrow {
  position: absolute; bottom: 18px; right: 22px;
  font-size: 16px; color: var(--text-dim);
  transition: var(--t);
}
.project-item:hover .proj-arrow { color: var(--gold); transform: translate(2px,-2px); }

/* ══════════════════════════════════════
   WRITING PAGE
══════════════════════════════════════ */
.writing-hero {
  max-width: var(--col); margin: 0 auto; padding: 88px 40px 56px;
}
.writing-eyebrow {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em;
  color: var(--text-dim); text-transform: uppercase; margin-bottom: 16px;
}
.writing-title {
  font-family: var(--serif); font-size: clamp(28px, 4vw, 46px);
  font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; margin-bottom: 16px;
}
.writing-title em { font-style: italic; color: var(--gold); }
.writing-desc { font-size: 15px; color: var(--text-mid); line-height: 1.8; }

.posts-wrap { max-width: var(--col); margin: 0 auto; padding: 0 40px 80px; }
.month-group { margin-bottom: 48px; }
.month-label {
  font-family: var(--mono); font-size: 11px; color: var(--text-dim);
  letter-spacing: 0.14em; text-transform: uppercase;
  padding-bottom: 12px; margin-bottom: 2px;
  border-bottom: 1px solid var(--line);
}
.post-item {
  padding: 22px 0; border-bottom: 1px solid var(--line);
  cursor: pointer; transition: border-color var(--t);
}
.post-item:hover { border-color: var(--line-h); }
.post-item-link { text-decoration: none; color: inherit; display: block; }
.post-item-inner {
  display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: start;
}
.post-item-inner.has-cover {
  grid-template-columns: 140px 1fr auto;
}
.post-cover {
  width: 140px; aspect-ratio: 16/10;
  background-size: cover; background-position: center;
  border-radius: 6px; border: 1px solid var(--line);
  transition: border-color var(--t), transform var(--t);
}
.post-item:hover .post-cover { border-color: var(--line-h); }
.post-title {
  font-family: var(--serif); font-size: 19px; font-weight: 600;
  letter-spacing: -0.015em; line-height: 1.25;
  margin-bottom: 7px; transition: color var(--t);
  text-decoration: none; color: inherit; display: block;
}
.post-item:hover .post-title { color: var(--gold); }
a.post-title:hover { color: var(--gold); }
.post-lede { font-size: 13px; color: var(--text-mid); line-height: 1.65; margin-bottom: 10px; }
.post-foot {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 10px; color: var(--text-dim); letter-spacing: 0.04em;
}
.post-tag-inline {
  color: var(--gold-dim); border: 1px solid rgba(212,169,106,0.15);
  padding: 1px 6px; border-radius: 3px; font-size: 10px; font-family: var(--mono);
}
.post-date-col {
  font-family: var(--mono); font-size: 11px; color: var(--text-dim);
  white-space: nowrap; padding-top: 3px; text-align: right;
}

/* ══════════════════════════════════════
   POST DETAIL
══════════════════════════════════════ */
.article-wrap { max-width: var(--col); margin: 0 auto; padding: 72px 40px 80px; }
.back-btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 11px; color: var(--text-dim);
  letter-spacing: 0.06em; text-decoration: none; margin-bottom: 48px;
  transition: color var(--t); background: none; border: none; padding: 0; cursor: pointer;
}
.back-btn:hover { color: var(--gold); }
.article-meta-top {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px;
}
.article-date { font-family: var(--mono); font-size: 11px; color: var(--text-dim); }
.article-title {
  font-family: var(--serif); font-size: clamp(26px,4.5vw,48px);
  font-weight: 700; letter-spacing: -0.025em; line-height: 1.1; margin-bottom: 20px;
}
.article-lede {
  font-size: 17px; color: var(--text-mid); line-height: 1.75;
  border-left: 2px solid rgba(212,169,106,0.5);
  padding-left: 18px; margin-bottom: 32px;
  font-style: italic; font-family: var(--serif);
}
.article-divider { height: 1px; background: var(--line); margin-bottom: 36px; }
.article-cover {
  margin: 28px 0 4px; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--line);
}
.article-cover img { display: block; width: 100%; height: auto; }

/* Markdown body */
.article-body { font-size: 16px; line-height: 1.85; color: var(--text-mid); }
.article-body h1, .article-body h2 {
  font-family: var(--serif); font-size: 24px; font-weight: 600;
  color: var(--text); letter-spacing: -0.015em;
  margin: 2.4em 0 0.8em; padding-top: 1.2em;
  border-top: 1px solid var(--line); line-height: 1.2;
}
.article-body h3 {
  font-family: var(--serif); font-size: 18px; font-weight: 600;
  color: var(--gold-dim); margin: 1.8em 0 0.6em;
}
.article-body p { margin-bottom: 1.3em; }
.article-body strong { color: var(--text); font-weight: 500; }
.article-body a { color: var(--gold); text-decoration: none; border-bottom: 1px solid rgba(212,169,106,0.3); }
.article-body code {
  font-family: var(--mono); font-size: 13px;
  background: var(--bg-3); border: 1px solid var(--line);
  color: var(--text); padding: 2px 7px; border-radius: 4px;
}
.article-body pre {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 22px; overflow-x: auto; margin: 1.6em 0;
}
.article-body pre code { background: none; border: none; padding: 0; font-size: 13px; color: var(--text-mid); }
.article-body blockquote {
  border-left: 2px solid rgba(212,169,106,0.45); padding: 4px 0 4px 20px;
  margin: 1.8em 0; font-style: italic; color: var(--text-mid); font-family: var(--serif);
}
.article-body ul, .article-body ol { padding-left: 1.4em; margin-bottom: 1.3em; }
.article-body li { margin-bottom: 0.4em; }

/* ── Inline images ─────────────────────────────────────────────────────── */
.article-body .article-img,
.article-body figure img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 2em auto;
  border-radius: 6px;
  border: 1px solid var(--line);
}
.article-body figure {
  margin: 2em 0;
  text-align: center;
}
.article-body figure img { margin: 0 auto; }
.article-body figcaption {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.article-body .img-xs   { max-width: 200px; }
.article-body .img-s    { max-width: 45%;   }
.article-body .img-m    { max-width: 70%;   }
.article-body .img-l    { max-width: 100%;  }
.article-body .img-full {
  max-width: min(960px, 92vw);
  width: min(960px, 92vw);
  margin-left:  calc(50% - min(480px, 46vw));
  margin-right: calc(50% - min(480px, 46vw));
}
.article-body .img-left  { float: left;  max-width: 45%; margin: 0.4em 1.5em 1em 0; }
.article-body .img-right { float: right; max-width: 45%; margin: 0.4em 0 1em 1.5em; }
.article-body p::after { content: ""; display: block; clear: both; }

@media (max-width: 720px) {
  .article-body .img-s,
  .article-body .img-m,
  .article-body .img-left,
  .article-body .img-right { max-width: 100%; float: none; margin: 2em auto; }
  .article-body .img-full  { width: 100%; max-width: 100%; margin: 2em 0; }
}

/* ── Comments ──────────────────────────────────────────────────────────── */
.comments-section {
  margin-top: 80px; padding-top: 40px;
  border-top: 1px solid var(--line);
}
.comments-heading {
  font-family: var(--serif); font-size: 22px; font-weight: 600;
  color: var(--text); margin-bottom: 6px; letter-spacing: -0.01em;
}
.comments-count {
  font-family: var(--mono); font-size: 12px; color: var(--text-dim);
  margin-left: 6px;
}
.comments-list { list-style: none; padding: 0; margin: 30px 0; }
.comment-item {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.comment-item:last-child { border-bottom: none; }
.comment-head {
  display: flex; align-items: baseline; gap: 12px; margin-bottom: 8px;
}
.comment-name {
  font-family: var(--sans); font-weight: 500; color: var(--gold);
  font-size: 14px;
}
.comment-time {
  font-family: var(--mono); font-size: 11px; color: var(--text-dim);
}
.comment-body {
  font-size: 15px; line-height: 1.7; color: var(--text-mid);
  white-space: pre-wrap; word-break: break-word;
}
.comment-empty {
  font-family: var(--serif); font-style: italic;
  color: var(--text-dim); font-size: 14px;
  margin: 30px 0;
}
.comment-form {
  margin-top: 36px; padding: 22px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px;
}
/* honeypot: completely off-screen but still focusable for bots */
.hp-field {
  position: absolute !important;
  left: -9999px !important; top: auto;
  width: 1px; height: 1px; overflow: hidden;
}
.comment-name-input,
.comment-body-input {
  width: 100%; background: var(--bg); border: 1px solid var(--line);
  color: var(--text); padding: 11px 14px; border-radius: 4px;
  font-family: var(--sans); font-size: 14px; outline: none;
  transition: border-color var(--t);
}
.comment-name-input:focus,
.comment-body-input:focus { border-color: var(--gold-dim); }
.comment-name-input  { margin-bottom: 10px; }
.comment-body-input  { resize: vertical; min-height: 100px; line-height: 1.6; font-family: var(--sans); }
.comment-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 12px; gap: 12px; flex-wrap: wrap;
}
.comment-hint {
  font-family: var(--mono); font-size: 10px; color: var(--text-dim);
  letter-spacing: 0.04em;
}
.comment-submit {
  background: var(--gold); color: var(--bg); border: none;
  font-family: var(--mono); font-size: 12px; font-weight: 500;
  padding: 9px 22px; border-radius: 4px; cursor: pointer;
  transition: opacity var(--t);
  letter-spacing: 0.04em;
}
.comment-submit:hover:not(:disabled) { opacity: 0.85; }
.comment-submit:disabled { opacity: 0.5; cursor: wait; }
.comment-msg {
  margin-top: 12px; font-family: var(--mono); font-size: 11px;
  min-height: 14px;
}
.comment-msg.is-info { color: var(--text-dim); }
.comment-msg.is-ok   { color: var(--green); }
.comment-msg.is-err  { color: var(--red); }

/* ══════════════════════════════════════
   ADMIN LAYOUT
══════════════════════════════════════ */
.admin-wrap {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: calc(100vh - 60px);
  transition: grid-template-columns var(--t);
}
.admin-wrap.side-collapsed { grid-template-columns: 56px 1fr; }

.admin-side {
  background: var(--bg-2); border-right: 1px solid var(--line);
  padding: 14px 0 28px;
  position: relative;
}
.admin-side-label {
  font-family: var(--mono); font-size: 10px; color: var(--text-dim);
  letter-spacing: 0.14em; text-transform: uppercase; padding: 0 22px 14px;
  white-space: nowrap; overflow: hidden;
  transition: opacity var(--t);
}
.side-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; margin: 0 0 14px auto;
  margin-right: 14px;
  background: var(--bg-3); border: 1px solid var(--line);
  color: var(--text-dim);
  border-radius: 4px; cursor: pointer;
  font-family: var(--mono); font-size: 13px; line-height: 1;
  transition: all var(--t);
  user-select: none;
}
.side-toggle:hover { color: var(--gold); border-color: var(--gold-dim); }

.side-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 22px; font-size: 13px; color: var(--text-mid);
  text-decoration: none; transition: var(--t);
  border-left: 2px solid transparent;
  white-space: nowrap; overflow: hidden;
  position: relative;
}
.side-item:hover { color: var(--text); background: rgba(255,255,255,0.02); }
.side-item.on { color: var(--gold); border-left-color: var(--gold); background: rgba(212,169,106,0.04); }
.side-icon { font-size: 13px; width: 16px; flex-shrink: 0; text-align: center; }
.side-label { transition: opacity var(--t); }

.admin-main { padding: 36px 40px; overflow-y: auto; min-width: 0; }

/* Collapsed state */
.admin-wrap.side-collapsed .admin-side-label,
.admin-wrap.side-collapsed .side-label {
  opacity: 0; pointer-events: none;
}
.admin-wrap.side-collapsed .side-item { padding: 9px 0; justify-content: center; }
.admin-wrap.side-collapsed .side-item .side-icon { width: 100%; }
.admin-wrap.side-collapsed .side-toggle { margin-right: auto; margin-left: auto; }
.admin-wrap.side-collapsed .side-item[style*="padding-left:40px"] { display: none !important; }

/* Tooltip on collapsed hover */
.admin-wrap.side-collapsed .side-item::after {
  content: attr(data-tip);
  position: absolute; left: 100%; top: 50%; transform: translateY(-50%);
  margin-left: 8px;
  background: var(--bg-3); color: var(--text);
  font-family: var(--mono); font-size: 11px;
  padding: 5px 10px; border-radius: 4px; border: 1px solid var(--line);
  white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity var(--t);
  z-index: 50;
}
.admin-wrap.side-collapsed .side-item:hover::after { opacity: 1; }

/* Admin typography */
.a-heading { font-family: var(--serif); font-size: 22px; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 4px; }
.a-sub { font-size: 13px; color: var(--text-dim); margin-bottom: 28px; }

/* Stats cards */
.stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; margin-bottom: 32px; }
.stat-box { background: var(--bg-3); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.stat-lbl { font-family: var(--mono); font-size: 10px; color: var(--text-dim); letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 8px; }
.stat-n { font-family: var(--serif); font-size: 32px; font-weight: 700; letter-spacing: -0.02em; }
.stat-n span { font-family: var(--mono); font-size: 12px; color: var(--gold); margin-left: 4px; }

/* Table */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-family: var(--mono); font-size: 10px; color: var(--text-dim);
  letter-spacing: 0.1em; text-transform: uppercase; padding: 9px 12px;
  border-bottom: 1px solid var(--line);
}
td { padding: 12px; font-size: 13px; border-bottom: 1px solid rgba(255,255,255,0.03); color: var(--text-mid); vertical-align: middle; }
tr:hover td { background: rgba(255,255,255,0.015); }
td strong { color: var(--text); }

/* Badges */
.badge { font-family: var(--mono); font-size: 10px; padding: 2px 8px; border-radius: 3px; letter-spacing: 0.04em; white-space: nowrap; }
.b-pub   { background: rgba(90,138,94,0.1);   color: #6aaa6e; border: 1px solid rgba(90,138,94,0.2); }
.b-draft { background: rgba(90,82,72,0.15);   color: var(--text-dim); border: 1px solid var(--line); }
.b-vis   { background: rgba(212,169,106,0.07); color: var(--gold-dim); border: 1px solid rgba(212,169,106,0.15); }
.b-hid   { background: rgba(90,82,72,0.1);    color: var(--text-dim); border: 1px solid var(--line); }

/* Buttons */
.act {
  font-family: var(--mono); font-size: 11px; padding: 3px 10px; border-radius: 4px;
  border: 1px solid var(--line); color: var(--text-dim); background: none;
  cursor: pointer; transition: var(--t); margin-right: 4px; text-decoration: none; display: inline-block;
}
.act:hover { border-color: var(--line-h); color: var(--text); }
.act.del:hover { border-color: rgba(192,97,74,0.35); color: var(--red); }
.new-btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--gold); color: #0e0c0a; font-weight: 600; font-size: 13px;
  padding: 8px 20px; border-radius: 6px; border: none; cursor: pointer;
  transition: var(--t); margin-bottom: 22px; font-family: var(--sans); text-decoration: none;
}
.new-btn:hover { background: #e0b97a; color: #0e0c0a; }
.pub-btn {
  background: var(--gold); color: #0e0c0a; font-weight: 600; font-size: 13px;
  padding: 8px 22px; border-radius: 6px; border: none; cursor: pointer;
  transition: var(--t); font-family: var(--sans);
}
.pub-btn:hover { background: #e0b97a; }
.ghost-btn {
  background: none; border: 1px solid var(--line); color: var(--text-mid); font-size: 13px;
  padding: 8px 18px; border-radius: 6px; cursor: pointer; transition: var(--t);
  font-family: var(--sans); text-decoration: none; display: inline-block;
}
.ghost-btn:hover { border-color: var(--line-h); color: var(--text); }

/* Forms */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.f-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.f-label { font-family: var(--mono); font-size: 10px; color: var(--text-dim); letter-spacing: 0.12em; text-transform: uppercase; }
.f-input {
  background: var(--bg-3); border: 1px solid var(--line); border-radius: 6px;
  padding: 9px 12px; color: var(--text); font-family: var(--sans); font-size: 13px;
  outline: none; transition: border-color var(--t); width: 100%;
}
.f-input:focus { border-color: rgba(212,169,106,0.35); }
.f-input::placeholder { color: var(--text-dim); }
.f-select {
  background: var(--bg-3); border: 1px solid var(--line); border-radius: 6px;
  padding: 9px 12px; color: var(--text); font-family: var(--sans); font-size: 13px;
  outline: none; cursor: pointer; width: 100%;
}
.f-select:focus { border-color: rgba(212,169,106,0.35); }
.editor-actions { display: flex; gap: 8px; margin: 16px 0 20px; align-items: center; }

/* Markdown editor split */
.editor-split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; height: calc(100vh - 360px); min-height: 320px; }
.ed-pane { background: var(--bg-3); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.pane-top { padding: 9px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.pane-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--gold); opacity: 0.7; }
.pane-lbl { font-family: var(--mono); font-size: 10px; color: var(--text-dim); letter-spacing: 0.14em; text-transform: uppercase; }
.ed-area { flex: 1; background: none; border: none; padding: 18px; color: var(--text); font-family: var(--mono); font-size: 13px; line-height: 1.75; resize: none; outline: none; }
.prev-body { flex: 1; padding: 18px; overflow-y: auto; font-size: 14px; line-height: 1.8; color: var(--text-mid); }

/* Error message */
.form-error {
  background: rgba(192,97,74,0.1); border: 1px solid rgba(192,97,74,0.25);
  color: var(--red); font-size: 13px; padding: 10px 14px; border-radius: 6px;
  margin-bottom: 16px;
}

/* Section label (admin) */
.tbl-head {
  font-family: var(--mono); font-size: 10px; color: var(--text-dim);
  letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 12px;
}

/* Mono text helpers */
.mono-sm { font-family: var(--mono); font-size: 11px; color: var(--text-dim); }
