/* ==========================================================================
   TinkeringDao Labs — Gruvbox-First Craft, Grounded Hardware & Field Journal
   - Default Theme: Gruvbox Dark (warm cast-iron & unbleached parchment)
   - Secondary Themes: Matte Black, Warm Paper
   - Mobile-first readability, interactive bench ledger, blueprints, Cmd+K,
     sticky/drawer TOC, code copy, and tap-to-zoom figure lightbox.
   ========================================================================== */

@view-transition {
  navigation: auto;
}

/* --- Theme Tokens (Gruvbox Default, WCAG AA Verified) -------------------- */

:root,
[data-theme="gruvbox"] {
  --t-bg-deep: #1d2021;
  --t-bg: #282828;
  --t-surface: #32302f;
  --t-surface-2: #3c3836;
  --t-border-subtle: #3c3836;
  --t-border-strong: #665c54;
  --t-text: #ebdbb2;
  --t-text-secondary: #d5c4a1;
  --t-text-muted: #bdae93;
  --t-brand: #fe8019;
  --t-brand-soft: rgba(254, 128, 25, 0.16);
  --t-brand-ink: #1d2021;
  --t-sage: #8ec07c;
  --t-sage-soft: rgba(142, 192, 124, 0.14);
  --t-aqua: #83a598;
  --t-elevation: 0 0 0 1px rgba(235, 219, 178, 0.08);
  --t-elevation-hover: 0 0 0 1px rgba(254, 128, 25, 0.35), 0 8px 24px -8px rgba(0, 0, 0, 0.45);
  --t-selection: rgba(254, 128, 25, 0.28);
  --t-link-hl: rgba(254, 128, 25, 0.22);
  --t-link-hl-hover: rgba(254, 128, 25, 0.42);
  --t-field-bg: #1d2021;
  --t-field-dim: #3c3836;
  --t-field-mid: #665c54;
  --t-field-lit: #d79921;
  --t-field-hover: #fe8019;
  --t-field-crest: #fabd2f;
  --t-diff-add: #b8bb26;
  --t-diff-add-bg: rgba(184, 187, 38, 0.1);
  --t-diff-del: #fb4934;
  --t-diff-del-bg: rgba(251, 73, 52, 0.1);
  --t-dao-tint: #8ec07c;
  color-scheme: dark;
}

[data-theme="matte-black"] {
  --t-bg-deep: #0b0b0c;
  --t-bg: #111112;
  --t-surface: #171719;
  --t-surface-2: #1f1f22;
  --t-border-subtle: #252529;
  --t-border-strong: #3e3e46;
  --t-text: #ececee;
  --t-text-secondary: #c2c2ca;
  --t-text-muted: #9a9aa6;
  --t-brand: #e68e0d;
  --t-brand-soft: rgba(230, 142, 13, 0.15);
  --t-brand-ink: #0c0e10;
  --t-sage: #62c482;
  --t-sage-soft: rgba(98, 196, 130, 0.13);
  --t-aqua: #7aa2f7;
  --t-elevation: 0 0 0 1px rgba(255, 255, 255, 0.07);
  --t-elevation-hover: 0 0 0 1px rgba(230, 142, 13, 0.35), 0 8px 24px -8px rgba(0, 0, 0, 0.5);
  --t-selection: rgba(230, 142, 13, 0.28);
  --t-link-hl: rgba(230, 142, 13, 0.24);
  --t-link-hl-hover: rgba(230, 142, 13, 0.44);
  --t-field-bg: #0b0b0c;
  --t-field-dim: #3d290a;
  --t-field-mid: #855209;
  --t-field-lit: #e68e0d;
  --t-field-hover: #f2b457;
  --t-field-crest: #fae0b8;
  --t-diff-add: #62c482;
  --t-diff-add-bg: rgba(98, 196, 130, 0.09);
  --t-diff-del: #e07676;
  --t-diff-del-bg: rgba(224, 118, 118, 0.09);
  --t-dao-tint: #6ee7b7;
  color-scheme: dark;
}

[data-theme="paper"] {
  --t-bg-deep: #f2efe9;
  --t-bg: #fbfaf6;
  --t-surface: #f4f1ea;
  --t-surface-2: #eae5db;
  --t-border-subtle: #dfdad0;
  --t-border-strong: #b8b2a6;
  --t-text: #24221e;
  --t-text-secondary: #45413a;
  --t-text-muted: #615c53;
  --t-brand: #b55414;
  --t-brand-soft: rgba(181, 84, 20, 0.11);
  --t-brand-ink: #ffffff;
  --t-sage: #2d6e46;
  --t-sage-soft: rgba(45, 110, 70, 0.1);
  --t-aqua: #2b5b6c;
  --t-elevation: 0 0 0 1px rgba(36, 34, 30, 0.08);
  --t-elevation-hover: 0 0 0 1px rgba(181, 84, 20, 0.35), 0 6px 18px -6px rgba(36, 34, 30, 0.12);
  --t-selection: #fde69e;
  --t-link-hl: #fce59c;
  --t-link-hl-hover: #fbd35c;
  --t-field-bg: #f2efe9;
  --t-field-dim: #d8d2c5;
  --t-field-mid: #b3aa99;
  --t-field-lit: #8c6d46;
  --t-field-hover: #b55414;
  --t-field-crest: #6e3209;
  --t-diff-add: #196b3b;
  --t-diff-add-bg: rgba(25, 107, 59, 0.08);
  --t-diff-del: #a62b2b;
  --t-diff-del-bg: rgba(166, 43, 43, 0.08);
  --t-dao-tint: #0f766e;
  color-scheme: light;
}

