/* Styles at dawn: the spinner sheet and the Ghostty window that shows the pick on a real tab strip.
   Cells sit on the sky and are separated by space. Only the style in use gets a surface: the dark of a
   Ghostty window, with an "In use" tag, so the choice reads without colour. Lit parts take the dawn accent,
   unlit parts are faint rings. Nothing tweens: every part snaps on the 0.12 s tick, like the glyph it draws. */

.styles-head { grid-column: 1 / span 7; }
.styles-head .lead { margin-top: 18px; max-width: 54ch; }

.styles-tabs {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(320px, 27vw, 420px);
  gap: 32px clamp(32px, 3.4vw, 56px);
  align-items: start;
  margin-top: clamp(12px, 2vw, 32px);
}

/* ---------- The sheet ---------- */
.sheet { container: sheet / inline-size; display: grid; row-gap: clamp(48px, 4vw + 16px, 80px); min-width: 0; }

.group {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  row-gap: 6px;
}
.group-head { padding-bottom: 10px; }
.group-head h3 { font-size: 1.5rem; line-height: 1.15; }
.group-head p { margin-top: 8px; max-width: 34ch; font-size: var(--text-small); line-height: 1.55; color: var(--dawn-muted); }

/* Phone: specimen on the left, name and strip beside it. The cell keeps its padding inside the column,
   so the picked card never runs into the screen edge. */
.cell {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  grid-template-areas: "spec head" "spec strip" "spec cap";
  align-content: start;
  gap: 8px 16px;
  min-width: 0;
  padding: 14px 12px 16px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--dawn-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 160ms ease, color 160ms ease;
}
.cell-head { grid-area: head; display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.cell-spec { grid-area: spec; display: block; height: 64px; }
.cell-strip { grid-area: strip; }
.cell-cap { grid-area: cap; }

.cell-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.1875rem;
  font-weight: 720;
  line-height: 1.25;
  letter-spacing: -0.008em;
  font-variation-settings: "CASL" 0.5, "MONO" 0;
}
.cell-on {
  display: none;
  flex: none;
  align-self: center;
  padding: 1px 8px 2px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(196, 161, 245, 0.65);
  color: var(--lavender);
  font-size: 0.75rem;
  font-weight: 650;
  line-height: 1.5;
}
.cell-time {
  flex: none;
  margin-left: auto;
  font-size: 0.875rem;
  font-variation-settings: "MONO" 1, "CASL" 0;
  font-variant-numeric: tabular-nums;
  color: var(--dawn-muted);
  white-space: nowrap;
}
.cell-cap { font-size: var(--text-small); line-height: 1.5; text-wrap: pretty; }

/* On a phone only the style in use keeps its line; the others still read it out as their description */
@container sheet (max-width: 539px) {
  .cell:not([aria-checked="true"]) .cell-cap { display: none; }
}

/* Two or four columns: every cell is a subgrid of four rows, so names, glyphs, strips and captions
   line up across a row however long each strip is. */
@container sheet (min-width: 540px) {
  .group {
    --hang: 14px; /* cells hang their padding into the gutter so their text lines up with the headings */
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: calc(2 * var(--hang) + 12px);
    row-gap: 20px;
  }
  .group-head { grid-column: 1 / -1; padding-bottom: 4px; }
  .cell {
    grid-row: span 4;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: subgrid;
    grid-template-areas: none;
    row-gap: 12px;
    margin-inline: calc(-1 * var(--hang));
    padding: 16px var(--hang) 20px;
  }
  .cell-head { grid-area: auto; grid-row: 1; }
  .cell-spec { grid-area: auto; grid-row: 2; height: 80px; margin-block: 2px; }
  .cell-strip { grid-area: auto; grid-row: 3; }
  .cell-cap { grid-area: auto; grid-row: 4; }
}
/* Four columns beside the window on a laptop: the heading runs across the top and eight styles fill two rows. */
@container sheet (min-width: 760px) {
  .group { grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: calc(2 * var(--hang) + 8px); }
  .cell-head { flex-wrap: wrap; row-gap: 2px; }
  .cell-name { font-size: 1.0625rem; }
  .cell-time { font-size: 0.8125rem; }
}

/* ---------- States ---------- */
@media (hover: hover) {
  .cell:hover { background: rgba(255, 255, 255, 0.5); }
}
.cell:active { background: rgba(255, 255, 255, 0.7); }
.cell[aria-checked="true"] {
  background: var(--dawn-ink);
  color: var(--moon);
  box-shadow: 0 1px 2px rgba(30, 26, 43, 0.2), 0 18px 36px -18px rgba(30, 26, 43, 0.55);
}
.cell[aria-checked="true"] .cell-on { display: inline-block; }
.cell[aria-checked="true"] .cell-time { color: var(--haze); }
.cell:focus-visible { outline-offset: 2px; border-radius: 16px; }

