/* joostboer.com v2.2.0 — dark/light manifesto */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* ── Dark theme (default) ──────────────────────────────────────────────────── */

:root {
  --bg: #0c0c0e;
  --bg-elevated: #141416;
  --bg-glass: rgba(20, 20, 22, 0.75);
  --text: #e8e6e1;
  --text-body: rgba(232, 230, 225, 0.85);
  --text-secondary: #8a8880;
  --text-muted: #5a5850;
  --accent: #c9a84c;
  --accent-glow: rgba(201, 168, 76, 0.12);
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --sidebar-hover: rgba(255, 255, 255, 0.02);
  --code-bg: #141416;
  --code-border: rgba(255, 255, 255, 0.06);
  --glow-opacity: 0.03;
  --sidebar-width: 280px;
  --content-width: 640px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.4, 0, 0.2, 1);
  --duration: 0.4s;
  color-scheme: dark;
}

/* ── Light theme ───────────────────────────────────────────────────────────── */

[data-theme="light"] {
  --bg: #fafaf8;
  --bg-elevated: #f0efec;
  --bg-glass: rgba(250, 250, 248, 0.8);
  --text: #1a1a18;
  --text-body: rgba(26, 26, 24, 0.78);
  --text-secondary: #6b6b63;
  --text-muted: #a0a098;
  --accent: #9a7b2e;
  --accent-glow: rgba(154, 123, 46, 0.08);
  --border: rgba(0, 0, 0, 0.07);
  --border-hover: rgba(0, 0, 0, 0.12);
  --sidebar-hover: rgba(0, 0, 0, 0.03);
  --code-bg: #f0efec;
  --code-border: rgba(0, 0, 0, 0.07);
  --glow-opacity: 0.02;
  color-scheme: light;
}

html {
  font-size: 18px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.75;
  overflow-wrap: break-word;
  transition: background 0.4s var(--ease-in), color 0.4s var(--ease-in);
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

/* ── Layout ────────────────────────────────────────────────────────────────── */

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

/* ── Sidebar ───────────────────────────────────────────────────────────────── */

.sidebar {
  width: var(--sidebar-width);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: background 0.4s var(--ease-in), border-color 0.4s var(--ease-in);
}

.sidebar-header {
  padding: 2.4rem 1.5rem 1.2rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.03em;
  transition: color var(--duration) var(--ease);
}

.logo:hover {
  color: var(--accent);
}

/* ── Theme toggle ──────────────────────────────────────────────────────────── */

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.25s var(--ease-in);
  flex-shrink: 0;
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--border-hover);
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
  transition: transform 0.4s var(--ease);
}

.theme-toggle:hover svg {
  transform: rotate(15deg);
}

.icon-sun, .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="light"] .icon-moon { display: block; }
/* auto: show sun (switch to light) by default, handled by JS */

.sidebar-avatar {
  padding: 1.25rem 1.5rem 0.5rem;
  text-align: center;
}

.sidebar-avatar img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  transition: border-color var(--duration) var(--ease);
}

.sidebar-avatar img:hover {
  border-color: var(--accent);
}