:root {
  --font-display: "Space Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --font-sans: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Space Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --font-reading: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --nav-h: calc(4.15rem + env(safe-area-inset-top, 0px));
  --container-max: 72rem;
  --reading-max: 41rem;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- Base & Mobile-First Readability ------------------------------------- */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  background-color: var(--t-bg);
  color: var(--t-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: clamp(0.975rem, 0.25vw + 0.94rem, 1.04rem);
  line-height: 1.68;
  background-color: var(--t-bg);
  color: var(--t-text);
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
  transition: background-color 220ms var(--ease-out), color 220ms var(--ease-out);
}

::selection {
  background: var(--t-selection);
}

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

:focus-visible {
  outline: 2px solid var(--t-brand);
  outline-offset: 3px;
}

code,
pre,
kbd {
  font-family: var(--font-mono);
}

section[id],
h2[id],
h3[id] {
  scroll-margin-top: calc(var(--nav-h) + 1.25rem);
}

.skip-link {
  position: fixed;
  top: -100%;
  left: 1rem;
  z-index: 100;
  padding: 0.65rem 1rem;
  background: var(--t-brand);
  color: var(--t-brand-ink);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 700;
}

.skip-link:focus {
  top: 0.75rem;
}

.wrap {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: clamp(1.125rem, 4vw, 2.25rem);
}

.reading-wrap {
  width: 100%;
  max-width: var(--reading-max);
  margin-inline: auto;
  padding-inline: clamp(1.15rem, 4.5vw, 1.75rem);
}

.reading-wrap--wide {
  max-width: 60rem;
}

/* --- Sticky Header & Command Trigger ------------------------------------- */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: var(--nav-h);
  padding-top: env(safe-area-inset-top, 0px);
  background: color-mix(in srgb, var(--t-bg-deep) 97%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--t-border-subtle);
}

.reading-progress {
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 2px;
  width: 100%;
  background: var(--t-brand);
  transform-origin: left center;
  transform: scaleX(0);
  pointer-events: none;
}

.nav-inner {
  height: 4.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-family: var(--font-display);
  font-size: clamp(0.95rem, 2.1vw, 1.06rem);
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--t-text);
  min-width: 0;
}

[data-theme="matte-black"] .nav-brand {
  color: #f4fbf8;
}

[data-theme="paper"] .nav-brand {
  color: #091510;
}

.brand-dao {
  color: var(--t-dao-tint);
}

.brand-mark {
  width: 2.625rem;
  height: 2.625rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .brand-mark {
    width: 2.3rem;
    height: 2.3rem;
  }
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.brand-icon-gruv {
  display: block !important;
}

.brand-icon-dark,
.brand-icon-light {
  display: none !important;
}

[data-theme="matte-black"] .brand-icon-gruv,
[data-theme="matte-black"] .brand-icon-light {
  display: none !important;
}

[data-theme="matte-black"] .brand-icon-dark {
  display: block !important;
}

[data-theme="paper"] .brand-icon-gruv,
[data-theme="paper"] .brand-icon-dark {
  display: none !important;
}

[data-theme="paper"] .brand-icon-light {
  display: block !important;
}

.nav-links {
  display: none;
  align-items: center;
  gap: 0.2rem;
}

.nav-links a {
  padding: 0.45rem 0.75rem;
  font-family: var(--font-display);
  font-size: 0.8125rem;
  color: var(--t-text-secondary);
  transition: color 150ms ease, background-color 150ms ease;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--t-text);
}

.nav-links a[aria-current="page"] {
  background: var(--t-surface);
  box-shadow: var(--t-elevation);
}

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

.cmd-trigger {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.5rem;
  min-width: 2.5rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--t-border-subtle);
  background: var(--t-surface);
  color: var(--t-text-secondary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease;
}

.cmd-trigger:hover {
  border-color: var(--t-border-strong);
  color: var(--t-text);
}

.cmd-icon {
  flex-shrink: 0;
}

.cmd-label {
  display: none;
}

.cmd-trigger kbd {
  display: none;
  font-size: 0.72rem;
  color: var(--t-text-muted);
}

@media (min-width: 640px) {
  .cmd-label {
    display: inline;
  }
}

@media (min-width: 920px) {
  .cmd-trigger kbd {
    display: inline;
  }
}

.theme-switcher {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--t-border-subtle);
  background: var(--t-surface);
  padding: 2px;
}

.theme-switcher--desktop {
  display: none;
}

@media (min-width: 640px) {
  .theme-switcher--desktop {
    display: inline-flex;
  }
}

.mobile-drawer-theme {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem clamp(1.125rem, 4vw, 2rem) 0.6rem;
  border-bottom: 1px solid var(--t-border-subtle);
}

@media (min-width: 640px) {
  .mobile-drawer-theme {
    display: none;
  }
}

