/* ─────────────────────────────────────────────────────────
   gY  ·  Design System
   Theme: "Deep Navy" - ocean-depth dark + electric blue + aurora teal
   ───────────────────────────────────────────────────────── */

/* ── Theme tokens ───────────────────────────────────────── */

:root[data-theme="dark"] {
  color-scheme: dark;

  /* Backgrounds */
  --bg-0: #030c1a;
  --bg-1: #061526;
  --bg-2: #0a1d34;
  --bg-3: #0e2540;

  /* Borders */
  --border: #152d4a;
  --border-hi: #1e3f68;

  /* Text */
  --text: #dce9f7;
  --text-2: #5878a0;
  --text-3: #2a4060;

  /* Primary accent - electric blue */
  --blue: #2472e8;
  --blue-hi: #4090ff;
  --blue-dim: rgba(36, 114, 232, 0.1);

  /* Secondary accent - aurora teal */
  --gold: #06b6d4;
  --gold-hi: #22d3ee;
  --gold-dim: rgba(6, 182, 212, 0.1);

  /* "Read" status accent - emerald */
  --read: #34d399;
  --read-dim: rgba(52, 211, 153, 0.16);

  /* Dot-grid star color */
  --grid-dot: rgba(140, 190, 255, 0.08);

  /* Glow tint (used in radial gradients) */
  --glow-blue: rgba(36, 114, 232, 0.07);
  --glow-gold: rgba(6, 182, 212, 0.06);
}

:root[data-theme="light"] {
  color-scheme: light;

  --bg-0: #f2f6fc;
  --bg-1: #ffffff;
  --bg-2: #eaf0f8;
  --bg-3: #dde8f4;

  --border: #c0d4ea;
  --border-hi: #98bade;

  --text: #06152a;
  --text-2: #3a5878;
  --text-3: #7090b0;

  --blue: #1455b0;
  --blue-hi: #1e72d4;
  --blue-dim: rgba(20, 85, 176, 0.07);

  --gold: #0891b2;
  --gold-hi: #0ea5e9;
  --gold-dim: rgba(8, 145, 178, 0.08);

  --read: #059669;
  --read-dim: rgba(5, 150, 105, 0.12);

  --grid-dot: rgba(24, 88, 184, 0.12);

  --glow-blue: rgba(20, 85, 176, 0.04);
  --glow-gold: rgba(8, 145, 178, 0.04);
}

/* ── Smooth theme transitions ───────────────────────────── */
/* Applied selectively to avoid sluggish transitions on interactive elements */
body,
.navbar,
.footer,
.post-item,
.skill-tag,
.tag,
.btn-ghost,
.icon-link {
  transition:
    background-color 0.3s ease,
    color 0.25s ease,
    border-color 0.25s ease,
    box-shadow 0.25s ease;
}

/* ── Shared variables (layout / type / spacing) ─────────── */
:root {
  --font-display: "IBM Plex Sans", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
  --font-hand: "Caveat", cursive;

  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.5rem;
  --space-2xl: 4rem;
  --space-3xl: 6rem;

  --max-w: 1430px;
  --max-w-prose: 880px;

  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

body {
  background-color: var(--bg-0);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  min-height: 100vh;
  /* Star-field dot grid - color is theme-aware */
  background-image: radial-gradient(
    circle,
    var(--grid-dot) 1px,
    transparent 1px
  );
  background-size: 36px 36px;
}

img,
video {
  display: block;
  max-width: 100%;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  cursor: pointer;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
}
ul,
ol {
  list-style: none;
}

/* ── Typography ─────────────────────────────────────────── */
h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.15;
  color: var(--text);
}

/* ── Layout helpers ─────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--space-xl);
}

.section {
  padding: var(--space-3xl) 0;
}

/* ── Gradient text ──────────────────────────────────────── */
.gradient-text {
  background: linear-gradient(130deg, var(--blue-hi) 0%, var(--gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─────────────────────────────────────────────────────────
   NAVBAR
   ───────────────────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 60px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-0) 70%, transparent);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar__logo {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  user-select: none;
}
.navbar__logo span:first-child {
  color: var(--blue-hi);
}
.navbar__logo span:last-child {
  color: var(--text);
}

.navbar__links-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  min-width: 0;
}

.navbar__links {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.navbar__links::-webkit-scrollbar {
  display: none;
}

.navbar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  flex-shrink: 0;
}

.navbar__link {
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: 0.01em;
  padding: var(--space-xs) 0;
  position: relative;
  transition: color 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.navbar__link::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 100%;
  height: 1px;
  background: var(--blue-hi);
  transition: right 0.25s var(--ease);
}

.navbar__link:hover,
.navbar__link.active {
  color: var(--text);
}
.navbar__link:hover::after,
.navbar__link.active::after {
  right: 0;
}

/* Theme toggle button */
.navbar__theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-2);
  transition:
    color 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease;
}

.navbar__theme-toggle:hover {
  color: var(--blue-hi);
  border-color: var(--blue-hi);
  background: var(--blue-dim);
}

/* ─────────────────────────────────────────────────────────
   HERO
   ───────────────────────────────────────────────────────── */
/* ── 3-column hero grid ──────────────────────────────────── */
.hero {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 200px 1fr 200px;
  grid-template-rows: 1fr;
  align-items: stretch;
  position: relative;
  overflow: hidden;
  z-index: 2; /* above the wide-screen gutter strips */
}

/* Deep-space nebula glow behind all columns */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 45%, var(--glow-blue) 0%, transparent 55%),
    radial-gradient(ellipse at 70% 25%, var(--glow-gold) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ── Center column ───────────────────────────────────────── */
.hero__center {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px var(--space-xl) var(--space-2xl);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

.hero__center {
  min-width: 0; /* prevents grid blowout - text stays inside the 1fr column */
}

.hero__center-inner {
  width: 100%;
}

/* ── Sidebars ────────────────────────────────────────────── */
.hero__sidebar {
  position: relative;
  z-index: 1;
  padding: calc(60px + var(--space-2xl)) var(--space-md) var(--space-2xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.hero__sidebar--left {
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--blue) 7%, var(--bg-0)) 0%,
    var(--bg-0) 70%
  );
}

.hero__sidebar--right {
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--gold) 6%, var(--bg-0)) 0%,
    var(--bg-0) 70%
  );
}

/* ── Sidebar inner sections ──────────────────────────────── */
.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.sidebar-section + .sidebar-section {
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
}

.sidebar-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.sidebar-label--blue {
  color: var(--blue-hi);
}
.sidebar-label--gold {
  color: var(--gold);
}

/* ── Profile (left) ──────────────────────────────────────── */
.profile-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.profile-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-hi) 100%);
  border: 1px solid var(--border-hi);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  user-select: none;
}

.profile-name {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.2;
}

.profile-handle {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-3);
  margin-top: 0.1rem;
}

/* ── Status/info rows ────────────────────────────────────── */
.status-row,
.info-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-2);
  line-height: 1.4;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
  flex-shrink: 0;
  box-shadow: 0 0 5px #34d399;
}

.info-icon {
  font-size: 0.75rem;
  flex-shrink: 0;
  opacity: 0.7;
}

/* ── Sidebar social links ────────────────────────────────── */
.sidebar-social {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-2);
  transition: color 0.18s ease;
}

.sidebar-social:hover {
  color: var(--blue-hi);
}
.sidebar-social svg {
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity 0.18s ease;
}
.sidebar-social:hover svg {
  opacity: 1;
}

/* ── Stack tags (right) ──────────────────────────────────── */
.stack-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.stack-tag {
  padding: 0.18rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: 0.04em;
  transition:
    border-color 0.18s ease,
    color 0.18s ease;
}

.stack-tag--hi {
  border-color: color-mix(in srgb, var(--gold) 35%, transparent);
  color: var(--gold);
  background: var(--gold-dim);
}

/* ── Stats (right) ───────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-num {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-top: 0.2rem;
}

/* ── Hero center content ─────────────────────────────────── */
.hero__label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--blue-hi);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: var(--space-lg);
}

.hero__label::before {
  content: "";
  display: inline-block;
  width: 28px;
  height: 1px;
  background: var(--blue-hi);
}

.hero__title {
  font-size: clamp(2.2rem, 5.5vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin-bottom: var(--space-lg);
}

.hero__subtitle {
  font-size: clamp(0.9rem, 1.5vw, 1.05rem);
  color: var(--text-2);
  line-height: 1.75;
  margin-bottom: var(--space-2xl);
}

.hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  align-items: center;
}

/* ── Responsive hero ─────────────────────────────────────── */

