@font-face {
  font-family: "Hanken Grotesk";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("assets/fonts/hanken-grotesk-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("assets/fonts/newsreader-latin.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/ibm-plex-mono-latin.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --bg: #fbfbfa;
  --surface: #fff;
  --subtle: #f4f3ef;
  --border: #e5e3de;
  --ink: #171715;
  --muted: #6c6a64; /* 5.2:1 on --bg */
  --faint: #73716c; /* 4.7:1 on --bg */
  --green: #346538;
  --accent: #f04b2f;
  --font-serif: "Newsreader", Georgia, serif;
  --font-sans: "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --shell: 580px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #171613;
  --surface: #211f1b;
  --subtle: #211f1b;
  --border: rgb(255 255 255 / 0.11);
  --ink: #f3f1ed;
  --muted: #aaa79f;
  --faint: #848078; /* 4.6:1 on --bg */
  --green: #77a57b;
  --accent: #ff765f;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 2rem;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body.theme-changing,
body.theme-changing * {
  transition-property: background-color, border-color, color;
  transition-duration: 180ms;
  transition-timing-function: var(--ease-out);
}

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

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

button {
  color: inherit;
  font: inherit;
}

h1,
h2,
h3,
p {
  margin: 0;
}

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

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}

.shell {
  width: min(100%, calc(var(--shell) + 2.5rem));
  margin-inline: auto;
  padding-inline: 1.25rem;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 10;
  padding: 0.55rem 0.8rem;
  border-radius: 6px;
  background: var(--ink);
  color: var(--bg);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: absolute;
  top: 1rem;
  right: 0;
  left: 0;
  z-index: 2;
  display: flex;
  width: min(100%, calc(var(--shell) + 2.5rem));
  margin-inline: auto;
  padding-inline: 1.25rem;
  justify-content: flex-start;
}

.site-footer nav {
  display: flex;
  gap: 1.25rem;
}

.site-footer a,
.theme-toggle {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 400;
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  margin-left: -13px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: color 150ms ease, transform 150ms var(--ease-out);
}

.theme-toggle .theme-icon {
  grid-area: 1 / 1;
  display: block;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  transform-origin: center;
  opacity: 0;
  transform: rotate(45deg) scale(0.6);
  transition-property: transform, opacity;
  transition-duration: 200ms;
  transition-timing-function: var(--ease-out);
}

.theme-icon-moon {
  fill: currentColor;
  stroke-width: 0;
}

:root:not([data-theme="dark"]) .theme-icon-moon,
:root[data-theme="dark"] .theme-icon-sun {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

:root .theme-toggle .theme-icon.is-leaving {
  z-index: 1;
  opacity: 0;
  transform: rotate(-45deg) scale(0.6);
}

:root .theme-toggle .theme-icon.is-parked {
  opacity: 0;
  transform: rotate(45deg) scale(0.6);
  transition-property: none;
}

html[data-theme-instant] .theme-toggle,
html[data-theme-instant] .theme-toggle .theme-icon {
  transition: none;
}

.theme-toggle:active {
  transform: scale(0.92);
}

/* Same-document theme reveal only. Scoped so it does not affect other view transitions. */
html[data-theme-vt] *,
html[data-theme-vt] *::before,
html[data-theme-vt] *::after {
  transition-duration: 0s !important;
}

html[data-theme-vt] .theme-icon-moon {
  view-transition-name: theme-icon-moon;
}

html[data-theme-vt] .theme-icon-sun {
  view-transition-name: theme-icon-sun;
}

html[data-theme-vt]::view-transition {
  pointer-events: none;
}

html[data-theme-vt]::view-transition-group(root) {
  animation: none;
  z-index: 0;
}

html[data-theme-vt]::view-transition-old(root) {
  animation: none;
  mix-blend-mode: normal;
  opacity: 1;
}

html[data-theme-vt]::view-transition-new(root) {
  mix-blend-mode: normal;
  animation-name: theme-reveal;
  animation-duration: 250ms;
  animation-timing-function: var(--ease-out);
  animation-fill-mode: both;
}

html[data-theme-vt]::view-transition-group(theme-icon-moon),
html[data-theme-vt]::view-transition-group(theme-icon-sun) {
  animation: none;
  overflow: visible;
}

html[data-theme-vt="dark"]::view-transition-group(theme-icon-moon),
html[data-theme-vt="light"]::view-transition-group(theme-icon-sun) {
  z-index: 6;
}

html[data-theme-vt="dark"]::view-transition-group(theme-icon-sun),
html[data-theme-vt="light"]::view-transition-group(theme-icon-moon) {
  z-index: 5;
}

html[data-theme-vt]::view-transition-image-pair(theme-icon-moon),
html[data-theme-vt]::view-transition-image-pair(theme-icon-sun),
html[data-theme-vt]::view-transition-old(theme-icon-moon),
html[data-theme-vt]::view-transition-new(theme-icon-moon),
html[data-theme-vt]::view-transition-old(theme-icon-sun),
html[data-theme-vt]::view-transition-new(theme-icon-sun) {
  mix-blend-mode: normal;
  overflow: visible;
  transform-origin: center;
}

html[data-theme-vt="dark"]::view-transition-old(theme-icon-moon),
html[data-theme-vt="light"]::view-transition-old(theme-icon-sun) {
  animation: theme-icon-leave 200ms var(--ease-out) both;
}

html[data-theme-vt="dark"]::view-transition-new(theme-icon-moon),
html[data-theme-vt="light"]::view-transition-new(theme-icon-sun),
html[data-theme-vt="dark"]::view-transition-old(theme-icon-sun),
html[data-theme-vt="light"]::view-transition-old(theme-icon-moon) {
  animation: none;
  opacity: 0;
}

html[data-theme-vt="dark"]::view-transition-new(theme-icon-sun),
html[data-theme-vt="light"]::view-transition-new(theme-icon-moon) {
  animation: theme-icon-enter 200ms var(--ease-out) both;
}

@keyframes theme-reveal {
  from {
    clip-path: circle(0px at var(--theme-x) var(--theme-y));
  }
  to {
    clip-path: circle(var(--theme-r) at var(--theme-x) var(--theme-y));
  }
}

@keyframes theme-icon-leave {
  from {
    opacity: 1;
    transform: rotate(0deg) scale(1);
  }
  to {
    opacity: 0;
    transform: rotate(-45deg) scale(0.6);
  }
}

@keyframes theme-icon-enter {
  from {
    opacity: 0;
    transform: rotate(45deg) scale(0.6);
  }
  to {
    opacity: 1;
    transform: rotate(0deg) scale(1);
  }
}

.section {
  padding-block: 4rem;
  border-top: 1px solid var(--border);
}

.section-label {
  margin-bottom: 2rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.meta {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.contact > a:active {
  transform: scale(0.97);
}

.contact > a span {
  display: inline-block;
  transition: transform 150ms var(--ease-out);
}

.about {
  display: grid;
  grid-template-columns: 105px minmax(0, 1fr);
  gap: 2rem;
}

.about .section-label {
  margin: 0;
}

.contact {
  padding-block: clamp(5.5rem, 13vw, 8.5rem);
}

.contact h2 {
  font-family: var(--font-serif);
  font-size: clamp(2.7rem, 9vw, 3.75rem);
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 1;
}

.contact p {
  margin-top: 1rem;
  color: var(--muted);
}

.contact > a,
.contact-email {
  position: relative;
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  padding-bottom: 0.15rem;
  border-bottom: 1px solid var(--border);
  font-size: 1.05rem;
  font-weight: 500;
  transition-property: color, transform, border-color;
  transition-duration: 150ms;
  transition-timing-function: var(--ease-out);
}

/* Grow the tap area to 44px; the underline stays tight to the text. */
.contact > a::after,
.contact-email::after {
  content: "";
  position: absolute;
  inset: -8px 0;
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
  margin-top: 1.5rem;
}

.copy-email {
  position: relative;
  display: inline-grid;
  grid-template-columns: 13px minmax(6ch, max-content);
  align-items: center;
  column-gap: 0.4rem;
  min-height: 34px;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  cursor: pointer;
  /* scale(0.8) → scale(1). Easing peak 1.4 is scale(1.08). */
  --ease-copy-spring: linear(
    0,
    0.2 8%,
    0.55 16%,
    0.9 24%,
    1.2 34%,
    1.36 40%,
    1.4 46%,
    1.28 54%,
    1.12 62%,
    1.02 70%,
    0.97 78%,
    0.99 86%,
    1.01 93%,
    1
  );
  transition-property: color, border-color, background-color, transform;
  transition-duration: 150ms;
  transition-timing-function: ease, ease, ease, var(--ease-out);
}

.copy-email-status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.copy-email::before {
  position: absolute;
  inset: -6px;
  content: "";
}

.copy-email:active {
  transform: scale(0.96);
}

.copy-email[data-copied] {
  border-color: color-mix(in srgb, var(--green) 45%, var(--border));
  color: var(--green);
}

.copy-icon {
  display: block;
  grid-area: 1 / 1;
  width: 13px;
  height: 13px;
  justify-self: center;
  align-self: center;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform-origin: center;
  opacity: 1;
  transform: scale(1);
  transition-property: opacity, transform;
  transition-duration: 250ms;
  transition-timing-function: var(--ease-out), var(--ease-out);
}

.copy-icon-check {
  opacity: 0;
  transform: scale(0.8);
}

.copy-email:not([data-copied]) .copy-icon-clipboard,
.copy-email[data-copied] .copy-icon-check {
  transition-timing-function: var(--ease-out), var(--ease-copy-spring);
}

.copy-email[data-copied] .copy-icon-clipboard {
  opacity: 0;
  transform: scale(0.8);
}

.copy-email[data-copied] .copy-icon-check {
  opacity: 1;
  transform: scale(1);
}

.copy-email-label {
  grid-area: 1 / 2;
  justify-self: start;
  align-self: center;
  min-width: 6ch;
  white-space: nowrap;
  opacity: 1;
  filter: none;
  transition-property: opacity, filter;
  transition-duration: 150ms;
  transition-timing-function: var(--ease-out);
}

.copy-email-label-copied,
.copy-email[data-copied] .copy-email-label:not(.copy-email-label-copied) {
  opacity: 0;
  filter: blur(2px);
}

.copy-email[data-copied] .copy-email-label-copied {
  opacity: 1;
  filter: none;
}

@media (prefers-reduced-motion: reduce) {
  .copy-email {
    transition-property: color, border-color, background-color;
  }

  .copy-email:active {
    transform: none;
  }

  .copy-icon,
  .copy-email-label {
    transition-duration: 0s;
  }
}

.site-footer {
  display: flex;
  min-height: 90px;
  border-top: 1px solid var(--border);
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

/* Footer links: full 44px hit target without changing the row. */
.site-footer nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

@media (hover: hover) and (pointer: fine) {
  .site-footer a:hover,
  .theme-toggle:hover,
  .contact > a:hover {
    color: var(--ink);
  }

  .contact > a:hover span {
    transform: translate(2px, -2px);
  }

}

@media (max-width: 600px) {

  .about {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .about .section-label {
    margin-bottom: 2rem;
  }

  .site-footer {
    padding-block: 1.5rem;
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .case-media {
    animation: none !important;
  }

  .theme-toggle:active,
.contact > a:active {
    transform: none;
  }

  .theme-toggle .theme-icon {
    transition-property: none;
    transition-duration: 0s;
  }

  html[data-theme-vt]::view-transition-old(root),
  html[data-theme-vt]::view-transition-new(root),
  html[data-theme-vt]::view-transition-old(theme-icon-moon),
  html[data-theme-vt]::view-transition-new(theme-icon-moon),
  html[data-theme-vt]::view-transition-old(theme-icon-sun),
  html[data-theme-vt]::view-transition-new(theme-icon-sun) {
    animation: none !important;
  }
}

/* Case study pages */
.case {
  padding-bottom: 4rem;
}

.case-links {
  margin-top: 1.25rem;
}

.case-links a {
  color: var(--ink);
  font-size: 0.9rem;
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 0.2em;
  transition: color 150ms var(--ease-out), text-decoration-color 150ms var(--ease-out);
}

.case-media {
  margin: 2.5rem 0 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--subtle);
  animation: case-media-in 200ms var(--ease-out) both;
}

.case-media:has(> video) {
  aspect-ratio: 1602 / 1080;
}

.case-media:has(> img) {
  aspect-ratio: 1 / 1;
}

.case-media video,
.case-media img {
  display: block;
  width: 100%;
  height: 100%;
}

@keyframes case-media-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.case-pager {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  margin-top: 3.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
}

.case-pager-link {
  display: flex;
  flex: 0 1 auto;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.45rem;
  max-width: 100%;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.case-pager-next {
  align-items: flex-end;
  margin-left: auto;
  text-align: right;
}

.case-pager .section-label {
  margin-bottom: 0;
  line-height: 1.2;
}

.case-pager-title {
  display: flex;
  align-items: last baseline;
  gap: 0.4rem;
  max-width: 100%;
}

.case-pager-name {
  min-width: 0;
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.2;
  text-wrap: balance;
}

.case-pager-arrow {
  flex: none;
  color: var(--faint);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  line-height: 1;
  transition: transform 150ms var(--ease-out), color 150ms var(--ease-out);
}

.case-steps {
  margin: 0.25rem 0 1rem;
  padding-left: 1.25rem;
  color: var(--muted);
  font-family: var(--font-serif);
  font-size: 1.2rem;
  line-height: 1.6;
}

.case-steps li {
  margin-bottom: 0.55rem;
}

.flow {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin: 2.75rem 0 0;
  min-width: 0;
  container-type: inline-size;
  container-name: catagent;
}

.flow figcaption {
  margin-bottom: 1rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}

.flow svg {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  overflow: visible;
}

.catagent-flow {
  color: var(--ink);
  min-width: 0;
}

.flow svg.catagent-flow-wide,
.flow svg.catagent-flow-stack {
  width: 100%;
  height: auto;
}

.flow svg.catagent-flow-wide {
  aspect-ratio: 580 / 608;
}

.flow svg.catagent-flow-stack {
  display: none;
  aspect-ratio: 360 / 626;
}

@container catagent (max-width: 519px) {
  .flow svg.catagent-flow-wide { display: none; }
  .flow svg.catagent-flow-stack { display: block; }
}

@media (max-width: 559px) {
  .flow svg.catagent-flow-wide { display: none; }
  .flow svg.catagent-flow-stack { display: block; }
}

.catagent-flow .cluster rect {
  fill: none;
  stroke: var(--border);
  stroke-width: 1;
}

.catagent-flow .cluster-label {
  fill: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
}

.catagent-flow .node {
  cursor: pointer;
}

.catagent-flow .node-shape {
  fill: var(--bg);
  stroke: var(--border);
  stroke-width: 1;
}

.catagent-flow .node-human .node-shape {
  fill: var(--ink);
  stroke: var(--ink);
}

.catagent-flow .node text {
  fill: currentColor;
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 400;
}

.catagent-flow .node-human text {
  fill: var(--bg);
}

.catagent-flow-stack .cluster-label {
  font-size: 10px;
}

.catagent-flow-stack .node text {
  font-size: 14px;
}

.catagent-flow .node-shape,
.catagent-flow .node text {
  transition: stroke 150ms ease, fill 150ms ease;
}

.catagent-flow .node[data-active-node] .node-shape {
  stroke: var(--accent);
}

.catagent-flow .node[data-active-node] text {
  fill: var(--accent);
}

.catagent-flow .node:focus {
  outline: none;
}

.catagent-flow .node:focus-visible .node-shape {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.catagent-flow .node text {
  pointer-events: none;
}

.catagent-flow .edge,
.catagent-flow .arrow {
  fill: none;
  stroke: currentColor;
  stroke-width: 1;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--muted);
}

.catagent-flow .edge {
  stroke-dasharray: 100;
  stroke-dashoffset: 0;
}

.catagent-flow text {
  dominant-baseline: central;
}

@media (prefers-reduced-motion: no-preference) {
  html:not(.vt) .catagent-flow .edge {
    animation: catagent-draw 200ms var(--ease-out) both;
    animation-delay: var(--d, 0ms);
  }

  html:not(.vt) .catagent-flow .arrow {
    animation: catagent-in 120ms var(--ease-out) both;
    animation-delay: calc(var(--d, 0ms) + 110ms);
  }

  html:not(.vt) .catagent-flow .node {
    animation: catagent-in 160ms var(--ease-out) both;
    animation-delay: var(--d, 0ms);
  }
}

@keyframes catagent-draw {
  from { stroke-dashoffset: 100; }
  to { stroke-dashoffset: 0; }
}

@keyframes catagent-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

html.vt .catagent-flow .edge,
html.vt .catagent-flow .arrow,
html.vt .catagent-flow .node {
  animation: none !important;
  opacity: 1 !important;
  stroke-dashoffset: 0 !important;
}

.flow-inspector {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.45rem 0.75rem;
  margin-top: 1rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
  transition: border-color 150ms ease;
}

.flow-inspector[data-active] {
  border-color: color-mix(in srgb, var(--ink) 24%, var(--border));
}

.flow-inspector-tag {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
}

.case-steps strong {
  color: var(--ink);
  font-weight: 500;
}

@media (hover: hover) and (pointer: fine) {

  .case-links a:hover,
.case-pager-link:hover {
    color: var(--accent);
  }

  .case-pager-link:hover .case-pager-arrow {
    color: var(--accent);
  }

  .case-pager-prev:hover .case-pager-arrow {
    transform: translateX(-2px);
  }

  .case-pager-next:hover .case-pager-arrow {
    transform: translateX(2px);
  }

  .contact-email:hover {
    color: var(--ink);
    border-color: var(--ink);
  }

  .contact-email:hover span {
    transform: translate(2px, -2px);
  }

  .copy-email:hover:not([data-copied]) {
    border-color: var(--muted);
    color: var(--ink);
  }
}

/* Keyboard focus mirrors hover on devices that can hover.
   Touch taps keep the existing :active press only. */
@media (hover: hover) and (pointer: fine) {

  .case-links a:focus-visible {
    color: var(--accent);
  }

  .case-pager-link:focus-visible {
    color: var(--accent);
  }

  .case-pager-link:focus-visible .case-pager-arrow {
    color: var(--accent);
  }

  .case-pager-prev:focus-visible .case-pager-arrow {
    transform: translateX(-2px);
  }

  .case-pager-next:focus-visible .case-pager-arrow {
    transform: translateX(2px);
  }

}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: reduce) {
  .case-pager-prev:hover .case-pager-arrow,
.case-pager-next:hover .case-pager-arrow,
.case-pager-prev:focus-visible .case-pager-arrow,
.case-pager-next:focus-visible .case-pager-arrow {
    transform: none;
  }

}

/* Cross-document transitions. Unknown at-rules and properties are ignored,
   so browsers without the View Transition API keep today's instant navigation. */
@view-transition {
  navigation: auto;
}

.theme-toggle {
  view-transition-name: theme-toggle;
}

.vt-catboard { view-transition-name: project-catboard; }
.vt-cat-agent { view-transition-name: project-cat-agent; }
.vt-slicebill { view-transition-name: project-slicebill; }
.vt-research { view-transition-name: project-research; }
.vt-figma { view-transition-name: project-figma-to-spec; }
.vt-hotreloads { view-transition-name: project-hotreloads; }

::view-transition {
  background: var(--bg);
  overflow: clip;
}

::view-transition-group(root) {
  animation-duration: 220ms;
  animation-timing-function: var(--ease-out);
}

::view-transition-old(root),
::view-transition-new(root) {
  mix-blend-mode: normal;
}

::view-transition-old(root) {
  animation:
    150ms var(--ease-out) both vt-fade-out,
    150ms var(--ease-out) both vt-shift-out;
}

::view-transition-new(root) {
  animation:
    220ms var(--ease-out) both vt-fade-in,
    220ms var(--ease-out) both vt-shift-in;
}

::view-transition-group(project-catboard),
::view-transition-group(project-cat-agent),
::view-transition-group(project-slicebill),
::view-transition-group(project-research),
::view-transition-group(project-figma-to-spec),
::view-transition-group(project-hotreloads) {
  animation-duration: 220ms;
  animation-timing-function: var(--ease-out);
}

::view-transition-old(project-catboard),
::view-transition-new(project-catboard),
::view-transition-old(project-cat-agent),
::view-transition-new(project-cat-agent),
::view-transition-old(project-slicebill),
::view-transition-new(project-slicebill),
::view-transition-old(project-research),
::view-transition-new(project-research),
::view-transition-old(project-figma-to-spec),
::view-transition-new(project-figma-to-spec),
::view-transition-old(project-hotreloads),
::view-transition-new(project-hotreloads) {
  height: 100%;
  mix-blend-mode: normal !important;
  object-fit: contain;
  object-position: left center;
  animation-timing-function: var(--ease-out);
}

::view-transition-old(project-catboard),
::view-transition-old(project-cat-agent),
::view-transition-old(project-slicebill),
::view-transition-old(project-research),
::view-transition-old(project-figma-to-spec),
::view-transition-old(project-hotreloads) {
  animation-duration: 150ms;
}

::view-transition-new(project-catboard),
::view-transition-new(project-cat-agent),
::view-transition-new(project-slicebill),
::view-transition-new(project-research),
::view-transition-new(project-figma-to-spec),
::view-transition-new(project-hotreloads) {
  animation-duration: 220ms;
}

::view-transition-group(theme-toggle) {
  animation: none;
  z-index: 1;
}

::view-transition-old(theme-toggle) {
  display: none;
}

::view-transition-new(theme-toggle) {
  animation: none;
}

@keyframes vt-fade-out {
  to { opacity: 0; }
}

@keyframes vt-fade-in {
  from { opacity: 0; }
}

@keyframes vt-shift-out {
  to { transform: translateY(-4px); }
}

@keyframes vt-shift-in {
  from { transform: translateY(4px); }
}

/* Entrance keyframes start at opacity 0. Drop them before the snapshot so the
   captured title is the finished type, not a blank frame. */
html.vt .case-media {
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }

  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
  }

  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-name: vt-fade-in !important;
    transform: none !important;
  }

  ::view-transition-old(root) {
    animation-name: vt-fade-out !important;
  }
}

/* CatBoard interactive UI illustrations (.cb-lab) */
.cb-lab {
  margin: 1.85rem 0 2.15rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
}

.cb-lab-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--border);
  background: var(--subtle);
}

.cb-lab-title {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.03em;
}

.cb-seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
}