.mobile-drawer-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--t-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.theme-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--t-text-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.35rem 0.48rem;
  min-height: 2.2rem;
  cursor: pointer;
  transition: color 150ms ease, background-color 150ms ease;
}

.theme-btn:hover {
  color: var(--t-text);
}

.theme-btn[aria-pressed="true"] {
  background: var(--t-surface-2);
  color: var(--t-brand);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px var(--t-border-strong);
}

.menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.6rem;
  height: 2.6rem;
  border: 1px solid var(--t-border-subtle);
  background: var(--t-surface);
  color: var(--t-text);
  cursor: pointer;
}

.mobile-drawer {
  display: none;
  border-top: 1px solid var(--t-border-subtle);
  background: var(--t-bg-deep);
}

.mobile-drawer.is-open {
  display: block;
  animation: slideDown 200ms var(--ease-out);
}

.mobile-drawer nav {
  display: flex;
  flex-direction: column;
  padding: 0.5rem clamp(1.125rem, 4vw, 2rem) 1.25rem;
}

.mobile-drawer a {
  padding: 0.85rem 0.25rem;
  min-height: 2.85rem;
  display: flex;
  align-items: center;
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--t-text-secondary);
  border-bottom: 1px solid var(--t-border-subtle);
}

.mobile-drawer a:last-child {
  border-bottom: none;
}

.mobile-drawer a[aria-current="page"] {
  color: var(--t-brand);
}

@media (min-width: 820px) {
  .nav-links {
    display: flex;
  }
  .menu-toggle,
  .mobile-drawer {
    display: none !important;
  }
}

@media (pointer: coarse) {
  .theme-btn,
  .copy-btn,
  .filter-pill,
  .cmd-trigger,
  .code-copy-btn {
    min-height: 2.75rem;
  }
}

/* --- Hero: Stillness + Warm Gruvbox Ripple Field ------------------------- */

.hero {
  position: relative;
  min-height: min(82svh, 46rem);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-bottom: 1px solid var(--t-border-subtle);
  background: var(--t-field-bg);
  overflow: hidden;
  touch-action: pan-y;
}

.hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  opacity: 0.88;
}

.hero-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 52% 58% at 78% 42%, color-mix(in srgb, var(--t-brand) 6%, transparent) 0%, transparent 72%),
    radial-gradient(ellipse 76% 78% at 24% 50%, var(--t-field-bg) 0%, color-mix(in srgb, var(--t-field-bg) 93%, transparent) 58%, transparent 100%),
    linear-gradient(to bottom, transparent 70%, var(--t-bg-deep) 100%);
}

.hero-body {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  width: 100%;
}

.hero-content {
  position: relative;
  z-index: 2;
  padding-block: clamp(2.15rem, 6vw, 4.75rem);
  max-width: 49rem;
}

@media (max-width: 639px) {
  .hero {
    min-height: auto;
  }
}

.ext-glyph {
  font-family: var(--font-mono);
  font-size: 0.68em;
  line-height: 1;
  font-weight: 400;
  color: var(--t-text-muted);
  margin-left: 0.2rem;
  display: inline-block;
  transform: translateY(-0.2em);
  transition: color 150ms ease, transform 150ms var(--ease-out);
}

a:hover .ext-glyph,
a:focus-visible .ext-glyph {
  color: var(--t-brand);
  transform: translate(1px, calc(-0.2em - 1px));
}

.hero-sponsors {
  position: relative;
  z-index: 2;
  width: 100%;
  border-top: 1px solid color-mix(in srgb, var(--t-border-subtle) 92%, transparent);
  background: color-mix(in srgb, var(--t-bg-deep) 86%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.hero-sponsors-inner {
  padding-block: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 1.15rem;
}

.sponsors-kicker {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--t-sage);
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 150ms ease;
}

.sponsors-kicker:hover {
  color: var(--t-brand);
}

@media (min-width: 720px) {
  .sponsors-kicker {
    padding-right: 1rem;
    border-right: 1px solid var(--t-border-subtle);
  }
}

.hero-sponsor-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.28rem 1.05rem;
  flex: 1 1 24rem;
  min-width: 0;
}

.hero-sponsor-item {
  display: inline-flex;
  align-items: center;
}

.hero-sponsor-link {
  display: inline-flex;
  align-items: baseline;
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--t-text-secondary);
  padding-block: 0.16rem;
  border-bottom: 1px solid transparent;
  white-space: nowrap;
  transition: color 150ms ease, border-color 150ms ease;
}

.hero-sponsor-link:hover {
  color: var(--t-text);
  border-bottom-color: var(--t-brand);
}

.sponsors-jump {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--t-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
  transition: color 150ms ease, border-color 150ms ease;
}

.sponsors-jump:hover {
  color: var(--t-brand);
  border-bottom-color: var(--t-brand);
}

.hero-flux-stage {
  perspective: 750px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(6.75rem, 15vw, 8.5rem);
  height: clamp(6.75rem, 15vw, 8.5rem);
  position: relative;
  cursor: grab;
}

.flux-card-3d {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.flux-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.flux-layer--z1 { transform: translateZ(0px); }
.flux-layer--z15 { transform: translateZ(6px); }
.flux-layer--z2 { transform: translateZ(22px); }

/* --- Brand Kit Page (/brand/) -------------------------------------------- */

.brand-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
  padding-bottom: 4rem;
}