/* Tablet: center full-width on top, sidebars side-by-side below */
@media (max-width: 1430px) {
  .hero {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
  }

  .hero__center {
    grid-column: 1 / -1;
    grid-row: 1;
    min-height: 85vh;
    border-left: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .hero__sidebar--left {
    grid-column: 1;
    grid-row: 2;
    border-right: 1px solid var(--border);
  }
  .hero__sidebar--right {
    grid-column: 2;
    grid-row: 2;
  }

  .hero__sidebar {
    padding-top: var(--space-2xl);
    padding-bottom: var(--space-2xl);
  }
}

/* Mobile: single column stack */
@media (max-width: 640px) {
  .hero {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }

  .hero__center {
    grid-column: 1;
    grid-row: 1;
    min-height: 100svh;
    padding: 60px var(--space-md) var(--space-xl);
    border-bottom: 1px solid var(--border);
  }

  .hero__sidebar--left {
    grid-column: 1;
    grid-row: 2;
    border-right: none;
  }
  .hero__sidebar--right {
    grid-column: 1;
    grid-row: 3;
    border-top: 1px solid var(--border);
  }

  .hero__sidebar {
    padding: var(--space-xl) var(--space-md);
    gap: var(--space-lg);
  }

  .hero__title {
    font-size: clamp(2rem, 8vw, 2.6rem);
  }
}

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.7rem 1.5rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: all 0.2s var(--ease);
}

.btn-primary {
  background: var(--blue);
  color: #fff;
}
.btn-primary:hover {
  background: var(--blue-hi);
  transform: translateY(-1px);
  box-shadow: 0 8px 28px color-mix(in srgb, var(--blue) 40%, transparent);
}

.btn-ghost {
  border: 1px solid var(--border-hi);
  color: var(--text-2);
}
.btn-ghost:hover {
  border-color: var(--blue-hi);
  color: var(--text);
  background: var(--blue-dim);
}

/* ─────────────────────────────────────────────────────────
   SECTION HEADINGS
   ───────────────────────────────────────────────────────── */
.section-header {
  margin-bottom: var(--space-2xl);
}

.section-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--gold);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: var(--space-md);
}

.section-label::before {
  content: "";
  display: inline-block;
  width: 20px;
  height: 1px;
  background: var(--gold);
}

.section-title {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  letter-spacing: -0.018em;
}

.section-desc {
  margin-top: var(--space-md);
  color: var(--text-2);
  font-size: 1.05rem;
  max-width: var(--max-w-prose);
  line-height: 1.75;
}

/* ── Doodle SVG components ──────────────────────────────── */
.doodle-card-border {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  color: var(--border-hi);
  opacity: 0.85;
  pointer-events: none;
  z-index: -1;
  transition:
    opacity 0.25s ease,
    color 0.25s ease;
}

.doodle-card-border path {
  fill: var(--bg-1);
  transition: fill 0.2s ease;
}

.project-card:hover .doodle-card-border,
.paper-card:hover .doodle-card-border,
.now-card:hover .doodle-card-border,
.read-card:hover .doodle-card-border {
  opacity: 1;
  color: var(--gold);
}

.project-card:hover .doodle-card-border path,
.paper-card:hover .doodle-card-border path,
.now-card:hover .doodle-card-border path,
.read-card:hover .doodle-card-border path {
  fill: var(--bg-2);
}

.doodle-underline {
  display: block;
  width: min(280px, 100%);
  height: 8px;
  color: var(--gold);
  opacity: 0.55;
  margin-top: 0.4rem;
}

.doodle-arrow {
  display: inline-block;
  width: 44px;
  height: 28px;
  color: var(--gold);
  opacity: 0.6;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ── Gradient divider ───────────────────────────────────── */
.divider {
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--blue-dim) 30%,
    var(--gold-dim) 70%,
    transparent 100%
  );
}

/* ─────────────────────────────────────────────────────────
   ABOUT
   ───────────────────────────────────────────────────────── */
.about__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3xl);
  align-items: start;
}

.about__bio {
  color: var(--text-2);
  font-size: 1.05rem;
  line-height: 1.8;
}
.about__bio p + p {
  margin-top: var(--space-md);
}
.about__bio strong {
  color: var(--text);
  font-weight: 500;
}

.about__skills-title {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: var(--space-md);
}

.skills-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
}

.skill-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.4rem 0.8rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-2);
}

.skill-tag:hover {
  border-color: var(--blue-hi);
  color: var(--text);
  background: var(--blue-dim);
}

.skill-tag .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--blue-hi);
  flex-shrink: 0;
}

/* ─────────────────────────────────────────────────────────
   PROJECTS
   ───────────────────────────────────────────────────────── */
.projects__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-lg);
}

.project-card {
  position: relative;
  isolation: isolate;
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.project-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  background: linear-gradient(140deg, var(--blue-dim) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.project-card:hover {
  transform: translateY(-4px) rotate(0.6deg);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
}

.project-card:nth-child(even):hover {
  transform: translateY(-4px) rotate(-0.6deg);
}

.project-card:hover::before {
  opacity: 1;
}

.project-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
}

.project-card__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--bg-3);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.project-card__links {
  display: flex;
  gap: var(--space-sm);
}

.icon-link {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-3);
}

.icon-link:hover {
  border-color: var(--blue-hi);
  color: var(--blue-hi);
  background: var(--blue-dim);
}

.project-card__title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.project-card__desc {
  color: var(--text-2);
  font-size: 0.9rem;
  line-height: 1.65;
  flex: 1;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.tag {
  padding: 0.2rem 0.55rem;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-3);
}

/* ─────────────────────────────────────────────────────────
   BLOG
   ───────────────────────────────────────────────────────── */
.blog__list {
  display: flex;
  flex-direction: column;
}

.post-item {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: var(--space-xl);
  align-items: start;
  padding: var(--space-xl) 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.post-item:first-child {
  border-top: 1px solid var(--border);
}
.post-item:hover .post-item__title {
  color: var(--blue-hi);
}

.post-item__date {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-3);
  letter-spacing: 0.05em;
  padding-top: 0.15rem;
}

.post-item__tag {
  --tc: var(--gold);
  display: inline-block;
  margin-bottom: var(--space-sm);
  padding: 0.18rem 0.5rem;
  background: color-mix(in srgb, var(--tc) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--tc) 30%, transparent);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--tc);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Per-category tag tints */
.post-item__tag[data-cat="systems"] {
  --tc: var(--blue-hi);
}
.post-item__tag[data-cat="finance"] {
  --tc: #34d399;
}
.post-item__tag[data-cat="aerospace"] {
  --tc: #a78bfa;
}
.post-item__tag[data-cat="gaming"] {
  --tc: #fbbf24;
}

.post-item__title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-sm);
  transition: color 0.18s ease;
}

.post-item__excerpt {
  font-size: 0.9rem;
  color: var(--text-2);
  line-height: 1.65;
}

.post-item__read-more {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: var(--space-md);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--blue-hi);
  opacity: 0;
  transform: translateX(-6px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.post-item:hover .post-item__read-more {
  opacity: 1;
  transform: translateX(0);
}

/* ─────────────────────────────────────────────────────────
   FOOTER
   ───────────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: var(--space-2xl) 0;
  margin-top: var(--space-3xl);
}

.footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  flex-wrap: wrap;
}

.footer__brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.015em;
}
.footer__brand span:first-child {
  color: var(--blue-hi);
}

.footer__copy {
  font-size: 0.78rem;
  color: var(--text-3);
  margin-top: var(--space-xs);
  font-family: var(--font-mono);
}

.footer__links {
  display: flex;
  gap: var(--space-lg);
}

.footer__link {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.85rem;
  color: var(--text-2);
  transition: color 0.18s ease;
}
.footer__link:hover {
  color: var(--blue-hi);
}

/* ─────────────────────────────────────────────────────────
   RESPONSIVE
   ───────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .container {
    padding: 0 var(--space-lg);
  }
  .about__grid {
    grid-template-columns: 1fr;
    gap: var(--space-2xl);
  }
  .post-item {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }
  .navbar__links-wrap {
    gap: var(--space-lg);
  }
  .navbar__links {
    gap: var(--space-lg);
  }
  .navbar__actions {
    gap: var(--space-lg);
  }
  .footer__inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .hero__title {
    font-size: 2.4rem;
  }
  .skills-grid {
    grid-template-columns: 1fr;
  }
  .navbar__links-wrap {
    gap: var(--space-sm);
  }
  .navbar__links {
    gap: var(--space-md);
  }
  .navbar__actions {
    gap: var(--space-sm);
  }
  .btn {
    font-size: 0.8rem;
    padding: 0.6rem 1.1rem;
  }
}

/* ─────────────────────────────────────────────────────────
   ANIMATIONS
   ───────────────────────────────────────────────────────── */
.page-enter {
  animation: pageIn 0.3s var(--ease) both;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ─────────────────────────────────────────────────────────
   POSTS PAGE - human-touch additions
   ───────────────────────────────────────────────────────── */

/* Grid: left column (greeting→quote), right column reads panel */
/* Left column sets height; reads panel fills it absolutely so it never creates a gap */
.posts-layout-grid {
  position: relative;
  margin-bottom: var(--space-2xl);
}
.posts-left-col {
  min-width: 0;
  margin-right: calc(320px + var(--space-2xl));
}

.posts-greeting {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 2.6vw, 1.9rem);
  font-weight: 300;
  font-style: italic;
  letter-spacing: 0.01em;
  color: var(--text-2);
  line-height: 1.2;
  margin-bottom: 0.35rem;
}

.posts-time {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-3);
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: baseline;
  gap: 0;
}

