/* The overview page: the hero and its live array panel, the bands that follow, and the two diagrams. */

/* ---------- hero ---------- */

.hero {
  position: relative;
  padding: 76px 0 64px;
  border-bottom: 1px solid var(--rule);
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(to right, color-mix(in srgb, var(--ink) 5%, transparent) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in srgb, var(--ink) 5%, transparent) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse 78% 62% at 72% 34%, #000 10%, transparent 78%);
  opacity: 0.75;
  pointer-events: none;
}

/* Light gathers behind the panel: the dark surface reads as an object in the room rather than a
   rectangle pasted on the page. */
.hero-inner {
  position: relative;
}

.hero-inner::before {
  content: "";
  position: absolute;
  inset: -4% -3% -8% 40%;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(
    58% 62% at 58% 44%,
    color-mix(in srgb, var(--teal) 14%, transparent),
    transparent 72%
  );
  filter: blur(6px);
}

.hero-inner > * {
  position: relative;
  z-index: 1;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--rule-2), transparent);
}

.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  gap: clamp(36px, 5vw, 76px);
  align-items: center;
}

.hero h1 {
  font-size: clamp(2.55rem, 5.1vw, 4.15rem);
  margin: 18px 0 20px;
}

.hero h1 em {
  font-style: italic;
  color: var(--blue);
}

.hero .lead {
  margin: 0 0 28px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.hero-note {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}

@media (width <= 900px) {
  .hero {
    padding: 52px 0 48px;
  }
  .hero-inner {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- the array panel ---------- */

.panel {
  position: relative;
  border-radius: var(--radius);
  background: linear-gradient(
    160deg,
    color-mix(in srgb, #fff 5%, var(--panel-2)),
    var(--panel) 46%,
    color-mix(in srgb, #000 12%, var(--panel))
  );
  color: var(--panel-ink);
  border: 1px solid color-mix(in srgb, #fff 9%, transparent);
  box-shadow:
    0 30px 70px -34px rgb(4 20 30 / 65%),
    inset 0 1px 0 color-mix(in srgb, #fff 10%, transparent);
  overflow: hidden;
}

/* A light that follows the pointer across the panel, as if the surface were glass. It is set from
   the pointer position in site.js and stays off under reduced motion. */
[data-sheen]::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: radial-gradient(
    460px circle at var(--mx, 50%) var(--my, 0%),
    rgb(255 255 255 / 9%),
    transparent 62%
  );
  opacity: 0;
  transition: opacity 240ms var(--ease);
}

[data-sheen]:hover::after {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  [data-sheen]::after {
    display: none;
  }
}

.panel-head {
  user-select: none;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid color-mix(in srgb, #fff 9%, transparent);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--panel-dim);
}

.panel-head .name {
  color: var(--panel-ink);
}

.panel-body {
  padding: 18px;
}

.panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px 12px;
  border-top: 1px solid color-mix(in srgb, #fff 9%, transparent);
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--panel-dim);
}

.panel-foot .pulse {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  margin-right: 7px;
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--teal) 60%, transparent);
  animation: pulse 2.6s ease-out infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--teal) 50%, transparent);
  }
  70% {
    box-shadow: 0 0 0 7px transparent;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

.array-grid {
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr));
}

.array-grid .cell {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1.55;
  border-radius: 1px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--panel-ink);
  background: color-mix(in srgb, var(--teal) calc(var(--t, 0) * 52%), color-mix(in srgb, #fff 6%, var(--panel)));
  border: 1px solid color-mix(in srgb, #fff 7%, transparent);
  transition: background 420ms ease, opacity 300ms ease;
  animation: cell-in 500ms ease both;
  animation-delay: calc(var(--i, 0) * 26ms);
}

.array-grid.small .cell {
  aspect-ratio: 1.4;
  font-size: 11px;
}

@keyframes cell-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.array-grid .cell.pending {
  color: transparent;
  background: color-mix(in srgb, #fff 5%, var(--panel));
  animation: none;
}

/* ---------- homepage sections ---------- */

.band {
  padding: 72px 0;
  border-bottom: 1px solid var(--rule);
}

.band.alt {
  /* A veil, not a slab: the page's own light shows through, so the alternating bands read as
     different weights of the same paper rather than two different papers. */
  background: var(--glass);
}

.band-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  flex-wrap: wrap;
  margin-bottom: 34px;
}

.band-head h2 {
  font-size: clamp(1.6rem, 2.6vw, 2.15rem);
  margin-top: 10px;
}

.band-head p {
  margin: 0;
  max-width: 46ch;
  color: var(--ink-2);
  font-size: 15.5px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
}

.card {
  background: var(--surface);
  padding: 26px 26px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  transition: background var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}

.card:hover {
  background: color-mix(in srgb, var(--teal) 4%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--teal) 26%, transparent);
}

.card:hover .glyph {
  color: var(--teal);
}

.card h3 {
  font-family: var(--sans);
  font-size: 16.5px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.35;
}

.card p {
  margin: 0;
  font-size: 14.5px;
  color: var(--ink-2);
  line-height: 1.6;
}

.card .glyph {
  width: 2rem;
  height: 2rem;
  color: var(--blue);
  margin-bottom: 4px;
  transition: color var(--fast) var(--ease);
}

.card .card-index {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  user-select: none;
}

@media (width <= 860px) {
  .cards {
    grid-template-columns: minmax(0, 1fr);
  }
  .band {
    padding: 52px 0;
  }
}

/* ---------- split feature ---------- */

.split {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
}

.split.flip {
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
}

.split h2 {
  font-size: clamp(1.55rem, 2.4vw, 2rem);
  margin: 10px 0 16px;
}

/* Scoped to the prose column: the figures in the other column have their own type scale, and a
   blanket `.split p` was overriding it. */
.split-copy p {
  margin: 0 0 14px;
  color: var(--ink-2);
  font-size: 15.5px;
}

.split-copy p:last-child {
  margin-bottom: 0;
}

@media (width <= 900px) {
  .split,
  .split.flip {
    grid-template-columns: minmax(0, 1fr);
  }
  .split.flip .split-copy {
    order: 2;
  }
}

/* buffer diagram */

.buffer-figure {
  border: 1px solid var(--rule);
  background: var(--glass);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 22px 22px 18px;
  min-width: 0;
}

.buffer-row {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 3px;
  margin-bottom: 14px;
}

.buffer-row span {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
  background: var(--paper);
  border-radius: 1px;
}

.buffer-row span.on {
  background: color-mix(in srgb, var(--teal) 22%, var(--surface));
  border-color: color-mix(in srgb, var(--teal) 40%, var(--rule));
  color: var(--ink);
}

.buffer-caption {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-3);
  flex-wrap: wrap;
}

.stride-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 3px;
  margin-top: 6px;
}