.sidebar-bio {
  padding: 0.5rem 1.5rem 1rem;
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.sidebar-projects {
  padding: 0 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-projects ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.sidebar-projects li::before {
  content: "\b7";
  color: var(--text-muted);
  margin-right: 0.5rem;
}

.sidebar-projects a {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.sidebar-projects a:hover {
  color: var(--accent);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
  scrollbar-width: none;
}

.sidebar-nav::-webkit-scrollbar {
  display: none;
}

.sidebar-item {
  display: block;
  padding: 0.65rem 1.5rem;
  text-decoration: none;
  color: var(--text-secondary);
  transition: all 0.25s var(--ease-in);
  position: relative;
}

.sidebar-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 0;
  background: var(--accent);
  transition: height 0.3s var(--ease);
}

.sidebar-item:hover {
  color: var(--text);
  background: var(--sidebar-hover);
}

.sidebar-item.active {
  color: var(--text);
}

.sidebar-item.active::before {
  height: 60%;
}

.sidebar-title {
  display: block;
  font-size: 0.79rem;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.sidebar-date {
  display: block;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.6rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  letter-spacing: 0.04em;
}

/* ── Main content ──────────────────────────────────────────────────────────── */

.content {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.articles {
  width: 100%;
  max-width: var(--content-width);
  padding: 0 2rem;
}

/* ── Article ───────────────────────────────────────────────────────────────── */

.post {
  padding: 5rem 0 4rem;
  border-bottom: 1px solid var(--border);
  animation: postReveal 0.6s var(--ease) both;
}

.post:last-child {
  border-bottom: none;
}

@keyframes postReveal {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.post.peeking {
  animation: none;
}

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

.post header time {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.68rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.post header h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.035em;
  margin-top: 0.6rem;
  color: var(--text);
}

/* ── Post body typography ──────────────────────────────────────────────────── */

.post-body p {
  margin-bottom: 1.5rem;
  color: var(--text-body);
}

.post-body h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  margin: 3rem 0 1rem;
  letter-spacing: -0.03em;
  color: var(--text);
}

.post-body h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  margin: 2.5rem 0 0.8rem;
  letter-spacing: -0.02em;
}

.post-body a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(201, 168, 76, 0.3);
  transition: border-color 0.2s;
}

.post-body a:hover {
  border-color: var(--accent);
}

.post-body blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 1.3rem;
  margin: 2rem 0;
  color: var(--text-secondary);
  font-style: italic;
}

.post-body ul, .post-body ol {
  margin: 1.3rem 0;
  padding-left: 1.4rem;
  color: var(--text-body);
}

.post-body li {
  margin-bottom: 0.5rem;
}

.post-body code {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.82em;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  padding: 0.15em 0.45em;
  border-radius: 4px;
  color: var(--accent);
}

.post-body pre {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  padding: 1.3rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 2rem 0;
  line-height: 1.5;
}

.post-body pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
}

.post-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3rem 0;
}

.post-body strong {
  color: var(--text);
  font-weight: 600;
}

.post-body em {
  color: var(--text-body);
}

/* ── Story panels (cinematic full-bleed) ───────────────────────────────────── */

.story-panel {
  --panel-w: min(1100px, calc(100vw - var(--sidebar-width)));
  width: var(--panel-w);
  margin-left: calc(50% - var(--panel-w) / 2);
  margin-right: calc(50% - var(--panel-w) / 2);
  margin-top: 3.5rem;
  margin-bottom: 3.5rem;
  overflow: hidden;
  border: none;
  border-radius: 2px;

  /* Reveal animation */
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 1.4s cubic-bezier(0.16, 1, 0.3, 1),
              transform 1.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.story-panel.revealed {
  opacity: 1;
  transform: translateY(0);
}

.story-panel svg {
  display: block;
}

.story-panel::after {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 6px var(--bg);
  pointer-events: none;
  z-index: 1;
}

.story-panel {
  position: relative;
}

.story-panel img,
.story-panel video {
  display: block;
  width: 100%;
  height: auto;
  transform: scale(1.08);
  will-change: transform;
}

@media (max-width: 860px) {
  .story-panel {
    width: calc(100% + 2.6rem);
    margin-left: -1.3rem;
    margin-right: -1.3rem;
    margin-top: 2.5rem;
    margin-bottom: 2.5rem;
    border-radius: 0;
  }
}

/* ── Final panel (closing image — full-bleed, slow reveal, pulse) ─────────── */

.story-panel.final-panel {
  --panel-w: calc(100vw - var(--sidebar-width));
  margin-top: 4.5rem;
  margin-bottom: 0;
  transform: translateY(60px) scale(0.97);
  transition: opacity 2.8s cubic-bezier(0.16, 1, 0.3, 1),
              transform 2.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.story-panel.final-panel.revealed {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.story-panel.final-panel img,
.story-panel.final-panel video {
  transform: scale(1);
  animation: finalPulse 4s ease-in-out 2.8s infinite;
}

@keyframes finalPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.12); }
}

@media (max-width: 860px) {
  .story-panel.final-panel {
    --panel-w: calc(100% + 2.6rem);
    margin-top: 3rem;
  }
}

/* ── Animated traffic chart ────────────────────────────────────────────────── */