.posts-time__hm {
  color: var(--text-2);
}

.posts-time__colon {
  color: var(--text-3);
  animation: colon-blink 1s step-start infinite;
}

.posts-time__sec {
  color: var(--text-3);
}

/* Digit slide-down: data-p alternates 0/1 each time the digit's value changes.
   Switching animation-name restarts the animation without any JS. */
.posts-time__digit {
  display: inline-block;
  min-width: 1.6ch;
  text-align: center;
  vertical-align: baseline;
}

.posts-time__digit[data-p="0"] {
  animation: flip-a 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.posts-time__digit[data-p="1"] {
  animation: flip-b 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes flip-a {
  from {
    opacity: 0.15;
    transform: translateY(-7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes flip-b {
  from {
    opacity: 0.15;
    transform: translateY(-7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes colon-blink {
  0%,
  49% {
    opacity: 1;
  }
  50% {
    opacity: 0.15;
  }
}

/* Now card */
.now-card {
  position: relative;
  isolation: isolate;
  border-radius: var(--radius-lg);
  padding: var(--space-lg) var(--space-xl);
  margin-bottom: var(--space-xl);
  display: inline-flex;
  flex-direction: column;
  gap: var(--space-md);
  min-width: 0;
}

.now-card__label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}

.now-card__entries {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.now-entry {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  font-size: 0.875rem;
}

.now-entry__emoji {
  font-size: 0.9rem;
  flex-shrink: 0;
  line-height: 1.4;
}

.now-entry__field {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-3);
  letter-spacing: 0.04em;
  min-width: 5.5rem;
  flex-shrink: 0;
}

.now-entry__value {
  color: var(--text-2);
  font-size: 0.875rem;
}

/* Rotating quote */
.posts-quote {
  margin: 0 0 var(--space-2xl);
  padding-left: var(--space-lg);
  border-left: 2px solid var(--blue-dim);
}

.posts-quote__text {
  font-family: var(--font-hand);
  font-size: 1rem;
  color: var(--text-2);
  line-height: 1.55;
  margin: 0 0 0.4rem;
}

.posts-quote__text::before {
  content: "\201C";
  font-size: 1.4rem;
  line-height: 0;
  vertical-align: -0.2em;
  margin-right: 0.15em;
  color: var(--gold);
  opacity: 0.7;
}

.posts-quote__attr {
  font-family: var(--font-hand);
  font-size: 0.85rem;
  color: var(--text-3);
  opacity: 0.8;
  padding-left: 0;
}

.posts-quote__attr::before {
  content: "- ";
}

.posts-quote__attr a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.posts-quote__attr a:hover {
  color: var(--gold-hi);
  opacity: 1;
}

/* ── Reads panel ──────────────────────────────────────────── */
.reads-panel {
  position: absolute;
  right: 0;
  top: 0;
  width: 320px;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.reads-panel__cards {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  padding-right: var(--space-xs);
  padding-bottom: var(--space-xs);
}

.reads-panel__label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}

.read-card {
  display: block;
  position: relative;
  isolation: isolate;
  text-decoration: none;
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-lg);
  padding-right: calc(var(--space-lg) + 1.2rem); /* room for arrow */
  transition: transform 0.2s var(--ease);
}

.read-card:hover {
  transform: translateY(-2px);
}

.read-card__meta {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-3);
  letter-spacing: 0.03em;
  margin-bottom: 0.4rem;
}

.read-card__title {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 0.45rem;
}

.read-card:hover .read-card__title {
  color: var(--blue-hi);
}

.read-card__desc {
  font-size: 0.76rem;
  color: var(--text-2);
  line-height: 1.55;
}

.read-card__arrow {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  font-size: 0.8rem;
  color: var(--text-3);
  transition:
    color 0.15s,
    transform 0.15s;
}

.read-card:hover .read-card__arrow {
  color: var(--blue-hi);
  transform: translate(2px, -2px);
}

@media (max-width: 700px) {
  .posts-left-col {
    margin-right: 0;
  }
  .reads-panel {
    position: static;
    width: auto;
    height: auto;
  }
  .reads-panel__cards {
    max-height: 300px;
  }
}

/* ─────────────────────────────────────────────────────────
   PAPERS
   ───────────────────────────────────────────────────────── */
.papers-disclaimer {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border: 1px solid var(--border);
  border-left: 2px solid var(--gold);
  border-radius: var(--radius-lg);
  background: var(--bg-1);
  color: var(--text-2);
  font-size: 0.9rem;
  font-style: italic;
  line-height: 1.6;
  max-width: var(--max-w-prose);
}

.papers-disclaimer__icon {
  color: var(--gold);
  font-style: normal;
}

/* Featured full-length review */
.papers-featured {
  margin-bottom: var(--space-3xl);
  padding-bottom: var(--space-2xl);
  border-bottom: 1px solid var(--border);
}

.papers-featured__title {
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  letter-spacing: -0.012em;
  margin: var(--space-xs) 0 var(--space-lg);
}

/* Topic group */
.paper-group {
  margin-bottom: var(--space-2xl);
}

.paper-group__heading {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-lg);
}

.paper-group__intro {
  color: var(--text-2);
  font-size: 0.95rem;
  line-height: 1.7;
  max-width: var(--max-w-prose);
  margin-bottom: var(--space-lg);
}

.papers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-lg);
}

.paper-card {
  position: relative;
  isolation: isolate;
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition:
    transform 0.25s var(--ease),
    box-shadow 0.25s var(--ease);
}

.paper-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  background: linear-gradient(140deg, var(--blue-dim) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.paper-card:hover {
  transform: translateY(-4px) rotate(0.6deg);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
}

.paper-card:nth-child(even):hover {
  transform: translateY(-4px) rotate(-0.6deg);
}

.paper-card:hover::before {
  opacity: 1;
}

.paper-card__meta {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-3);
  letter-spacing: 0.03em;
  margin-bottom: 0.5rem;
}

.paper-card__title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 0.55rem;
}

.paper-card__title a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s;
}

.paper-card__title a:hover {
  color: var(--blue-hi);
}

.paper-card__arrow {
  margin-left: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-3);
}

.paper-card__title a:hover .paper-card__arrow {
  color: var(--blue-hi);
}

.paper-card__summary {
  font-size: 0.85rem;
  color: var(--text-2);
  line-height: 1.65;
}

/* Clickable paper card (navigates to the per-paper review page) */
.paper-card--link {
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.paper-card--link:hover .paper-card__title {
  color: var(--blue-hi);
}

.paper-card__read {
  margin-top: auto;
  padding-top: var(--space-md);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--blue-hi);
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
}

.paper-card__read-arrow {
  transition: transform 0.18s var(--ease);
}

.paper-card--link:hover .paper-card__read-arrow {
  transform: translateX(3px);
}

/* Group badge shown on each card in the flat list view */
.paper-card__group {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  background: var(--gold-dim);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  margin-bottom: 0.6rem;
  line-height: 1;
}

/* Read/unread status badge, pinned to the top-right of each card */
.paper-card__status {
  position: absolute;
  top: var(--space-lg);
  right: var(--space-lg);
  z-index: 1;
  font-family: var(--font-mono);
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  border: 1px solid var(--border);
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  line-height: 1;
}

.paper-card__status.is-read {
  color: #fff;
  border-color: var(--read);
  background: var(--read);
}

/* A read card fades back slightly so unread ones stand out */
.paper-card.is-read {
  opacity: 0.62;
}

.paper-card.is-read:hover {
  opacity: 1;
}

/* Read-progress bar + "mark all unread" control above the paper grid */
.papers-read-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin: var(--space-md) 0 var(--space-lg);
}

.papers-read-bar__count {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-2);
}

.papers-read-bar__clear {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-2);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  cursor: pointer;
  transition:
    color 0.18s var(--ease),
    border-color 0.18s var(--ease),
    background 0.18s var(--ease);
}

.papers-read-bar__clear:hover {
  color: var(--blue-hi);
  border-color: var(--blue-hi);
  background: var(--blue-dim);
}

/* Lazy-load hint at the bottom of the papers list */
.papers-load-more {
  text-align: center;
  margin-top: var(--space-2xl);
  padding: var(--space-lg) 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-3);
  border-top: 1px solid var(--border);
  animation: pulse-opacity 2s ease-in-out infinite;
}