.cb-seg-btn {
  position: relative;
  min-height: 30px;
  padding: 0.28rem 0.62rem;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, transform 150ms var(--ease-out);
}

.cb-seg-btn::before {
  position: absolute;
  inset: -6px -2px;
  content: "";
}

.cb-seg-btn:active {
  transform: scale(0.96);
}

.cb-seg-btn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

.cb-seg-btn.is-active {
  background: var(--ink);
  color: var(--bg);
}

.cb-lab-canvas {
  padding: 1rem;
  display: grid;
  gap: 0.9rem;
}

/* Demo 1: Worktree Kanban & Git Branch Rail */
.cb-lanes {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  min-height: 112px;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
}

.cb-lane {
  display: flex;
  flex-direction: column;
  padding: 0.35rem 0.45rem;
  border: 1px dashed var(--border);
  border-radius: 4px;
  min-height: 96px;
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.cb-lane-label {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  pointer-events: none;
}

.cb-card-shuttle {
  position: absolute;
  top: 2rem;
  left: 0.5rem;
  width: calc((100% - 1rem - 1.5rem) / 4);
  pointer-events: none;
  will-change: transform;
  transition: transform 240ms cubic-bezier(0.32, 0.72, 0, 1);
}

.cb-lanes[data-kb-instant] .cb-card-shuttle {
  transition: none;
}

.cb-lanes[data-stage="todo"] .cb-card-shuttle {
  transform: translate3d(0, 0, 0);
}

.cb-lanes[data-stage="progress"] .cb-card-shuttle {
  transform: translate3d(calc(100% + 0.5rem), 0, 0);
}

.cb-lanes[data-stage="review"] .cb-card-shuttle {
  transform: translate3d(calc(200% + 1rem), 0, 0);
}

.cb-lanes[data-stage="merged"] .cb-card-shuttle {
  transform: translate3d(calc(300% + 1.5rem), 0, 0);
}

.cb-mini-card {
  padding: 0.45rem 0.5rem;
  border: 1px solid color-mix(in srgb, var(--ink) 22%, var(--border));
  border-radius: 5px;
  background: var(--surface);
}

.cb-mini-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
}