.story-panel.chart-panel {
  opacity: 1;
  transform: none;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.traffic-chart {
  display: block;
  width: 100%;
  height: auto;
}

.chart-line {
  transition: none;
}

.chart-area {
  transition: opacity 0.3s ease;
}

.chart-crash-label {
  transition: opacity 0.4s ease;
}

/* ── Cold quote ───────────────────────────────────────────────────────────── */

.cold-quote {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.6rem;
  font-style: italic;
  font-weight: 500;
  text-align: center;
  padding: 2.5rem 0;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
  line-height: 1.4;
}

/* ── Site tribute cards ──────────────────────────────────────────────────── */

.site-tribute {
  --tribute-w: min(1100px, calc(100vw - var(--sidebar-width)));
  width: var(--tribute-w);
  margin-left: calc(50% - var(--tribute-w) / 2);
  margin-right: calc(50% - var(--tribute-w) / 2);
  margin-top: 3rem;
  margin-bottom: 3rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.site-card {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2.5rem;
  align-items: center;
}

.site-card.reverse {
  grid-template-columns: 1fr 280px;
}

.site-card.reverse .site-image {
  order: 2;
}

.site-card.reverse .site-text {
  order: 1;
}

.site-image {
  overflow: hidden;
  border-radius: 4px;
  background: var(--bg);
}

.site-image img {
  display: block;
  width: 100%;
  height: auto;
  transform: scale(1.06);
  filter: saturate(0.85);
  transition: filter 0.4s ease;
}

.site-card:hover .site-image img {
  filter: saturate(1);
}

.site-text h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}

.site-text h3 a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease;
}

.site-text h3 a:hover {
  border-bottom-color: var(--accent);
}

.site-text p {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text-body);
}

.site-text p a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(201, 168, 76, 0.3);
  text-underline-offset: 2px;
}

@media (max-width: 860px) {
  .site-tribute {
    --tribute-w: calc(100% + 2.6rem - 1rem);
    gap: 2.5rem;
  }

  .site-card,
  .site-card.reverse {
    grid-template-columns: 1fr;
    gap: 1rem;
    text-align: center;
  }

  .site-card.reverse .site-image,
  .site-card.reverse .site-text {
    order: unset;
  }

  .site-image {
    max-width: 180px;
    margin: 0 auto;
  }
}

/* ── Record article: breakout SVG charts ───────────────────────────────────── */

.record-chart {
  --chart-w: min(960px, calc(100vw - var(--sidebar-width) - 2rem));
  width: var(--chart-w);
  margin-left: calc(50% - var(--chart-w) / 2);
  margin-right: calc(50% - var(--chart-w) / 2);
  margin-top: 3rem;
  margin-bottom: 3rem;
  display: block;
}

@media (max-width: 860px) {
  .record-chart {
    --chart-w: calc(100% + 2.6rem - 1.6rem);
  }
}

/* ── Record article: clinical data components ─────────────────────────────── */

.record-entry {
  margin: 1.5rem 0;
  padding: 1rem 1.3rem;
  border: 0.5px solid var(--border);
  border-radius: 4px;
  background: var(--bg-elevated);
}

.record-entry .record-date {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.68rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 0.4rem;
}

.record-entry .record-fact {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-body);
}

.record-entry .record-fact a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(201, 168, 76, 0.3);
}

.record-entry .record-fact a:hover {
  border-color: var(--accent);
}

.record-entry .record-amount {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-weight: 600;
  color: var(--accent);
}

/* Case file dossier cards */
.case-file {
  margin: 2rem 0;
  border: 0.5px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-elevated);
}

.case-file-header {
  padding: 0.6rem 1.2rem;
  border-bottom: 0.5px solid var(--border);
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.case-file-body {
  padding: 1.2rem;
}

.case-file-body h4 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.case-file-body h4 a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease;
}

.case-file-body h4 a:hover {
  border-bottom-color: var(--accent);
}

.case-file-body p {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text-body);
  margin-bottom: 0;
}

.case-file-body p a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(201, 168, 76, 0.3);
}

.case-file-body p a:hover {
  border-color: var(--accent);
}

.case-file-row {
  display: flex;
  gap: 0.5rem;
  padding: 0.35rem 0;
  font-size: 0.85rem;
  line-height: 1.5;
}

.case-file-label {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  min-width: 70px;
  flex-shrink: 0;
  padding-top: 0.15rem;
}

.case-file-value {
  color: var(--text-body);
}

.case-file-value a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(201, 168, 76, 0.3);
}