@keyframes pulse-opacity {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

/* Per-paper review page: "read the original" link */
.paper-page__source {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--blue-hi);
  text-decoration: none;
  margin-bottom: var(--space-2xl);
  transition: gap 0.18s var(--ease);
}

.paper-page__source:hover {
  gap: 0.45rem;
}

/* Figure wrapper for an interactive chart embedded mid-review */
.paper-figure {
  margin: var(--space-2xl) 0;
}

/* ─────────────────────────────────────────────────────────
   INTERACTIVE CHARTS (paper reviews)
   ───────────────────────────────────────────────────────── */
.chart {
  margin: 0;
  padding: var(--space-lg) var(--space-lg) var(--space-md);
  border: 1px solid var(--border);
  border-left: 2px solid var(--gold);
  border-radius: var(--radius-lg);
  background: var(--bg-1);
}

.chart__title {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
  margin-bottom: var(--space-lg);
  line-height: 1.4;
}

.chart__caption {
  margin-top: var(--space-md);
  font-size: 0.8rem;
  font-style: italic;
  color: var(--text-2);
  line-height: 1.6;
}

/* ── Bar chart ── */
.chart__bars {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.chart-bar {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) 1.6fr auto;
  align-items: center;
  gap: var(--space-md);
  cursor: default;
}

.chart-bar__label {
  font-size: 0.78rem;
  color: var(--text-2);
  line-height: 1.3;
  transition: color 0.15s;
}

.chart-bar.is-active .chart-bar__label {
  color: var(--text);
}

.chart-bar__track {
  height: 14px;
  border-radius: 7px;
  background: var(--bg-3);
  overflow: hidden;
}

.chart-bar__fill {
  height: 100%;
  border-radius: 7px;
  background: linear-gradient(90deg, var(--blue), var(--blue-hi));
  transform-origin: left center;
  animation: chart-grow 0.7s var(--ease) both;
  transition: filter 0.15s;
}

.chart-bar.is-accent .chart-bar__fill {
  background: linear-gradient(90deg, var(--gold), var(--gold-hi));
}

.chart-bar.is-active .chart-bar__fill {
  filter: brightness(1.18);
}

.chart-bar__value {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
  transition:
    color 0.15s,
    transform 0.15s var(--ease);
}

.chart-bar.is-active .chart-bar__value {
  color: var(--gold-hi);
  transform: scale(1.08);
}

@keyframes chart-grow {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

/* ── Line chart ── */
.chart__plot {
  position: relative;
}

.chart__svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.chart-line__area {
  fill: var(--blue-dim);
  stroke: none;
}

.chart-line__path {
  fill: none;
  stroke: var(--blue-hi);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 600;
  stroke-dashoffset: 600;
  animation: chart-draw 1.1s var(--ease) forwards;
}

@keyframes chart-draw {
  to {
    stroke-dashoffset: 0;
  }
}

.chart-line__dot {
  fill: var(--bg-1);
  stroke: var(--gold-hi);
  stroke-width: 2.5;
  cursor: pointer;
  transition:
    r 0.15s var(--ease),
    fill 0.15s;
}

.chart-line__dot.is-active {
  fill: var(--gold-hi);
  r: 9;
}

.chart__axis {
  display: flex;
  justify-content: space-between;
  margin-top: 0.4rem;
}

.chart__tick {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-3);
}

.chart__readout {
  position: absolute;
  top: 0;
  right: 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gold-hi);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 8px);
  padding: 0.2rem 0.5rem;
  pointer-events: none;
}

@media (max-width: 560px) {
  .chart-bar {
    grid-template-columns: 1fr;
    gap: 0.3rem;
  }
  .chart-bar__value {
    justify-self: start;
  }
}

/* ─────────────────────────────────────────────────────────
   EASTER EGG - type "rust" anywhere
   ───────────────────────────────────────────────────────── */
.easter-egg {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  pointer-events: none;
  animation: egg-fade 3.2s var(--ease) both;
}

@keyframes egg-fade {
  0% {
    opacity: 0;
  }
  8% {
    opacity: 1;
  }
  78% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

.easter-egg__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  background: var(--bg-1);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-lg);
  padding: var(--space-xl) var(--space-2xl);
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.5),
    0 0 0 1px var(--border-hi);
  animation: egg-pop 0.4s var(--ease) both;
}

@keyframes egg-pop {
  from {
    transform: scale(0.7) translateY(12px);
  }
  to {
    transform: scale(1) translateY(0);
  }
}

.easter-egg__crab {
  font-size: 3.5rem;
  display: block;
  line-height: 1;
  animation: crab-bounce 0.55s ease 3;
  animation-delay: 0.3s;
}

@keyframes crab-bounce {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  35% {
    transform: translateY(-10px) rotate(-8deg);
  }
  65% {
    transform: translateY(-10px) rotate(8deg);
  }
}

.easter-egg__msg {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--blue-hi);
  letter-spacing: 0.05em;
}

/* ── Per-character flip (language switch) ───────────────── */
/*
   perspective() is embedded in the transform so no parent
   perspective property is needed on the container.
*/
.flip-char {
  display: inline-block;
  animation: char-flip 0.42s var(--ease) both;
}

@keyframes char-flip {
  from {
    opacity: 0;
    transform: perspective(250px) rotateY(-90deg);
  }
  to {
    opacity: 1;
    transform: perspective(250px) rotateY(0deg);
  }
}

/* ── Whole-block fade (long strings) ────────────────────── */
.fade-in {
  animation: fadeIn 0.35s ease both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ── Language dropdown ──────────────────────────────────── */
.lang-dropdown {
  position: relative;
  display: flex;
  align-items: center;
}

.lang-dropdown__backdrop {
  position: fixed;
  inset: 0;
  z-index: 49;
  background: transparent;
}

.lang-dropdown__btn {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0 0.65rem;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-2);
  transition:
    color 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease;
  white-space: nowrap;
}

.lang-dropdown__btn:hover,
.lang-dropdown__btn.is-open {
  color: var(--gold);
  border-color: var(--gold);
  background: var(--gold-dim);
}

.lang-dropdown__chevron {
  font-size: 0.6rem;
  opacity: 0.7;
  transition: transform 0.18s ease;
}

.lang-dropdown__btn.is-open .lang-dropdown__chevron {
  transform: rotate(180deg);
}

.lang-dropdown__menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 50;
  min-width: 140px;
  background: var(--bg-1);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-lg);
  padding: 0.35rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: dropdown-in 0.14s var(--ease) both;
}

@keyframes dropdown-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.lang-dropdown__option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.7rem;
  border-radius: calc(var(--radius-lg) - 2px);
  text-align: left;
  transition:
    background 0.12s ease,
    color 0.12s ease;
  color: var(--text-2);
}

.lang-dropdown__option:hover {
  background: var(--bg-2);
  color: var(--text);
}

.lang-dropdown__option.is-selected {
  background: var(--gold-dim);
  color: var(--gold-hi);
}

.lang-dropdown__code {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  min-width: 2rem;
}

.lang-dropdown__label {
  font-size: 0.8rem;
}

/* ── Social links (hero) ────────────────────────────────── */
.social-links {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-2);
  transition: all 0.18s ease;
}

.social-link:hover {
  border-color: var(--blue-hi);
  color: var(--blue-hi);
  background: var(--blue-dim);
}

/* ── About bio paragraph spacing ────────────────────────── */
.about__bio .fade-in + .fade-in {
  margin-top: var(--space-md);
}

/* ─────────────────────────────────────────────────────────
   POST DETAIL PAGE
   ───────────────────────────────────────────────────────── */
.post-page {
  max-width: var(--max-w-prose);
  margin: 0 auto;
  padding-top: 60px; /* navbar offset */
}

.post-page__back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-2);
  margin-bottom: var(--space-2xl);
  transition:
    color 0.18s ease,
    gap 0.2s var(--ease);
}
.post-page__back:hover {
  color: var(--blue-hi);
  gap: var(--space-md);
}

.post-page__meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.post-page__date {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-3);
  letter-spacing: 0.05em;
}

.post-page__title {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: var(--space-xl);
}

.post-page__excerpt {
  font-size: 1.05rem;
  color: var(--text-2);
  line-height: 1.75;
  margin-bottom: var(--space-2xl);
  padding-bottom: var(--space-2xl);
  border-bottom: 1px solid var(--border);
}

.post-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-3xl) var(--space-xl);
  border: 1px dashed var(--border-hi);
  border-radius: var(--radius-lg);
  text-align: center;
}

/* ── Post / Paper prev-next navigation ─────────────────── */
.post-page__nav {
  display: flex;
  justify-content: space-between;
  gap: var(--space-xl);
  margin-top: var(--space-3xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--border);
}

