/* ═══════════════════════════════════════════════════════════
   LazyCoder — Design System
   Monochrome editorial palette. No borders, only tonal depth.
   ═══════════════════════════════════════════════════════════ */

/* ── Design tokens ──────────────────────────────────────── */
/* Shared */
:root {
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-serif: 'Lora', Georgia, 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', ui-monospace, monospace;

  --reading-width: 70ch;
  --nav-height: 4.5rem;
  --radius: 0.25rem;
  --radius-full: 9999px;

  --transition: 200ms ease;
}

/* Default fallback (before theme classes — overridden when theme is set) */
:root {
  --surface: #f8f8fc;
  --surface-container-low: #f0f0f6;
  --surface-container: #e4e4ee;
  --surface-high: #d6d6e4;
  --surface-highest: #c8c8d8;
  --surface-dim: #babac8;

  --primary: #5a4e9e;
  --on-primary: #f8f8fc;
  --on-surface: #1a1b2e;
  --secondary: #565a7e;
  --on-surface-variant: #3b3d5c;
  --tertiary: #6b5eb8;
  --outline-variant: #a0a0be;
}

html.dark {
  --surface: #000000;
  --surface-container-low: #070711;
  --surface-container: #0e0e1a;
  --surface-high: #151525;
  --surface-highest: #1c1c30;
  --surface-dim: #070711;

  --primary: #bb9af7;
  --on-primary: #000000;
  --on-surface: #c0caf5;
  --secondary: #7aa2f7;
  --on-surface-variant: #a9b1d6;
  --tertiary: #7dcfff;
  --outline-variant: #565f89;
}

/* ── Amber — warm gold, editorial feel ──────────────────── */
.theme-amber {
  --surface: #fafaf8;
  --surface-container-low: #f3f1ec;
  --surface-container: #ebe8e0;
  --surface-high: #e2ded4;
  --surface-highest: #d9d4c8;
  --surface-dim: #d0cab8;

  --primary: #b1740d;
  --on-primary: #fafaf8;
  --on-surface: #1c1917;
  --secondary: #6b5f4e;
  --on-surface-variant: #524a3e;
  --tertiary: #8b6914;
  --outline-variant: #c4b898;
}

html.dark.theme-amber {
  --surface: #1a1815;
  --surface-container-low: #1f1d18;
  --surface-container: #25231c;
  --surface-high: #2b2820;
  --surface-highest: #322e25;
  --surface-dim: #151310;

  --primary: #e0a63a;
  --on-primary: #1a1815;
  --on-surface: #e0d8c8;
  --secondary: #a89878;
  --on-surface-variant: #c4b898;
  --tertiary: #d4a038;
  --outline-variant: #5c5040;
}

/* ── Blue — professional, clean tech ────────────────────── */
.theme-blue {
  --surface: #f8fafb;
  --surface-container-low: #f0f4f8;
  --surface-container: #e3e8ef;
  --surface-high: #d5dde6;
  --surface-highest: #c8d1dd;
  --surface-dim: #bcc5d2;

  --primary: #2563eb;
  --on-primary: #f8fafb;
  --on-surface: #1e293b;
  --secondary: #475569;
  --on-surface-variant: #334155;
  --tertiary: #3b82f6;
  --outline-variant: #94a3b8;
}

html.dark.theme-blue {
  --surface: #0f1724;
  --surface-container-low: #141d2e;
  --surface-container: #1a2338;
  --surface-high: #202a42;
  --surface-highest: #26314d;
  --surface-dim: #0a1018;

  --primary: #5b9cf5;
  --on-primary: #0f1724;
  --on-surface: #c8d2e0;
  --secondary: #7b93b8;
  --on-surface-variant: #94a8c8;
  --tertiary: #7db8f8;
  --outline-variant: #3b5068;
}

/* ── Green — organic, calm, open-source ─────────────────── */
.theme-green {
  --surface: #f6f8f5;
  --surface-container-low: #eef1ec;
  --surface-container: #e2e7df;
  --surface-high: #d5dcd2;
  --surface-highest: #c9d1c5;
  --surface-dim: #bcc5b8;

  --primary: #3b6b4d;
  --on-primary: #f6f8f5;
  --on-surface: #2d3a2c;
  --secondary: #5a6b58;
  --on-surface-variant: #3d4e3b;
  --tertiary: #4a825a;
  --outline-variant: #a4b8a0;
}

html.dark.theme-green {
  --surface: #162018;
  --surface-container-low: #1a251c;
  --surface-container: #1f2b21;
  --surface-high: #243126;
  --surface-highest: #29382c;
  --surface-dim: #111812;

  --primary: #6b9e7a;
  --on-primary: #162018;
  --on-surface: #c8d4c4;
  --secondary: #889e84;
  --on-surface-variant: #a8bca4;
  --tertiary: #7ab88a;
  --outline-variant: #3c503c;
}

/* ── Red — bold, distinctive ────────────────────────────── */
.theme-red {
  --surface: #fdfaf9;
  --surface-container-low: #f7f0ef;
  --surface-container: #efe3e0;
  --surface-high: #e6d6d2;
  --surface-highest: #dcc9c4;
  --surface-dim: #d2bcb6;

  --primary: #c1292e;
  --on-primary: #fdfaf9;
  --on-surface: #1f1817;
  --secondary: #6b504e;
  --on-surface-variant: #52403e;
  --tertiary: #d44444;
  --outline-variant: #c4a8a2;
}

html.dark.theme-red {
  --surface: #1a1012;
  --surface-container-low: #1f1416;
  --surface-container: #25191b;
  --surface-high: #2b1e20;
  --surface-highest: #322326;
  --surface-dim: #140c0e;

  --primary: #e0555a;
  --on-primary: #1a1012;
  --on-surface: #dcc8c4;
  --secondary: #b09088;
  --on-surface-variant: #c4a898;
  --tertiary: #e86868;
  --outline-variant: #5c3c40;
}