/* Large stat display */
.stat-display {
  text-align: center;
  padding: 3rem 1rem;
  margin: 2.5rem 0;
}

.stat-display .stat-number {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.03em;
  line-height: 1.1;
  display: block;
}

.stat-display .stat-label {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 0.6rem;
  display: block;
}

@media (max-width: 860px) {
  .stat-display .stat-number {
    font-size: 2.2rem;
  }
}

/* Record vertical timeline */
.record-timeline {
  position: relative;
  margin: 3rem 0;
  padding-left: 2.5rem;
}

.record-timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 0.5px;
  background: var(--border);
}

.tl-entry {
  position: relative;
  margin-bottom: 1.5rem;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.tl-entry.tl-revealed {
  opacity: 1;
  transform: translateY(0);
}

.tl-entry::before {
  content: '';
  position: absolute;
  left: -2.5rem;
  top: 0.55rem;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-muted);
  z-index: 1;
}

.tl-entry[data-cat="antitrust"]::before { background: #a04035; }
.tl-entry[data-cat="internal"]::before { background: #c9a84c; }
.tl-entry[data-cat="quality"]::before { background: #5cb870; }
.tl-entry[data-cat="publishers"]::before { background: #6b8aad; }
.tl-entry[data-cat="ads"]::before { background: #b07cc6; }
.tl-entry[data-cat="accountability"]::before { background: var(--text-muted); }

.tl-date {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.62rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tl-text {
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text-body);
  margin-top: 0.15rem;
}

.tl-text a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(201, 168, 76, 0.3);
}

.tl-text a:hover {
  border-color: var(--accent);
}

.tl-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 0.8rem 1rem;
  border: 0.5px solid var(--border);
  border-radius: 4px;
  background: var(--bg-elevated);
}

.tl-legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.tl-legend-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Record footer */
.record-footer {
  margin-top: 4rem;
  padding: 1rem 0;
  border-top: 0.5px solid var(--border);
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

/* ── Void ─────────────────────────────────────────────────────────────────── */

.void {
  height: 250vh;
}

/* ── Loader ────────────────────────────────────────────────────────────────── */

.loader {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.scroll-sentinel {
  height: 1px;
}

/* ── Mobile menu toggle ────────────────────────────────────────────────────── */

.menu-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1001;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 42px;
  height: 42px;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.menu-toggle span {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--text);
  transition: transform 0.3s var(--ease), opacity 0.2s;
}

.menu-toggle.open span:nth-child(1) {
  transform: rotate(45deg) translate(4.5px, 4.5px);
}

.menu-toggle.open span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.open span:nth-child(3) {
  transform: rotate(-45deg) translate(4.5px, -4.5px);
}

/* ── Mobile header bar ─────────────────────────────────────────────────────── */

.mobile-bar {
  display: none;
}

/* ── Mobile ────────────────────────────────────────────────────────────────── */

@media (max-width: 860px) {
  :root {
    --sidebar-width: 0px;
  }

  html, body {
    overflow-x: clip;
    max-width: 100vw;
  }

  .menu-toggle {
    display: none !important;
  }

  .sidebar {
    display: none;
  }

  .mobile-bar {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1.3rem;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    transition: background 0.4s var(--ease-in), border-color 0.4s var(--ease-in);
  }

  .mobile-bar .logo {
    font-size: 1rem;
  }

  .mobile-bar .theme-toggle {
    width: 30px;
    height: 30px;
  }

  .content {
    margin-left: 0;
    padding-top: 3.2rem;
    min-width: 0;
    max-width: 100%;
    overflow-x: clip;
  }

  .articles {
    padding: 0 1.3rem;
    min-width: 0;
  }

  .post {
    padding: 2.5rem 0 2.5rem;
  }

  .post header h1 {
    font-size: 1.7rem;
  }

  .post-body p {
    font-size: 0.95rem;
    line-height: 1.8;
  }

  html {
    font-size: 16px;
  }
}

/* ── Subtle ambient glow ───────────────────────────────────────────────────── */

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(
    ellipse at 30% 20%,
    rgba(201, 168, 76, var(--glow-opacity)) 0%,
    transparent 50%
  );
  pointer-events: none;
  z-index: -1;
}

/* ── Search Demo (How Search Should Work) ──────────────────────────────────── */

.search-demo {
  --sd-bg: var(--bg-elevated);
  --sd-card: var(--bg);
  --sd-border: var(--border);
  --sd-text: var(--text);
  --sd-body: var(--text-body);
  --sd-muted: var(--text-muted);
  --sd-accent: var(--accent);
  --sd-green: #5cb870;
  --sd-red: #c04040;
  --sd-orange: #d4903c;
  --sd-radius: 6px;
  --demo-w: min(1100px, calc(100vw - var(--sidebar-width) - 2rem));
  width: var(--demo-w);
  margin-left: calc(50% - var(--demo-w) / 2);
  margin-right: calc(50% - var(--demo-w) / 2);
  margin-top: 3rem;
  margin-bottom: 3rem;
  background: var(--sd-bg);
  border: 1px solid var(--sd-border);
  border-radius: 8px;
  padding: 1.8rem;
  font-family: 'Inter', -apple-system, sans-serif;
}

@media (max-width: 860px) {
  .search-demo {
    --demo-w: calc(100% + 2.6rem - 1.6rem);
    padding: 1rem;
  }
}

.sd-query-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--sd-card);
  border: 1px solid var(--sd-border);
  border-radius: 24px;
  padding: 0.7rem 1.2rem;
  margin-bottom: 1rem;
}

.sd-query-bar svg {
  width: 18px;
  height: 18px;
  color: var(--sd-muted);
  flex-shrink: 0;
}

.sd-query-text {
  font-size: 0.92rem;
  color: var(--sd-text);
  flex: 1;
}

.sd-query-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.2rem;
}