.post-page__nav-btn {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  max-width: 46%;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-2);
  text-align: left;
  transition:
    color 0.18s ease,
    gap 0.2s var(--ease);
}

.post-page__nav-btn--next {
  margin-left: auto;
  text-align: right;
}

.post-page__nav-btn:hover {
  color: var(--blue-hi);
}

.post-page__nav-btn:hover.post-page__nav-btn--prev {
  gap: calc(var(--space-md) + 4px);
}

.post-page__nav-btn:hover.post-page__nav-btn--next {
  gap: calc(var(--space-md) + 4px);
}

.post-page__nav-arrow {
  flex-shrink: 0;
  font-size: 1rem;
  color: var(--text-3);
  transition: color 0.18s ease;
}

.post-page__nav-btn:hover .post-page__nav-arrow {
  color: var(--blue-hi);
}

.post-page__nav-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.post-page__nav-hint {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
}

.post-page__nav-title {
  font-size: 0.82rem;
  font-family: var(--font-sans);
  color: var(--text-1);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-placeholder__icon {
  font-size: 2rem;
  line-height: 1;
}

.post-placeholder__title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.post-placeholder__desc {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-3);
  max-width: 320px;
  line-height: 1.6;
}

/* ─────────────────────────────────────────────────────────
   GISCUS COMMENTS
   ───────────────────────────────────────────────────────── */
.giscus-wrapper {
  margin-top: var(--space-3xl);
  padding-top: var(--space-2xl);
  border-top: 1px solid var(--border);
}

/* ─────────────────────────────────────────────────────────
   MARKDOWN BODY
   ───────────────────────────────────────────────────────── */
.markdown-body {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text);
}

.markdown-body h2 {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 2.5rem 0 0.75rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
}

.markdown-body h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 2rem 0 0.5rem;
  color: var(--text);
}

.markdown-body p {
  margin: 0 0 1.25rem;
  color: var(--text-2);
}

.markdown-body a {
  color: var(--blue-hi);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.markdown-body a:hover {
  color: var(--gold-hi);
}

.markdown-body ul,
.markdown-body ol {
  margin: 0 0 1.25rem 1.5rem;
  color: var(--text-2);
}

.markdown-body li {
  margin-bottom: 0.35rem;
}

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

.markdown-body em {
  font-style: italic;
}

.markdown-body code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.15em 0.4em;
  color: var(--gold-hi);
}

.markdown-body pre {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg) var(--space-xl);
  overflow-x: auto;
  margin: 0 0 1.5rem;
}

.markdown-body pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.85rem;
  color: var(--text);
}

/* highlight.js light-mode overrides */
:root[data-theme="light"] .hljs {
  background: #f5f7fa;
  color: #383a42;
}
:root[data-theme="light"] .hljs-keyword,
:root[data-theme="light"] .hljs-selector-tag,
:root[data-theme="light"] .hljs-built_in {
  color: #a626a4;
}
:root[data-theme="light"] .hljs-string,
:root[data-theme="light"] .hljs-attr {
  color: #50a14f;
}
:root[data-theme="light"] .hljs-number,
:root[data-theme="light"] .hljs-literal {
  color: #986801;
}
:root[data-theme="light"] .hljs-comment {
  color: #a0a1a7;
}
:root[data-theme="light"] .hljs-title,
:root[data-theme="light"] .hljs-function {
  color: #4078f2;
}
:root[data-theme="light"] .hljs-type,
:root[data-theme="light"] .hljs-class {
  color: #c18401;
}

/* ── Post color utilities ───────────────────────────────── */
/* Use in markdown as: <span class="hi-blue">text</span>     */
.hi-blue {
  color: var(--blue-hi);
}
.hi-teal {
  color: var(--gold-hi);
}
.hi-green {
  color: #34d399;
}
.hi-purple {
  color: #a78bfa;
}
.hi-amber {
  color: #fbbf24;
}
.hi-red {
  color: #f87171;
}
.hi-muted {
  color: var(--text-2);
}

.markdown-body blockquote {
  border-left: 3px solid var(--blue);
  margin: 0 0 1.25rem;
  padding: 0.5rem 0 0.5rem var(--space-lg);
  color: var(--text-2);
  font-style: italic;
}

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

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.5rem;
  font-size: 0.9rem;
}

.markdown-body th,
.markdown-body td {
  text-align: left;
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--border);
}

.markdown-body th {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  border-bottom-color: var(--border-hi);
}

/* ─────────────────────────────────────────────────────────
   FIGURES - credited infographics + original SVG diagrams
   embedded inside paper reviews (.markdown-body)
   ───────────────────────────────────────────────────────── */
.markdown-body .md-figure {
  margin: 2rem 0;
  padding: var(--space-md);
  border: 1px solid var(--border);
  border-left: 2px solid var(--gold);
  border-radius: var(--radius-lg);
  background: var(--bg-1);
}

.markdown-body .md-figure img,
.markdown-body .md-figure svg {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-md, 8px);
}

.markdown-body .md-figure img {
  background: #fff; /* most infographics assume a light backing */
}

.markdown-body .md-figure figcaption {
  margin-top: var(--space-md);
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--text-2);
}

.markdown-body .md-figure figcaption strong {
  color: var(--text);
}

.markdown-body .md-figure .md-credit {
  display: block;
  margin-top: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.01em;
  color: var(--text-3);
}

/* ── Original SVG concept diagrams (theme-aware via CSS vars) ── */
.diagram {
  font-family: var(--font-mono);
}
.diagram .d-die {
  fill: #6b7a93;
  stroke: var(--border-hi);
  stroke-width: 1;
}
.diagram .d-cu {
  fill: var(--gold);
}
.diagram .d-chan {
  fill: #7fb5e6;
}
.diagram .d-gate {
  fill: var(--gold);
}
.diagram .d-tube {
  fill: none;
  stroke: #7fb5e6;
  stroke-width: 3;
  stroke-linecap: round;
}
.diagram .d-tube-bad {
  fill: none;
  stroke: #e8745c;
  stroke-width: 3;
  stroke-linecap: round;
}
.diagram .d-loop {
  fill: none;
  stroke: #7fb5e6;
  stroke-width: 2.5;
}
.diagram .d-arrow-bad {
  fill: none;
  stroke: #e8745c;
  stroke-width: 2.5;
  stroke-linecap: round;
}
.diagram .d-elec-bad {
  fill: none;
  stroke: #e8745c;
  stroke-width: 2.5;
  stroke-linejoin: round;
}
.diagram .d-light {
  fill: none;
  stroke: var(--gold);
  stroke-width: 4;
  stroke-linecap: round;
}
.diagram .d-pipe-full {
  fill: #e8745c;
}
.diagram .d-pipe-idle {
  fill: #7fb5e6;
  opacity: 0.3;
}
.diagram .d-pipe-mid {
  fill: var(--gold);
}
.diagram .d-bond-ok {
  fill: #4caf82;
}
.diagram .d-bond-bad {
  fill: #e8745c;
}
.diagram .d-sink {
  fill: #9aa3af;
}
.diagram .d-defect {
  fill: none;
  stroke: #e8745c;
  stroke-width: 2.5;
}
.diagram .d-defect-x {
  fill: #e8745c;
  font-size: 18px;
  font-weight: 700;
}
.diagram .d-check {
  fill: #4caf82;
  font-size: 18px;
  font-weight: 700;
}
.diagram .d-neuron {
  fill: none;
  stroke: #6b7a93;
  stroke-width: 2;
}
.diagram .d-heat {
  fill: none;
  stroke: #e8745c;
  stroke-width: 2;
}
.diagram .d-cache-small {
  fill: var(--gold);
}
.diagram .d-cache-ok {
  fill: #4caf82;
}
.diagram .d-plateau {
  fill: none;
  stroke: #6b7a93;
  stroke-width: 2;
  stroke-dasharray: 4 4;
}
.diagram .d-loop-arrow {
  fill: none;
  stroke: var(--gold);
  stroke-width: 2;
}
.diagram .d-bond-ok-box {
  fill: rgba(76, 175, 130, 0.22);
  stroke: #4caf82;
  stroke-width: 1;
}
.diagram .d-die-faint {
  fill: #6b7a93;
  opacity: 0.35;
  stroke: var(--border-hi);
}
.diagram .d-solid {
  fill: rgba(107, 122, 147, 0.5);
  stroke: var(--border-hi);
  stroke-width: 1;
}
.diagram .d-cool-line {
  fill: none;
  stroke: #4f9ed6;
  stroke-width: 3;
}
.diagram .d-shot {
  fill: #4f9ed6;
}
.diagram .d-errbar {
  stroke: var(--gold);
  stroke-width: 3;
}
.diagram .d-rule-box {
  fill: none;
  stroke: var(--text-3);
  stroke-width: 1.5;
}
.diagram .d-char {
  fill: #7a5a32;
}
.diagram .d-plume {
  fill: rgba(6, 182, 212, 0.3);
}
.diagram .d-faint-path {
  fill: none;
  stroke: #6b7a93;
  stroke-width: 1.5;
  opacity: 0.5;
}
.diagram .d-bump {
  fill: #b8bec7;
  stroke: #8a9099;
  stroke-width: 0.75;
}
.diagram .d-pad {
  fill: var(--gold);
}
.diagram .d-rule {
  stroke: var(--text-3);
  stroke-width: 1;
}
.diagram .d-arrow {
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.5;
}
.diagram .d-hot {
  fill: #e8745c;
}
.diagram .d-cool {
  fill: #4f9ed6;
}
.diagram .d-txt {
  fill: var(--text-2);
  font-size: 13px;
}
.diagram .d-txt-strong {
  fill: var(--text);
  font-size: 13px;
  font-weight: 700;
}
.diagram .d-txt-sm {
  fill: var(--text-3);
  font-size: 11px;
}