.cb-mini-id {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.6rem;
}

.cb-mini-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--faint);
  transition: background-color 150ms ease, transform 150ms var(--ease-out);
}

.cb-lanes[data-stage="progress"] .cb-mini-dot {
  background: var(--accent);
}

.cb-lanes[data-stage="review"] .cb-mini-dot,
.cb-lanes[data-stage="merged"] .cb-mini-dot {
  background: var(--green);
}

.cb-mini-title {
  margin-top: 0.2rem !important;
  color: var(--ink) !important;
  font-family: var(--font-sans) !important;
  font-size: 0.72rem !important;
  font-weight: 500;
  line-height: 1.25 !important;
}

.cb-mini-cli {
  margin-top: 0.15rem !important;
  color: var(--muted) !important;
  font-family: var(--font-mono) !important;
  font-size: 0.58rem !important;
  line-height: 1.2 !important;
}

/* Git Branch Rail Diagram (SVG) */
.cb-branch-wrap {
  padding: 0.65rem 0.75rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  overflow: hidden;
}

.cb-branch-svg {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 540 / 100;
}

.cb-svg-track-title {
  fill: var(--ink);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
}

.cb-svg-track-sub {
  fill: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
}

.cb-svg-line {
  stroke: var(--border);
  stroke-width: 2;
  stroke-linecap: round;
}

.cb-svg-main-line {
  stroke: color-mix(in srgb, var(--ink) 35%, var(--border));
}

.cb-svg-path {
  fill: none;
  stroke: var(--border);
  stroke-width: 2;
  stroke-linecap: round;
  transition: stroke 200ms ease, opacity 200ms ease, stroke-dasharray 200ms ease;
}

.cb-svg-node {
  fill: var(--surface);
  stroke: var(--border);
  stroke-width: 1.6;
  transition: fill 200ms ease, stroke 200ms ease, opacity 200ms ease;
}

.cb-node-main {
  stroke: var(--ink);
  fill: var(--surface);
}

.cb-svg-hint-main {
  fill: var(--muted);
  font-family: var(--font-mono);
  font-size: 9.5px;
}

.cb-svg-hint-wt {
  fill: var(--muted);
  font-family: var(--font-mono);
  font-size: 9.5px;
  transition: fill 200ms ease;
}

.cb-svg-hint-merge {
  fill: var(--green);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  opacity: 0;
  transition: opacity 200ms ease;
}

.cb-svg-pulse-ring {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  opacity: 0;
  transform-origin: 256px 72px;
}

@keyframes cb-pulse {
  0% { r: 5px; opacity: 0.9; }
  100% { r: 16px; opacity: 0; }
}

.cb-lab[data-stage="todo"] .cb-svg-fork,
.cb-lab[data-stage="todo"] .cb-svg-wt-line,
.cb-lab[data-stage="todo"] .cb-svg-merge {
  stroke-dasharray: 4 4;
  opacity: 0.22;
}

.cb-lab[data-stage="todo"] .cb-svg-agent-group,
.cb-lab[data-stage="todo"] .cb-node-diff,
.cb-lab[data-stage="todo"] .cb-node-merge {
  opacity: 0.2;
}

.cb-lab[data-stage="progress"] .cb-svg-fork {
  stroke: var(--ink);
  opacity: 1;
}

.cb-lab[data-stage="progress"] .cb-svg-wt-line {
  stroke: var(--accent);
  opacity: 1;
}

.cb-lab[data-stage="progress"] .cb-svg-merge {
  stroke-dasharray: 4 4;
  opacity: 0.22;
}

.cb-lab[data-stage="progress"] .cb-svg-pulse-ring {
  opacity: 1;
  animation: cb-pulse 1.35s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.cb-lab[data-stage="progress"] .cb-node-agent {
  fill: var(--accent);
  stroke: var(--accent);
}

.cb-lab[data-stage="progress"] .cb-node-diff,
.cb-lab[data-stage="progress"] .cb-node-merge {
  opacity: 0.2;
}

.cb-lab[data-stage="progress"] .cb-svg-hint-wt {
  fill: var(--accent);
}

.cb-lab[data-stage="review"] .cb-svg-fork,
.cb-lab[data-stage="review"] .cb-svg-wt-line {
  stroke: var(--ink);
  opacity: 1;
}

.cb-lab[data-stage="review"] .cb-svg-agent-group {
  opacity: 0.45;
}

.cb-lab[data-stage="review"] .cb-node-diff {
  opacity: 1;
  fill: var(--green);
  stroke: var(--green);
}

.cb-lab[data-stage="review"] .cb-svg-merge {
  stroke-dasharray: 4 4;
  opacity: 0.35;
}

.cb-lab[data-stage="review"] .cb-node-merge {
  opacity: 0.25;
}

.cb-lab[data-stage="review"] .cb-svg-hint-wt {
  fill: var(--green);
}

.cb-lab[data-stage="merged"] .cb-svg-fork,
.cb-lab[data-stage="merged"] .cb-svg-wt-line {
  stroke-dasharray: 4 4;
  opacity: 0.22;
}

.cb-lab[data-stage="merged"] .cb-svg-agent-group,
.cb-lab[data-stage="merged"] .cb-node-diff {
  opacity: 0.2;
}

.cb-lab[data-stage="merged"] .cb-svg-merge {
  stroke: var(--green);
  opacity: 1;
}

.cb-lab[data-stage="merged"] .cb-node-merge {
  opacity: 1;
  fill: var(--green);
  stroke: var(--green);
}

.cb-lab[data-stage="merged"] .cb-svg-hint-merge {
  opacity: 1;
}

.cb-inspect-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.cb-pane {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  min-width: 0;
}

.cb-pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.65rem;
}

.cb-pane-badge {
  padding: 0.12rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.62rem;
  font-variant-numeric: tabular-nums;
}

.cb-pane-badge.is-safe {
  border-color: color-mix(in srgb, var(--green) 45%, var(--border));
  background: color-mix(in srgb, var(--green) 9%, var(--surface));
  color: var(--ink);
}

.cb-world-card {
  display: grid;
  gap: 0.42rem;
  padding: 0.5rem 0.58rem;
  border: 1px solid color-mix(in srgb, var(--green) 35%, var(--border));
  border-radius: 5px;
  background: var(--surface);
  min-height: 84px;
  align-content: start;
}

.cb-world-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--ink);
}

.cb-world-tag {
  color: var(--muted);
  font-size: 0.6rem;
}

.cb-world-desc {
  margin: 0 !important;
  color: var(--muted) !important;
  font-family: var(--font-sans) !important;
  font-size: 0.74rem !important;
  line-height: 1.42 !important;
}

.cb-world-desc code {
  font-size: 0.66rem !important;
}

.cb-term {
  display: grid;
  gap: 0.28rem;
  min-height: 68px;
  align-content: start;
}

.cb-term-line {
  margin: 0 !important;
  color: var(--muted) !important;
  font-family: var(--font-mono) !important;
  font-size: 0.65rem !important;
  line-height: 1.45 !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cb-term-line.is-accent {
  color: var(--ink) !important;
  font-weight: 500;
}

.cb-action-box {
  position: relative;
  min-height: 84px;
}

.cb-micro-diff {
  display: grid;
  gap: 0.42rem;
}

.cb-diff-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--ink);
  font-weight: 500;
}

.cb-diff-stat {
  color: var(--green);
  font-size: 0.62rem;
  font-weight: 600;
}

.cb-diff-snippet {
  display: grid;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  line-height: 1.45;
  background: var(--surface);
}

.cb-diff-ln {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.16rem 0.45rem;
}

.cb-diff-ln code {
  background: transparent !important;
  padding: 0 !important;
  font-size: inherit !important;
  color: inherit !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cb-diff-ln.is-del {
  background: color-mix(in srgb, #dc2626 12%, transparent);
  color: #b91c1c;
}

.cb-diff-ln.is-add {
  background: color-mix(in srgb, #16a34a 12%, transparent);
  color: #15803d;
}

[data-theme="dark"] .cb-diff-ln.is-del {
  background: color-mix(in srgb, #f87171 14%, transparent);
  color: #fca5a5;
}

[data-theme="dark"] .cb-diff-ln.is-add {
  background: color-mix(in srgb, #4ade80 14%, transparent);
  color: #86efac;
}

.cb-d-s {
  font-weight: 700;
  width: 8px;
  user-select: none;
}

.cb-approve-btn {
  margin-top: 0.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.38rem;
  padding: 0.38rem 0.65rem;
  border: 0;
  border-radius: 4px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 150ms ease, transform 150ms var(--ease-out);
}

.cb-approve-btn:hover {
  opacity: 0.92;
}

.cb-approve-btn:active {
  transform: scale(0.97);
}

.cb-approve-btn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

.cb-lab-caption {
  min-height: 3.6rem;
  display: flex;
  align-items: center;
  padding: 0.65rem 0.9rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  line-height: 1.45;
}

/* Demo 2: Spatial File Lock Map */
.cb-lock-map {
  display: grid;
  gap: 0.65rem;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
}

.cb-lock-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.62rem;
}

.cb-lock-status {
  padding: 0.14rem 0.48rem;
  border-radius: 4px;
  border: 1px solid color-mix(in srgb, var(--green) 45%, var(--border));
  background: color-mix(in srgb, var(--green) 9%, var(--surface));
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 500;
  transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease;
}

.cb-lock-status.is-warn {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  color: var(--accent);
}

.cb-lock-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 76px minmax(0, 1.08fr);
  align-items: stretch;
  min-height: 196px;
}

.cb-lock-cards {
  display: grid;
  grid-template-rows: repeat(3, 60px);
  gap: 8px;
}

.cb-tcard {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.24rem;
  width: 100%;
  padding: 0.42rem 0.58rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms var(--ease-out), background-color 160ms var(--ease-out), transform 160ms var(--ease-out);
}

.cb-tcard.is-queued {
  border-style: dashed;
}

.cb-tcard:active {
  transform: scale(0.98);
}

.cb-tcard:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

.cb-tcard.is-selected {
  border-style: solid;
  border-color: var(--ink);
  background: color-mix(in srgb, var(--ink) 4%, var(--surface));
}

.cb-lab[data-ticket="t3"] .cb-tcard.is-selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}

.cb-tcard-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  width: 100%;
}

.cb-tcard-id {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.6rem;
}

.cb-tcard-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.08rem 0.36rem;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.56rem;
  font-weight: 500;
  white-space: nowrap;
}