.sd-pill {
  background: none;
  border: 1px solid var(--sd-border);
  border-radius: 14px;
  padding: 0.3rem 0.8rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.65rem;
  color: var(--sd-muted);
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.02em;
}

.sd-pill:hover {
  border-color: var(--sd-accent);
  color: var(--sd-accent);
}

.sd-pill.active {
  border-color: var(--sd-accent);
  color: var(--sd-accent);
  background: var(--accent-glow);
}

.sd-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--sd-border);
}

.sd-tab {
  background: none;
  border: none;
  padding: 0.6rem 1.2rem;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--sd-muted);
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
}

.sd-tab::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
  transition: background 0.2s;
}

.sd-tab:hover { color: var(--sd-body); }

.sd-tab.active {
  color: var(--sd-accent);
}

.sd-tab.active::after {
  background: var(--sd-accent);
}

.sd-view { display: none; }
.sd-view.active { display: block; }

.sd-section-label {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sd-muted);
  margin-bottom: 0.8rem;
  padding-left: 0.2rem;
}

.sd-section { margin-bottom: 1.8rem; }

.sd-result {
  background: var(--sd-card);
  border: 1px solid var(--sd-border);
  border-radius: var(--sd-radius);
  padding: 1rem 1.2rem;
  margin-bottom: 0.6rem;
  transition: border-color 0.2s;
}

.sd-result:hover {
  border-color: var(--border-hover);
}

.sd-result-url {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.65rem;
  color: var(--sd-muted);
  letter-spacing: 0.02em;
  margin-bottom: 0.3rem;
}

.sd-result-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--sd-accent);
  margin-bottom: 0.35rem;
  letter-spacing: -0.01em;
}

.sd-result-snippet {
  font-size: 0.82rem;
  color: var(--sd-body);
  line-height: 1.5;
  margin-bottom: 0.6rem;
}

.sd-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.sd-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.03em;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  border: 1px solid var(--sd-border);
}

.sd-badge.expertise {
  color: var(--sd-accent);
  border-color: rgba(201, 168, 76, 0.25);
}

.sd-badge.tested {
  color: var(--sd-green);
  border-color: rgba(92, 184, 112, 0.25);
}

.sd-badge.satisfaction {
  color: var(--sd-green);
  border-color: rgba(92, 184, 112, 0.25);
}

.sd-badge.satisfaction.medium {
  color: var(--sd-orange);
  border-color: rgba(212, 144, 60, 0.25);
}

.sd-badge.satisfaction.low {
  color: var(--sd-red);
  border-color: rgba(192, 64, 64, 0.25);
}

.sd-badge.off-lane {
  color: var(--sd-orange);
  border-color: rgba(212, 144, 60, 0.25);
}