/* ─────────────────────────────────────────────────────────
   BLOG CATEGORY FILTER
   ───────────────────────────────────────────────────────── */
.blog-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: var(--space-2xl);
}

.blog-filter__pill {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    color 0.18s ease,
    background 0.18s ease;
}

.blog-filter__pill:hover {
  border-color: var(--blue-hi);
  color: var(--blue-hi);
}

.blog-filter__pill.is-active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

/* ── Papers search box ── */
.papers-search {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: var(--space-lg);
  max-width: 420px;
}

.papers-search__icon {
  position: absolute;
  left: 0.85rem;
  font-size: 0.95rem;
  color: var(--text-3);
  pointer-events: none;
}

.papers-search__input {
  width: 100%;
  padding: 0.5rem 2.2rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-1);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text);
  transition:
    border-color 0.18s ease,
    background 0.18s ease;
}

.papers-search__input::placeholder {
  color: var(--text-3);
}

.papers-search__input:focus {
  outline: none;
  border-color: var(--gold);
  background: var(--bg-0);
}

/* Hide the native search clear control in favour of our own button */
.papers-search__input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.papers-search__clear {
  position: absolute;
  right: 0.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-3);
  font-size: 0.75rem;
  cursor: pointer;
  transition: color 0.18s ease;
}

.papers-search__clear:hover {
  color: var(--text);
}

.papers-empty {
  margin: var(--space-xl) 0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-2);
}

/* ─────────────────────────────────────────────────────────
   RECENT POSTS SECTION (HOME)
   ───────────────────────────────────────────────────────── */
.recent-section {
  padding: var(--space-3xl) 0 calc(var(--space-3xl) * 1.5);
  border-top: 1px solid var(--border);
}

.recent-section__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-lg);
  margin-bottom: var(--space-2xl);
}

.recent-section__label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: 0.4rem;
}

.recent-section__title {
  font-size: clamp(1.2rem, 2.5vw, 1.6rem);
  font-weight: 700;
  letter-spacing: -0.018em;
  line-height: 1.2;
}

.recent-section__all {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-2);
  white-space: nowrap;
  padding-bottom: 0.2rem;
  transition: color 0.18s ease;
  cursor: pointer;
  background: none;
  border: none;
}

.recent-section__all:hover {
  color: var(--blue-hi);
}

/* ── Recent cards ─────────────────────────────────────── */
.recent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-lg);
}

.recent-card {
  position: relative;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg) var(--space-xl);
  cursor: pointer;
  transition:
    border-color 0.2s var(--ease),
    transform 0.2s var(--ease),
    box-shadow 0.2s var(--ease);
  overflow: hidden;
}

.recent-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--blue-dim) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.25s var(--ease);
  pointer-events: none;
}

.recent-card:hover {
  border-color: var(--border-hi);
  transform: translateY(-3px);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.22);
}

.recent-card:hover::before {
  opacity: 1;
}

.recent-card__meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}

/* Override tag margin inside cards */
.recent-card .post-item__tag {
  margin-bottom: 0;
}

.recent-card__date {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-3);
  letter-spacing: 0.04em;
}

.recent-card__title {
  font-family: var(--font-display);
  font-size: 0.97rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-sm);
  color: var(--text);
  transition: color 0.18s ease;
}

.recent-card:hover .recent-card__title {
  color: var(--blue-hi);
}

.recent-card__excerpt {
  font-size: 0.82rem;
  color: var(--text-2);
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ─────────────────────────────────────────────────────────
   WIDE-SCREEN GUTTER STRIPS
   Pure-CSS decorative frame: visible at ≥ 1280px, purely
   in the gutter outside the 1100px content column.
   Uses body::before / ::after so no extra DOM is needed.
   .hero has z-index: 2 and sits above these strips.
   ───────────────────────────────────────────────────────── */

@media (min-width: 1430px) {
  body::before,
  body::after {
    content: "";
    position: fixed;
    top: 60px; /* start below navbar */
    bottom: 0;
    /* gutter width = half-viewport minus half of max-w (1430px / 2 = 715px) */
    width: calc(50vw - 715px);
    z-index: 1;
    pointer-events: none;
  }

  body::before {
    left: 0;
    background: linear-gradient(
      170deg,
      color-mix(in srgb, var(--blue) 10%, var(--bg-0)) 0%,
      var(--bg-0) 55%
    );
    border-right: 1px solid var(--border);
  }

  body::after {
    right: 0;
    background: linear-gradient(
      190deg,
      color-mix(in srgb, var(--gold) 10%, var(--bg-0)) 0%,
      var(--bg-0) 55%
    );
    border-left: 1px solid var(--border);
  }
}

/* ─────────────────────────────────────────────────────────
   DESK SCENE - floating ambient pixel-art widget
   ───────────────────────────────────────────────────────── */
.desk-scene-wrap,
.sherlock-scene-wrap {
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-xl);
  width: 400px;
  height: 300px;
  z-index: 5;
  pointer-events: none;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  opacity: 0.82;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* Light theme: the scene has a dark background by design - keep it visible but toned */
:root[data-theme="light"] .desk-scene-wrap,
:root[data-theme="light"] .sherlock-scene-wrap {
  opacity: 0.92;
  border-color: rgba(0, 0, 0, 0.15);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.desk-scene,
.sherlock-scene {
  width: 100%;
  height: 100%;
  display: block;
}

/* Moon glow pulse */
.ds-moon {
  animation: ds-moon-pulse 6s ease-in-out infinite;
}
@keyframes ds-moon-pulse {
  0%,
  100% {
    filter: drop-shadow(0 0 8px #b8cfe844);
  }
  50% {
    filter: drop-shadow(0 0 18px #b8cfe888);
  }
}

/* Stars blink - opacity only, three out-of-phase groups */
.ds-s1 {
  animation: ds-twinkle 3.2s ease-in-out infinite;
}
.ds-s2 {
  animation: ds-twinkle 2.7s ease-in-out infinite 0.9s;
}
.ds-s3 {
  animation: ds-twinkle 4.1s ease-in-out infinite 1.7s;
}
@keyframes ds-twinkle {
  0%,
  100% {
    opacity: 0.85;
  }
  50% {
    opacity: 0.05;
  }
}

/* Robot eyes blink */
.ds-robot-eye {
  animation: ds-robot-blink 5s step-start infinite;
}
@keyframes ds-robot-blink {
  0%,
  88%,
  100% {
    opacity: 1;
  }
  90% {
    opacity: 0;
  }
  92% {
    opacity: 1;
  }
  94% {
    opacity: 0;
  }
  96% {
    opacity: 1;
  }
}

/* Crab on screen - gentle bob */
.ds-crab-screen {
  animation: ds-crab-bob 2.5s ease-in-out infinite;
}
@keyframes ds-crab-bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2px);
  }
}

/* Character breathing */
.ds-breathe {
  transform-origin: 77px 198px;
  animation: ds-breathe 4s ease-in-out infinite;
}
@keyframes ds-breathe {
  0%,
  100% {
    transform: scaleY(1);
  }
  50% {
    transform: scaleY(1.025);
  }
}

/* Head bob */
.ds-head-bob {
  animation: ds-head-bob 4s ease-in-out infinite;
}
@keyframes ds-head-bob {
  0%,
  100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-2px);
  }
  70% {
    transform: translateY(-1px);
  }
}

/* Left arm tinkering */
.ds-arm-l {
  transform-origin: 56px 185px;
  animation: ds-arm-tinker 2.4s ease-in-out infinite;
}
@keyframes ds-arm-tinker {
  0%,
  100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(-12deg) translateY(-3px);
  }
  55% {
    transform: rotate(6deg);
  }
  80% {
    transform: rotate(-8deg) translateY(-2px);
  }
}