/* ── Tokyo Night — dev vibe, neon accents ───────────────── */
.theme-tokyo {
  --surface: #f8f8fc;
  --surface-container-low: #f0f0f6;
  --surface-container: #e4e4ee;
  --surface-high: #d6d6e4;
  --surface-highest: #c8c8d8;
  --surface-dim: #babac8;

  --primary: #5a4e9e;
  --on-primary: #f8f8fc;
  --on-surface: #1a1b2e;
  --secondary: #565a7e;
  --on-surface-variant: #3b3d5c;
  --tertiary: #6b5eb8;
  --outline-variant: #a0a0be;
}

html.dark.theme-tokyo {
  --surface: #000000;
  --surface-container-low: #070711;
  --surface-container: #0e0e1a;
  --surface-high: #151525;
  --surface-highest: #1c1c30;
  --surface-dim: #070711;

  --primary: #bb9af7;
  --on-primary: #000000;
  --on-surface: #c0caf5;
  --secondary: #7aa2f7;
  --on-surface-variant: #a9b1d6;
  --tertiary: #7dcfff;
  --outline-variant: #565f89;
}

/* Dark mode glow — neon text-shadow on dark background */
@keyframes phantom-glow {
  0% {
    text-shadow:
      0 0 5px var(--secondary),
      0 0 10px var(--primary);
  }

  50% {
    text-shadow:
      0 0 8px var(--tertiary),
      0 0 15px var(--primary);
  }

  100% {
    text-shadow:
      0 0 5px var(--secondary),
      0 0 10px var(--primary);
  }
}

/* Light mode glow — wider blur, lower opacity for light backgrounds */
@keyframes light-glow {

  0%,
  100% {
    text-shadow:
      0 0 8px color-mix(in srgb, var(--primary) 18%, transparent);
  }

  50% {
    text-shadow:
      0 0 16px color-mix(in srgb, var(--primary) 30%, transparent),
      0 0 28px color-mix(in srgb, var(--tertiary) 15%, transparent);
  }
}

.nav-logo,
.nav-link--active,
.nav-link:hover,
.prose a:hover,
.article-card-title a:hover,
.read-more:hover {
  animation: light-glow 3s infinite alternate;
}

html.dark .nav-logo,
html.dark .nav-link--active,
html.dark .nav-link:hover,
html.dark .prose a:hover,
html.dark .article-card-title a:hover,
html.dark .read-more:hover {
  animation: phantom-glow 3s infinite alternate;
  color: var(--on-surface);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  background: var(--surface);
  color: var(--on-surface);
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition), color var(--transition);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
  padding-top: var(--nav-height);
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  font-family: inherit;
  background: none;
  border: none;
}


/* ── Navigation ─────────────────────────────────────────── */
.site-nav {
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 100;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--outline-variant) 30%, transparent);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 2rem;
  height: var(--nav-height);
}

.nav-logo {
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  gap: 2.5rem;
}

.nav-link {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--secondary);
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}

.nav-link:hover,
.nav-link--active {
  color: var(--on-surface);
  border-bottom-color: var(--primary);
}

.nav-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-full);
  color: var(--on-surface);
  transition: background var(--transition);
}

.btn-icon:hover {
  background: var(--surface-high);
}

/* Nav dropdowns (settings, account) */
.nav-dropdown {
  position: relative;
}
.nav-dropdown-panel {
  /* position:fixed because popovers live in the top layer (no ancestor context) */
  position: fixed;
  inset: auto;
  margin: 0;
  color: var(--on-surface);
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--outline-variant) 30%, transparent);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 0.5rem;
  min-width: 10rem;
  z-index: 150;
}
.nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  color: var(--on-surface);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 150ms;
  text-decoration: none;
  border: none;
  background: none;
  font-family: inherit;
}
.nav-dropdown-item:hover {
  background: var(--surface-container-low);
}
.nav-dropdown-label {
  padding: 0.25rem 0.75rem 0.5rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--secondary);
}
.nav-dropdown-sep {
  height: 1px;
  background: color-mix(in srgb, var(--outline-variant) 30%, transparent);
  margin: 0.25rem 0;
}
.theme-dots {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}
.theme-dot {
  width: 0.875rem;
  height: 0.875rem;
  border-radius: var(--radius-full);
  flex-shrink: 0;
  cursor: pointer;
  border: 2px solid transparent;
  padding: 0;
  transition: transform 150ms;
}
.theme-dot:hover {
  transform: scale(1.2);
}

/* Theme toggle icon visibility */

html.dark .theme-icon-dark {
  display: none;
}


/* ── Site footer ────────────────────────────────────────── */
.site-footer {
  background: var(--surface-container-low);
  margin-top: 8rem;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem;
  max-width: 72rem;
  margin: 0 auto;
  padding: 3rem 2rem;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.footer-logo {
  font-weight: 900;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.footer-copy {
  font-size: 0.75rem;
  color: var(--secondary);
}

.footer-links {
  display: flex;
  gap: 2rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--secondary);
}

.footer-links a:hover {
  color: var(--on-surface);
}

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 0.875rem;
  letter-spacing: 0.02em;
  transition: opacity var(--transition), background var(--transition);
  white-space: nowrap;
}

.btn--primary {
  background: var(--primary);
  color: var(--on-primary);
}

.btn--primary:hover {
  opacity: 0.85;
}

.btn--ghost {
  background: transparent;
  color: var(--on-surface);
  border: 1px solid rgba(198, 198, 198, 0.35);
}

.btn--ghost:hover {
  background: var(--surface-high);
}

.btn--sm {
  padding: 0.375rem 1rem;
  font-size: 0.8rem;
}

.btn--full {
  width: 100%;
  justify-content: center;
}

/* ── Pills / Tags ───────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 400;
  background: var(--surface-container-low);
  color: var(--on-surface);
  transition: background var(--transition), color var(--transition);
}

.pill:hover {
  background: var(--surface-high);
}

.pill--active {
  background: var(--primary);
  color: var(--on-primary);
}

.pill--primary {
  background: var(--primary);
  color: var(--on-primary);
}

.pill--sm {
  padding: 0.2rem 0.6rem;
  font-size: 0.6rem;
}

/* ── Section label ──────────────────────────────────────── */
.section-label {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--secondary);
  margin-bottom: 3rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--outline-variant);
  opacity: 0.3;
}

/* ── Hero ───────────────────────────────────────────────── */
.hero {
  padding-top: 6rem;
  padding-bottom: 4rem;
  border-bottom: 1px solid color-mix(in srgb, var(--outline-variant) 30%, transparent);
}