@media (min-width: 720px) {
  .brand-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.brand-card {
  border: 1px solid var(--t-border-subtle);
  background: var(--t-surface);
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.brand-preview {
  padding: clamp(1.25rem, 4vw, 2rem);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 11.5rem;
  border-bottom: 1px solid var(--t-border-subtle);
}

.brand-preview--dark { background: #0b0b0c; }
.brand-preview--light { background: #f5f4f0; }

.brand-preview img {
  width: 100%;
  max-width: 100%;
  max-height: 9rem;
  height: auto;
  object-fit: contain;
  display: block;
}

.brand-card-foot {
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.hero-enter {
  animation: heroEnter 600ms var(--ease-out) both;
}
.hero-enter-2 { animation-delay: 75ms; }
.hero-enter-3 { animation-delay: 150ms; }
.hero-enter-4 { animation-delay: 225ms; }

.hero-note {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--t-text-secondary);
  margin-bottom: 1.15rem;
}

.status-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--t-sage);
  display: inline-block;
  vertical-align: middle;
  margin-right: 0.5rem;
  transform: translateY(-1px);
  animation: pulseDot 3.2s ease-in-out infinite;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4.4vw, 2.85rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
  text-wrap: balance;
  color: var(--t-text);
  margin-bottom: 1.2rem;
}

.hero-lead {
  font-size: clamp(1rem, 1.5vw, 1.11rem);
  line-height: 1.72;
  color: var(--t-text-secondary);
  max-width: 44rem;
  text-wrap: pretty;
  margin-bottom: 1.35rem;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.62rem 1.15rem;
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 700;
  border: 1px solid var(--t-border-strong);
  cursor: pointer;
  transition: transform 180ms var(--ease-out), background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--t-brand);
  color: var(--t-brand-ink);
  border-color: var(--t-brand);
}

.btn-primary:hover {
  filter: brightness(1.06);
}

.btn-secondary {
  background: var(--t-surface);
  color: var(--t-text);
  border-color: var(--t-border-strong);
}

.btn-secondary:hover {
  background: var(--t-surface-2);
  border-color: var(--t-brand);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--t-text-secondary);
  padding-inline: 0.5rem;
}

.btn-ghost:hover {
  color: var(--t-brand);
}

/* --- Advanced UI #1: Interactive Bench Ledger ("Where the Hours Went") --- */

.bench-strip {
  padding-block: clamp(2rem, 4.5vw, 3rem);
  border-bottom: 1px solid var(--t-border-subtle);
  background: var(--t-bg-deep);
}

.bench-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  margin-bottom: 1rem;
}

.bench-head h2 {
  font-family: var(--font-display);
  font-size: clamp(1rem, 1.8vw, 1.18rem);
  font-weight: 700;
}

.bench-summary {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  color: var(--t-text-muted);
}

.bench-bar {
  display: flex;
  width: 100%;
  height: 0.36rem;
  gap: 2px;
  background: transparent;
  overflow: hidden;
  margin-bottom: 1rem;
}

.bench-seg {
  height: 100%;
  border: none;
  cursor: pointer;
  transition: filter 160ms ease, opacity 160ms ease;
}

.bench-seg--1 { background: var(--t-brand); flex: 85; }
.bench-seg--2 { background: var(--t-sage); flex: 75; }
.bench-seg--3 { background: var(--t-aqua); flex: 80; }
.bench-seg--4 { background: #fabd2f; flex: 45; }
.bench-seg--5 { background: #d3869b; flex: 35; }

.bench-seg:hover,
.bench-seg[aria-pressed="true"] {
  filter: brightness(1.2);
}

.bench-legend {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  border-top: 1px solid var(--t-border-subtle);
  border-left: 1px solid var(--t-border-subtle);
}

@media (min-width: 640px) {
  .bench-legend {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .bench-legend {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.bench-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.9rem 1rem;
  background: transparent;
  border: none;
  border-right: 1px solid var(--t-border-subtle);
  border-bottom: 1px solid var(--t-border-subtle);
  text-align: left;
  cursor: pointer;
  transition: background-color 160ms ease, box-shadow 160ms ease;
}

.bench-item:hover,
.bench-item.is-active {
  background: color-mix(in srgb, var(--t-surface) 75%, transparent);
  box-shadow: inset 0 2px 0 var(--t-brand);
}

.bench-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  color: var(--t-text);
}

.bench-swatch {
  width: 0.48rem;
  height: 0.48rem;
  display: inline-block;
  margin-right: 0.42rem;
}

.bench-hrs {
  color: var(--t-brand);
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.bench-item-desc {
  font-size: 0.82rem;
  color: var(--t-text-secondary);
  line-height: 1.48;
}

/* --- Sections & Two-Column Swiss Editorial Grid -------------------------- */

.section {
  padding-block: clamp(2.75rem, 6vw, 4.5rem);
  border-bottom: 1px solid var(--t-border-subtle);
}

.editorial-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.6rem;
}

@media (min-width: 960px) {
  .editorial-split {
    grid-template-columns: 17.5rem minmax(0, 1fr);
    gap: 3.5rem;
    align-items: start;
  }

  .editorial-aside {
    position: sticky;
    top: calc(var(--nav-h) + 2rem);
  }
}

.editorial-main {
  min-width: 0;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 2rem;
  margin-bottom: clamp(1.5rem, 3.5vw, 2.5rem);
}

.section-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--t-sage);
  margin-bottom: 0.45rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2.3vw, 1.55rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--t-text);
  text-wrap: balance;
}