.stride-grid span {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 9px 2px;
  border: 1px solid var(--rule);
  border-radius: 1px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-2);
  background: var(--surface);
}

.stride-grid span.head {
  color: var(--ink-3);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  background: transparent;
  border-color: transparent;
}

/* ---------- numbers strip ---------- */

.numbers {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.number {
  padding: 26px 24px 24px;
  border-right: 1px solid var(--rule);
  min-width: 0;
}

.number:last-child {
  border-right: 0;
}

.number b {
  display: block;
  font-family: var(--serif);
  font-size: clamp(2rem, 3.4vw, 2.7rem);
  font-weight: 600;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.number span {
  display: block;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  user-select: none;
}

@media (width <= 760px) {
  .numbers {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .number:nth-child(2) {
    border-right: 0;
  }
  .number:nth-child(1),
  .number:nth-child(2) {
    border-bottom: 1px solid var(--rule);
  }
}

/* ---------- package tiles ---------- */

.packages {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.package {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 20px 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.package .path {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--blue);
  overflow-wrap: anywhere;
}

.package p {
  margin: 0;
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.6;
}

.package ul {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.package li {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 2px 6px;
  background: var(--paper);
}

@media (width <= 860px) {
  .packages {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- closing call ---------- */

.closing {
  padding: 70px 0 76px;
}

.closing-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
}

.closing h2 {
  font-size: clamp(1.5rem, 2.6vw, 2.05rem);
  max-width: 22ch;
}

.array-grid:empty {
  min-height: 204px;
}

/* broadcasting diagram: cells, not outlines, so the repetition is visible */

.bcast {
  display: grid;
  gap: 16px;
}

.bcast-inputs {
  display: flex;
  align-items: flex-end;
  gap: 20px;
}

.bcast-label {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  user-select: none;
}

.bcast-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(16px, 30px));
  gap: 4px;
}

.bcast-grid i {
  display: block;
  aspect-ratio: 1;
  border: 1px solid color-mix(in srgb, var(--teal) 30%, var(--rule));
  border-radius: 1px;
  background: color-mix(in srgb, var(--teal) calc(var(--t, 0.2) * 100%), var(--surface));
}

.bcast-grid.wide {
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
}

.bcast-grid.wide i {
  aspect-ratio: 1.6;
}

.bcast-op {
  font-family: var(--mono);
  font-size: 19px;
  line-height: 1;
  color: var(--ink-3);
  padding-bottom: 22px;
  user-select: none;
}

.bcast-join {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  user-select: none;
}

.bcast-join::before,
.bcast-join::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--rule);
}

.bcast-note {
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink-3);
}


/* The hero array carries its coordinates: column indices along the top, row indices down the left,
   with a hairline on each axis so the grid reads as a coordinate frame rather than a table. */
.array-frame {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  grid-template-rows: 14px auto;
  gap: 3px 6px;
}

.array-frame .axis-cols {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr));
  gap: 4px;
  padding-bottom: 2px;
  border-bottom: 1px solid color-mix(in srgb, var(--panel-dim) 30%, transparent);
}