.sd-publisher {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.58rem;
  color: var(--sd-muted);
  margin-top: 0.5rem;
  letter-spacing: 0.03em;
}

.sd-ad {
  padding: 0.6rem 1rem;
  margin-bottom: 0.35rem;
  border-radius: var(--sd-radius);
  background: var(--sd-card);
  border: 1px solid var(--sd-border);
}

.sd-ad-label {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.55rem;
  font-weight: 700;
  color: var(--sd-muted);
  letter-spacing: 0.08em;
  background: rgba(255,255,255,0.04);
  padding: 0.1rem 0.35rem;
  border-radius: 2px;
  display: inline-block;
  margin-bottom: 0.25rem;
}

[data-theme="light"] .sd-ad-label {
  background: rgba(0,0,0,0.04);
}

.sd-ad-title {
  font-size: 0.85rem;
  color: var(--sd-accent);
  font-weight: 500;
}

.sd-ad-url {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.6rem;
  color: var(--sd-muted);
}

.sd-ai-box {
  background: var(--sd-card);
  border: 1px solid var(--sd-border);
  border-radius: var(--sd-radius);
  padding: 1rem 1.2rem;
  margin: 1rem 0;
}

.sd-ai-label {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sd-muted);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.sd-ai-label svg {
  width: 12px;
  height: 12px;
}

.sd-ai-text {
  font-size: 0.82rem;
  color: var(--sd-body);
  line-height: 1.55;
}

.sd-ai-sources {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.58rem;
  color: var(--sd-muted);
  margin-top: 0.5rem;
}

.sd-paa {
  border: 1px solid var(--sd-border);
  border-radius: var(--sd-radius);
  margin: 1rem 0;
  overflow: hidden;
}

.sd-paa-header {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--sd-body);
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--sd-border);
}

.sd-paa-item {
  font-size: 0.8rem;
  color: var(--sd-body);
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--sd-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sd-paa-item:last-child { border-bottom: none; }

.sd-paa-arrow {
  color: var(--sd-muted);
  font-size: 0.7rem;
}

.sd-organic {
  padding: 0.7rem 0;
}

.sd-organic-url {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.6rem;
  color: var(--sd-muted);
  letter-spacing: 0.02em;
}

.sd-organic-title {
  font-size: 0.88rem;
  color: var(--sd-accent);
  font-weight: 500;
  margin: 0.15rem 0;
}

.sd-organic-snippet {
  font-size: 0.78rem;
  color: var(--sd-body);
  line-height: 1.45;
}

.sd-separator {
  border: none;
  border-top: 1px solid var(--sd-border);
  margin: 0.4rem 0;
}

.sd-note {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.6rem;
  color: var(--sd-muted);
  text-align: center;
  padding: 1rem 0 0.2rem;
  letter-spacing: 0.04em;
}

/* ── Newsletter subscribe ─────────────────────────────────────────────────── */

.sidebar-subscribe {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.subscribe-form {
  display: flex;
  gap: 0;
  max-width: 100%;
}

.subscribe-form input[type="email"] {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 4px 0 0 4px;
  padding: 0.5rem 0.7rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}

.subscribe-form input[type="email"]:focus {
  border-color: var(--accent);
}

.subscribe-form input[type="email"]::placeholder {
  color: var(--text-muted);
}

.subscribe-form button {
  background: var(--accent);
  color: var(--bg);
  border: 1px solid var(--accent);
  border-radius: 0 4px 4px 0;
  padding: 0.5rem 0.8rem;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.2s;
}

.subscribe-form button:hover {
  opacity: 0.85;
}

.subscribe-note {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

.subscribe-success {
  font-size: 0.75rem;
  color: var(--accent);
  padding: 0.5rem 0;
}

/* Article subscribe block */

.article-subscribe {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.article-subscribe p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 0.8rem;
}

.article-subscribe .subscribe-form {
  max-width: 400px;
}

.article-subscribe .subscribe-form input[type="email"] {
  font-size: 0.85rem;
  padding: 0.6rem 0.8rem;
}

.article-subscribe .subscribe-form button {
  font-size: 0.8rem;
  padding: 0.6rem 1rem;
}

@media (max-width: 860px) {
  .article-subscribe .subscribe-form {
    max-width: 100%;
  }
}