.cb-tcard-badge.is-run {
  border: 1px solid color-mix(in srgb, var(--green) 42%, var(--border));
  background: color-mix(in srgb, var(--green) 9%, var(--surface));
  color: var(--ink);
}

.cb-tcard-badge.is-wait {
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  color: var(--accent);
}

.cb-run-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
}

.cb-tcard-title {
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.73rem;
  font-weight: 500;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* SVG Wires in Center */
.cb-lock-wires {
  display: block;
  width: 100%;
  height: 196px;
  overflow: visible;
}

.cb-wire {
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  transition: opacity 180ms var(--ease-out), stroke 180ms ease;
}

.cb-wire-bg {
  stroke: var(--border);
  opacity: 0.38;
}

.cb-wire-t1,
.cb-wire-t2,
.cb-wire-t3 {
  opacity: 0;
}

.cb-wire-dot {
  opacity: 0;
  transition: opacity 180ms var(--ease-out), fill 180ms ease;
}

.cb-lab[data-ticket="t1"] .cb-wire-t1 {
  stroke: var(--green);
  opacity: 1;
}

.cb-lab[data-ticket="t1"] .cb-dot-t1 {
  fill: var(--green);
  opacity: 1;
}

.cb-lab[data-ticket="t2"] .cb-wire-t2 {
  stroke: var(--green);
  opacity: 1;
}

.cb-lab[data-ticket="t2"] .cb-dot-t2 {
  fill: var(--green);
  opacity: 1;
}

.cb-lab[data-ticket="t3"] .cb-wire-t3.is-conflict {
  stroke: var(--accent);
  stroke-dasharray: 4 3;
  opacity: 1;
}

.cb-lab[data-ticket="t3"] .cb-wire-t3.is-queued {
  stroke: var(--ink);
  stroke-dasharray: 3 3;
  opacity: 0.7;
}

.cb-lab[data-ticket="t3"] .cb-dot-t3.is-conflict {
  fill: var(--accent);
  opacity: 1;
}

.cb-lab[data-ticket="t3"] .cb-dot-t3.is-queued {
  fill: var(--ink);
  opacity: 0.75;
}

/* Right Column: Repository Files */
.cb-lock-files {
  display: grid;
  grid-template-rows: repeat(4, 46px);
  gap: 4px;
}

.cb-fslot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  padding: 0 0.55rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  transition: border-color 160ms var(--ease-out), background-color 160ms var(--ease-out), opacity 160ms var(--ease-out), transform 160ms var(--ease-out);
}

.cb-fslot-name {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cb-fslot-tag {
  padding: 0.08rem 0.36rem;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.56rem;
  white-space: nowrap;
  transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease;
}

.cb-fslot.is-active-lock {
  border-color: color-mix(in srgb, var(--green) 55%, var(--border));
  background: color-mix(in srgb, var(--green) 7%, var(--surface));
}

.cb-fslot.is-active-lock .cb-fslot-tag {
  border-color: color-mix(in srgb, var(--green) 48%, var(--border));
  background: color-mix(in srgb, var(--green) 12%, var(--surface));
  color: var(--ink);
  font-weight: 500;
}

.cb-fslot.is-conflict-lock {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--border));
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.cb-fslot.is-conflict-lock .cb-fslot-tag {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--accent);
  font-weight: 500;
}

.cb-fslot.is-queued-lock {
  border-style: dashed;
  border-color: color-mix(in srgb, var(--ink) 35%, var(--border));
}

.cb-fslot.is-idle {
  opacity: 0.65;
  border-style: dashed;
}

.cb-fslot.is-dim {
  opacity: 0.48;
}

.cb-lab[data-kb-instant] .cb-tcard,
.cb-lab[data-kb-instant] .cb-fslot,
.cb-lab[data-kb-instant] .cb-fslot-tag,
.cb-lab[data-kb-instant] .cb-wire,
.cb-lab[data-kb-instant] .cb-wire-dot,
.cb-lab[data-kb-instant] .cb-lock-status {
  transition: none;
}

/* Demo 3: Exit signal reconciliation */
.cb-rec-board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  min-height: 112px;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
}

.cb-rec-lane {
  display: flex;
  flex-direction: column;
  padding: 0.38rem 0.52rem;
  border: 1px dashed var(--border);
  border-radius: 4px;
  min-height: 96px;
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.cb-rec-lane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  pointer-events: none;
}

.cb-rec-lane-hint {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  transition: color 150ms ease;
}

.cb-rec-board[data-mode="naive"] [data-rec-lane="naive"] .cb-rec-lane-hint {
  color: var(--accent);
}

.cb-rec-board[data-mode="reconciled"] [data-rec-lane="reconciled"] .cb-rec-lane-hint {
  color: var(--green);
}

.cb-rec-shuttle {
  position: absolute;
  top: 2.05rem;
  left: 0.5rem;
  width: calc((100% - 1rem - 0.65rem) / 2);
  pointer-events: none;
  will-change: transform;
  transition: transform 240ms cubic-bezier(0.32, 0.72, 0, 1);
}

.cb-rec-board[data-mode="naive"] .cb-rec-shuttle {
  transform: translate3d(0, 0, 0);
}

.cb-rec-board[data-mode="reconciled"] .cb-rec-shuttle {
  transform: translate3d(calc(100% + 0.65rem), 0, 0);
}

.cb-rec-card {
  padding: 0.45rem 0.58rem;
  border: 1px solid color-mix(in srgb, var(--ink) 22%, var(--border));
  border-radius: 5px;
  background: var(--surface);
  transition: border-color 160ms ease, background-color 160ms ease;
}

.cb-rec-board[data-mode="naive"] .cb-rec-card {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
}

.cb-rec-board[data-mode="reconciled"] .cb-rec-card {
  border-color: color-mix(in srgb, var(--green) 50%, var(--border));
}

.cb-rec-badge {
  padding: 0.08rem 0.38rem;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.56rem;
  font-weight: 500;
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease;
}

.cb-rec-badge.is-ready {
  border: 1px solid color-mix(in srgb, var(--green) 45%, var(--border));
  background: color-mix(in srgb, var(--green) 11%, var(--surface));
  color: var(--ink);
}

.cb-rec-badge.is-stuck {
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--border));
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--accent);
}

.cb-rec-checks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.cb-check-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.55rem 0.62rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  min-height: 92px;
  transition: border-color 160ms var(--ease-out), background-color 160ms var(--ease-out), opacity 160ms var(--ease-out);
}

.cb-check-card.is-ok {
  border-color: color-mix(in srgb, var(--green) 45%, var(--border));
  background: color-mix(in srgb, var(--green) 5%, var(--bg));
}

.cb-check-card.is-stuck {
  border-color: color-mix(in srgb, var(--accent) 58%, var(--border));
  background: color-mix(in srgb, var(--accent) 7%, var(--bg));
}

.cb-check-card.is-dim {
  opacity: 0.55;
  border-style: dashed;
}

.cb-check-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.3rem;
}

.cb-check-step {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.cb-check-tag {
  padding: 0.06rem 0.34rem;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.56rem;
  font-weight: 500;
  white-space: nowrap;
}

.cb-check-tag.is-ok {
  border-color: color-mix(in srgb, var(--green) 48%, var(--border));
  background: color-mix(in srgb, var(--green) 12%, var(--surface));
  color: var(--ink);
}

.cb-check-tag.is-stuck {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--accent);
}

.cb-check-title {
  margin: 0.1rem 0 0 !important;
  color: var(--ink) !important;
  font-family: var(--font-sans) !important;
  font-size: 0.73rem !important;
  font-weight: 600 !important;
  line-height: 1.25 !important;
}

.cb-check-desc {
  margin: 0 !important;
  color: var(--muted) !important;
  font-family: var(--font-sans) !important;
  font-size: 0.68rem !important;
  line-height: 1.38 !important;
}

.cb-lab[data-kb-instant] .cb-rec-shuttle,
.cb-lab[data-kb-instant] .cb-rec-card,
.cb-lab[data-kb-instant] .cb-rec-badge,
.cb-lab[data-kb-instant] .cb-check-card,
.cb-lab[data-kb-instant] .cb-check-tag,
.cb-lab[data-kb-instant] .ca-bline,
.cb-lab[data-kb-instant] .ca-sbar-seg,
.cb-lab[data-kb-instant] .ca-plat-card,
.cb-lab[data-kb-instant] .ca-feed-item,
.cb-lab[data-kb-instant] .ca-inspector-card {
  transition: none;
}

/* CatAgent Enhanced Interactive Elements (Emil Design System) */

/* Demo 1: Multi-Platform Fan-Out */
.ca-fanout-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.ca-plat-card {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms var(--ease-out), background-color 160ms var(--ease-out), transform 160ms var(--ease-out);
}

.ca-plat-card:active {
  transform: scale(0.96);
}

.ca-plat-card.is-active {
  border-color: var(--ink);
  background: color-mix(in srgb, var(--ink) 4%, var(--surface));
}

.ca-plat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
}

.ca-plat-name {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
}

.ca-plat-badge {
  padding: 0.08rem 0.36rem;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.56rem;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid color-mix(in srgb, var(--green) 42%, var(--border));
  background: color-mix(in srgb, var(--green) 9%, var(--surface));
  color: var(--ink);
}

.ca-plat-repo {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.6rem;
}

.ca-plat-test {
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.25;
}

/* Demo 2: Team PR Stream & Activity */
.ca-stream-box {
  display: grid;
  gap: 0.55rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
}

.ca-stream-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.64rem;
}

.ca-stream-title {
  color: var(--ink);
  font-weight: 600;
}

.ca-stream-badge {
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
  font-size: 0.6rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
}

.ca-stream-badge.is-warn {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  color: var(--accent);
}

.ca-stream-badge.is-ok {
  border-color: color-mix(in srgb, var(--green) 45%, var(--border));
  background: color-mix(in srgb, var(--green) 9%, var(--surface));
  color: var(--ink);
}

.ca-feed {
  display: grid;
  gap: 0.45rem;
}

.ca-feed-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 0.55rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  font-family: var(--font-sans);
  font-size: 0.73rem;
  line-height: 1.4;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.ca-feed-item.is-bot {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
}

.ca-feed-item.is-human {
  border-color: color-mix(in srgb, var(--green) 45%, var(--border));
  background: color-mix(in srgb, var(--green) 5%, var(--surface));
}

.ca-feed-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  user-select: none;
}

.ca-feed-content {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.ca-feed-author {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--muted);
}

.ca-feed-author strong {
  color: var(--ink);
}

.ca-feed-text {
  margin: 0 !important;
  color: var(--ink) !important;
  font-size: 0.72rem !important;
  line-height: 1.35 !important;
}

.ca-stream-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  margin-top: 0.25rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border);
}

.ca-stat-card {
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  font-family: var(--font-mono);
}

.ca-stat-label {
  color: var(--muted);
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.ca-stat-val {
  margin-top: 0.15rem;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ink);
}

.ca-stat-val.is-warn {
  color: var(--accent);
}

.ca-stat-val.is-ok {
  color: var(--green);
}

/* Demo 3: Live Telemetry & Inspector */
.ca-telemetry-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
}

.ca-telem-item {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.ca-telem-num {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
}

.ca-telem-label {
  font-family: var(--font-sans);
  font-size: 0.62rem;
  color: var(--muted);
  line-height: 1.25;
}

.ca-inspector-card {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  transition: border-color 160ms var(--ease-out), background-color 160ms var(--ease-out);
}

.ca-insp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.62rem;
}

.ca-insp-title {
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.74rem;
  font-weight: 600;
}

.ca-insp-desc {
  margin: 0 !important;
  color: var(--muted) !important;
  font-family: var(--font-sans) !important;
  font-size: 0.7rem !important;
  line-height: 1.4 !important;
}