.hero-inner {
  display: flex;
  align-items: center;
  gap: 3rem;
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 2rem;
}

.hero-avatar {
  flex-shrink: 0;
}

.hero-avatar-placeholder {
  width: 7rem;
  height: 7rem;
  border-radius: var(--radius-full);
  background: var(--surface-container-low);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--secondary);
}

/* Mascot avatar — cropped from sprite sheet (2752×1536, displayed at half size) */
.hero-avatar-sprite {
  width: 7rem;
  height: 7rem;
  border-radius: var(--radius-full);
  background-image: url('/static/img/lazycoder-sprite-sheet.avif');
  background-size: 1376px 768px;
  background-position: -691px -143px;
  background-repeat: no-repeat;
}

/* Avatar rotation — cycle through 6 mascot variants */
@keyframes avatar-cycle {

  0%,
  14% {
    background-position: -691px -143px;
  }

  /* (a) Default */
  17%,
  31% {
    background-position: -803px -143px;
  }

  /* (b) Sunglasses */
  34%,
  48% {
    background-position: -915px -143px;
  }

  /* (c) Headphones */
  51%,
  64% {
    background-position: -691px -300px;
  }

  /* (d) Reading Python */
  67%,
  81% {
    background-position: -803px -300px;
  }

  /* (e) On cloud */
  84%,
  100% {
    background-position: -915px -300px;
  }

  /* (f) Server rack */
}

.hero-avatar-sprite:hover {
  animation: avatar-cycle 4s steps(1) infinite;
}

/* Individual avatar variants (use via class) */
.avatar--default {
  background-position: -691px -143px;
}

.avatar--sunglasses {
  background-position: -803px -143px;
}

.avatar--headphones {
  background-position: -915px -143px;
}

.avatar--reading {
  background-position: -691px -300px;
}

.avatar--cloud {
  background-position: -803px -300px;
}

.avatar--server {
  background-position: -915px -300px;
}

/* ── Icon Set (calc-based, scales with --icon-size) ────────── */
/* Usage: <div class="sprite-icon icon--plant"></div>          */
.sprite-icon {
  --icon-size: 48px;
  display: inline-block;
  width: var(--icon-size);
  height: var(--icon-size);
  background-image: url('/static/img/lazycoder-sprite-sheet.avif');
  background-size:
    calc(2752 / 180 * var(--icon-size)) calc(1536 / 180 * var(--icon-size));
  background-repeat: no-repeat;
}

/* Row 1 */
.icon--plant {
  background-position: calc(-2137 / 180 * var(--icon-size)) calc(-300 / 180 * var(--icon-size));
}

.icon--mug {
  background-position: calc(-2305 / 180 * var(--icon-size)) calc(-300 / 180 * var(--icon-size));
}

.icon--books {
  background-position: calc(-2490 / 180 * var(--icon-size)) calc(-300 / 180 * var(--icon-size));
}

/* Row 2 */
.icon--terminal {
  background-position: calc(-2137 / 180 * var(--icon-size)) calc(-505 / 180 * var(--icon-size));
}

.icon--document {
  background-position: calc(-2305 / 180 * var(--icon-size)) calc(-505 / 180 * var(--icon-size));
}

.icon--gear {
  background-position: calc(-2490 / 180 * var(--icon-size)) calc(-505 / 180 * var(--icon-size));
}

/* Row 3 */
.icon--cloud {
  background-position: calc(-2137 / 180 * var(--icon-size)) calc(-730 / 180 * var(--icon-size));
}

.icon--mascot1 {
  background-position: calc(-2305 / 180 * var(--icon-size)) calc(-730 / 180 * var(--icon-size));
}

.icon--mascot2 {
  background-position: calc(-2490 / 180 * var(--icon-size)) calc(-730 / 180 * var(--icon-size));
}

/* ── Activity Frames (mascot poses for empty states) ──────── */
/* Usage: <div class="activity-frame frame--neon"></div>        */
.activity-frame {
  --frame-size: 250px;
  width: var(--frame-size);
  height: var(--frame-size);
  border-radius: var(--radius);
  background-image: url('/static/img/lazycoder-sprite-sheet.avif');
  background-repeat: no-repeat;
  background-size:
    calc(2752 / 350 * var(--frame-size))
    calc(1536 / 350 * var(--frame-size));
}

.frame--neon   { background-position: calc(-110 / 350 * var(--frame-size)) calc(-970 / 350 * var(--frame-size)); }
.frame--server { background-position: calc(-480 / 350 * var(--frame-size)) calc(-970 / 350 * var(--frame-size)); }
.frame--typing { background-position: calc(-850 / 350 * var(--frame-size)) calc(-970 / 350 * var(--frame-size)); }

