:root {
  --paper: #f7f4ec;
  --paper-deep: #ede5d6;
  --ink: #171713;
  --muted: #656056;
  --line: #d7cdbb;
  --bench-blue: #0f6e99;
  --solder-green: #1d6f5f;
  --copper: #b96532;
  --graphite: #252721;
  --white: #fffdf7;
  --ink-soft: #36342e;
  --radius: 8px;
  --max: 1180px;
  --section: clamp(64px, 9vw, 120px);
  --section-half: clamp(44px, 6vw, 80px);
  --shadow-lg: 0 24px 60px rgba(23, 23, 19, 0.15);
  --shadow-sm: 0 14px 36px rgba(23, 23, 19, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(23, 23, 19, 0.035) 1px, transparent 1px) 0 0 / 56px 56px,
    linear-gradient(0deg, rgba(23, 23, 19, 0.03) 1px, transparent 1px) 0 0 / 56px 56px,
    var(--paper);
  color: var(--ink);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.55;
}

img,
video {
  display: block;
  width: 100%;
}

a {
  color: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px max(22px, calc((100vw - var(--max)) / 2));
  background: rgba(247, 244, 236, 0.86);
  border-bottom: 1px solid rgba(23, 23, 19, 0.12);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 700;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--paper);
  background: var(--ink);
  border-radius: 50%;
  font-family: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  color: var(--muted);
  font-size: 14px;
}

nav a {
  text-decoration: none;
}

nav a:hover,
nav a:focus-visible {
  color: var(--ink);
}

main {
  overflow: clip;
}

.section-grid,
.prototypes,
.feature-band,
.statement,
.closing {
  width: min(var(--max), calc(100% - 44px));
  margin: 0 auto;
}

.section-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(340px, 1.08fr);
  gap: clamp(28px, 5vw, 76px);
  align-items: center;
}

.hero {
  padding: clamp(42px, 5vw, 64px) 0 var(--section-half);
}

.eyebrow,
.case-label {
  margin: 0 0 14px;
  color: var(--solder-green);
  font-family: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 24px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(44px, 5vw, 68px);
  font-weight: 700;
  line-height: 1.02;
}

h2 {
  margin-bottom: 20px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(32px, 3.6vw, 52px);
  line-height: 1.08;
}

h3 {
  margin-bottom: 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(22px, 2.4vw, 30px);
  line-height: 1.2;
}

.lead {
  max-width: 620px;
  color: var(--ink-soft);
  font-size: clamp(18px, 2vw, 21px);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px 22px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  font-family: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  transition: transform 0.15s ease, background-color 0.15s ease,
    border-color 0.15s ease, color 0.15s ease;
}

.button svg {
  flex: none;
}

.button .button-icon {
  width: 11px;
  height: 8px;
}

.button.primary {
  color: var(--paper);
  background: var(--ink);
}

.button.primary:hover,
.button.primary:focus-visible {
  background: var(--graphite);
}

.button.secondary {
  color: var(--ink);
  border-color: rgba(23, 23, 19, 0.28);
  background: var(--white);
}

.button.secondary:hover,
.button.secondary:focus-visible {
  color: var(--solder-green);
  border-color: var(--solder-green);
  background: rgba(29, 111, 95, 0.08);
}

.button:hover,
.button:focus-visible,
.text-link:hover,
.text-link:focus-visible {
  transform: translateY(-1px);
}

.hero-status {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-top: 28px;
  color: inherit;
  text-decoration: none;
}

.hero-status:focus-visible {
  outline: 2px solid var(--solder-green);
  outline-offset: 4px;
  border-radius: 6px;
}

.hero-status .repo-badge {
  transition: border-color 0.15s ease, color 0.15s ease;
}

.hero-status:hover .repo-badge,
.hero-status:focus-visible .repo-badge {
  border-color: var(--solder-green);
  color: var(--solder-green);
}

.hero-status-arrow {
  width: 11px;
  height: 8px;
  flex: none;
  color: var(--solder-green);
  transition: transform 0.15s ease, color 0.15s ease;
}

.hero-status:hover .hero-status-arrow,
.hero-status:focus-visible .hero-status-arrow {
  transform: translateY(2px);
  color: var(--ink);
}

.hero-status-dot {
  width: 9px;
  height: 9px;
  flex: none;
  border-radius: 50%;
  background: var(--copper);
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px rgba(185, 101, 50, 0.35);
  animation: hero-status-pulse 2.6s ease-out infinite;
}