.section-desc {
  margin-top: 0.6rem;
  color: var(--t-text-secondary);
  max-width: 40rem;
  font-size: 0.925rem;
  line-height: 1.62;
  text-wrap: pretty;
}

.editorial-aside .section-link {
  margin-top: 1.15rem;
}

.section-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--t-text);
  border-bottom: 1px solid var(--t-border-strong);
  padding-bottom: 2px;
  transition: color 150ms ease, border-color 150ms ease;
}

.section-link:hover {
  color: var(--t-brand);
  border-color: var(--t-brand);
}

/* --- Minimalist Journal List (Lee Rob + Manuel Moreale Style) ------------ */

.editorial-main > .post-list {
  border-top: 1px solid var(--t-border-subtle);
  border-bottom: 1px solid var(--t-border-subtle);
  padding-block: 0.25rem;
}

.year-group {
  margin-top: 1.5rem;
}

.year-group.is-hidden {
  display: none;
}

.year-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--t-text-muted);
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--t-border-subtle);
  margin-bottom: 0.35rem;
}

.post-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.post-row {
  border-bottom: 1px solid color-mix(in srgb, var(--t-border-subtle) 55%, transparent);
}

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

.post-row.is-hidden {
  display: none;
}

.post-row-link {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  padding-block: 0.85rem;
  transition: color 150ms ease;
}

.post-row-title {
  font-family: var(--font-reading);
  font-size: clamp(1.06rem, 0.4vw + 1rem, 1.18rem);
  font-weight: 400;
  line-height: 1.42;
  color: var(--t-text);
  transition: color 150ms ease;
}

.post-row-leader {
  display: none;
}

.post-row-meta {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
  color: var(--t-text-muted);
  flex-shrink: 0;
}

.post-row-hours {
  color: var(--t-sage);
}

.post-row-link:hover .post-row-title {
  color: var(--t-brand);
}

.post-row-link:hover .post-row-leader {
  border-color: var(--t-brand);
  opacity: 0.85;
}

@media (min-width: 720px) {
  .post-row {
    border-bottom: none;
  }
  .post-row-link {
    flex-direction: row;
    align-items: baseline;
    gap: 0.75rem;
    padding-block: 0.62rem;
  }
  .post-row-leader {
    display: block;
    flex: 1 1 auto;
    min-width: 1.5rem;
    height: 1px;
    border: none;
    border-top: 1px dotted var(--t-border-strong);
    opacity: 0.5;
    transform: translateY(-0.24em);
    transition: border-color 150ms ease, opacity 150ms ease;
  }
}

/* --- Minimalist Expandable Lab Bench Rows -------------------------------- */

.bench-drawer-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--t-border-subtle);
}

.bench-drawer-list .blueprint-drawer {
  border-bottom: 1px solid var(--t-border-subtle);
  padding-block: 1.15rem;
}

.bench-drawer-list .blueprint-drawer summary {
  list-style: none;
  display: block;
  cursor: pointer;
  user-select: none;
}

.bench-drawer-list .blueprint-drawer summary::-webkit-details-marker {
  display: none;
}

.bench-row-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem 1rem;
  margin-bottom: 0.4rem;
}

.bench-row-head h3 {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--t-text);
  transition: color 150ms ease;
}

.bench-drawer-list .blueprint-drawer:hover .bench-row-head h3 {
  color: var(--t-brand);
}

.bench-row-tag {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--t-sage);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.bench-row-tag::after {
  content: "+";
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--t-text-muted);
}

.bench-drawer-list .blueprint-drawer[open] .bench-row-tag::after {
  content: "−";
  color: var(--t-brand);
}

.bench-row-desc {
  font-size: 0.94rem;
  line-height: 1.66;
  color: var(--t-text-secondary);
  max-width: 42rem;
}

.blueprint-body {
  padding-top: 0.95rem;
  margin-top: 0.85rem;
  border-top: 1px dashed var(--t-border-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--t-text-secondary);
}

.signal-chain {
  padding: 0.65rem 0.85rem;
  background: var(--t-bg-deep);
  border: 1px solid var(--t-border-subtle);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--t-text);
  white-space: normal;
  overflow-wrap: break-word;
}

.ic-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.ic-chip {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--t-border-subtle);
  background: var(--t-bg-deep);
  color: var(--t-text-secondary);
}

/* --- Hairline Action, Repository & Partner Ledgers ----------------------- */

.action-ledger {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--t-border-subtle);
}

.action-row {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding-block: 1.15rem;
  border-bottom: 1px solid var(--t-border-subtle);
}

@media (min-width: 720px) {
  .action-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1.75rem;
  }

  .action-row .cmd-box {
    flex: 0 0 22rem;
    max-width: 22rem;
  }
}

.action-row-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.action-row-head {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.action-row-head h3 {
  font-family: var(--font-display);
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--t-text);
}