/* ── Profile Banner (About page header) ──────────────────── */
/* Usage: <div class="profile-banner"></div>                    */
.profile-banner {
  --banner-width: 820px;
  max-width: 100%;
  width: var(--banner-width);
  height: calc(var(--banner-width) * 420 / 820);
  border-radius: 12px;
  background-image: url('/static/img/lazycoder-sprite-sheet.avif');
  background-repeat: no-repeat;
  background-size:
    calc(2752 / 820 * var(--banner-width))
    calc(1536 / 820 * var(--banner-width));
  background-position:
    calc(-1880 / 820 * var(--banner-width))
    calc(-1000 / 820 * var(--banner-width));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.hero-avatar img {
  width: 7rem;
  height: 7rem;
  border-radius: var(--radius-full);
  object-fit: cover;
}

.hero-name {
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  margin-bottom: 0.75rem;
}

.hero-bio {
  font-size: 1.25rem;
  color: var(--secondary);
  font-weight: 300;
  line-height: 1.6;
}

/* ── Topic filter ───────────────────────────────────────── */
.topic-filter {
  border-bottom: 1px solid rgba(198, 198, 198, 0.15);
}

.topic-filter-inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.25rem 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.topic-filter-inner::-webkit-scrollbar {
  display: none;
}

.topic-label {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.topic-pills {
  display: flex;
  gap: 0.5rem;
  flex-wrap: nowrap;
}

/* ── Article list ───────────────────────────────────────── */
.article-list {
  padding: 5rem 0;
}

.article-list-inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 2rem;
}

.articles {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.article-card {
  width: 100%;
  padding: 3.5rem 0;
  border-bottom: 1px solid rgba(198, 198, 198, 0.3);
}

.article-card:last-child {
  border-bottom: none;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--secondary);
  margin-bottom: 1rem;
}

.meta-sep {
  opacity: 0.4;
}

.article-card-title {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

.article-card-title a:hover {
  color: var(--secondary);
}

.article-card-excerpt {
  font-size: 1.125rem;
  font-family: var(--font-serif);
  color: var(--secondary);
  line-height: 1.5;
  margin-bottom: 1.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.25rem;
}

.article-tags {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.read-more {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
  transition: gap var(--transition);
}

.read-more:hover {
  gap: 0.5rem;
}

.read-more-icon {
  font-size: 1rem;
}

.load-more {
  margin-top: 4rem;
}

/* ── List page (series / tag) ───────────────────────────── */
.list-page {
  padding-top: 4rem;
}

.list-header {
  max-width: 72rem;
  margin: 0 auto;
  padding: 3rem 2rem 4rem;
}

.list-header-label {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--secondary);
  margin-bottom: 1rem;
}

.list-title {
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  margin-bottom: 1rem;
}

.list-description {
  color: var(--secondary);
  font-size: 1.125rem;
}

.series-article-list {
  max-width: var(--reading-width);
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.series-list-item {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.series-list-number {
  font-size: 2rem;
  font-weight: 900;
  color: var(--surface-highest);
  flex-shrink: 0;
  min-width: 2rem;
  line-height: 1;
}

/* ── Article page ───────────────────────────────────────── */
.article-page {
  max-width: 56rem;
  margin: 0 auto;
  padding: 5rem 2rem 6rem;
}

.article-header {
  text-align: center;
  margin-bottom: 4rem;
}

.article-header-tags {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.article-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin-bottom: 1.5rem;
}

.article-byline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--secondary);
}

.byline-sep {
  opacity: 0.4;
}

.article-series-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--secondary);
}

.article-series-badge a {
  color: var(--primary);
  font-weight: 700;
}

.article-hero-image {
  margin-bottom: 4rem;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 21/9;
  background: var(--surface-container-low);
}

.article-hero-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1);
  opacity: 0.9;
  transition: filter 1s ease, opacity 1s ease;
}

.article-hero-image img:hover {
  filter: none;
  opacity: 1;
}

.article-lead {
  max-width: var(--reading-width);
  margin: 0 auto 3.5rem;
  padding-left: 1.5rem;
  border-left: 3px solid var(--primary);
}

.article-lead p {
  font-size: 1.375rem;
  font-weight: 300;
  line-height: 1.6;
  color: var(--on-surface-variant);
  font-style: italic;
}

/* ── Prose (article body) ───────────────────────────────── */
.prose {
  max-width: var(--reading-width);
  margin: 0 auto;
}

.prose p {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  line-height: 1.8;
  color: var(--on-surface);
  margin-bottom: 1.75rem;
  font-weight: 400;
}

.prose h2 {
  font-family: var(--font-sans);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 3.5rem 0 1.25rem;
  color: var(--on-surface);
}

.prose h3 {
  font-family: var(--font-sans);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 2.5rem 0 1rem;
  color: var(--on-surface);
}

.prose ul,
.prose ol {
  padding-left: 2rem;
  margin-bottom: 1.75rem;
}

.prose li {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  line-height: 1.8;
  color: var(--on-surface);
  margin-bottom: 0.5rem;
}

.prose blockquote {
  font-family: var(--font-serif);
  border-left: 3px solid var(--on-surface);
  padding: 0 1.5rem;
  margin: 2.5rem 0;
  font-style: italic;
  color: var(--on-surface-variant);
  font-size: 1.25rem;
  line-height: 1.6;
}

.prose a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--surface-highest);
  padding: 0.15em 0.4em;
  border-radius: 0.2rem;
}

.prose strong {
  font-weight: 700;
  color: var(--on-surface);
}

.prose img {
  border-radius: var(--radius);
  margin: 2rem 0;
}

/* Code block */
.prose pre {
  background: var(--surface-highest);
  padding: 1.75rem 2rem;
  margin: 2.5rem 0;
  overflow-x: auto;
  border-radius: var(--radius);
  position: relative;
}

.prose pre code {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.7;
  background: none;
  padding: 0;
  border-radius: 0;
  color: var(--on-surface);
}

.code-filename {
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--secondary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.copy-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--secondary);
  background: var(--surface-high);
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius);
  transition: opacity var(--transition);
}

.copy-btn:hover {
  opacity: 0.7;
}

/* ── Series nav (within article) ────────────────────────── */
.series-nav {
  max-width: var(--reading-width);
  margin: 4rem auto;
  padding: 2rem;
  background: var(--surface-container-low);
  border-radius: var(--radius);
}

.series-nav-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--secondary);
  margin-bottom: 1.25rem;
}

.series-nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.series-nav-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.series-nav-list li a {
  font-weight: 600;
  font-size: 0.9375rem;
}

.series-nav-current a {
  font-weight: 800;
}

.series-nav-current::before {
  content: '▶  ';
  font-size: 0.7rem;
  color: var(--primary);
}

.series-nav-meta {
  font-size: 0.7rem;
  color: var(--secondary);
}

/* ── Related articles ───────────────────────────────────── */
.related-articles {
  max-width: var(--reading-width);
  margin: 4rem auto;
  padding-top: 4rem;
  border-top: 1px solid rgba(198, 198, 198, 0.2);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.related-card {
  padding: 1.5rem;
  background: var(--surface-container-low);
  border-radius: var(--radius);
  transition: background var(--transition);
}

.related-card:hover {
  background: var(--surface-container);
}

.related-card-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 0.5rem;
}

.related-card-meta {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--secondary);
}

