/* keepwatching gallery.
   Dark by default — every preview is a dark 9:16 frame, and a light page would
   make twenty-four bright rectangles fight the text. */

:root {
  --bg: #07090c;
  --panel: #0f141a;
  --panel-2: #141b23;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --fg: #f2f5f8;
  --muted: #8b98a6;
  --dim: #5d6a78;
  --accent: #22c55e;
  --warn: #f59e0b;
  /* Content-axis violet. Deliberately not the format green. */
  --axis: #a78bfa;
  --radius: 16px;
  --wrap: 1240px;
  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--fg);
  font: 400 16px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "tnum" 0;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 20px;
}

a {
  color: inherit;
}

.sr,
.skip {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip:focus {
  position: fixed;
  top: 12px;
  left: 12px;
  width: auto;
  height: auto;
  clip: auto;
  padding: 10px 16px;
  background: var(--accent);
  color: #04180c;
  border-radius: 10px;
  z-index: 99;
}

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

.hero {
  padding: 68px 0 44px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(1100px 460px at 50% -180px, rgba(34, 197, 94, 0.16), transparent 70%),
    var(--bg);
}

.mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.mark .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.16);
}

h1 {
  margin: 22px 0 0;
  font-size: clamp(34px, 6.2vw, 62px);
  line-height: 1.06;
  letter-spacing: -0.032em;
  font-weight: 800;
  max-width: 17ch;
}

.lede {
  margin-top: 20px;
  max-width: 62ch;
  font-size: clamp(16px, 2.1vw, 19px);
  color: var(--muted);
}

/* Two measurement boards, visually separated so the eye never merges them.
   Format numbers are accent-green; axis numbers are violet and never appear in
   the same card, the same table, or the same colour as a format number. */
.boards {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 34px;
  align-items: start;
}

.board {
  padding: 20px 22px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
}

.board h2 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.board > p {
  margin-top: 6px;
  font-size: 13.5px;
  color: var(--dim);
  max-width: 42ch;
}

.board-format {
  border-left: 3px solid var(--accent);
}
.board-format h2 {
  color: var(--accent);
}

.board-axis {
  border-left: 3px solid var(--axis);
}
.board-axis h2 {
  color: var(--axis);
}
.board-axis .stats dd {
  color: var(--axis);
}

.board .running {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--dim);
}

.board .running a {
  color: var(--accent);
}

.axis-rows {
  margin-top: 14px;
  display: grid;
  gap: 6px;
}

.axis-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13.5px;
}

.axis-row .carried {
  display: block;
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--dim);
}

.axis-row .carried .outside {
  color: var(--axis);
  font-weight: 700;
}

.axis-row .warn-lone {
  color: var(--warn);
}

.axis-note {
  margin-top: 4px;
  padding: 9px 12px;
  border: 1px dashed rgba(167, 139, 250, 0.35);
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--dim);
}

.axis-note .outside {
  color: var(--axis);
  font-weight: 700;
}

.axis-row .an {
  font-variant-numeric: tabular-nums;
  color: var(--dim);
  font-size: 12.5px;
}

.axis-row .av {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--axis);
}

.axis-empty {
  margin-top: 14px;
  padding: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  font-size: 13px;
  color: var(--dim);
}

/* The numbers have to be readable in a screenshot of the first viewport. */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(94px, 1fr));
  gap: 10px;
  margin: 16px 0 0;
}

.stats > div {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.stats dt {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
}

.stats dd {
  margin-top: 4px;
  font-size: clamp(24px, 4.4vw, 36px);
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 30px;
}

.cta code {
  padding: 13px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--panel);
  font: 500 14.5px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #cfe9d8;
  overflow-x: auto;
  max-width: 100%;
}

.btn {
  padding: 13px 22px;
  border-radius: 12px;
  background: var(--accent);
  color: #04180c;
  font-weight: 700;
  text-decoration: none;
  font-size: 14.5px;
}

.honest {
  margin-top: 18px;
  font-size: 14px;
  color: var(--dim);
}

/* ------------------------------------------------------------- toolbar */

.toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 12px 0;
  background: rgba(7, 9, 12, 0.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.toolbar .wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

/* Chips wrap rather than scroll sideways. A horizontal strip hides whatever
   does not fit — and nobody swipes a filter bar, so a chip parked off the right
   edge is a format family that cannot be filtered. `kw layout` fails on it. */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}

.chip,
.ghost,
select {
  flex: 0 0 auto;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font: 600 13.5px/1.3 inherit;
  cursor: pointer;
  white-space: nowrap;
}

.chip[aria-pressed="true"] {
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(34, 197, 94, 0.5);
  color: #b7f3cd;
}

.sorts {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 0 0 auto;
  margin-left: auto;
}

select {
  border-radius: 10px;
  padding-right: 10px;
}

/* ---------------------------------------------------------------- grid */

main {
  padding: 34px 20px 70px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 22px;
}

.card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  overflow: hidden;
}

.card.top {
  border-color: rgba(34, 197, 94, 0.42);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.16);
}