/* ---------- The specimen ---------- */
.spec {
  --on: var(--dawn-accent);
  --off: rgba(30, 26, 43, 0.2);
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.cell[aria-checked="true"] .spec { --on: var(--lavender); --off: rgba(233, 230, 247, 0.26); }
.spec .dot,
.spec .part {
  fill: transparent;
  stroke: var(--off);
  stroke-width: 1.5px;
  vector-effect: non-scaling-stroke;
}
.spec .dot.on,
.spec .part.on { fill: var(--on); stroke: var(--on); }
.spec .ring { fill: none; stroke: var(--off); stroke-width: 1.5px; vector-effect: non-scaling-stroke; }
.spec .arc { fill: none; stroke: var(--on); stroke-width: 2.6; stroke-linecap: round; }
.spec .glyph { fill: var(--on); font-family: var(--font-glyph); }
.spec-emoji .glyph,
.cell[data-kind="emoji"] .cell-strip .f { font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", var(--font-glyph); }

/* ---------- The strip: every frame in muted ink (7:1 on the dawn), the current one in full ink with a mark under it ---------- */
.cell-strip {
  --gap: 4px;
  container-type: inline-size;
  display: grid;
  grid-template-columns: repeat(var(--cols, 10), max-content);
  gap: 8px var(--gap);
  align-content: start;
  min-width: 0;
  padding-bottom: 6px;
}
.cell[data-kind="braille"] .cell-strip { --fmax: 26px; } /* TP Glyphs draws braille small in its em */
.cell[data-cells="3"] .cell-strip { --gap: 12px; }
.cell[data-kind="emoji"] .cell-strip { --fmax: 18px; }
.cell[data-kind="arc"] .cell-strip,
.cell[data-kind="text"] .cell-strip { --fmax: 24px; }
.cell[data-kind="emoji"] .cell-strip { --gap: 2px; }
.cell[data-key="garden"] .cell-strip { --gap: 6px; }
.cell-strip .f {
  position: relative;
  display: block;
  width: calc(var(--fw, 0.6) * 1em);
  font-family: var(--font-glyph);
  font-weight: 400;
  font-variation-settings: normal;
  font-size: min(var(--fmax, 20px), calc((100cqi - (var(--cols, 10) - 1) * var(--gap)) / (var(--cols, 10) * var(--fw, 0.6))));
  line-height: 1.45;
  text-align: center;
  white-space: pre;
  color: var(--dawn-muted);
}
.cell-strip .f::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: max(6px, min(100%, 1.1em));
  height: 2px;
  border-radius: 1px;
  background: var(--dawn-accent);
  transform: translateX(-50%);
  opacity: 0;
}
.cell-strip .f.is-now { color: var(--dawn-ink); }
.cell[data-kind="emoji"] .cell-strip .f:not(.is-now) { opacity: 0.6; } /* colour emoji ignore ink, so the frames you are not on step back */
.cell-strip .f.is-now::after { opacity: 1; }
.cell[aria-checked="true"] .cell-strip .f { color: var(--haze); }
.cell[aria-checked="true"] .cell-strip .f.is-now { color: var(--moon); }
.cell[aria-checked="true"] .cell-strip .f::after { background: var(--lavender); }
.f-g { display: block; }
.f-at {
  display: block;
  margin-top: 2px;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-variation-settings: "MONO" 1, "CASL" 0;
  line-height: 1.3;
  white-space: nowrap;
}
.cell[data-key="garden"] .cell-strip .f::after { bottom: -6px; }

/* ---------- The Ghostty window beside the sheet ---------- */
.preview { position: sticky; top: 24px; }
.preview .gw {
  position: relative;
  width: 100%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 20px 40px -16px rgba(30, 26, 43, 0.5);
}
.preview .gw-body { height: 72px; }
.dawn .gw-body p { color: inherit; } /* terminal text keeps its own ink, not the dawn ink */
.preview-note { margin-top: 14px; min-height: 1.6em; font-size: var(--text-small); font-weight: 620; }
.dawn .preview-more { margin-top: 6px; max-width: 44ch; font-size: var(--text-small); color: var(--dawn-muted); }

/* Narrow: the window rides along the top of the sheet as a slim tab strip, so a pick shows at once. */
@media (max-width: 1099px) {
  .styles-head { grid-column: 1 / -1; }
  .styles-tabs { grid-template-columns: minmax(0, 1fr); }
  .preview { order: -1; top: 10px; z-index: 3; }
  .preview .gw-body { display: none; }
  .preview-note {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .dawn .preview-more { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .cell { transition: none; }
}