/* ── Article footer ─────────────────────────────────────── */
.article-footer {
  max-width: var(--reading-width);
  margin: 3rem auto 0;
  padding-top: 2rem;
  border-top: 1px solid rgba(198, 198, 198, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.article-share {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.share-label {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--secondary);
}

.share-sep {
  width: 1px;
  height: 1.25rem;
  background: var(--outline-variant);
  opacity: 0.4;
}

.article-tags-footer {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ── Like button ────────────────────────────────────────── */
.like-btn {
  color: var(--secondary);
  transition: color var(--transition), transform var(--transition);
}

.like-btn:hover {
  color: #e91e63;
}

.like-btn.liked {
  color: #e91e63;
}

.like-btn.liked .like-icon {
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.like-btn:active {
  transform: scale(1.3);
}

.like-count {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--secondary);
  min-width: 1ch;
  transition: color var(--transition);
}

.like-btn.liked+.like-count {
  color: #e91e63;
}

/* ── Empty state ────────────────────────────────────────── */
.empty-state {
  color: var(--secondary);
  font-size: 1rem;
  padding: 3rem 0;
}

/* ── Form components (shared public + admin) ────────────── */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--secondary);
  margin-bottom: 0.5rem;
}

.form-hint {
  font-size: 0.7rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--secondary);
  opacity: 0.7;
}

.form-input {
  width: 100%;
  background: var(--surface-container-low);
  border: 1px solid color-mix(in srgb, var(--outline-variant) 30%, transparent);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
  font-family: var(--font-sans);
  color: var(--on-surface);
  transition: border-color 180ms ease-out, box-shadow 180ms ease-out;
  outline: none;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}

.form-input::placeholder {
  color: var(--secondary);
  opacity: 0.6;
}

select.form-input {
  cursor: pointer;
}

textarea.form-input {
  resize: vertical;
}

.form-error-banner {
  background: #fef2f2;
  color: #b91c1c;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
}

html.dark .form-error-banner {
  background: #450a0a;
  color: #fca5a5;
}

.form-success-banner {
  background: #f0fdf4;
  color: #166534;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
}

html.dark .form-success-banner {
  background: #052e16;
  color: #86efac;
}

/* ── Search overlay ─────────────────────────────────────── */
.search-overlay {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  align-items: flex-start;
  justify-content: center;
  padding-top: calc(var(--nav-height) + 2rem);
}

.search-overlay[hidden] {
  display: none;
}

.search-overlay-inner {
  width: 100%;
  max-width: 44rem;
  padding: 0 1.5rem;
}

.search-overlay-form {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface-container);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
}

.search-overlay-icon {
  color: var(--secondary);
  flex-shrink: 0;
}

.search-overlay-form input[type="search"] {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 1.125rem;
  font-family: var(--font-sans);
  color: var(--on-surface);
  min-width: 0;
}

.search-overlay-form input[type="search"]::placeholder {
  color: var(--secondary);
  opacity: 0.6;
}

/* Remove native search-clear button */
.search-overlay-form input[type="search"]::-webkit-search-cancel-button {
  display: none;
}

/* ── Search page ─────────────────────────────────────────── */
.search-page {
  padding-top: 5rem;
  padding-bottom: 6rem;
}

.search-page-inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 2rem;
}

.search-heading {
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  margin-bottom: 2.5rem;
}

.search-page-form {
  display: flex;
  gap: 1rem;
  align-items: stretch;
  margin-bottom: 3rem;
}

.search-input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface-container-low);
  border: 1px solid rgba(198, 198, 198, 0.2);
  border-radius: var(--radius);
  padding: 0.625rem 0.875rem;
  transition: border-color var(--transition);
}

.search-input-wrap:focus-within {
  border-color: var(--primary);
}

.search-icon-inline {
  color: var(--secondary);
  flex-shrink: 0;
}

.search-page-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 1rem;
  font-family: var(--font-sans);
  color: var(--on-surface);
  min-width: 0;
}

.search-page-input::placeholder {
  color: var(--secondary);
  opacity: 0.6;
}

.search-page-input::-webkit-search-cancel-button {
  display: none;
}

.search-results-header {
  margin-bottom: 2.5rem;
}

.search-count {
  font-size: 0.875rem;
  color: var(--secondary);
}

.search-count strong {
  color: var(--on-surface);
}

.search-results {
  display: flex;
  flex-direction: column;
  gap: 4rem;
}

.search-result-card {
  max-width: var(--reading-width);
}

.search-result-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 0.75rem;
}

.search-result-title a:hover {
  color: var(--secondary);
}

.search-result-excerpt {
  font-size: 1rem;
  color: var(--secondary);
  line-height: 1.7;
  margin-bottom: 1rem;
}

/* Highlight from ts_headline */
.search-result-excerpt mark,
mark {
  background: transparent;
  color: var(--on-surface);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: rgba(0, 0, 0, 0.35);
  text-underline-offset: 2px;
}

html.dark mark {
  text-decoration-color: rgba(255, 255, 255, 0.35);
}

.search-empty {
  padding: 4rem 0;
  color: var(--secondary);
}

.search-empty a {
  color: var(--primary);
  text-decoration: underline;
}

/* ── Reader auth nav ─────────────────────────────────────── */
/* Guest nav: visible by default; hidden when reader-logged-in */
.reader-guest {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

html.reader-logged-in .reader-guest {
  display: none;
}

/* Member nav: hidden by default; shown when reader-logged-in */
.reader-member {
  display: none;
  align-items: center;
  gap: 0.25rem;
}

html.reader-logged-in .reader-member {
  display: flex;
}

.nav-link--auth {
  font-size: 0.875rem;
  color: var(--secondary);
}

.nav-link--auth:hover {
  color: var(--primary);
}

/* ── Auth pages (reader login / register) ────────────────── */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-container-low);
  padding: 2rem 1rem;
}

.auth-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
}

.auth-logo {
  display: block;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--primary);
  margin-bottom: 1.5rem;
  text-decoration: none;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: var(--on-surface);
}

.auth-subtitle {
  color: var(--secondary);
  margin-bottom: 1.75rem;
  font-size: 0.9rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-footer-link {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.875rem;
  color: var(--secondary);
}

.auth-footer-link a {
  color: var(--primary);
}

/* OAuth buttons */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.25rem 0;
  color: var(--secondary);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--outline-variant);
  opacity: 0.4;
}

.oauth-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.btn--oauth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.5rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
  transition: opacity 180ms;
}
.btn--oauth:hover {
  opacity: 0.85;
}