/* Right arm (typing / mousing) */
.ds-arm-r {
  transform-origin: 96px 185px;
  animation: ds-arm-type 1.8s ease-in-out infinite 0.3s;
}
@keyframes ds-arm-type {
  0%,
  100% {
    transform: translateY(0);
  }
  20% {
    transform: translateY(-3px) rotate(-4deg);
  }
  50% {
    transform: translateY(2px);
  }
  75% {
    transform: translateY(-2px) rotate(3deg);
  }
}

/* LED blink */
.ds-led {
  animation: ds-led 1.6s step-start infinite;
}
@keyframes ds-led {
  0%,
  60% {
    opacity: 1;
  }
  65%,
  100% {
    opacity: 0.1;
  }
}

/* Screen glow */
.ds-screen {
  animation: ds-screen-glow 5s ease-in-out infinite;
}
@keyframes ds-screen-glow {
  0%,
  100% {
    fill: #040d1c;
    filter: drop-shadow(0 0 4px #2472e822);
  }
  50% {
    fill: #061526;
    filter: drop-shadow(0 0 10px #2472e844);
  }
}

/* Cursor blink */
.ds-cursor {
  animation: ds-cursor-blink 1.1s step-start infinite;
}
@keyframes ds-cursor-blink {
  0%,
  49% {
    opacity: 0.9;
  }
  50% {
    opacity: 0;
  }
}

@media (max-width: 900px) {
  .desk-scene-wrap,
  .sherlock-scene-wrap {
    display: none;
  }
}

/* ─────────────────────────────────────────────────────────
   SHERLOCK SCENE - daytime Baker Street ambient overlay
   ───────────────────────────────────────────────────────── */

/* Falling snow - translate down within the clipped window, three phases */
.sh-snow {
  animation: sh-snow-fall 6s linear infinite;
}
.sh-sn1 {
  animation-duration: 7s;
}
.sh-sn2 {
  animation-duration: 5.4s;
  animation-delay: -2s;
}
.sh-sn3 {
  animation-duration: 8.2s;
  animation-delay: -4s;
}
@keyframes sh-snow-fall {
  0% {
    transform: translate(0, -14px);
    opacity: 0;
  }
  12% {
    opacity: 0.95;
  }
  88% {
    opacity: 0.95;
  }
  100% {
    transform: translate(-10px, 140px);
    opacity: 0;
  }
}

/* Hearth flames - flicker via vertical scale + opacity */
.sh-flame {
  transform-origin: 318px 246px;
  animation: sh-flicker 0.9s ease-in-out infinite;
}
.sh-flame2 {
  transform-origin: 312px 248px;
  animation: sh-flicker 1.3s ease-in-out infinite;
}
@keyframes sh-flicker {
  0%,
  100% {
    transform: scaleY(1) scaleX(1);
    opacity: 0.95;
  }
  35% {
    transform: scaleY(1.14) scaleX(0.94);
    opacity: 1;
  }
  60% {
    transform: scaleY(0.9) scaleX(1.05);
    opacity: 0.85;
  }
}

/* Ember bed glow */
.sh-ember {
  animation: sh-ember-pulse 2.4s ease-in-out infinite;
}
@keyframes sh-ember-pulse {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 0.85;
  }
}

/* Fire glow spilling onto the floor */
.sh-glow {
  animation: sh-glow-pulse 3.6s ease-in-out infinite;
}
@keyframes sh-glow-pulse {
  0%,
  100% {
    opacity: 0.05;
  }
  50% {
    opacity: 0.12;
  }
}

/* Candle flame flutter */
.sh-candle {
  transform-origin: 356px 84px;
  animation: sh-candle 1.1s ease-in-out infinite;
}
@keyframes sh-candle {
  0%,
  100% {
    transform: scaleY(1) translateX(0);
  }
  50% {
    transform: scaleY(0.85) translateX(0.6px);
  }
}

/* Pipe smoke - rise and fade, three staggered puffs */
.sh-smoke {
  animation: sh-smoke-rise 4.5s ease-in-out infinite;
}
.sh-sm1 {
  animation-delay: 0s;
}
.sh-sm2 {
  animation-delay: -1.5s;
}
.sh-sm3 {
  animation-delay: -3s;
}
@keyframes sh-smoke-rise {
  0% {
    transform: translate(0, 0) scale(0.6);
    opacity: 0;
  }
  20% {
    opacity: 0.55;
  }
  70% {
    opacity: 0.3;
  }
  100% {
    transform: translate(-8px, -30px) scale(1.4);
    opacity: 0;
  }
}

/* Tea steam */
.sh-steam {
  animation: sh-steam-rise 3s ease-in-out infinite;
}
.sh-st2 {
  animation-delay: -1.4s;
}
@keyframes sh-steam-rise {
  0% {
    transform: translate(0, 0) scale(0.6);
    opacity: 0;
  }
  30% {
    opacity: 0.6;
  }
  100% {
    transform: translate(-4px, -16px) scale(1.2);
    opacity: 0;
  }
}

/* Sherlock - slow breathing, subtle head settle, pipe arm drift */
.sh-breathe {
  transform-origin: 143px 224px;
  animation: sh-breathe 5s ease-in-out infinite;
}
@keyframes sh-breathe {
  0%,
  100% {
    transform: scaleY(1);
  }
  50% {
    transform: scaleY(1.02);
  }
}
.sh-head {
  animation: sh-head 5s ease-in-out infinite;
}
@keyframes sh-head {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-1px) rotate(-0.6deg);
  }
}
.sh-arm {
  transform-origin: 165px 178px;
  animation: sh-arm 5s ease-in-out infinite;
}
@keyframes sh-arm {
  0%,
  100% {
    transform: rotate(0deg);
  }
  50% {
    transform: rotate(-2deg);
  }
}

/* ─────────────────────────────────────────────────────────
   POST BANNER - per-post pixel-art banner (pokemon, homm3, …)
   ───────────────────────────────────────────────────────── */

/* Banner wrapper in post.rs - fixed aspect ratio so all banners are the same height */
.post-banner {
  width: 100%;
  max-width: 720px;
  aspect-ratio: 512 / 244;
  margin: 0 auto var(--space-xl);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}
:root[data-theme="light"] .post-banner {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* The SVG wrapper - fills the banner height (banner enforces aspect-ratio) */
.pokemon-scene-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
}
.pokemon-scene {
  width: 100%;
  height: 100%;
  display: block;
}

/* Trainer sprite - <image> at (0,0); translate both positions and animates it.
   Sprite grid 22×21 → display 33×32 px (1.5× scale).
   translateY(102) keeps the sprite on the sandy path in the 360×240 viewBox.
   scaleX flip occurs while off-screen. */
.pk-trainer-sprite {
  transform-box: fill-box;
  transform-origin: center;
  animation: pk-trainer-ride 8s linear infinite;
}
@keyframes pk-trainer-ride {
  0% {
    transform: translate(-36px, 98px) scaleX(1);
  }
  49% {
    transform: translate(360px, 98px) scaleX(1);
  }
  50% {
    transform: translate(360px, 98px) scaleX(-1);
  }
  99% {
    transform: translate(-36px, 98px) scaleX(-1);
  }
  100% {
    transform: translate(-36px, 98px) scaleX(1);
  }
}

/* ─────────────────────────────────────────────────────────
   TOOLS PAGE
   ───────────────────────────────────────────────────────── */

.tool-launch-btn {
  margin-top: auto;
  align-self: flex-start;
}

/* project-card flex column so button sits at bottom */
.project-card {
  display: flex;
  flex-direction: column;
}

/* ─────────────────────────────────────────────────────────
   PIXEL-ART TOOL
   ───────────────────────────────────────────────────────── */

.tool-back-btn {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-2);
  letter-spacing: 0.04em;
  transition: color 0.15s ease;
}
.tool-back-btn:hover {
  color: var(--blue-hi);
}

.tool-widget {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
}

/* Upload zone */
.tool-upload-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  border: 2px dashed var(--border-hi);
  border-radius: var(--radius);
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background 0.2s ease;
  padding: var(--space-lg);
  text-align: center;
}
.tool-upload-zone:hover,
.tool-upload-zone.dragover {
  border-color: var(--blue-hi);
  background: var(--blue-dim);
}
.tool-upload-zone.dragover {
  border-style: solid;
}

.tool-file-input {
  display: none;
}

.tool-upload-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text-2);
  font-size: 0.9rem;
}

.tool-upload-icon {
  font-size: 1.8rem;
  color: var(--blue-hi);
}

.tool-upload-filename {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--gold);
  word-break: break-all;
}

/* Controls row */
.tool-controls {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.tool-ctrl-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-2);
  flex-shrink: 0;
}

.tool-btn-group {
  display: flex;
  gap: var(--space-xs);
}

