/* Shared look for every Model Carving blog figure: tokens, panel chrome, play controls, caption, tooltip. */
.cf {
  --bg: #ffffff;
  --ink: #1b1d20;
  --ink-2: #5d636b;
  --muted: #535b66;
  --rule: #e4e6e9;
  --axis: #767d86;
  --grid: #eff0f2;
  --shade: #f4f5f7;
  --blue: #0072b2;
  --blue-band: rgba(0, 114, 178, 0.15);
  --fd: #4c5560;
  --closing: #2a2e34;
  --closed: #65717c;
  --attn: #6a51a3;
  --mlp: #8a5a00;
  --removed: #d5d9de;
  --gain: #2b7038;
  --pressure: #ad3654;
  --pressure-opacity: 0.12;
  --fd2: #68717c;
  --focus: #0072b2;

  margin: 2.5rem auto 0;
  max-width: 980px;
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "tnum" 1, "cv11" 1;
  position: relative;
}

:where(:root:not([data-theme="light"])) .cf:not(.cf-light) {
  --bg: #161719;
  --ink: #e7e8ea;
  --ink-2: #a9aeb5;
  --muted: #a4aab2;
  --rule: #2d3034;
  --axis: #707780;
  --grid: #222428;
  --shade: #1e2023;
  --blue: #4ba3e0;
  --blue-band: rgba(75, 163, 224, 0.2);
  --fd: #8f949b;
  --closing: #e2e4e7;
  --closed: #858c95;
  --attn: #9d88d8;
  --mlp: #f2c14e;
  --removed: #3a3d42;
  --gain: #58a65b;
  --pressure: #e0607a;
  --pressure-opacity: 0.09;
  --fd2: var(--axis);
  --focus: #4ba3e0;
}

.cf.cf-narrow {
  max-width: 660px;
}

.cf-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.25rem;
}

.cf-panels.cf-stacked {
  grid-template-columns: 1fr;
  gap: 1.4rem;
}

.cf-panels.cf-split {
  grid-template-columns: 0.72fr 1.28fr;
}

.cf-panels.cf-pair {
  grid-template-columns: 1fr 0.5fr;
}

.cf-panels.cf-three {
  grid-template-columns: 1fr 1fr 0.78fr;
  gap: 1.9rem;
}

.cf-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.35rem;
}

.cf-title {
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  white-space: nowrap;
}

.cf-stat {
  font-size: 0.8rem;
  color: var(--ink-2);
  white-space: nowrap;
}

.cf-stat b {
  color: var(--ink);
  font-weight: 600;
}

.cf-key {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.9rem;
  min-height: 1.25rem;
  margin-bottom: 0.4rem;
  font-size: 0.76rem;
  color: var(--ink-2);
}

.cf-key > span {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  white-space: nowrap;
}

.cf-key i {
  display: inline-block;
  width: 14px;
  height: 0;
  border-top: 2px solid currentColor;
  border-radius: 2px;
}

.cf-key i.band {
  height: 8px;
  border: 1px solid var(--blue);
  background: var(--blue-band);
}

.cf-key i.sq {
  width: 9px;
  height: 9px;
  border: 0;
  border-radius: 2px;
  background: currentColor;
}

.cf-key i.sq.hollow {
  background: transparent;
  border: 1px dashed var(--muted);
}

.cf canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: var(--ar, 1.2);
}

.cf-controls {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1rem;
}

.cf-controls.cf-controls-short {
  grid-template-columns: auto auto 1fr;
}

.cf-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: var(--bg);
  color: var(--ink-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}

.cf-btn:hover {
  color: var(--ink);
  border-color: var(--muted);
}

.cf-btn:focus-visible,
.cf-scrub input:focus-visible,
.cf-chip:focus-visible,
.cf .dc-text:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.cf-btn svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
}

.cf-scrub {
  position: relative;
  height: 28px;
}

.cf-ticks {
  position: absolute;
  inset: 4px 0 auto 0;
  height: 8px;
  pointer-events: none;
}

.cf-ticks span {
  position: absolute;
  top: 0;
  width: 1px;
  height: 8px;
  background: var(--muted);
  opacity: 0.7;
}

.cf-ticks span.on {
  background: var(--ink);
  opacity: 0.9;
}

.cf-scrub input {
  position: absolute;
  inset: auto 0 2px 0;
  width: 100%;
  margin: 0;
  height: 14px;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.cf-scrub input::-webkit-slider-runnable-track {
  height: 2px;
  background: linear-gradient(to right, var(--ink) var(--p, 0%), var(--axis) var(--p, 0%));
  border-radius: 2px;
}

.cf-scrub input::-moz-range-track {
  height: 2px;
  background: linear-gradient(to right, var(--ink) var(--p, 0%), var(--axis) var(--p, 0%));
  border-radius: 2px;
}

.cf-scrub input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--bg);
  border: 1.5px solid var(--ink);
}

.cf-scrub input::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg);
  border: 1.5px solid var(--ink);
}

.cf-readout {
  font-size: 0.8rem;
  color: var(--ink-2);
  white-space: nowrap;
  min-width: 11.5em;
  text-align: right;
}

.cf-readout b {
  color: var(--ink);
  font-weight: 600;
}

/* option chips (e.g. a task or a model picker) */
.cf-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.9rem;
}

.cf-chip {
  font: inherit;
  font-size: 0.8rem;
  padding: 0.22rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--bg);
  color: var(--ink-2);
  cursor: pointer;
}

.cf-chip[aria-pressed="true"] {
  border-color: var(--ink);
  color: var(--ink);
}

.cf figcaption {
  margin-top: 1.1rem;
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 46rem;
}

.cf figcaption strong {
  color: var(--ink);
  font-weight: 600;
}

/* hover readout that follows the pointer */
.cf-tip {
  position: absolute;
  pointer-events: none;
  z-index: 3;
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--rule);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  font-size: 0.76rem;
  line-height: 1.4;
  color: var(--ink-2);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.12s;
}

.cf-tip b {
  color: var(--ink);
  font-weight: 600;
}

@media (max-width: 860px) {
  .cf-panels,
  .cf-panels.cf-stacked,
  .cf-panels.cf-split,
  .cf-panels.cf-pair,
  .cf-panels.cf-three {
    grid-template-columns: 1fr;
    gap: 1.6rem;
  }
  .cf canvas.cf-wide {
    aspect-ratio: 1.25;
  }
  .cf-controls {
    grid-template-columns: auto auto 1fr;
  }
  .cf-readout {
    grid-column: 1 / -1;
    text-align: left;
    min-width: 0;
  }
}