.btn--google {
  background: #fff;
  color: #1f1f1f;
  border: 1px solid #dadce0;
}
html.dark .btn--google {
  background: #1f1f1f;
  color: #e8eaed;
  border-color: #5f6368;
}

.form-error-banner {
  background: color-mix(in srgb, var(--error, #b00020) 10%, transparent);
  border: 1px solid var(--error, #b00020);
  color: var(--error, #b00020);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

/* ── Bookmark button ─────────────────────────────────────── */
.bookmark-btn {
  color: var(--secondary);
}

.bookmark-btn:hover {
  color: var(--primary);
}

.bookmark-btn--active {
  color: var(--primary);
}

/* ── Profile page ────────────────────────────────────────── */
.profile-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 4rem 1.5rem 4rem;
}
.profile-header {
  text-align: center;
  margin-bottom: 3rem;
}
.profile-avatar {
  width: 5rem;
  height: 5rem;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: var(--on-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  font-size: 2rem;
  font-weight: 900;
}
.profile-name {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.25rem;
}
.profile-meta {
  font-size: 0.875rem;
  color: var(--secondary);
}
.profile-stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
  margin-top: 1.5rem;
}
.profile-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.profile-stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
}
.profile-stat-label {
  font-size: 0.75rem;
  color: var(--secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.profile-section {
  border-top: 1px solid color-mix(in srgb, var(--outline-variant) 30%, transparent);
  padding-top: 2rem;
}
.profile-section-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}
.profile-comments {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.profile-comment {
  padding-bottom: 1.25rem;
  border-bottom: 1px solid color-mix(in srgb, var(--outline-variant) 20%, transparent);
}
.profile-comment:last-child { border-bottom: none; }
.profile-comment-body {
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 0.35rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.profile-comment-meta {
  font-size: 0.78rem;
  color: var(--secondary);
}
.profile-comment-meta a {
  color: var(--primary);
  font-weight: 600;
}
.profile-comment-meta a:hover { text-decoration: underline; }

/* ── Saved page ──────────────────────────────────────────── */
.page-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.page-header {
  margin-bottom: 2.5rem;
}

.page-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.page-subtitle {
  color: var(--secondary);
}

.empty-state-page {
  text-align: center;
  padding: 5rem 0;
  color: var(--secondary);
}

.empty-state-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 1rem;
}

/* ── Comments section ────────────────────────────────────── */
.comments-section {
  border-top: 1px solid var(--outline-variant);
  margin-top: 4rem;
  padding-top: 3rem;
}

.comments-inner {
  max-width: 70ch;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.comments-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 2rem;
}

/* Individual comment */
.comment {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--outline-variant);
}

.comment:last-of-type {
  border-bottom: none;
}

.comment--reply {
  margin-left: 2rem;
  padding-left: 1rem;
  border-left: 2px solid var(--outline-variant);
  border-bottom: none;
  padding-bottom: 0.5rem;
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.comment-author {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--on-surface);
}

.comment-author-badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  padding: 0.1em 0.5em;
  border-radius: 4px;
}

.comment-date {
  font-size: 0.8rem;
  color: var(--secondary);
  margin-left: auto;
}

.comment-body {
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--on-surface);
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.5rem;
}

.comment-like-btn {
  font-size: 0.875rem;
  color: var(--secondary);
}


.comment-like-btn:hover {
  color: #e91e63;
}

.comment-like-count {
  font-size: 0.8rem;
  color: var(--secondary);
}

.comment-action-btn {
  font-size: 0.85rem;
  color: var(--secondary);
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: color 150ms, background 150ms;
}
.comment-action-btn:hover {
  color: var(--on-surface);
  background: var(--surface-container-low);
}

.comment-edit-form {
  margin-bottom: 0.75rem;
}
.comment-edit-form textarea {
  margin-bottom: 0.5rem;
}
.comment-edit-actions {
  display: flex;
  gap: 0.5rem;
}

/* Replies container */
.comment-replies {
  margin-top: 1rem;
  margin-left: 1.5rem;
  border-left: 2px solid var(--outline-variant);
  padding-left: 1rem;
}

/* Reply toggle (details/summary) */
.reply-form-toggle {
  margin-top: 0.75rem;
}

.reply-toggle-btn {
  font-size: 0.8rem;
  color: var(--secondary);
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0;
}

.reply-toggle-btn:hover {
  color: var(--primary);
}

.reply-toggle-btn::-webkit-details-marker {
  display: none;
}

/* Comment form */
.comment-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.comment-form--reply {
  margin-top: 0.75rem;
}

.comment-form-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--outline-variant);
}