.action-row-copy p {
  font-size: 0.9rem;
  color: var(--t-text-secondary);
  line-height: 1.58;
  margin-top: 0.3rem;
}

.cmd-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-width: 0;
  max-width: 100%;
  padding: 0.48rem 0.65rem;
  background: var(--t-bg-deep);
  border: 1px solid var(--t-border-subtle);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--t-text);
  overflow: hidden;
}

.cmd-box code {
  min-width: 0;
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.copy-btn,
.code-copy-btn {
  flex-shrink: 0;
  appearance: none;
  border: 1px solid var(--t-border-subtle);
  background: var(--t-surface);
  color: var(--t-text-secondary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.32rem 0.6rem;
  min-height: 2.05rem;
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease;
}

.copy-btn:hover,
.code-copy-btn:hover {
  border-color: var(--t-border-strong);
  color: var(--t-text);
}

.copy-btn.is-copied,
.code-copy-btn.is-copied {
  border-color: var(--t-sage);
  color: var(--t-sage);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
}

.filter-bar--aside {
  margin-top: 1.15rem;
  margin-bottom: 0;
}

.filter-pill {
  appearance: none;
  border: 1px solid var(--t-border-subtle);
  background: transparent;
  color: var(--t-text-secondary);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
  padding: 0.38rem 0.72rem;
  min-height: 2.2rem;
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease, background-color 150ms ease;
}

.filter-pill:hover {
  border-color: var(--t-border-strong);
  color: var(--t-text);
}

.filter-pill[aria-pressed="true"] {
  background: var(--t-brand-soft);
  border-color: var(--t-brand);
  color: var(--t-text);
}

.repo-ledger {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--t-border-subtle);
}

.repo-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-block: 1rem;
  padding-inline: 0;
  border-bottom: 1px solid var(--t-border-subtle);
  transition: padding-left 180ms var(--ease-out), background-color 160ms ease, box-shadow 160ms ease;
}

.repo-card:hover,
.repo-card.is-highlighted {
  padding-left: 0.85rem;
  padding-right: 0.65rem;
  background: color-mix(in srgb, var(--t-surface) 45%, transparent);
  box-shadow: inset 2px 0 0 var(--t-brand);
}

.repo-card.is-hidden {
  display: none;
}

.repo-card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 1rem;
}

.repo-card h3 {
  font-family: var(--font-mono);
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--t-text);
  overflow-wrap: anywhere;
  transition: color 150ms ease;
}

.repo-card:hover h3 {
  color: var(--t-brand);
}

.repo-card h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.repo-scope {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--t-sage);
  white-space: nowrap;
  flex-shrink: 0;
}

.repo-card p {
  font-size: 0.91rem;
  color: var(--t-text-secondary);
  line-height: 1.6;
  max-width: 44rem;
}

.repo-url {
  display: none;
}

.partner-ledger {
  list-style: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  border-top: 1px solid var(--t-border-subtle);
}

@media (min-width: 680px) {
  .partner-ledger {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 2.5rem;
  }
}

.partner-row {
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
  padding-block: 1rem;
  border-bottom: 1px solid var(--t-border-subtle);
  min-width: 0;
}

.partner-row-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.3rem 0.75rem;
}

.partner-row-name {
  font-family: var(--font-display);
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--t-text);
  border-bottom: 1px solid transparent;
  transition: color 150ms ease, border-color 150ms ease;
}

.partner-row-name:hover {
  color: var(--t-brand);
  border-bottom-color: var(--t-brand);
}

.partner-row-role {
  font-family: var(--font-mono);
  font-size: 0.73rem;
  color: var(--t-sage);
  white-space: nowrap;
}

.partner-row-desc {
  font-size: 0.875rem;
  line-height: 1.56;
  color: var(--t-text-secondary);
}

/* --- Blog Index & Editorial Essay View (Mobile-First + Side TOC) --------- */

.log-header {
  padding-top: clamp(2.25rem, 5vw, 4rem);
  padding-bottom: 1.75rem;
}

.log-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.6vw, 2.25rem);
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.log-intro {
  font-size: 1.05rem;
  line-height: 1.72;
  color: var(--t-text-secondary);
  max-width: 40rem;
}

.log-list-wrap {
  padding-bottom: 4.5rem;
}

/* Article Layout with Desktop Side-Rail TOC + Mobile Collapsible TOC */
.article-layout {
  width: 100%;
  max-width: 66rem;
  margin-inline: auto;
  padding-inline: clamp(1.15rem, 4.5vw, 2rem);
  padding-block: clamp(2rem, 5vw, 4rem) clamp(3.5rem, 7vw, 5rem);
}

@media (min-width: 1120px) {
  .article-layout {
    display: grid;
    grid-template-columns: minmax(0, 42rem) 15.5rem;
    justify-content: space-between;
    align-items: start;
    gap: 3rem;
  }
}

.article-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--t-text-muted);
  margin-bottom: 1.5rem;
  transition: color 150ms ease;
}

.article-back:hover {
  color: var(--t-brand);
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  color: var(--t-text-muted);
  margin-bottom: 0.9rem;
}