.array-frame .axis-rows {
  grid-column: 1;
  grid-row: 2;
  display: grid;
  grid-template-rows: repeat(var(--rows, 3), minmax(0, 1fr));
  gap: 4px;
  padding-right: 2px;
  border-right: 1px solid color-mix(in srgb, var(--panel-dim) 30%, transparent);
}

.array-frame .array-grid {
  grid-column: 2;
  grid-row: 2;
}

.array-frame .axis-cols span,
.array-frame .axis-rows span {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1;
  color: var(--panel-dim);
}

/* The lattice and the strip: a [2, 3, 4] array as space, and the twelve cells the upper layer folds
   onto. Every part is read, not copied, so none of it is selectable. */

.space-figure {
  border: 1px solid var(--rule);
  background: var(--glass);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-soft);
  border-radius: var(--radius);
  padding: 16px 20px 18px;
  min-width: 0;
  user-select: none;
  outline: none;
}

.space-figure:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.space-plot {
  margin: -4px -6px 6px;
  padding: 6px;
  border-radius: 2px;
  background-image: radial-gradient(
    circle at 1px 1px,
    color-mix(in srgb, var(--ink) 15%, transparent) 1px,
    transparent 0
  );
  background-size: 14px 14px;
}

.lattice {
  display: block;
  width: 100%;
  max-width: 520px;
  margin-inline: auto;
  height: auto;
  overflow: visible;
}

.lattice .edge {
  stroke: color-mix(in srgb, var(--ink) 36%, transparent);
  stroke-width: 1;
}

.lattice .edge.far {
  stroke: color-mix(in srgb, var(--ink) 15%, transparent);
}

.lattice .riser {
  stroke: color-mix(in srgb, var(--ink) 18%, transparent);
  stroke-width: 1;
}

/* The upper plane is a surface, not a pane of glass: it hides the half of the lower plane behind it,
   which is what makes the stack read as depth rather than two drawings that overlap. Both planes are
   neutral; teal is kept for the one element and the one cell being pointed at. */
/* Both planes are mixed from the card's own glass, so the surface sits at the same warmth as the
   card rather than as a lighter hole in it. The share of ink is a token because the two themes need
   different amounts to sit at the same apparent distance above their card. */
.lattice .plane {
  fill: var(--plane);
  stroke: color-mix(in srgb, var(--ink) 24%, transparent);
  stroke-width: 1;
}

.lattice .plane.far {
  fill: var(--plane-far);
  stroke: color-mix(in srgb, var(--ink) 12%, transparent);
}

.lattice .node .hit {
  fill: transparent;
  cursor: crosshair;
}

.lattice .node .halo {
  fill: none;
  stroke: transparent;
  stroke-width: 1;
}

.lattice .node.on .halo {
  stroke: color-mix(in srgb, var(--teal) 55%, transparent);
}

.lattice .node .dot {
  fill: var(--surface);
  stroke: color-mix(in srgb, var(--ink) 40%, transparent);
  stroke-width: 1;
  transition: fill 120ms ease, stroke 120ms ease, stroke-width 120ms ease;
}

.lattice .node.top .dot,
.lattice .node .hit:hover + .dot {
  stroke: var(--ink);
}

.lattice .node.on .dot {
  fill: var(--teal);
  stroke: var(--teal);
  stroke-width: 2.6;
}

.lattice .axis-tag {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  fill: var(--ink-3);
}

.space-caption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 12px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--ink-3);
}

.space-strip-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 6px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--ink-3);
}

.space-strip-label b {
  font-weight: 600;
  color: var(--ink);
}

.space-strip {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 3px;
}

.space-strip span {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border: 1px solid var(--rule);
  border-radius: 1px;
  background: var(--paper);
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--ink-3);
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.space-strip span.on {
  background: color-mix(in srgb, var(--teal) 26%, var(--surface));
  border-color: color-mix(in srgb, var(--teal) 55%, var(--rule));
  color: var(--ink);
}

.space-readout {
  display: flex;
  align-items: baseline;
  gap: 9px;
  flex-wrap: wrap;
  margin: 13px 0 0;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-2);
}

.space-readout .arrow {
  color: var(--ink-3);
}

.space-readout .ico {
  width: 0.85em;
  height: 0.85em;
}

.space-readout .formula {
  color: var(--ink-3);
}

.space-readout .offset {
  color: var(--teal);
  font-weight: 600;
}

@media (width <= 560px) {
  /* The panel foot carries a dtype, a shape and the strides; at this width it takes two lines
     rather than shrinking the type. */
  .panel-foot {
    flex-wrap: wrap;
    gap: 4px 10px;
    font-size: 9.5px;
  }
  .space-figure {
    padding: 14px 14px 16px;
  }
  .space-caption,
  .space-strip-label {
    flex-direction: column;
    gap: 2px;
  }
  .space-strip span {
    font-size: 8.5px;
  }
}