.comment-form-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.comment-posting-as {
  font-size: 0.875rem;
  color: var(--secondary);
  margin-bottom: 0.25rem;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

  .hero-inner {
    flex-direction: column;
    text-align: center;
  }

  .hero-name {
    font-size: 2rem;
  }

  .article-title {
    font-size: 2rem;
  }

  .article-byline {
    flex-wrap: wrap;
    justify-content: center;
  }

  .related-grid {
    grid-template-columns: 1fr;
  }

  .article-footer {
    flex-direction: column;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
}

/* ═══════════════════════════════════════════════════════════
   Syntax Highlight — maps highlight.js classes to design tokens
   Markdown CodeBlock outputs hljs-* classes; this CSS styles them.
   ═══════════════════════════════════════════════════════════ */

/* Light mode */
.hljs-keyword,
.hljs-operator,
.hljs-punctuation {
  color: #3b3b3b;
  font-weight: 600;
}

.hljs-string,
.hljs-template-string,
.hljs-regexp {
  color: #5f5e5e;
}

.hljs-comment,
.hljs-quote {
  color: #5f5e5e;
  font-style: italic;
  opacity: 0.75;
}

.hljs-title,
.hljs-function,
.hljs-attr {
  color: #000000;
  font-weight: 600;
}

.hljs-number,
.hljs-literal {
  color: #3b3b3b;
}

.hljs-type,
.hljs-built_in,
.hljs-class {
  color: #000000;
  font-weight: 700;
}

.hljs-variable,
.hljs-params {
  color: #474747;
}

.hljs-tag,
.hljs-name {
  color: #000000;
}

.hljs-meta {
  color: #777777;
}

/* Dark mode overrides */
html.dark .hljs-keyword,
html.dark .hljs-operator,
html.dark .hljs-punctuation {
  color: #e2e2e2;
}

html.dark .hljs-string,
html.dark .hljs-template-string,
html.dark .hljs-regexp {
  color: #c6c6c6;
}

html.dark .hljs-comment,
html.dark .hljs-quote {
  color: #adabaa;
}

html.dark .hljs-title,
html.dark .hljs-function,
html.dark .hljs-attr {
  color: #ffffff;
}

html.dark .hljs-number,
html.dark .hljs-literal {
  color: #e2e2e2;
}

html.dark .hljs-type,
html.dark .hljs-built_in,
html.dark .hljs-class {
  color: #ffffff;
}

html.dark .hljs-variable,
html.dark .hljs-params {
  color: #adabaa;
}

html.dark .hljs-tag,
html.dark .hljs-name {
  color: #ffffff;
}

html.dark .hljs-meta {
  color: #777777;
}

/* ═══════════════════════════════════════════════════════════
   LazyCoder Admin Panel
   ═══════════════════════════════════════════════════════════ */

/* ── Layout ─────────────────────────────────────────────── */
.admin-body {
  background: var(--surface-container-low);
  min-height: 100vh;
}

.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────── */
.admin-sidebar {
  width: 15rem;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid color-mix(in srgb, var(--outline-variant) 25%, transparent);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  overflow-y: auto;
}

.admin-logo {
  display: block;
  padding: 1.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: var(--primary);
  border-bottom: 1px solid color-mix(in srgb, var(--outline-variant) 20%, transparent);
}

.admin-nav {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 0;
  flex: 1;
}

.nav-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--outline-variant);
  flex-shrink: 0;
  transition: background var(--transition), transform var(--transition);
}

.admin-nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1.5rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--secondary);
  transition: background 180ms ease-out, color 180ms ease-out;
  border: none;
  border-left: 2px solid transparent;
  background: none;
  text-align: left;
  width: 100%;
}

.admin-nav-link:hover {
  background: var(--surface-container-low);
  color: var(--on-surface);
}

.admin-nav-link:hover .nav-dot {
  background: var(--primary);
  transform: scale(1.4);
}

.admin-nav-link--active {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  color: var(--primary);
  border-left-color: var(--primary);
}

.admin-nav-link--active .nav-dot {
  background: var(--primary);
  transform: scale(1.4);
}

.admin-sidebar-footer {
  border-top: 1px solid color-mix(in srgb, var(--outline-variant) 20%, transparent);
  padding: 0.75rem 0;
}

.admin-theme-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 1.5rem 0.75rem;
}

.theme-toggle-mini {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  width: 1.75rem;
  height: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  color: var(--secondary);
  transition: color 180ms ease-out, background 180ms ease-out;
  margin-left: auto;
}

.theme-toggle-mini:hover {
  color: var(--primary);
  background: var(--surface-container-low);
}

.admin-logout-btn {
  color: var(--secondary);
}

.admin-logout-btn:hover {
  color: #b91c1c;
}

/* ── Main content ───────────────────────────────────────── */
.admin-main {
  flex: 1;
  margin-left: 15rem;
  min-width: 0;
}

.admin-content {
  max-width: 72rem;
  margin: 0 auto;
  padding: 2.5rem 2rem;
}

/* ── Page header ────────────────────────────────────────── */
.admin-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.admin-page-title {
  font-size: 1.75rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.admin-page-title::after {
  content: '';
  height: 3px;
  width: 2rem;
  background: var(--primary);
  border-radius: 3px;
}

.admin-greeting {
  font-size: 0.875rem;
  color: var(--secondary);
}

/* ── Stat cards ─────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 1.25rem;
  margin-bottom: 3rem;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  border-left: 3px solid var(--primary);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: box-shadow 180ms ease-out;
}

.stat-card:hover {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.stat-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--secondary);
}

.stat-value {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--primary);
}

/* ── Section ────────────────────────────────────────────── */
.admin-section {
  margin-bottom: 2.5rem;
}

.admin-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.admin-section-title {
  font-size: 1rem;
  font-weight: 700;
}

/* ── Table ──────────────────────────────────────────────── */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--outline-variant) 25%, transparent);
}

.admin-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  background: var(--surface-container-low);
  border-bottom: 2px solid color-mix(in srgb, var(--outline-variant) 30%, transparent);
}

.admin-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid color-mix(in srgb, var(--outline-variant) 15%, transparent);
  vertical-align: middle;
  transition: background 150ms ease-out;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.admin-table tr:hover td {
  background: color-mix(in srgb, var(--primary) 5%, transparent);
}

.table-title {
  font-weight: 600;
}

.table-title a:hover {
  text-decoration: underline;
}

.table-slug {
  display: block;
  font-size: 0.75rem;
  color: var(--secondary);
  font-family: var(--font-mono);
  margin-top: 0.2rem;
}

.table-meta {
  color: var(--secondary);
  font-size: 0.8rem;
  white-space: nowrap;
}

.table-tags {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.table-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  white-space: nowrap;
}

.table-action {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--secondary);
  transition: color var(--transition);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.table-action:hover {
  color: var(--on-surface);
}

.table-action--btn {
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}

.table-action--danger:hover {
  color: #b91c1c;
}

/* ── Status badge ───────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-badge--published {
  background: #dcfce7;
  color: #166534;
}

.status-badge--draft {
  background: var(--surface-high);
  color: var(--secondary);
}

.status-badge--archived {
  background: var(--surface-highest);
  color: var(--secondary);
  opacity: 0.7;
}

html.dark .status-badge--published {
  background: #14532d;
  color: #86efac;
}

.status-badge--admin {
  background: #ede9fe;
  color: #5b21b6;
}
html.dark .status-badge--admin {
  background: #3b1f7e;
  color: #c4b5fd;
}

.status-badge--reader {
  background: var(--surface-container-low);
  color: var(--secondary);
}

/* ── Auth pages ─────────────────────────────────────────── */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-container-low) 100%);
}

.auth-card {
  width: 100%;
  max-width: 26rem;
  padding: 3rem;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

html.dark .auth-card {
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.5);
}