@keyframes hero-status-pulse {
  0% {
    box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px rgba(185, 101, 50, 0.4);
  }
  70%,
  100% {
    box-shadow: 0 0 0 3px var(--paper), 0 0 0 12px rgba(185, 101, 50, 0);
  }
}

.hero-status-note {
  color: var(--muted);
  font-family: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
}

.hero-media {
  margin: 0;
  align-self: stretch;
}

.hero-media img,
.case-media img,
video {
  border: 1px solid rgba(23, 23, 19, 0.16);
  border-radius: var(--radius);
  background: var(--paper-deep);
  box-shadow: var(--shadow-lg);
}

.hero-media img {
  height: min(68svh, 680px);
  object-fit: cover;
}

/* --- Hero: momentum strip + panel-over-photo card + loud diary CTA --- */
.hero-momentum {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 0;
  margin: 22px 0 0;
  font-family: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

.hero-momentum span + span::before {
  content: "·";
  margin: 0 10px;
  color: var(--muted);
}

.hero-momentum-hot {
  color: var(--copper);
}

.hero-media {
  position: relative;
}

.hero-panel-card {
  position: absolute;
  left: clamp(-30px, -3vw, -12px);
  /* Anchor to the photo (fixed height), not the stretched figure box. */
  top: calc(min(68svh, 680px) - 265px);
  width: min(66%, 360px);
  display: block;
  text-decoration: none;
  border: 1px solid rgba(23, 23, 19, 0.22);
  border-radius: 8px;
  overflow: hidden;
  background: var(--white);
  box-shadow: var(--shadow-lg);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.hero-panel-card:hover,
.hero-panel-card:focus-visible {
  transform: translateY(-3px);
}

.hero-panel-card:focus-visible {
  outline: 2px solid var(--solder-green);
  outline-offset: 3px;
}

.hero-panel-chrome {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-bottom: 1px solid rgba(23, 23, 19, 0.14);
  background: var(--paper-deep);
  font-family: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero-panel-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(23, 23, 19, 0.18);
}

.hero-panel-chrome .hero-panel-dot:first-child {
  background: var(--copper);
}

.hero-panel-card img {
  display: block;
  width: 100%;
  height: auto;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.hero-status--loud {
  padding: 12px 16px;
  border: 1px solid rgba(23, 23, 19, 0.16);
  border-radius: 12px;
  background: var(--white);
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(23, 23, 19, 0.06));
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.hero-status--loud:hover {
  transform: translateY(-1px);
  border-color: var(--solder-green);
}

.hero-status--loud .hero-status-note {
  color: var(--ink);
  font-weight: 700;
}

@media (max-width: 900px) {
  .hero-panel-card {
    position: static;
    width: 100%;
    margin-top: 14px;
  }
}

figcaption {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.statement {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 48px;
  padding: var(--section-half) 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.statement p:first-child {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(26px, 3.2vw, 44px);
  line-height: 1.15;
}

.statement-support {
  align-self: end;
}

.statement-support p {
  color: var(--muted);
  font-size: 17px;
}

audio {
  display: block;
  width: 100%;
  margin-top: 14px;
  accent-color: var(--solder-green);
}

/* Custom transport replaces native controls when JS runs. */
audio:not([controls]) {
  display: none;
}

.player {
  --player-accent: var(--solder-green);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.player-toggle {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  padding: 0;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--ink);
  border-radius: 50%;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease,
    border-color 0.15s ease;
}

.player-toggle svg {
  width: 9px;
  height: 9px;
  fill: currentColor;
}

.player-icon-play {
  margin-left: 1px;
}

.player-icon-pause {
  display: none;
}

.player.is-playing .player-icon-play {
  display: none;
}

.player.is-playing .player-icon-pause {
  display: block;
}

.player.is-playing .player-toggle {
  color: var(--paper);
  background: var(--ink);
}

.player-toggle:hover,
.player-toggle:focus-visible {
  color: var(--player-accent);
  border-color: var(--player-accent);
}

.player.is-playing .player-toggle:hover,
.player.is-playing .player-toggle:focus-visible {
  color: var(--paper);
  background: var(--graphite);
  border-color: var(--graphite);
}

.player-toggle:focus-visible {
  outline: 2px solid var(--player-accent);
  outline-offset: 2px;
}

.player-time {
  flex: none;
  min-width: 28px;
  color: var(--muted);
  font-family: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.player-duration {
  text-align: right;
}

/* Seek rail, segmented like the step tracks — playback fills the steps. */
.player-rail {
  --p: 0;
  position: relative;
  flex: 1;
  height: 10px;
  min-width: 80px;
}

.player-rail::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to right,
    var(--player-accent) calc(var(--p) * 100%),
    var(--line) calc(var(--p) * 100%)
  );
  -webkit-mask: repeating-linear-gradient(90deg, #000 0 4px, transparent 4px 7px);
  mask: repeating-linear-gradient(90deg, #000 0 4px, transparent 4px 7px);
}

.player-seek {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.player-rail:has(.player-seek:focus-visible) {
  outline: 2px solid var(--player-accent);
  outline-offset: 4px;
}

.player-loop {
  flex: none;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-family: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.instrument {
  padding: var(--section) 0;
}

.instrument p,
.about-copy p,
.case-copy p,
.closing p {
  color: var(--ink-soft);
  font-size: 17px;
}

.signal-card {
  padding: clamp(20px, 4vw, 34px);
  color: var(--paper);
  background: var(--graphite);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.signal-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 28px;
}

.signal-row span {
  display: grid;
  min-height: 72px;
  place-items: center;
  padding: 12px;
  color: var(--paper);
  background: rgba(247, 244, 236, 0.08);
  border: 1px solid rgba(247, 244, 236, 0.2);
  border-radius: 6px;
  font-family: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
}

.modulation-strip {
  display: grid;
  gap: 18px;
  margin: 14px 0 24px;
  padding: 20px 0;
  border-top: 1px solid rgba(247, 244, 236, 0.18);
  border-bottom: 1px solid rgba(247, 244, 236, 0.18);
}

.step-track {
  display: grid;
  gap: 7px;
}

.step-track.sixteen {
  grid-template-columns: repeat(16, 1fr);
}

.step-track.twelve {
  grid-template-columns: repeat(12, 1fr);
  width: 86%;
}

.step-track span {
  height: 18px;
  border-radius: 999px;
  background: var(--bench-blue);
}

.step-track.twelve span {
  background: var(--copper);
}

.step-track span:nth-child(3n) {
  opacity: 0.42;
}

.step-track span:nth-child(5n) {
  opacity: 0.72;
}

.signal-card p {
  margin-bottom: 0;
  color: rgba(247, 244, 236, 0.78);
}

.firmware-study {
  width: min(var(--max), calc(100% - 44px));
  margin: 0 auto var(--section);
  padding-top: clamp(20px, 4vw, 54px);
}

.firmware-study-heading {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: end;
  margin-bottom: 30px;
}

.firmware-study-heading h2 {
  max-width: 780px;
  margin-bottom: 0;
}

.firmware-study-heading > p {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 17px;
}

.firmware-study-main {
  margin: 0;
}

.firmware-study-visual {
  position: relative;
  aspect-ratio: 8 / 5;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.firmware-photo-window {
  position: absolute;
  top: 11.2%;
  left: 31.25%;
  width: 64.375%;
  height: 77%;
  overflow: hidden;
  border-radius: 8px;
  background: var(--graphite);
}

.firmware-photo-window img {
  position: absolute;
  top: -1.35%;
  left: -0.675%;
  width: 101.35%;
  max-width: none;
  height: 102.7%;
}

.firmware-study-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
}

.firmware-study-visual.is-compact .firmware-photo-window {
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 0;
}

.firmware-study-visual.is-compact .firmware-photo-window img {
  top: -107.4%;
  left: -93.375%;
  width: 288%;
  height: 259.2%;
}

.firmware-study figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-family: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  font-size: 11px;
  line-height: 1.5;
}

.mod-relations-label {
  margin: clamp(26px, 5vw, 48px) 0 14px;
}

.mod-relations {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.mod-relations article {
  padding: clamp(16px, 2.2vw, 26px);
  background: var(--white);
}

.mod-relations .mod-icon {
  display: block;
  width: 72px;
  height: 32px;
  margin-bottom: 14px;
}

.mod-relations h4 {
  margin: 0 0 10px;
  font-family: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.4px;
  color: var(--ink);
}

.mod-relations h4 span {
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0.4px;
}

.mod-relations p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.firmware-variants {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(18px, 3vw, 30px);
  margin-top: clamp(32px, 5vw, 64px);
}

.firmware-variant {
  display: flex;
  flex-direction: column;
  padding: clamp(16px, 2.4vw, 28px);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}


.firmware-variant h3 {
  margin-bottom: 10px;
}

.firmware-variant p:not(.case-label) {
  color: var(--muted);
}

.firmware-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 18px 0 24px;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-family: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.firmware-legend li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
}

.legend-dot.green {
  background: var(--solder-green);
}

.legend-dot.copper {
  background: var(--copper);
}

.legend-dot.ink {
  background: var(--ink);
}

.firmware-variant figure {
  margin: auto 0 0;
  padding-top: 18px;
}

.firmware-variant .firmware-study-visual {
  box-shadow: var(--shadow-sm);
}

.feature-band {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-bottom: var(--section);
  background: var(--line);
  border: 1px solid var(--line);
}

.feature-band article {
  padding: clamp(22px, 3vw, 34px);
  background: var(--white);
}

.feature-band p {
  color: var(--muted);
}

.prototypes {
  padding: var(--section) 0;
  border-top: 1px solid var(--line);
}

.section-heading {
  max-width: 760px;
  margin-bottom: clamp(36px, 5vw, 56px);
}

.case-study {
  display: grid;
  grid-template-columns: 0.82fr 1.18fr;
  gap: clamp(26px, 4vw, 52px);
  align-items: center;
  margin-bottom: var(--section-half);
}

.case-study.reverse {
  grid-template-columns: 1fr 0.9fr;
}

.case-study.reverse .case-copy {
  order: 2;
}

.case-study.reverse .case-media {
  order: 1;
}

.gallery {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.gallery img,
.single img {
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.text-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 10px 18px;
  border: 1px solid rgba(29, 111, 95, 0.4);
  border-radius: 999px;
  background: rgba(29, 111, 95, 0.08);
  color: var(--solder-green);
  font-family: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.text-link:hover,
.text-link:focus-visible {
  border-color: var(--solder-green);
}

.video-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(18px, 3vw, 30px);
  margin-bottom: var(--section-half);
}

.video-pair figure {
  margin: 0;
}

video {
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.about {
  align-items: start;
  padding: var(--section) 0;
  border-top: 1px solid var(--line);
}

.about-copy {
  columns: 2 280px;
  column-gap: 34px;
}

.closing {
  margin-bottom: 44px;
  padding: clamp(38px, 7vw, 78px);
  color: var(--paper);
  background: var(--ink);
  border-radius: var(--radius);
}

.closing .eyebrow,
.closing p {
  color: rgba(247, 244, 236, 0.78);
}

.closing h2 {
  max-width: 820px;
  color: var(--paper);
}

.closing p {
  max-width: 760px;
}

.closing-mail {
  margin-top: 20px;
  color: var(--ink);
  background: var(--paper);
  border-color: var(--paper);
}

@media (max-width: 880px) {
  .site-header {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .section-grid,
  .case-study,
  .case-study.reverse,
  .statement,
  .video-pair,
  .feature-band,
  .firmware-study-heading,
  .firmware-variants {
    grid-template-columns: 1fr;
  }

  .mod-relations {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .case-study.reverse .case-copy,
  .case-study.reverse .case-media {
    order: initial;
  }

  .hero-media img {
    height: auto;
    aspect-ratio: 4 / 3;
  }

  .signal-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .section-grid,
  .prototypes,
  .feature-band,
  .statement,
  .closing,
  .firmware-study {
    width: min(100% - 28px, var(--max));
  }

  nav {
    gap: 10px 14px;
  }

  .mod-relations {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 40px;
  }

  h2 {
    font-size: 30px;
  }

  .gallery,
  .signal-row {
    grid-template-columns: 1fr;
  }

  .step-track span {
    height: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .button:hover,
  .button:focus-visible,
  .text-link:hover,
  .text-link:focus-visible {
    transform: none;
  }

  .hero-status:hover .hero-status-arrow,
  .hero-status:focus-visible .hero-status-arrow {
    transform: none;
  }

  .hero-status-dot {
    animation: none;
  }
}

/* Dev diary ------------------------------------------------------------- */
.dev-diary {
  width: min(var(--max), calc(100% - 44px));
  margin: 0 auto var(--section);
  scroll-margin-top: 84px;
}

.diary-index {
  margin-bottom: clamp(18px, 2.5vw, 26px);
}

.diary-index-head {
  margin-bottom: clamp(20px, 3vw, 28px);
}

.diary-index-head .eyebrow {
  display: block;
  margin-bottom: 10px;
}

.diary-index-lead {
  margin: 12px 0 0;
  max-width: 52ch;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.diary-stats {
  color: var(--muted);
  font-family: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.diary-jump-latest {
  margin-left: 12px;
  color: var(--solder-green);
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px solid rgba(29, 111, 95, 0.35);
  white-space: nowrap;
}

.diary-jump-latest:hover,
.diary-jump-latest:focus-visible {
  border-bottom-color: var(--solder-green);
}

.diary-chapters {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.diary-chapters li {
  border-bottom: 1px solid var(--line);
}

.diary-chapters a {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 4px 16px;
  padding: 15px 10px;
  color: inherit;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.diary-chapters a:hover,
.diary-chapters a:focus-visible {
  background: rgba(29, 111, 95, 0.06);
}

.diary-chapters a:focus-visible {
  outline: 2px solid var(--solder-green);
  outline-offset: -2px;
}

.diary-chapters-num {
  font-family: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--copper);
}

.diary-chapters-name {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
}

.diary-chapters-sub {
  display: block;
  margin-top: 2px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
}

.diary-chapters-meta {
  font-family: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  color: var(--muted);
}

.diary-chapters-arrow {
  width: 8px;
  height: 12px;
  color: var(--solder-green);
  transition: transform 0.15s ease;
}

.diary-chapters a:hover .diary-chapters-arrow,
.diary-chapters a:focus-visible .diary-chapters-arrow {
  transform: translateX(3px);
}

/* the middle cell of an index row and of a chapter heading; min-width lets a
   long subtitle wrap instead of stretching the grid track */
.diary-chapters-text,
.diary-chapter-text {
  min-width: 0;
}

.diary {
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.diary > summary {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px clamp(20px, 3vw, 32px);
  cursor: pointer;
  list-style: none;
}

.diary > summary::-webkit-details-marker {
  display: none;
}

.diary > summary:focus-visible {
  outline: 2px solid var(--solder-green);
  outline-offset: -2px;
}

.diary-title {
  display: block;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  color: var(--ink);
}

.diary-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-top: 16px;
}

.diary-meta-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-family: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
}

.diary-toggle {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 9px;
  padding: 10px 18px;
  border: 1px solid rgba(23, 23, 19, 0.28);
  border-radius: 999px;
  background: var(--white);
  color: var(--solder-green);
  font-family: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.diary > summary:hover .diary-toggle,
.diary > summary:focus-visible .diary-toggle {
  border-color: var(--solder-green);
  background: rgba(29, 111, 95, 0.08);
}

.diary-toggle-chevron {
  width: 11px;
  height: 8px;
  flex: none;
  transition: transform 0.2s ease;
}

.diary[open] .diary-toggle-chevron {
  transform: rotate(180deg);
}

.diary-toggle-close {
  display: none;
}

.diary[open] .diary-toggle-open {
  display: none;
}

.diary[open] .diary-toggle-close {
  display: inline;
}

.diary-body {
  padding: clamp(26px, 3.5vw, 38px) clamp(20px, 3vw, 32px) clamp(24px, 3vw, 34px);
  border-top: 1px solid var(--line);
}

.diary-timeline {
  list-style: none;
  margin: 0 0 clamp(28px, 4vw, 40px);
  padding: 0;
}

.diary-timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: clamp(14px, 2vw, 28px);
  padding: 0 0 30px 34px;
  scroll-margin-top: 84px;
}

.diary-timeline li:last-child {
  padding-bottom: 4px;
}

/* commit rail */
.diary-timeline li::before {
  content: "";
  position: absolute;
  top: 9px;
  bottom: -9px;
  left: 5px;
  width: 2px;
  background: var(--line);
}

.diary-timeline li:last-child::before {
  display: none;
}

/* commit dot */
.diary-timeline li::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--solder-green);
  box-shadow: 0 0 0 3px var(--white);
}

.diary-timeline li.is-current::after {
  background: var(--copper);
  box-shadow: 0 0 0 3px var(--white), 0 0 0 5px rgba(185, 101, 50, 0.35);
}

.diary-date {
  padding-top: 1px;
  color: var(--muted);
  font-family: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.diary-timeline li.is-current .diary-date {
  color: var(--ink);
}

.diary-chapter {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 4px 16px;
  margin: 0 0 22px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 84px;
}

.diary-chapter-num {
  font-family: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--copper);
}

.diary-chapter-name {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(19px, 2vw, 23px);
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
}

.diary-chapter-sub {
  display: block;
  margin-top: 3px;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
  color: var(--muted);
}

.diary-chapter-range {
  font-family: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  color: var(--muted);
}

.diary-entry h4 {
  margin: 0 0 6px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
}

.diary-entry p {
  margin: 0;
  max-width: 62ch;
  color: var(--muted);
}

/* Entries that run several paragraphs without a figure between them need the
   break back — figures already restore it via `.diary-render + p`. */
.diary-entry p + p {
  margin-top: 18px;
}

/* An entry written in frustration stays on the record — the stamp says what it
   is, the addendum below it carries the result that arrived afterwards. */
.diary-entry .diary-stamp {
  display: inline-block;
  margin: 0 0 14px;
  padding: 3px 9px;
  max-width: none;
  border: 1px solid var(--copper);
  border-radius: 3px;
  color: var(--copper);
  font-family: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  transform: rotate(-1.2deg);
}

.diary-entry .diary-stamp + p {
  margin-top: 0;
}

.diary-addendum {
  margin: 18px 0 0;
  max-width: 62ch;
  padding-left: 16px;
  border-left: 2px solid var(--solder-green);
}

.diary-entry .diary-addendum-label {
  margin: 0 0 6px;
  color: var(--solder-green);
  font-family: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.diary-entry .diary-addendum p {
  max-width: none;
}

.diary-addendum + .diary-render {
  margin-top: 18px;
}

.diary-entry a,
.firmware-study-heading a {
  color: var(--solder-green);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.repo-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-family: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.repo-badge svg {
  flex: none;
  opacity: 0.85;
}

.repo-badge:hover,
.repo-badge:focus-visible {
  border-color: var(--solder-green);
  color: var(--solder-green);
}

/* Render attached to a diary entry — the artifact that commit shipped. */
.diary-render {
  margin: 18px 0 0;
  max-width: 62ch;
}

/* Stacked renders belong to one milestone — tighter than the paragraph gap. */
.diary-render + .diary-render {
  margin-top: 14px;
}

/* The hero takes sit two-up on desktop: four listens in one glance, no scroll. */
.hero-listens {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 26px;
  margin-top: 26px;
}

/* The newest take runs the full width rather than leaving an odd cell dangling. */
.hero-listen--wide {
  grid-column: 1 / -1;
}

/* Grid gap owns the spacing here, and each cell fills its own column. */
.hero-listens .diary-render,
.hero-listens .diary-render + .diary-render {
  margin: 0;
  max-width: none;
}

/* One column before the players get too narrow to scrub. */
@media (max-width: 1080px) {
  .hero-listens {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }
}

/* A paragraph after a render needs the gap back (renders carry no bottom margin). */
.diary-render + p {
  margin-top: 18px;
}

.diary-render-label {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--solder-green);
  font-family: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.diary-timeline li.is-current .diary-render-label {
  color: var(--copper);
}

.diary-render-wave,
.diary-render-cam {
  flex: none;
  fill: currentColor;
}

.diary-render audio,
.diary-render video,
.diary-render .player {
  margin-top: 8px;
}

/* A clip is evidence, not a hero shot — keep it inside the reading column and
   show the whole frame, since the global video rule crops to 16/9. */
.diary-render video {
  aspect-ratio: auto;
  object-fit: contain;
}

.diary-timeline li.is-current .player {
  --player-accent: var(--copper);
}

/* Two-colour envelope breaker — orange tail dies, teal comp lifts it back up. */
.diary-breaker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  max-width: 62ch;
  margin: 22px 0;
  padding: 4px 0;
}

.diary-breaker-env {
  width: min(300px, 100%);
  height: auto;
}

.diary-breaker-label {
  font-family: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--solder-green);
}

.diary-timeline li.is-current .diary-breaker-label {
  color: var(--copper);
}

.diary-panel {
  margin: 22px 0;
}

.diary-panel img {
  width: min(560px, 100%);
  border: 1px solid rgba(23, 23, 19, 0.16);
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow-lg);
}

/* Wrap the caption on the same measure as the body copy, not full width. */
.diary-panel figcaption {
  max-width: 62ch;
  line-height: 1.5;
}

/* A chapter's closing image gets more than the panel measure — it is the
   last thing on the page, not a figure inside an argument. */
.diary-panel--wide img {
  width: min(760px, 100%);
}

.diary-download {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 20px 0 6px;
}

.diary-download span {
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 640px) {
  .diary-chapters a {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .diary-chapters-meta {
    grid-column: 2;
  }

  .diary-timeline li {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .diary-chapter {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .diary-chapter-range {
    grid-column: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  .diary-toggle,
  .diary-toggle-chevron,
  .diary-chapters-arrow,
  .player-toggle {
    transition: none;
  }
}