.hours-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  background: var(--t-sage-soft);
  border: 1px solid color-mix(in srgb, var(--t-sage) 40%, transparent);
  color: var(--t-sage);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

/* Bench Session Capsule inside Blog Posts */
.bench-capsule {
  margin-block: 1.5rem 2rem;
  padding: 1.1rem 1.25rem;
  background: var(--t-surface);
  border: 1px solid var(--t-border-subtle);
  border-left: 3px solid var(--t-sage);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
}

@media (min-width: 600px) {
  .bench-capsule {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.capsule-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.capsule-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--t-text-muted);
}

.capsule-val {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--t-text);
  font-weight: 700;
}

/* Mobile TOC Drawer & Desktop Sticky Rail */
.toc-mobile {
  margin-bottom: 1.75rem;
  border: 1px solid var(--t-border-subtle);
  background: var(--t-surface);
}

.toc-mobile summary {
  list-style: none;
  padding: 0.8rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--t-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toc-mobile summary::-webkit-details-marker {
  display: none;
}

.toc-mobile summary::after {
  content: "+";
  color: var(--t-brand);
}

.toc-mobile[open] summary::after {
  content: "−";
}

.toc-mobile ol,
.toc-rail ol {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.toc-mobile ol {
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--t-border-subtle);
  padding-top: 0.75rem;
}

.toc-rail {
  display: none;
}

@media (min-width: 1120px) {
  .toc-mobile {
    display: none;
  }
  .toc-rail {
    display: block;
    position: sticky;
    top: calc(var(--nav-h) + 2rem);
    padding-left: 1rem;
    border-left: 1px solid var(--t-border-subtle);
  }
}

.toc-rail-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--t-text-muted);
  margin-bottom: 0.75rem;
}

.toc-link {
  font-size: 0.825rem;
  line-height: 1.45;
  color: var(--t-text-muted);
  display: block;
  padding-block: 0.15rem;
  transition: color 150ms ease;
}

.toc-link:hover,
.toc-link.is-active {
  color: var(--t-brand);
}

/* Mobile-First Essay Prose */
.article-prose {
  font-family: var(--font-reading);
  font-size: clamp(1.08rem, 0.45vw + 1rem, 1.2rem);
  line-height: 1.84;
  color: var(--t-text);
}

.article-prose h1 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.4vw, 2.1rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  text-wrap: balance;
  margin-bottom: 1.25rem;
}

.article-prose h2,
.article-prose h3,
.article-prose h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--t-text);
}

.article-prose h2 {
  font-size: clamp(1.15rem, 2.2vw, 1.3rem);
  line-height: 1.38;
  margin-top: 2.75rem;
  margin-bottom: 0.95rem;
}

.article-prose h3 {
  font-size: 1.02rem;
  line-height: 1.4;
  margin-top: 2rem;
  margin-bottom: 0.65rem;
  color: var(--t-sage);
}

.heading-anchor {
  margin-left: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.8em;
  color: var(--t-text-muted);
  opacity: 0;
  background: none !important;
  transition: opacity 150ms ease, color 150ms ease;
}

.article-prose h2:hover .heading-anchor,
.article-prose h3:hover .heading-anchor,
.heading-anchor:focus-visible {
  opacity: 1;
  color: var(--t-brand);
}

.article-prose p {
  margin-bottom: 1.3rem;
  color: var(--t-text-secondary);
}

.article-prose strong {
  font-weight: 700;
  color: var(--t-text);
}

.article-prose em {
  font-style: italic;
}

.article-prose a:not(.heading-anchor) {
  background-image: linear-gradient(to right, var(--t-link-hl), var(--t-link-hl-hover));
  background-repeat: no-repeat;
  background-position: 0% 95%;
  background-size: 100% 34%;
  color: var(--t-text);
  transition: background-size 160ms var(--ease-out);
}

.article-prose a:not(.heading-anchor):hover {
  background-size: 100% 85%;
}

.article-prose ul,
.article-prose ol {
  margin-block: 1rem 1.4rem;
  padding-left: 1.5rem;
  color: var(--t-text-secondary);
}

.article-prose li {
  margin-bottom: 0.55rem;
}

.article-prose li::marker {
  color: var(--t-brand);
}

.article-prose code {
  font-size: 0.82em;
  padding: 0.15em 0.38em;
  background: var(--t-surface-2);
  border: 1px solid var(--t-border-subtle);
  color: var(--t-text);
}

.code-block-wrap {
  position: relative;
  margin-block: 1.5rem;
}

.code-block-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.85rem;
  background: var(--t-surface);
  border: 1px solid var(--t-border-subtle);
  border-bottom: none;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--t-text-muted);
}

.article-prose pre {
  margin: 0;
  padding: 1rem 1.15rem;
  background: var(--t-bg-deep);
  border: 1px solid var(--t-border-subtle);
  overflow-x: auto;
  font-size: 0.8125rem;
  line-height: 1.65;
}

.article-prose pre code {
  padding: 0;
  background: none;
  border: none;
}

.article-prose blockquote {
  margin-block: 1.85rem;
  padding: 1.05rem 1.3rem;
  border-left: 3px solid var(--t-brand);
  background: var(--t-surface);
  font-style: italic;
  color: var(--t-text);
}