.auth-logo {
  display: block;
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--primary);
  margin-bottom: 1.5rem;
  text-decoration: none;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  margin-bottom: 0.25rem;
}

.auth-subtitle {
  font-size: 0.875rem;
  color: var(--secondary);
  margin-bottom: 2rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ── Editor layout ──────────────────────────────────────── */
.editor-layout {
  display: grid;
  grid-template-columns: 1fr 18rem;
  gap: 2rem;
  align-items: start;
}

.editor-header-actions {
  display: flex;
  gap: 0.75rem;
}

.form-input--title {
  font-size: 1.75rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  background: transparent;
  border-color: transparent;
  padding-left: 0;
}

.form-input--title:focus {
  border-color: transparent;
  border-bottom-color: var(--primary);
  border-radius: 0;
}

.form-input--slug {
  font-size: 0.875rem;
  font-family: var(--font-mono);
  background: transparent;
  border-color: transparent;
  padding-left: 0;
}

.form-input--slug:focus {
  border-color: transparent;
  border-bottom-color: var(--primary);
  border-radius: 0;
}

.form-input--excerpt {
  font-size: 0.9375rem;
  color: var(--secondary);
}

/* Markdown toolbar */
.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.5rem;
  background: var(--surface-container-low);
  border-radius: var(--radius) var(--radius) 0 0;
  border: 1px solid rgba(198, 198, 198, 0.2);
  border-bottom: none;
}

.editor-toolbar button {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--secondary);
  background: none;
  cursor: pointer;
  transition: background 150ms ease-out, color 150ms ease-out;
}

.editor-toolbar button:hover {
  background: var(--surface-highest);
  color: var(--on-surface);
}

.editor-toolbar button.is-active {
  background: var(--primary);
  color: var(--on-primary);
}

/* Markdown editor area */
.editor-main {
  min-width: 0;
}

.editor-content {
  width: 100%;
  min-height: 32rem;
  background: var(--surface);
  border: 1px solid rgba(198, 198, 198, 0.2);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 1.5rem 2rem;
  font-size: 1rem;
  line-height: 1.8;
  outline: none;
  color: var(--on-surface);
  resize: vertical;
}

.editor-content:focus-within {
  border-color: rgba(198, 198, 198, 0.4);
}

/* Style editor content like the public prose */
.editor-content p {
  margin-bottom: 1rem;
}

.editor-content h2 {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 2rem 0 0.75rem;
  letter-spacing: -0.02em;
}

.editor-content h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 1.5rem 0 0.5rem;
}

.editor-content ul,
.editor-content ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.editor-content code {
  font-family: var(--font-mono);
  background: var(--surface-highest);
  padding: 0.15em 0.4em;
  border-radius: 0.2rem;
  font-size: 0.85em;
}

.editor-content pre {
  background: var(--surface-highest);
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 1.25rem 0;
}

.editor-content pre code {
  background: none;
  padding: 0;
  font-size: 0.875rem;
}

.editor-content blockquote {
  border-left: 3px solid var(--primary);
  padding-left: 1rem;
  margin: 1.5rem 0;
  color: var(--secondary);
  font-style: italic;
}

/* Editor sidebar */
.editor-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.sidebar-section {
  padding: 1.25rem;
  background: var(--surface);
  border-radius: var(--radius);
  border-top: 2px solid var(--primary);
  margin-bottom: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sidebar-section-title {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
}

.tag-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tag-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  cursor: pointer;
}

.sidebar-actions {
  margin-top: 0.5rem;
}

.image-preview-box {
  min-height: 5rem;
  background: var(--surface-container-low);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.image-preview-box img {
  width: 100%;
  height: auto;
  object-fit: cover;
}

/* ── Form card ──────────────────────────────────────────── */
.form-card {
  background: var(--surface);
  padding: 2rem;
  border-radius: var(--radius);
  max-width: 40rem;
}

/* ── Two-col layout ─────────────────────────────────────── */
.two-col-layout {
  display: grid;
  grid-template-columns: 1fr 20rem;
  gap: 3rem;
  align-items: start;
}

/* ── Media grid ─────────────────────────────────────────── */
.upload-zone {
  margin-bottom: 2rem;
  border: 2px dashed rgba(198, 198, 198, 0.35);
  border-radius: var(--radius);
}

.upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 3rem;
  cursor: pointer;
  color: var(--secondary);
  font-size: 0.875rem;
  transition: background var(--transition);
}

.upload-label:hover {
  background: var(--surface-container-low);
}

.upload-icon {
  font-size: 2.5rem;
  color: var(--outline-variant);
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 1rem;
}

.media-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.media-thumb {
  aspect-ratio: 1;
  background: var(--surface-container-low);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-thumb--file .material-symbols-outlined {
  font-size: 2.5rem;
  color: var(--secondary);
}

.media-filename {
  font-size: 0.75rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-size {
  font-size: 0.65rem;
  color: var(--secondary);
}

.media-actions {
  padding: 0 0.625rem 0.625rem;
  display: flex;
  gap: 0.75rem;
}

/* ── Analytics layout ───────────────────────────────────── */
.admin-analytics-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.admin-section--half {
  margin-bottom: 0;
}

.referrer-url {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  max-width: 28ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .admin-analytics-row {
    grid-template-columns: 1fr;
  }
}

/* ── Notification badge in sidebar ──────────────────────── */
.admin-nav-link {
  position: relative;
}

.notif-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: #e91e63;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  margin-left: auto;
}

/* ── Comment moderation table ────────────────────────────── */
.comment-content-preview {
  font-size: 0.875rem;
  color: var(--admin-secondary, #666);
  max-width: 40ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comment-row--pending td {
  background: color-mix(in srgb, #ff9800 6%, transparent);
}

.notif-row--unread td {
  background: color-mix(in srgb, var(--admin-primary, #1976d2) 6%, transparent);
}

.table-actions-cell {
  white-space: nowrap;
}

/* ── Reading progress bar ──────────────────────────────────── */
#reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--primary);
  z-index: 300;
  width: 0;
  transition: width 100ms linear;
}

/* ── Pagination ───────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 3rem;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius);
  transition: background var(--transition), color var(--transition);
}

.pagination-current {
  background: var(--primary);
  color: var(--on-primary);
}