@media (max-width: 560px) {
  .ca-fanout-grid,
  .ca-stream-stats,
  .ca-telemetry-bar {
    grid-template-columns: 1fr;
  }
}
/* CatAgent Demo 3: Commit Provenance & Survival Inspector */
.ca-blame-box {
  display: grid;
  gap: 0.55rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
}

.ca-survival-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  height: 7px;
}

.ca-sbar-seg {
  display: block;
  border-radius: 999px;
  transition: opacity 160ms var(--ease-out);
}

.ca-sbar-seg.is-agent {
  background: var(--green);
}

.ca-sbar-seg.is-human {
  background: var(--accent);
}

.ca-sbar-seg.is-dim {
  opacity: 0.22;
}

.ca-blame-lines {
  display: grid;
  gap: 0.28rem;
}

.ca-bline {
  display: grid;
  grid-template-columns: 16px 124px minmax(0, 1fr);
  align-items: center;
  gap: 0.45rem;
  padding: 0.26rem 0.48rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 0.63rem;
  cursor: pointer;
  transition: opacity 160ms var(--ease-out), border-color 160ms ease, background-color 160ms ease;
}

.ca-bline.is-agent {
  border-color: color-mix(in srgb, var(--green) 42%, var(--border));
  background: color-mix(in srgb, var(--green) 6%, var(--surface));
}

.ca-bline.is-human {
  border-color: color-mix(in srgb, var(--accent) 52%, var(--border));
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}

.ca-bline.is-dim {
  opacity: 0.34;
}

.ca-bline-num {
  color: var(--faint);
  font-size: 0.58rem;
  text-align: right;
  user-select: none;
}

.ca-bline-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.06rem 0.32rem;
  border-radius: 3px;
  font-size: 0.55rem;
  font-weight: 500;
  white-space: nowrap;
}

.ca-bline-tag.is-agent {
  border: 1px solid color-mix(in srgb, var(--green) 48%, var(--border));
  background: color-mix(in srgb, var(--green) 12%, var(--surface));
  color: var(--ink);
}

.ca-bline-tag.is-human {
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--border));
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--accent);
}