/* The preview is the product. It gets the space. */
.frame {
  position: relative;
  aspect-ratio: 9 / 16;
  background: #0b0f14;
  overflow: hidden;
}

.frame video,
.frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.frame .rank {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(7, 9, 12, 0.78);
  border: 1px solid var(--line-strong);
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  backdrop-filter: blur(6px);
}

.frame .nbadge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: rgba(7, 9, 12, 0.78);
  border: 1px solid var(--line-strong);
  backdrop-filter: blur(6px);
}

.frame .nbadge.measured {
  color: #b7f3cd;
  border-color: rgba(34, 197, 94, 0.5);
}

.frame .nbadge.untested {
  color: #f4d29a;
  border-color: rgba(245, 158, 11, 0.45);
}

.frame .dur {
  position: absolute;
  bottom: 12px;
  right: 12px;
  padding: 4px 9px;
  border-radius: 8px;
  background: rgba(7, 9, 12, 0.78);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.name {
  font-size: 17.5px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.25;
}

.family {
  font-size: 11.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 600;
}

/* Numbers first, prose second — the claim is the point of the card. */
.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--panel-2);
}

.metrics div {
  padding: 10px 4px;
  min-width: 0;
  text-align: center;
  border-right: 1px solid var(--line);
}

.metrics div:last-child {
  border-right: 0;
}

.metrics .k {
  font-size: 10.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--dim);
}

.metrics .v {
  margin-top: 3px;
  font-size: 15.5px;
  white-space: nowrap;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.metrics .v.none {
  color: var(--dim);
  font-weight: 600;
}

.curve {
  display: block;
  width: 100%;
  height: 44px;
}

/* The no-data state: one honest line instead of a row of empty boxes. */
.notmeasured {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  font-size: 13.5px;
  color: var(--muted);
}

.notmeasured .nz,
.axis-strip.none .nz {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: #f4d29a;
}

.axis-strip.none {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: var(--dim);
}

/* Content-axis strip. Separated from the format metrics by a rule and a colour
   so no reader can mistake one board's number for the other's. */
.axis-strip {
  border: 1px solid rgba(167, 139, 250, 0.32);
  border-radius: 12px;
  background: rgba(167, 139, 250, 0.07);
  padding: 9px 12px;
  display: grid;
  gap: 6px;
}

.axis-strip .head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 10.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--axis);
  font-weight: 700;
}

.axis-strip .head .n {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  text-transform: none;
  color: var(--dim);
  font-weight: 600;
}

.axis-strip .r {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
}

.axis-strip .r span:first-child {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.axis-strip .r span:last-child {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--axis);
  white-space: nowrap;
}

.axis-strip.none .r {
  color: var(--dim);
}

/* Provenance of the example copy, so a viewer knows whether the numbers on
   screen are real. */
.prov {
  font-size: 11.5px;
  color: var(--dim);
}

.prov b {
  font-weight: 700;
}

.prov.sourced b {
  color: #b7f3cd;
}

.prov.selfref b {
  color: #f4d29a;
}

.prov a {
  color: var(--muted);
}

.hyp {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--muted);
}

.hyp b {
  color: #cbd6e2;
  font-weight: 600;
}

details {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: auto;
}

summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  list-style: none;
}

summary::-webkit-details-marker {
  display: none;
}

summary::before {
  content: "+ ";
  color: var(--accent);
}

details[open] summary::before {
  content: "− ";
}

.detail {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
  display: grid;
  gap: 8px;
}

.detail b {
  color: #cbd6e2;
  font-weight: 600;
}

.vid {
  display: block;
  font: 500 11.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--dim);
  word-break: break-all;
}

.empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
  max-width: 62ch;
  margin: 0 auto;
  line-height: 1.6;
}

.empty p + p {
  margin-top: 12px;
}

.empty code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.empty .cmd {
  display: inline-block;
  padding: 11px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--panel);
  color: #cfe9d8;
  font-size: 14.5px;
}

/* -------------------------------------------------------------- footer */

footer {
  border-top: 1px solid var(--line);
  padding: 30px 0 60px;
  color: var(--muted);
  font-size: 14px;
}

footer a {
  color: var(--accent);
}

.built {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--dim);
}

/* --------------------------------------------------------- responsive */

@media (max-width: 860px) {
  .boards {
    grid-template-columns: 1fr;
  }

  /* Wrapped chips make the bar several rows tall; sticking that to the top of a
     phone would eat a third of the screen. Scroll past it instead. */
  .toolbar {
    position: static;
  }

  .sorts {
    margin-left: 0;
  }
  /* auto-fit leaves a lone orphan tile at this width; 2x2 reads as a block. */
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .hero {
    padding: 44px 0 32px;
  }
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
  }
  .cta code {
    font-size: 12.5px;
    width: 100%;
  }
}

@media (max-width: 520px) {
  .grid {
    grid-template-columns: 1fr;
  }
  /* A full-width 9:16 frame is taller than the phone. Cap it so a card is one
     screen and twenty-four formats stay browsable. */
  .frame {
    aspect-ratio: auto;
    height: 58vh;
    max-height: 460px;
  }
}

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