.tool-size-btn {
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-2);
  transition: all 0.15s ease;
}
.tool-size-btn:hover {
  border-color: var(--blue-hi);
  color: var(--text);
  background: var(--blue-dim);
}
.tool-size-btn.active {
  border-color: var(--blue-hi);
  background: var(--blue-dim);
  color: var(--blue-hi);
  font-weight: 600;
}

/* Status */
.tool-status {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-2);
  animation: tool-pulse 1.2s ease-in-out infinite;
}
@keyframes tool-pulse {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

/* Output */
.tool-output {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.tool-preview {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-2);
  line-height: 0;
}
.tool-preview svg {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Lazily-decoded .svgz images (see components/lazy_svgz.rs) */
.lazy-svgz {
  display: block;
  line-height: 0;
}
.lazy-svgz svg {
  max-width: 100%;
  height: auto;
  display: block;
}
/* Inside a fixed-aspect banner, the svgz must fill the container exactly */
.post-banner .lazy-svgz {
  width: 100%;
  height: 100%;
}
.post-banner .lazy-svgz svg {
  width: 100%;
  height: 100%;
}
/* Reserve space + show a subtle shimmer until the SVG is decoded. */
.lazy-svgz--loading {
  min-height: 120px;
  border-radius: var(--radius);
  background: linear-gradient(
    100deg,
    var(--bg-2) 30%,
    var(--bg-3, var(--border)) 50%,
    var(--bg-2) 70%
  );
  background-size: 200% 100%;
  animation: lazy-svgz-shimmer 1.4s ease-in-out infinite;
}
@keyframes lazy-svgz-shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

/* ── HoMM3 resource / mine sparkle ───────────────────────
   #b5a838 = scattered gold-coin dots across the terrain (the "gold" sparkle)
   #dcaf63 = secondary orange highlight dots
   #a01513 = mine building cluster (slow red pulse)
   #eec03c = hero flag - intentionally NOT animated
   ──────────────────────────────────────────────────────── */

/* Star-blink: dim → quick bright peak with glow → slow fade back */
@keyframes homm3-star {
  0% {
    opacity: 0.2;
    filter: brightness(0.5);
  }
  15% {
    opacity: 1;
    filter: brightness(1.8) drop-shadow(0 0 3px #ffe090);
  }
  45% {
    opacity: 0.2;
    filter: brightness(0.5);
  }
  100% {
    opacity: 0.2;
    filter: brightness(0.5);
  }
}

/* Gold coin sparkles - primary scattered dots, 1.4 s */
.post-banner .lazy-svgz svg path[fill="#b5a838"] {
  animation: homm3-star 1.4s ease-in-out infinite;
}
/* Secondary highlights - slightly longer, offset so they don't peak together */
.post-banner .lazy-svgz svg path[fill="#dcaf63"] {
  animation: homm3-star 1.8s ease-in-out infinite;
  animation-delay: -0.7s;
}

.tool-size-readout {
  margin: 0;
  font-family: var(--font-mono, monospace);
  font-size: 0.85rem;
  color: var(--text-2, var(--text));
}
.tool-size-readout strong {
  color: var(--text);
  font-weight: 600;
}

.tool-download-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.tool-download-btn {
  align-self: flex-start;
}

/* ─────────────────────────────────────────────────────────
   CODE / JSON FORMATTER PANELS
   ───────────────────────────────────────────────────────── */

.fmt-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.fmt-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.fmt-textarea {
  width: 100%;
  min-height: 240px;
  padding: var(--space-md);
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.6;
  resize: vertical;
  transition: border-color 0.15s ease;
}
.fmt-textarea:focus {
  outline: none;
  border-color: var(--blue-hi);
}
.fmt-textarea--output {
  background: var(--bg-2);
  color: var(--text);
  cursor: default;
}

/* Validity badge */
.fmt-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
}
.fmt-badge--ok {
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.25);
}
.fmt-badge--err {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Error display */
.fmt-error {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.18);
  border-radius: var(--radius);
  padding: var(--space-md);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ─────────────────────────────────────────────────────────
   CHESS TOOL
   ───────────────────────────────────────────────────────── */

.chess-status {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text);
  text-align: center;
  min-height: 1.4em;
  margin: 0;
}
.chess-status--think {
  color: var(--gold-hi);
  animation: tool-pulse 1.2s ease-in-out infinite;
}

.chess-board-wrap {
  display: flex;
  justify-content: center;
}

.chess-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 100%;
  max-width: 480px;
  aspect-ratio: 1 / 1;
  border: 2px solid var(--border-hi);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
}

.chess-sq {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.4rem, 7vw, 2.5rem);
  line-height: 1;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: background-color 0.12s ease;
}
.chess-sq--light {
  background: #dde6f1;
}
.chess-sq--dark {
  background: #7a93b6;
}

/* Highlight the from/to squares of the most recent move. */
.chess-sq--last {
  background-image: linear-gradient(
    rgba(64, 144, 255, 0.38),
    rgba(64, 144, 255, 0.38)
  );
}
/* Currently selected piece. */
.chess-sq--sel {
  box-shadow: inset 0 0 0 3px var(--gold-hi);
}

/* Legal destination markers. */
.chess-sq--target::after {
  content: "";
  position: absolute;
  width: 30%;
  height: 30%;
  border-radius: 50%;
  background: rgba(15, 25, 45, 0.32);
}
.chess-sq--capture::after {
  content: "";
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  border: 4px solid rgba(15, 25, 45, 0.32);
}

.chess-piece {
  pointer-events: none;
}
.chess-piece--white {
  color: #fbfdff;
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.55),
    0 0 1px rgba(0, 0, 0, 0.8);
}
.chess-piece--black {
  color: #16263d;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
}

/* ── Ratchet WebGPU tools (Whisper, Moondream) ───────────────────────── */
.ratchet-notice {
  padding: var(--space-lg);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  background: var(--bg-2);
  color: var(--text-2);
  line-height: 1.6;
}
.ratchet-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}
.ratchet-select {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text);
  font: inherit;
}
.ratchet-file-label {
  cursor: pointer;
}
.ratchet-check {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-2);
  font-size: 0.9rem;
}
.ratchet-progress {
  position: relative;
  height: 1.25rem;
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  overflow: hidden;
  margin-bottom: var(--space-md);
}
.ratchet-progress__bar {
  height: 100%;
  background: var(--blue);
  transition: width 0.2s ease;
}
.ratchet-progress__label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--text);
}
.ratchet-audio {
  width: 100%;
  margin-bottom: var(--space-md);
}
.ratchet-image {
  max-width: 100%;
  max-height: 320px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: var(--space-md);
}
.ratchet-segments {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}
.ratchet-segment {
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
}
.ratchet-segment__time {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  color: var(--text-2);
  margin-bottom: 0.25rem;
}
.ratchet-segment__text {
  color: var(--text);
  line-height: 1.5;
}
.ratchet-answer {
  margin-top: var(--space-md);
  padding: var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-2);
  color: var(--text);
  line-height: 1.6;
  white-space: pre-wrap;
}
.ratchet-proctime {
  margin-top: var(--space-md);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  color: var(--gold);
}

/* ── Text-to-speech: navbar badge + per-article play button ─────────────── */

.tts-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill, 999px);
  background: var(--bg-2);
  color: var(--text-2);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition:
    color 0.2s ease,
    border-color 0.2s ease;
}
.tts-badge:hover {
  color: var(--text);
  border-color: var(--blue);
}
.tts-badge__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e; /* ready */
  flex: none;
}
.tts-badge.is-loading .tts-badge__dot {
  background: var(--gold);
  animation: tts-pulse 1s ease-in-out infinite;
}
@keyframes tts-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

.tts-controls {
  margin: var(--space-md) 0 var(--space-lg);
}
.tts-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.tts-status {
  flex-basis: 100%;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  color: var(--text-2);
}
.tts-status--err {
  color: #ef4444;
}
.tts-play-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--blue);
  border-radius: var(--radius-pill, 999px);
  background: var(--blue-dim);
  color: var(--blue-hi);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.2s ease,
    opacity 0.2s ease;
}
.tts-play-btn:hover:not(:disabled) {
  background: var(--blue);
  color: #fff;
}
.tts-play-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  border-color: var(--border);
  background: transparent;
  color: var(--text-2);
}
.tts-play-btn.is-playing {
  border-color: var(--gold);
  background: var(--gold-dim);
  color: var(--gold-hi);
}
/* Paused: keeps the resumable "Listen" blue but with a dashed edge as a cue. */
.tts-play-btn.is-paused {
  border-style: dashed;
}
/* Secondary stop button: muted until hovered, then a clear cancel affordance. */
.tts-play-btn--stop {
  border-color: var(--border);
  background: transparent;
  color: var(--text-2);
}
.tts-play-btn--stop:hover:not(:disabled) {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}
.tts-play-btn__icon {
  font-size: 0.7rem;
  line-height: 1;
}