.ca-bline-code {
  background: transparent !important;
  padding: 0 !important;
  color: var(--ink) !important;
  font-size: 0.62rem !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (hover: hover) and (pointer: fine) {
  .cb-seg-btn:hover:not(.is-active) {
    color: var(--ink);
  }

  .cb-lane:hover,
  .cb-rec-lane:hover {
    border-color: var(--muted);
  }

  .cb-tcard:hover:not(.is-selected) {
    border-color: color-mix(in srgb, var(--ink) 32%, var(--border));
  }
}

@media (max-width: 560px) {
  .cb-inspect-grid {
    grid-template-columns: 1fr;
  }

  .cb-lock-stage {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .cb-lock-wires {
    display: none;
  }

  .cb-rec-checks {
    grid-template-columns: 1fr;
  }

  .ca-bline {
    grid-template-columns: 118px minmax(0, 1fr);
  }

  .ca-bline-num {
    display: none;
  }

  .cb-check-card {
    min-height: auto;
  }

  .cb-mini-cli {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cb-svg-pulse-ring {
    animation: none !important;
    display: none !important;
  }

  .cb-card-shuttle,
  .cb-mini-dot,
  .cb-lane,
  .cb-approve-btn,
  .cb-svg-path,
  .cb-svg-node,
  .cb-svg-hint-wt,
  .cb-svg-hint-merge,
  .cb-seg-btn,
  .cb-tcard,
  .cb-fslot,
  .cb-fslot-tag,
  .cb-wire,
  .cb-wire-dot,
  .cb-lock-status,
  .cb-rec-shuttle,
  .cb-rec-card,
  .cb-rec-badge,
  .cb-check-card,
  .cb-check-tag,
  .ca-bline,
  .ca-sbar-seg {
    transition: none;
  }
}

/* Compact maker hero. */
.maker-hero { padding-block: 6rem 1.5rem; --maker-muted: color-mix(in oklch, var(--muted) 95%, var(--ink)); }
.maker-person { display: flex; align-items: center; gap: 1rem; }
.maker-photo { position: relative; flex-shrink: 0; padding: 3px; border: 0; border-radius: 3px; background: var(--surface); color: var(--ink); cursor: pointer; touch-action: manipulation; transform: rotate(-5deg); transition: transform 160ms var(--ease-out), scale 120ms var(--ease-out); box-shadow: 0 0 0 1px rgb(0 0 0 / .05), 0 2px 3px rgb(0 0 0 / .04), 0 8px 12px -6px rgb(0 0 0 / .16); }
.maker-photo img { width: 58px; height: 58px; object-fit: cover; border-radius: 1px; }
.maker-photo:active { scale: .97; }
.maker-photo-hint { position: absolute; right: -6px; bottom: -6px; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--ink); color: var(--bg); box-shadow: 0 0 0 2px var(--bg); }
.maker-photo-hint svg { display: block; width: 12px; height: 12px; transform: rotate(5deg); transition: transform 160ms var(--ease-out); }
.maker-name { font-size: 1rem; font-weight: 500; line-height: 1.4; }
.maker-handle { margin-top: .25rem; color: var(--maker-muted); font: .75rem/1.5 var(--font-mono); }
.maker-hello { display: inline-flex; align-items: center; min-height: 44px; margin-left: auto; font-size: .875rem; }
.maker-hero a { text-decoration: underline; text-underline-offset: .25em; }
.maker-hero h1 { margin-top: 1.75rem; font: 400 clamp(2rem, 6vw, 2.625rem)/1.08 var(--font-serif); letter-spacing: -.025em; text-wrap: balance; }
.maker-introduction { max-width: 48ch; margin-top: 1rem; color: var(--maker-muted); font-size: 1rem; line-height: 1.6; text-wrap: pretty; }
.maker-introduction a { color: var(--ink); }
.maker-projects { margin-top: 1.75rem; }
.maker-caption { margin-bottom: 1.25rem; color: var(--maker-muted); font: .75rem/1.5 var(--font-mono); }
.maker-dock { display: flex; justify-content: center; gap: 1.5rem; width: max-content; max-width: 100%; margin: 0 auto .5rem; padding: .75rem 1.25rem .5rem; border-radius: 19px; background: color-mix(in oklch, var(--surface) 60%, var(--subtle)); box-shadow: inset 0 1px 0 rgb(255 255 255 / .6), 0 0 0 1px rgb(0 0 0 / .06), 0 3px 3px rgb(0 0 0 / .03), 0 14px 25px -14px rgb(0 0 0 / .18); }
.maker-app { position: relative; display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: 0 .125rem .625rem; min-height: 44px; min-width: 44px; border: 0; background: none; color: var(--maker-muted); font-size: .8125rem; cursor: pointer; touch-action: manipulation; }
.maker-app img { width: 56px; height: 56px; border-radius: 14px; box-shadow: 0 0 0 1px rgb(0 0 0 / .06); transition: transform 200ms var(--ease-out), scale 120ms var(--ease-out); transform-origin: 50% 85%; }
.maker-app:active img { scale: .97; }
.maker-app[aria-selected="true"] { color: var(--ink); }
.maker-app[aria-selected="true"] img { transform: translateY(-6px) rotate(-5deg); }
.maker-app[aria-selected="true"]::after { position: absolute; bottom: 0; left: calc(50% - 2px); width: 4px; height: 4px; border-radius: 50%; background: var(--ink); content: ""; }
.maker-panel { padding-top: 1rem; }
.maker-panel[hidden] { display: none; }
.js .maker-panels { min-height: 160px; }
/* Before scripts.js runs, show only the first panel so the hero does not collapse after paint. */
.js .maker-panels:not(.is-ready) .maker-panel:not(:first-child) { display: none; }
.maker-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.maker-panel h3 { font-size: 1.125rem; font-weight: 500; letter-spacing: -.02em; }
.maker-panel-heading > span { color: var(--maker-muted); font: .75rem var(--font-mono); }
.maker-panel > p { margin-top: .5rem; max-width: 54ch; color: var(--maker-muted); font-size: .9375rem; line-height: 1.55; text-wrap: pretty; }
.maker-project-links { display: flex; gap: 1.25rem; }
.maker-project-links a { display: inline-flex; align-items: center; min-width: 44px; min-height: 44px; font-size: .875rem; }
/* GBLA in the dock: a hairline divider keeps it apart from the cat apps. */
.maker-dock-divider { align-self: stretch; width: 1px; margin: .25rem -.375rem 1.125rem; background: var(--border); }
/* The GBLA ticket: a scorebug stub, filled from /gbla/ fixture and live data by scripts.js. */
.gbla-ticket { display: inline-flex; align-items: stretch; min-height: 44px; margin-top: .875rem; border-radius: 8px; color: #fff; font: .8125rem/1.3 var(--font-mono); font-variant-numeric: tabular-nums; text-decoration: none !important; transition: scale 120ms var(--ease-out); touch-action: manipulation; }
.gbla-ticket:active { scale: .98; }
.gbla-ticket-tag { position: relative; display: inline-flex; align-items: center; gap: .375rem; padding: 0 .75rem; border-radius: 8px 0 0 8px; border-right: 1.5px dashed rgb(20 52 124 / .45); background: #f2c94c; color: #14347c; font-weight: 600; letter-spacing: .06em; }
/* Ticket notches are cut, not painted, so they work on any background. */
.gbla-ticket-tag { --edge: 100%; }
.gbla-ticket-body { --edge: 0; display: inline-flex; align-items: stretch; border-radius: 0 8px 8px 0; background: #14347c; }
.gbla-ticket-tag, .gbla-ticket-body { mask: radial-gradient(circle 6px at var(--edge) 0, #0000 97%, #000) top / 100% 51% no-repeat, radial-gradient(circle 6px at var(--edge) 100%, #0000 97%, #000) bottom / 100% 51% no-repeat; }
.gbla-ticket.is-live .gbla-ticket-tag { background: #c8372b; color: #fff; } /* 5.2:1 */
.gbla-ticket-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: gbla-pulse 1.4s var(--ease-out) infinite; }
@keyframes gbla-pulse { 50% { opacity: .25; } }
.gbla-ticket-text { display: inline-flex; flex-direction: column; justify-content: center; padding: .5rem .375rem .5rem .875rem; text-wrap: balance; }
.gbla-ticket-when { font-size: .75rem; opacity: .8; }
.gbla-ticket-text b { margin-inline: .375rem; font-weight: 600; }
.gbla-ticket-go { display: inline-flex; align-items: center; padding-right: .875rem; transition: transform 160ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .gbla-ticket:hover .gbla-ticket-go { transform: translateX(3px); } }
@media (prefers-reduced-motion: reduce) { .gbla-ticket-dot { animation: none; } .gbla-ticket, .gbla-ticket-go { transition: none; } .gbla-ticket:active { scale: 1; } }
.maker-footer { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-top: 1.25rem; padding-top: .75rem; border-top: 1px solid var(--border); color: var(--maker-muted); font-size: .75rem; }
.maker-footer a { display: inline-flex; align-items: center; min-height: 44px; }
.maker-dock.keyboard-motion .maker-app img { transition: none !important; scale: 1; opacity: 1; }
[data-theme="dark"] .maker-dock, [data-theme="dark"] .maker-photo { box-shadow: 0 0 0 1px rgb(255 255 255 / .12); }
@media (hover: hover) and (pointer: fine) {
  .maker-photo:hover { transform: translateY(-2px) rotate(0deg); }
  .maker-photo:hover .maker-photo-hint svg { transform: rotate(0deg); }
  .maker-app:hover img { transform: translateY(-6px) rotate(0deg); }
}
.maker-photo:focus-visible { transform: rotate(-5deg); scale: 1; transition: none; }
.maker-photo:focus-visible .maker-photo-hint svg { transform: rotate(5deg); transition: none; }
@media (max-width: 420px) {
  .maker-hero { padding-top: 5rem; }
  .maker-person { gap: .75rem; }
  .maker-photo img { width: 48px; height: 48px; }
  .maker-photo-hint svg { display: block; width: 12px; height: 12px; transform: rotate(5deg); transition: transform 160ms var(--ease-out); }
.maker-name { font-size: .9375rem; }
  .maker-hello { font-size: .8125rem; }
  .maker-dock { gap: 1.25rem; padding-inline: 1rem; }
  .maker-app img { width: 48px; height: 48px; border-radius: 12px; }
  .js .maker-panels { min-height: 192px; }
}
@media (prefers-reduced-motion: reduce) {
  .maker-photo { transition: none; }
  .maker-photo:hover { transform: rotate(-5deg); }
  .maker-photo .maker-photo-hint svg { transform: rotate(5deg); transition: none; }
  .maker-photo:active { scale: 1; }
  .maker-dock .maker-app img { transform: none; scale: 1; transition: opacity 80ms var(--ease-out) !important; }
  .maker-app:active img { opacity: .8; }
  .maker-dock.keyboard-motion img { opacity: 1; }
}

/* The portrait's song-cover backstory. */
body:has(.portrait-story[open]) { overflow: hidden; }
.portrait-story { width: min(356px, calc(100% - 2rem)); max-height: calc(100dvh - 2rem); margin: auto; padding: 1rem 1.25rem 1.25rem; border: 0; border-radius: 6px; background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--border), 0 20px 60px rgb(0 0 0 / .2); overflow-y: auto; overscroll-behavior: contain; transform-origin: center; }
.portrait-story::backdrop { background: rgb(0 0 0 / .35); }
.portrait-story-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; color: var(--muted); font: .75rem/1.5 var(--font-mono); }
.portrait-story-top button { display: grid; place-items: center; min-width: 44px; min-height: 44px; margin-right: -.5rem; border: 0; background: none; color: var(--ink); font: 1.5rem/1 var(--font-sans); cursor: pointer; touch-action: manipulation; }
.portrait-sleeve { margin: .5rem 0 0; padding: 6px 6px 0; background: var(--subtle); box-shadow: 0 0 0 1px var(--border); }
.portrait-sleeve img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; }
.portrait-sleeve figcaption { padding: .625rem .375rem; color: var(--muted); font: .6875rem/1.5 var(--font-mono); }
.portrait-story h2 { margin-top: 1.25rem; font: 400 1.875rem/1.1 var(--font-serif); letter-spacing: -.025em; text-wrap: balance; }
.portrait-story > p { margin-top: .75rem; color: var(--muted); font-size: .9375rem; line-height: 1.6; }
.portrait-listen { display: inline-flex; align-items: center; min-height: 44px; margin-top: .75rem; font-size: .875rem; text-decoration: underline; text-underline-offset: .25em; }

/* Professional projects in prose. */
.team-work { --team-muted: color-mix(in oklch, var(--muted) 95%, var(--ink)); }
.team-kicker { margin-bottom: 1.5rem; color: var(--team-muted); font: .75rem/1.5 var(--font-mono); }
.team-prose { max-width: 50ch; color: var(--team-muted); font: 400 1.3125rem/1.9 var(--font-sans); letter-spacing: .005em; text-wrap: pretty; }
.team-prose + .team-prose { margin-top: 1.375rem; }
.team-prose > a { color: var(--ink); text-decoration: underline dashed; text-underline-offset: 6px; text-decoration-thickness: 1px; }
.team-selector { display: inline-flex; isolation: isolate; max-width: 100%; vertical-align: middle; line-height: 1; margin-inline: 4px; }
.team-choice { position: relative; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; min-width: 44px; min-height: 44px; padding: 0; border: 0; background: none; color: var(--ink); cursor: pointer; touch-action: manipulation; }
.team-choice-face { display: flex; flex-direction: column; align-items: center; pointer-events: none; transform: rotate(calc(var(--team-side) * 8deg)); transition: transform 200ms var(--ease-out), scale 120ms var(--ease-out); }
.team-choice img { width: 34px; height: 34px; border-radius: 9px; box-shadow: 0 0 0 1px rgb(0 0 0 / .08), 0 2px 3px rgb(0 0 0 / .08), 0 6px 10px -6px rgb(0 0 0 / .18); }
.team-choice-name { position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%); white-space: nowrap; padding: 6px 8px; border-radius: 5px; background: var(--ink); color: var(--bg); font: .75rem/1.3 var(--font-sans); visibility: hidden; }
.team-choice[aria-selected="true"] .team-choice-face { transform: translateY(-6px) rotate(0deg); }
.team-choice:active .team-choice-face { scale: .97; }
.team-choice-dot { position: absolute; bottom: -3px; left: calc(50% - 2px); width: 4px; height: 4px; border-radius: 50%; background: var(--ink); opacity: 0; }
.team-choice[aria-selected="true"] .team-choice-dot { opacity: 1; }
.team-choice:focus-visible .team-choice-name { visibility: visible; }
.team-hint { margin-top: 1.375rem; color: var(--team-muted); font: .75rem/1.5 var(--font-mono); }
.team-panels { margin-top: 1.625rem; border-top: 1px solid var(--border); }
.team-panels.is-ready { min-height: 246px; }
.team-panel { padding-top: 1.375rem; }
.team-panel[hidden] { display: none; }
.team-panel-heading { display: flex; align-items: center; gap: .75rem; }
.team-panel-heading img { width: 36px; height: 36px; border-radius: 9px; }
.team-panel h3 { font-size: 1.1875rem; font-weight: 500; line-height: 1.4; letter-spacing: -.015em; }
.team-panel-heading p { margin-top: 2px; color: var(--team-muted); font-size: .8125rem; line-height: 1.5; }
.team-contribution { margin-top: 1rem; max-width: 52ch; color: var(--team-muted); font-size: 1rem; line-height: 1.65; text-wrap: pretty; }
.team-contribution strong { color: var(--ink); font-weight: 500; }
.team-panel-footer { display: flex; align-items: center; justify-content: space-between; gap: .875rem; margin-top: .625rem; }
.team-panel-footer > span { color: var(--team-muted); font: .75rem/1.5 var(--font-mono); }
.team-panel-footer a { display: inline-flex; align-items: center; min-width: 44px; min-height: 44px; font-size: .875rem; text-decoration: underline; text-underline-offset: 4px; }
.team-selector.keyboard-motion .team-choice-face { transition: none !important; scale: 1; }
@media (hover: hover) and (pointer: fine) {
  .team-choice:hover .team-choice-face { transform: translateY(-6px) rotate(0deg); }
  .team-choice:hover .team-choice-name { visibility: visible; }
}
@media (max-width: 420px) {
  .team-prose { font-size: 1.1875rem; line-height: 1.85; }
  .team-selector { margin-inline: 0; }
  .team-panel-footer { flex-direction: column; align-items: start; gap: 0; }
  .team-panels.is-ready { min-height: 304px; }
}
@media (prefers-reduced-motion: reduce) {
  .team-selector .team-choice .team-choice-face { transition: none !important; transform: none; scale: 1; }
}

/* Hotreloads reel stack. */
.hotreloads-channel { --channel-muted: color-mix(in oklch, var(--muted) 95%, var(--ink)); }
.channel-kicker, .writing-kicker { margin-bottom: 1.125rem; font: .75rem/1.5 var(--font-mono); color: var(--muted); }
.channel-stack-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 1.5rem; }
.channel-heading { display: flex; flex-direction: column; align-items: start; gap: 6px; }
.channel-heading h2 { font: 400 2.125rem/1.12 var(--font-serif); letter-spacing: -.025em; }
.channel-heading > span { font: .75rem var(--font-mono); color: var(--channel-muted); }
.channel-intro { margin-top: 1rem; font-size: 1.125rem; line-height: 1.55; text-wrap: pretty; }
.channel-description { margin-top: .75rem; color: var(--channel-muted); font-size: .875rem; line-height: 1.65; text-wrap: pretty; }
.channel-links { display: flex; flex-wrap: wrap; gap: 0 1.25rem; margin-top: .75rem; }
.channel-links a, .channel-story { display: inline-flex; align-items: center; gap: .5rem; min-width: 44px; min-height: 44px; font-size: .875rem; text-decoration: underline; text-underline-offset: 4px; }
.channel-reel-preview { margin: 0; }
.channel-fan { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.channel-reel-cover { display: block; border-radius: 7px; touch-action: manipulation; }
.channel-fan img { width: 100%; height: auto; border-radius: 7px; outline: 1px solid rgb(0 0 0 / .1); }
.channel-reels.is-ready .channel-fan { display: block; position: relative; isolation: isolate; overflow: clip; height: 308px; margin-top: 12px; }
.channel-reels.is-ready .channel-reel-cover { position: absolute; left: 50%; top: 25px; width: 166px; max-width: none; box-shadow: 0 8px 18px -8px rgb(0 0 0 / .25); transition: transform 220ms var(--ease-out); }
.channel-reel-cover[data-slot="0"] { z-index: 1; }
.channel-reel-cover[data-slot="1"] { z-index: 2; }
.channel-reel-cover[data-slot="2"] { z-index: 3; }
.channel-reel-cover[data-slot="3"] { z-index: 4; }
.channel-reel-cover[data-slot="4"] { z-index: 5; }
.channel-reels.is-ready [data-slot="0"] { transform: translateX(calc(-50% - 32px)) rotate(-7deg); }
.channel-reels.is-ready [data-slot="1"] { transform: translateX(calc(-50% - 16px)) rotate(-3.5deg); }
.channel-reels.is-ready [data-slot="2"] { transform: translateX(calc(-50% + 16px)) rotate(3.5deg); }
.channel-reels.is-ready [data-slot="3"] { transform: translateX(calc(-50% + 32px)) rotate(7deg); }
.channel-reels.is-ready [data-slot="4"] { transform: translateX(-50%); }
.channel-reel-preview figcaption { min-height: 84px; margin-top: 2px; font: 400 1.25rem/1.3 var(--font-serif); text-wrap: balance; }
.channel-reel-views { display: block; margin-top: .5rem; color: var(--channel-muted); font: .75rem/1.5 var(--font-mono); font-variant-numeric: tabular-nums; }
.channel-reels.is-ready .channel-fan, .channel-reels.is-ready .channel-reel-cover { touch-action: pan-y pinch-zoom; }
.channel-fan.is-dragging { user-select: none; -webkit-user-select: none; }
.channel-reel-meta { display: flex; flex-direction: column; align-items: center; gap: 0; }
.channel-reel-topic { color: var(--channel-muted); font: .75rem/1.5 var(--font-mono); }
.channel-reel-tabs { display: flex; gap: 4px; }
.channel-reel-tabs[hidden] { display: none; }
.channel-reel-tabs button { padding: 0; min-width: 44px; min-height: 44px; border: 0; background: none; color: var(--channel-muted); font: .75rem var(--font-mono); cursor: pointer; touch-action: manipulation; }
.channel-reel-tabs button[aria-selected="true"] { color: var(--ink); text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 2px; }
.channel-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; }
.channel-watch { display: inline-flex; align-items: center; gap: .5rem; min-width: 44px; min-height: 44px; font-size: .875rem; text-decoration: underline; text-underline-offset: 4px; touch-action: manipulation; }
.channel-reels.keyboard-motion .channel-reel-cover { transition: none; }
[data-theme="dark"] .channel-fan img { outline-color: rgb(255 255 255 / .1); }
@media (hover: hover) and (pointer: fine) {
  .channel-reels.is-ready:not(.keyboard-motion) .channel-reel-cover[data-slot="4"]:hover { transform: translate(-50%, -6px); }
}
@media (max-width: 520px) {
  .channel-stack-layout { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .channel-heading { flex-direction: row; align-items: baseline; justify-content: space-between; gap: 1rem; }
  .channel-heading h2 { font-size: 1.875rem; }
  .channel-intro { max-width: 28ch; }
  .channel-reels.is-ready .channel-fan { height: 295px; margin-top: 6px; }
  .channel-reels.is-ready .channel-reel-cover { width: 172px; }
  .channel-reel-preview figcaption { min-height: 78px; text-align: center; }
  .channel-reel-meta { max-width: 250px; margin-inline: auto; }
  .channel-footer { margin-top: .5rem; }
}
@media (prefers-reduced-motion: reduce) {
  .channel-reels.is-ready .channel-reel-cover { transition: none; }
  .channel-reels.is-ready .channel-reel-cover[data-slot="4"]:hover { transform: translateX(-50%); }
}

/* Video destination picker. */
html { scrollbar-gutter: stable; }
body:has(.channel-platform[open]) { overflow: hidden; }
.channel-platform { width: min(340px, calc(100% - 2rem)); max-height: calc(100% - 2rem); margin: auto; padding: 1.25rem; border: 0; border-radius: 12px; background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--border), 0 20px 60px rgb(0 0 0 / .2); overflow: auto; overscroll-behavior: contain; }
.channel-platform::backdrop { background: rgb(0 0 0 / .35); }
.channel-platform-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.channel-platform-heading h2 { font-size: 1rem; line-height: 1.4; font-weight: 500; }
.channel-platform-heading button { display: grid; place-items: center; flex-shrink: 0; min-width: 44px; min-height: 44px; padding: 0; border: 0; background: none; color: inherit; font-size: 1.5rem; cursor: pointer; touch-action: manipulation; }
#channel-platform-reel { margin-top: .5rem; color: var(--muted); font-size: .875rem; line-height: 1.5; }
.channel-platform-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .625rem; margin-top: 1.25rem; }
.channel-platform-options a { display: flex; justify-content: center; align-items: center; gap: .5rem; min-width: 44px; min-height: 64px; padding: .5rem; border: 1px solid var(--border); border-radius: 7px; color: inherit; font-size: .875rem; line-height: 1.5; text-align: center; text-decoration: underline; text-underline-offset: 4px; touch-action: manipulation; }

/* Notes bookshelf. */
.writing-shelf { --writing-muted: color-mix(in oklch, var(--muted) 95%, var(--ink)); --shelf-front: rgb(201 148 76 / .22); --shelf-edge: rgb(148 96 29 / .18); --book-shadow: 0 1px 2px rgb(0 0 0 / .16), 3px 4px 7px rgb(0 0 0 / .12), 8px 12px 18px -10px rgb(0 0 0 / .25); }
.writing-shelf > h2 { font: 400 2.125rem/1.12 var(--font-serif); letter-spacing: -.025em; text-wrap: balance; }
.writing-intro { margin-top: .875rem; max-width: 47ch; color: var(--writing-muted); font-size: 1rem; line-height: 1.6; text-wrap: pretty; }
.writing-filters { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 1.5rem; border-bottom: 1px solid var(--border); }
.writing-filters[hidden] { display: none; }
.writing-filters button { position: relative; padding: 0 .75rem; min-width: 44px; min-height: 44px; border: 0; background: none; color: var(--writing-muted); font: .875rem var(--font-sans); cursor: pointer; touch-action: manipulation; }
.writing-filters button[aria-pressed="true"] { color: var(--ink); }
.writing-filters button[aria-pressed="true"]::after { position: absolute; bottom: 0; left: .75rem; right: .75rem; height: 2px; background: var(--ink); content: ""; }
.writing-status { margin-top: .75rem; color: var(--writing-muted); font: .75rem/1.5 var(--font-mono); font-variant-numeric: tabular-nums; }
.note-shelf { position: relative; isolation: isolate; margin-top: 1rem; }
.note-shelf-scroll { overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: none; border-radius: 8px; }
.note-shelf-scroll::-webkit-scrollbar { display: none; }
.note-books { display: flex; align-items: end; gap: 16px; width: max-content; min-width: 100%; min-height: 246px; padding: 32px 28px 36px; }
.note-book { position: relative; flex: 0 0 112px; display: flex; justify-content: center; scroll-snap-align: center; perspective: 700px; transform-origin: center bottom; }
.note-book[hidden] { display: none; }
.note-book-link { position: relative; display: block; width: var(--book-width); flex-shrink: 0; border-radius: 2px 5px 5px 2px; transform: rotate(var(--book-angle)); transform-origin: center bottom; transition: transform 200ms var(--ease-out), scale 120ms var(--ease-out); touch-action: manipulation; }
.note-book-link img { position: relative; width: 100%; height: auto; aspect-ratio: 2 / 3; object-fit: cover; border-radius: inherit; transform-origin: left center; transition: transform 180ms var(--ease-out); box-shadow: var(--book-shadow); outline: 1px solid rgb(0 0 0 / .1); outline-offset: -1px; }
.note-book-link::before { position: absolute; inset: 3px 0 1px 5px; border-radius: inherit; background: #eee8d9; box-shadow: 2px 0 0 #d8d0be; content: ""; }
.note-book-link::after { position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(90deg, rgb(0 0 0 / .12), transparent 4%, rgb(255 255 255 / .15) 7%, transparent 12%); content: ""; pointer-events: none; }
.note-book-link:active { scale: .98; }
.note-book-link:active img { transform: perspective(700px) rotateY(-18deg); }
.note-shelf-front { position: absolute; z-index: 2; left: 0; right: 0; bottom: 14px; height: 76px; border-radius: 7px 7px 12px 12px; background: var(--shelf-front); box-shadow: inset 0 0 0 1px var(--shelf-edge), inset 0 1px 0 rgb(255 255 255 / .5), 0 8px 12px -10px rgb(0 0 0 / .3); pointer-events: none; }
.note-shelf-front::before, .note-shelf-front::after { position: absolute; bottom: 16px; width: 6px; height: 6px; border-radius: 50%; background: var(--shelf-edge); box-shadow: inset 0 1px 1px rgb(255 255 255 / .6); content: ""; }
.note-shelf-front::before { left: 12px; }
.note-shelf-front::after { right: 12px; }
.note-book-summary { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.writing-hint { margin-top: .875rem; color: var(--writing-muted); font: .75rem/1.6 var(--font-mono); }
.writing-hint > span { display: none; }
[data-theme="dark"] .writing-shelf { --shelf-front: rgb(184 133 67 / .22); --shelf-edge: rgb(230 192 137 / .22); --book-shadow: 0 0 0 1px rgb(255 255 255 / .1); }
[data-theme="dark"] .note-book-link img { outline-color: rgb(255 255 255 / .1); }
@media (hover: hover) and (pointer: fine) {
  .note-book-link:hover { transform: translateY(-10px) rotate(0deg); }
  .note-book-link:hover img { transform: perspective(700px) rotateY(-12deg); }
  .note-book-link:active img { transform: perspective(700px) rotateY(-18deg); }
}
@media (max-width: 600px) { .writing-hint > span { display: inline; } }
@media (max-width: 420px) {
  .writing-shelf > h2 { font-size: 1.875rem; }
  .writing-intro { font-size: .9375rem; }
  .writing-filters { gap: 0; }
  .writing-filters button { padding-inline: .5rem; font-size: .8125rem; }
  .writing-filters button[aria-pressed="true"]::after { left: .5rem; right: .5rem; }
  .note-books { padding-inline: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .note-book-link, .note-book-link img { transition: none; }
  .note-book-link:hover img, .note-book-link:active img { transform: none; }
  .note-book-link:hover { transform: rotate(var(--book-angle)); }
  .note-book-link:active { scale: 1; }
}

/* Let the picked book leave the shelf during native article navigation. */
::view-transition-group(notes-book) { animation-duration: 220ms; animation-timing-function: var(--ease-out); }
::view-transition-old(notes-book) { transform-origin: center bottom; animation: note-book-pick 220ms var(--ease-out) both; }
@keyframes note-book-pick {
  to { transform: translateY(-24px) rotate(-4deg) scale(1.04); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(notes-book), ::view-transition-old(notes-book) { animation: none; }
}

/* About as a personal file. */
.about-file { --about-muted: color-mix(in oklch, var(--muted) 95%, var(--ink)); }
.about-eyebrow { color: var(--about-muted); margin-bottom: 1.25rem; font: .75rem/1.5 var(--font-mono); }
.about-file > h2 { font: 400 2.125rem/1.12 var(--font-serif); letter-spacing: -.025em; text-wrap: balance; }
.personal-file { margin-top: 2rem; }
.file-tabs { display: flex; gap: 4px; align-items: end; padding-left: 12px; }
.file-tabs[hidden] { display: none; }
.file-tabs button { position: relative; padding: 0 16px; min-height: 44px; min-width: 44px; border: 0; border-radius: 6px 6px 0 0; background: var(--subtle); color: var(--about-muted); font: .8125rem var(--font-sans); cursor: pointer; touch-action: manipulation; }
.file-tabs button[aria-selected="true"] { z-index: 2; background: var(--surface); color: var(--ink); box-shadow: 0 -1px 0 var(--border), 1px 0 0 var(--border), -1px 0 0 var(--border); }
.file-tabs button:active { scale: .98; }
.file-sheet { position: relative; z-index: 1; padding: 28px; border-radius: 8px; background: var(--surface); box-shadow: 0 0 0 1px var(--border), 0 6px 18px -12px rgb(0 0 0 / .3); }
.file-person { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border); color: var(--about-muted); font: .75rem/1.5 var(--font-mono); }
.file-panels.is-ready { min-height: 235px; }
.file-panel { padding-top: 24px; }
.file-panel[hidden] { display: none; }
.file-chapter { color: var(--about-muted); font: .75rem/1.5 var(--font-mono); }
.file-panel h3 { margin-top: 12px; font: 400 1.625rem/1.2 var(--font-serif); letter-spacing: -.02em; text-wrap: balance; }
.file-prose { margin-top: 16px; color: var(--about-muted); font-size: .9375rem; line-height: 1.75; text-wrap: pretty; }
.file-links { display: flex; flex-wrap: wrap; gap: 0 20px; margin-top: 10px; }
.file-links a { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; font-size: .875rem; text-decoration: underline; text-underline-offset: 4px; touch-action: manipulation; }
.file-fold { position: absolute; right: 0; bottom: 0; width: 20px; height: 20px; border-radius: 6px 0 6px 0; background: var(--subtle); box-shadow: -1px -1px 0 var(--border); pointer-events: none; }
[data-theme="dark"] .file-sheet { box-shadow: 0 0 0 1px var(--border); }
@media (max-width: 420px) {
  .about-file > h2 { font-size: 1.875rem; }
  .file-tabs { padding-left: 6px; gap: 3px; }
  .file-tabs button { padding-inline: 12px; font-size: .75rem; }
  .file-sheet { padding: 20px; }
  .file-person { gap: 12px; }
  .file-person span:last-child { white-space: nowrap; }
  .file-panel h3 { font-size: 1.5rem; }
  .file-prose { font-size: .875rem; }
  .file-panels.is-ready { min-height: 290px; }
}
@media (prefers-reduced-motion: reduce) { .file-tabs button:active { scale: 1; } }

/* Book-style research reader. */
body:has(.notes-reader) { padding-bottom: 100px; }
.notes-reader { --reading-size: 18px; }
.reader-back { padding-top: 16px; }
.reader-back a { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; color: var(--muted); font: .75rem/1.5 var(--font-mono); text-decoration: underline; text-underline-offset: 4px; }
.reader-book-header { margin: 12px auto 0; text-align: center; }
.reader-book-cover { width: 96px; height: 144px; margin-inline: auto; border-radius: 2px 4px 4px 2px; transform: rotate(-3deg); box-shadow: 0 0 0 1px rgb(0 0 0 / .1), 2px 4px 8px rgb(0 0 0 / .12); }
.reader-book-meta { margin-top: 20px; color: var(--muted); font: .75rem/1.5 var(--font-mono); }
.reader-book-header h1 { max-width: 24ch; margin: 10px auto 0; font: 400 2rem/1.15 var(--font-serif); letter-spacing: -.025em; text-wrap: balance; }
.reader-introduction { margin: 16px auto 0; max-width: 52ch; text-align: start; }
.reader-introduction summary { display: flex; justify-content: center; align-items: center; gap: 10px; min-height: 44px; font: .75rem/1.5 var(--font-mono); color: var(--muted); cursor: pointer; }
.reader-introduction summary::after { content: '+'; }
.reader-introduction[open] summary::after { content: '−'; }
.reader-introduction > p { padding-block: 12px; font-size: 1rem; line-height: 1.65; }
.reader-book-body { margin-top: 36px; }
.reader-book-chapter { scroll-margin-top: 24px; }
.reader-book-chapter + .reader-book-chapter { margin-top: 48px; }
.reader-book-chapter[hidden] { display: none; }
.reader-chapter-heading { margin-bottom: 28px; text-align: center; }
.reader-chapter-heading > p { color: var(--muted); font-size: .8125rem; line-height: 1.5; }
.reader-chapter-heading h2 { max-width: 30ch; margin: 8px auto 0; font: 500 1.1875rem/1.35 var(--font-sans); text-wrap: balance; }
.reader-chapter-text { font: 400 var(--reading-size)/1.75 var(--font-sans); overflow-wrap: break-word; }
.reader-chapter-text > p + p, .reader-chapter-text > p + ol { margin-top: 1.25rem; }
.reader-chapter-text > p:first-child::first-letter { float: left; margin: .03em .08em 0 0; font: 400 3.5em/.85 var(--font-serif); }
.reader-chapter-text strong { font-weight: 600; }
.reader-chapter-text a { text-decoration: underline; text-underline-offset: 4px; }
.reader-chapter-text code { font-size: .82em; overflow-wrap: anywhere; }
.reader-chapter-text .case-steps { padding-left: 1.35rem; }
.reader-chapter-text li + li { margin-top: 1rem; }
.reader-diagram { margin-top: 24px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.reader-diagram > summary { display: flex; align-items: center; justify-content: space-between; min-height: 44px; cursor: pointer; font-size: .875rem; }
.reader-diagram > summary::after { content: '+'; }
.reader-diagram[open] > summary::after { content: '−'; }
.reader-diagram .flow { margin-top: 16px; }
.reader-controls { position: fixed; z-index: 5; left: 50%; bottom: max(12px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; align-items: center; gap: 4px; width: max-content; max-width: calc(100% - 24px); padding: 6px; border-radius: 999px; background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--border), 0 6px 20px -8px rgb(0 0 0 / .22); }
.reader-controls[hidden] { display: none; }
.reader-controls button { display: grid; place-items: center; width: 44px; min-width: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 50%; background: none; color: inherit; font-size: 1rem; cursor: pointer; touch-action: manipulation; }
.reader-controls button:disabled { color: var(--muted); opacity: .5; cursor: default; }
.reader-controls .theme-toggle { margin: 0; }
.reader-chapter-chooser { position: relative; display: grid; place-items: center; width: 80px; height: 44px; border-radius: 5px; background: var(--subtle); }
.reader-position { font: 16px var(--font-sans); font-variant-numeric: tabular-nums; }
.reader-position::after { content: '⌄'; margin-left: 6px; }
.reader-controls select { position: absolute; inset: 0; width: 100%; min-height: 44px; opacity: 0; font-size: 16px; cursor: pointer; }
.reader-chapter-chooser:has(select:focus-visible) { outline: 2px solid var(--ink); outline-offset: 4px; }
.notes-reader .case-pager[hidden] { display: none; }
.reader-controls [data-reader-size] { font-family: var(--font-serif); font-size: 1.125rem; }
[data-theme="dark"] .reader-book-cover { box-shadow: 0 0 0 1px rgb(255 255 255 / .1); }
[data-theme="dark"] .reader-controls { box-shadow: 0 0 0 1px var(--border); }
@media (max-width: 420px) {
  .reader-book-header h1 { font-size: 1.75rem; }
  .reader-book-cover { width: 84px; height: 126px; }
  .reader-book-body { margin-top: 28px; }
  .reader-chapter-heading { margin-bottom: 24px; }
}

/* Keep long neighbouring note titles inside the reader on phones. */
.notes-reader .case-pager-name { overflow-wrap: anywhere; }
@media (max-width: 420px) {
  .notes-reader .case-pager { flex-direction: column; align-items: stretch; }
  .notes-reader .case-pager-link { width: 100%; }
}

/* ---- CV drawer: printer animation + download ---- */
.cv-open {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  height: 36px;
  margin: 4px 0 0 auto;
  padding: 0 .85rem 0 .7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: 400 .78rem/1 var(--font-mono);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 150ms var(--ease-out), border-color 150ms ease;
}
.cv-open svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.cv-open:active { transform: scale(.96); }
@media (hover: hover) and (pointer: fine) { .cv-open:hover { border-color: var(--muted); } }
.cv-open:focus-visible, .cv-close:focus-visible, .cv-grab:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

body:has(.cv-drawer[open]) { overflow: hidden; }
.cv-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(440px, 100vw);
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  box-shadow: -24px 0 60px rgb(0 0 0 / .18);
  overflow-y: auto;
  overscroll-behavior: contain;
  transform: translateX(100%);
  transition: transform 320ms var(--ease-out);
}
.cv-drawer.is-in { transform: translateX(0); }
.cv-drawer::backdrop { background: rgb(0 0 0 / 0); transition: background 320ms var(--ease-out); }
.cv-drawer.is-in::backdrop { background: rgb(0 0 0 / .38); }

.cv-top { display: flex; align-items: center; justify-content: space-between; padding: .75rem 1rem .5rem 1.5rem; color: var(--muted); font: .75rem/1.5 var(--font-mono); }
.cv-close { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--ink); color: var(--bg); font: 1.35rem/1 var(--font-sans); cursor: pointer; touch-action: manipulation; transition: transform 150ms var(--ease-out); }
.cv-close:active { transform: scale(.93); }

.cv-stage {
  --slot: 104px;
  position: relative;
  height: 584px;
  margin: .25rem 1rem 0;
  overflow: hidden;
  border-radius: 10px;
  background-color: var(--subtle);
  background-image: radial-gradient(circle, var(--border) 1.2px, transparent 1.6px);
  background-size: 14px 14px;
}
.cv-printer {
  position: absolute;
  z-index: 3;
  top: 22px;
  left: 14px;
  right: 14px;
  height: 92px;
  border-radius: 46px 46px 40px 40px;
  background: linear-gradient(180deg, #f3f4f6 0%, #c9ccd3 38%, #9a9ea8 72%, #d3d6dc 100%);
  box-shadow: inset 0 2px 3px rgb(255 255 255 / .9), inset 0 -6px 10px rgb(60 64 74 / .35), 0 18px 28px -10px rgb(30 34 50 / .45);
}
.cv-printer::after { content: ""; position: absolute; left: 6%; right: 6%; bottom: -5px; height: 9px; border-radius: 0 0 6px 6px; background: linear-gradient(#2a2d38, #14161c); }
.cv-printer-badge { position: absolute; left: 22px; top: 24px; display: grid; place-items: center; width: 44px; height: 28px; border-radius: 5px; background: #2b2e37; color: #fff; font: 600 .8rem/1 var(--font-sans); letter-spacing: .02em; }
.cv-printer-panel { position: absolute; left: 80px; right: 52px; top: 22px; height: 26px; border-radius: 3px; background: linear-gradient(#fafafa, #e4e5e8); box-shadow: inset 0 1px 2px rgb(0 0 0 / .18); }
.cv-printer-led { position: absolute; right: 24px; top: 26px; width: 16px; height: 16px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #9db8ff, #2f5bff 60%, #1b3bb8); box-shadow: 0 0 0 2px rgb(255 255 255 / .55), 0 0 10px rgb(47 91 255 / .6); }
.cv-printer-slot { position: absolute; z-index: 1; left: 7%; right: 7%; bottom: 4px; height: 5px; border-radius: 3px; background: #101218; }

.cv-feed { position: absolute; z-index: 2; top: var(--slot); right: 0; bottom: 0; left: 0; overflow: hidden; }
.cv-paper {
  position: absolute;
  top: 0;
  left: 50%;
  width: 76%;
  margin: 0 0 0 -38%;
  aspect-ratio: 1100 / 1556;
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / .18), 0 14px 30px -8px rgb(30 34 50 / .35);
  transform: translateY(-101%);
  transform-origin: 50% 0;
}
.cv-paper img { display: block; width: 100%; height: 100%; object-fit: cover; }

.cv-drawer.is-printing .cv-paper { animation: cv-feed 3.8s linear forwards; }
.cv-drawer.is-printing .cv-printer { animation: cv-shake .14s steps(2, end) infinite; }
.cv-drawer.is-printing .cv-printer-led { animation: cv-blink .5s steps(2, end) infinite; }
.cv-drawer.is-done .cv-paper { transform: translateY(14px) rotate(-1.4deg); }
.cv-drawer.is-done .cv-printer-led { background: radial-gradient(circle at 35% 30%, #b7f5c4, #2ec46a 60%, #17803f); box-shadow: 0 0 0 2px rgb(255 255 255 / .55), 0 0 10px rgb(46 196 106 / .6); }

@keyframes cv-feed {
  0% { transform: translateY(-101%) rotate(0deg); animation-timing-function: cubic-bezier(.4, 0, .2, 1); }
  20% { transform: translateY(-80%) rotate(0deg); }
  25% { transform: translateY(-80%) rotate(0deg); animation-timing-function: cubic-bezier(.4, 0, .2, 1); }
  48% { transform: translateY(-52%) rotate(0deg); }
  53% { transform: translateY(-52%) rotate(0deg); animation-timing-function: cubic-bezier(.4, 0, .2, 1); }
  76% { transform: translateY(-22%) rotate(-.4deg); }
  81% { transform: translateY(-22%) rotate(-.4deg); animation-timing-function: cubic-bezier(.22, 1, .36, 1); }
  100% { transform: translateY(14px) rotate(-1.4deg); }
}
@keyframes cv-shake { 0% { transform: translateY(0); } 100% { transform: translateY(1.5px); } }
@keyframes cv-blink { 0% { opacity: 1; } 100% { opacity: .35; } }

.cv-status { padding: 1.25rem 1.5rem 1.75rem; font: 500 1.0625rem/1.45 var(--font-sans); color: var(--ink); text-wrap: pretty; }
.cv-status span { color: var(--muted); font-weight: 400; }
.cv-grab { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.cv-status [data-cv-done] { display: none; }
.cv-drawer.is-done .cv-status [data-cv-done] { display: inline; }
.cv-drawer.is-done .cv-status [data-cv-busy] { display: none; }
.cv-dots::after { content: ""; animation: cv-dots 1.2s steps(4, end) infinite; }
@keyframes cv-dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

@media (max-height: 760px) { .cv-stage { height: 520px; } .cv-paper { width: 66%; margin-left: -33%; } }
@media (prefers-reduced-motion: reduce) {
  .cv-drawer, .cv-drawer::backdrop { transition-duration: 1ms; }
  .cv-drawer.is-printing .cv-paper, .cv-drawer.is-printing .cv-printer, .cv-drawer.is-printing .cv-printer-led, .cv-dots::after { animation: none; }
}