.article-prose blockquote p {
  margin-bottom: 0;
  color: var(--t-text);
}

.article-prose hr {
  border: none;
  margin-block: 2.5rem;
  text-align: center;
}

.article-prose hr::before {
  content: "·  ·  ·";
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--t-text-muted);
}

/* Tap-to-Zoom Figures */
.blog-figure {
  margin-block: 2rem;
}

.blog-figure-frame {
  position: relative;
  padding: clamp(0.45rem, 1.8vw, 0.85rem);
  background: var(--t-surface);
  border: 1px solid var(--t-border-subtle);
  cursor: zoom-in;
  transition: border-color 160ms ease;
}

.blog-figure-frame:hover {
  border-color: var(--t-brand);
}

.blog-figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--t-border-subtle);
}

.blog-figure-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.blog-figure figcaption {
  margin-top: 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.55;
  color: var(--t-text-muted);
  text-align: center;
}

.table-wrap {
  margin-block: 1.75rem;
  overflow-x: auto;
  border: 1px solid var(--t-border-subtle);
  background: var(--t-surface);
}

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  line-height: 1.55;
}

.table-wrap th,
.table-wrap td {
  padding: 0.7rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--t-border-subtle);
  vertical-align: top;
}

.table-wrap th {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--t-text);
  background: var(--t-surface-2);
}

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

.diff-note {
  margin-block: 1.5rem;
  border: 1px solid var(--t-border-subtle);
  background: var(--t-bg-deep);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.65;
  overflow-x: auto;
}

.diff-line {
  display: block;
  padding: 0.22rem 0.9rem;
  white-space: pre;
}

.diff-line.is-add {
  background: var(--t-diff-add-bg);
  color: var(--t-diff-add);
}

.diff-line.is-del {
  background: var(--t-diff-del-bg);
  color: var(--t-diff-del);
}

.post-pager {
  margin-top: 3.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--t-border-subtle);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

@media (min-width: 600px) {
  .post-pager {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.pager-link {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1.05rem;
  border: 1px solid var(--t-border-subtle);
  background: var(--t-surface);
  transition: border-color 160ms ease, transform 180ms var(--ease-out);
}

.pager-link:hover {
  border-color: var(--t-brand);
  transform: translateY(-1px);
}

.pager-link--next {
  text-align: right;
}

.pager-dir {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--t-text-muted);
}

.pager-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--t-text);
}

/* --- Native <dialog> Modals: Command Palette & Figure Lightbox ----------- */

dialog.modal-dialog {
  margin: auto;
  border: 1px solid var(--t-border-strong);
  background: var(--t-bg-deep);
  color: var(--t-text);
  width: min(92vw, 36rem);
  max-height: 82svh;
  padding: 0;
}

dialog.modal-dialog::backdrop {
  background: rgba(15, 16, 17, 0.76);
  backdrop-filter: blur(4px);
}

.cmd-head {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--t-border-subtle);
  padding: 0.75rem 1rem;
  gap: 0.6rem;
}

.cmd-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--t-text);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  outline: none;
}

.cmd-close {
  appearance: none;
  border: 1px solid var(--t-border-subtle);
  background: var(--t-surface);
  color: var(--t-text-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.25rem 0.55rem;
  cursor: pointer;
}

.cmd-results {
  list-style: none;
  max-height: 60svh;
  overflow-y: auto;
  padding: 0.5rem;
}

.cmd-results a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0.75rem;
  font-size: 0.875rem;
  border: 1px solid transparent;
}

.cmd-results a:hover,
.cmd-results a:focus-visible {
  background: var(--t-surface);
  border-color: var(--t-border-subtle);
  color: var(--t-brand);
}

.cmd-kind {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--t-text-muted);
  flex-shrink: 0;
}

dialog.lightbox-dialog {
  width: min(96vw, 68rem);
  max-height: 92svh;
  padding: 0.75rem;
}

.lightbox-inner {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.lightbox-inner img {
  width: 100%;
  max-height: 78svh;
  object-fit: contain;
  background: var(--t-bg);
}

.lightbox-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--t-text-muted);
}

.not-found {
  padding-block: clamp(4rem, 12vw, 8rem);
}

.not-found h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4.5vw, 2.6rem);
  margin-bottom: 1rem;
}

.not-found p {
  color: var(--t-text-secondary);
  margin-bottom: 2rem;
  max-width: 32rem;
}

/* --- Footer -------------------------------------------------------------- */

.site-footer {
  margin-top: auto;
  padding-block: 2.5rem;
  border-top: 1px solid var(--t-border-subtle);
  background: var(--t-bg-deep);
  font-size: 0.85rem;
  color: var(--t-text-muted);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 768px) {
  .footer-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.footer-links a:hover {
  color: var(--t-brand);
}

/* --- Motion & Reduced-Motion Safety -------------------------------------- */

@keyframes heroEnter {
  from {
    transform: translateY(8px);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .hero-enter,
  .mobile-drawer.is-open {
    opacity: 1;
    transform: none;
    animation: none;
    transition: none;
  }
  .btn:hover,
  .story-card:hover,
  .repo-card:hover,
  .pager-link:hover,
  .bench-item:hover {
    transform: none;
  }
  .status-dot {
    animation: none;
  }
}
