/* One stylesheet, no build step, one theme.
 *
 * The palette is the logo's: a near-black ground, brushed-steel type, and a
 * single orange that is never decoration. Orange marks the thing this product
 * exists to watch — a price, a pass about to run, the screen you are on — and
 * everything static is steel. Two accents would leave neither meaning anything.
 *
 * No preprocessor either. Nesting, `@layer` and `color-mix()` are the browser's
 * now, and they are what a preprocessor was reached for — so the file a browser
 * reads is the file that was written.
 */

/* Two faces, carried in `brand/fonts/` rather than fetched from a font host:
 * one origin is what makes the cookie and the Origin check free, and a page
 * that reaches a CDN for its type gives that up for a typeface. Both are under
 * the SIL Open Font License, whose text sits beside them.
 *
 * Space Grotesk is the chrome — headings, the bar, the controls — because its
 * flat terminals and squared bowls are the wordmark's own. IBM Plex Mono is
 * every figure, and it carries Cyrillic because a criterion can be typed in it
 * and half a rendered word in the fallback face is worse than the fallback.
 */
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("/brand/fonts/space-grotesk-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("/brand/fonts/space-grotesk-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/brand/fonts/plex-mono-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/brand/fonts/plex-mono-400-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/brand/fonts/plex-mono-400-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Plex Mono";
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("/brand/fonts/plex-mono-500-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* The order the cascade reads them in: later wins, whatever the selectors say.
 *
 * That is the whole point of declaring it. `.switch button` no longer beats
 * `button:hover` by carrying a class — it beats it by being a component, which
 * is the reason it should. What used to be argued in selectors is settled here
 * once, and every rule below is free to be as specific as it is *legible*.
 *
 *   tokens      the palette, the radii, the faces
 *   base        the document: type, links, tables
 *   controls    a button, a field, a label — a piece of lit metal
 *   focus       the ring, which outranks whatever it is drawn around
 *   components  a thing reused on more than one screen
 *   screens     the bar, and one block per screen
 *   narrow      what changes when the viewport does
 */
@layer tokens, base, controls, focus, components, screens, narrow;

/* Unlayered, and deliberately: an unlayered rule outranks every layer, however
   specific the layered one is. This is the whole of it — `#topbar` sets
   `display: flex` and the editor under a watch is shown by script, and neither
   now needs a rule of its own repeating what the browser's own stylesheet
   already says. */
[hidden] {
  display: none;
}

@layer tokens {
  :root {
    color-scheme: dark;

    --ground: #0b0c0e;
    --panel: #131518;
    --raise: #1a1d22;
    --line: #24282e;
    --edge: rgba(228, 232, 236, 0.06);

    --chrome: #eef1f4;
    --steel: #b8c0c8;
    --mute: #79818b;

    /* The logo's orange is a specular one — it is lit metal, not paint, and at
       the size of a button it glares. So the accent is banded: a calmer hue for
       type and small marks, a deeper pair for anything filled, and the bright end
       kept for a highlight a few pixels wide. */
    --flame: #e8913f;
    /* Saturated rather than bright: the glare came from how light the logo's
       orange is, not from how orange it is. A step lighter and a button is a
       highlighter; a step darker and it goes brown. */
    --flame-top: #f2901f;
    --flame-mid: #e8801a;
    --flame-deep: #cc6a10;
    --flame-edge: #a85608;
    --ember: #ffb161;
    --danger: #ff6b6b;
    --good: #46c08a;

    --radius: 14px;
    --pill: 999px;
    /* The reader's own face for what a marketplace wrote — a title can be
       Bulgarian, and the system face has every glyph for it. */
    --ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --display: "Space Grotesk", var(--ui);
    --data: "Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  }
}

@layer base {
  * {
    box-sizing: border-box;
  }

  body {
    margin: 0;
    background:
      radial-gradient(120% 80% at 50% -10%, #16181c 0%, var(--ground) 55%),
      var(--ground);
    background-attachment: fixed;
    color: var(--steel);
    font: 15px/1.55 var(--ui);
    -webkit-font-smoothing: antialiased;
  }

  h1,
  h2,
  h3 {
    font-family: var(--display);
    color: var(--chrome);
    letter-spacing: -0.02em;
    line-height: 1.2;
  }

  a {
    color: var(--steel);
  }

  .skip {
    position: absolute;
    left: -9999px;

    &:focus {
      left: 1rem;
      top: 1rem;
      z-index: 5;
      background: var(--raise);
      padding: 0.5rem 0.75rem;
      border-radius: var(--radius);
    }
  }

  /* Numbers are read in columns — a price against a price, a run against a run —
     so every figure is monospaced and tabular. */
  .num,
  td.num,
  .price,
  .stat {
    font-family: var(--data);
    font-variant-numeric: tabular-nums;
  }

  .eyebrow {
    font: 600 0.68rem/1 var(--display);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--mute);
  }

  section > h2 {
    font-size: 1.05rem;
    margin: 0 0 0.75rem;
  }

  table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.88rem;
  }

  th,
  td {
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
  }

  th {
    font: 600 0.68rem/1 var(--display);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--mute);
  }

  tbody tr:hover td {
    background: rgba(255, 255, 255, 0.02);
  }
}

@layer controls {
  /* Every control is a piece of the same lit metal: a gradient down, a hairline
     of light along the top edge, and a shadow under it. */
  /* The one block written flat rather than nested, and this is why: `&` under a
     comma list resolves to `:is(button, a.button)`, and `:is()` takes the
     *highest* specificity in the list. A nested `&:hover` would therefore
     outrank `button.ghost`, and the sign-out button would light up like every
     other one. Two selectors cost less than that. */
  button,
  a.button {
    font: 500 0.92rem/1 var(--display);
    display: inline-flex;
    align-items: center;
    /* Centred both ways, which costs a button whose width is its content nothing
       and is the whole difference for one whose width is set: a round icon button
       packs its glyph to the left edge without this. */
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: var(--pill);
    background: linear-gradient(180deg, #242931, #191d22);
    box-shadow: inset 0 1px 0 color-mix(in srgb, var(--chrome) 9%, transparent);
    color: var(--steel);
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, filter 0.15s;
  }

  button:hover,
  a.button:hover {
    border-color: #3a4049;
    color: var(--chrome);
  }

  button.primary,
  a.button.primary {
    background: linear-gradient(180deg, var(--flame-top) 0%, var(--flame-mid) 45%, var(--flame-deep) 100%);
    /* The edge belongs to the metal, not to the page: a black border under an
       orange fill reads as a bar drawn along the bottom of the button. */
    border-color: var(--flame-edge);
    box-shadow: inset 0 1px 0 rgba(255, 232, 205, 0.45), 0 2px 8px rgba(0, 0, 0, 0.35);
    color: #1a1004;
    font-weight: 650;
  }

  button.primary:hover,
  a.button.primary:hover {
    color: #1a1004;
    filter: brightness(1.07);
  }

  button.ghost {
    background: none;
    border-color: transparent;
    color: var(--mute);
    padding-inline: 0.5rem;
  }

  button.danger:hover {
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 40%, transparent);
  }

  input,
  select {
    font: inherit;
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #0f1114;
    color: var(--chrome);

    &:hover {
      border-color: #343a42;
    }
  }

  input {
    &::placeholder {
      color: #565d66;
    }

    /* The platform's own stepper is the one control the palette cannot reach, and
       it is useless here besides: a mileage nudged from 200 000 by one is not how
       anybody answers "up to". The figure is typed. */
    &[type="number"] {
      appearance: textfield;

      &::-webkit-outer-spin-button,
      &::-webkit-inner-spin-button {
        appearance: none;
        margin: 0;
      }
    }
  }

  /* The platform's own select breaks the palette on every desktop, so the arrow
     is drawn here — inline, because nothing on this page fetches from elsewhere. */
  select {
    appearance: none;
    padding-right: 2rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%2379818b' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    background-size: 10px 7px;
  }

  label {
    display: grid;
    gap: 0.3rem;

    /* A control keeps an intrinsic width of about twenty characters unless it is
       told otherwise, which is wider than a column of a four-up grid — so it
       overflowed its cell and ate the gap, leaving fields looking glued together.
       `min-width: 0` is the half that matters: without it a grid item refuses to
       shrink below that intrinsic width whatever the percentage says. */
    & > input,
    & > select {
      width: 100%;
      min-width: 0;
    }

    & > span {
      font: 600 0.68rem/1 var(--display);
      letter-spacing: 0.12em;
      text-transform: uppercase;
      color: var(--mute);
    }
  }
}

/* Its own layer, above the controls it is drawn around: the ring has to reach a
   field that gave itself a radius, and the radius here is the ring's own — a
   two-pixel outline around a square corner reads as a chip out of the corner.
   Only a component that draws its own focus may say otherwise, and one does:
   the gallery, in the layer below. */
@layer focus {
  :focus-visible {
    outline: 2px solid var(--flame);
    outline-offset: 2px;
    border-radius: 4px;
  }
}

@layer components {
  .panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: inset 0 1px 0 var(--edge);
  }

  .tag {
    font-family: var(--display);
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: var(--pill);
    padding: 0.1rem 0.55rem;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    color: var(--mute);
    white-space: nowrap;

    &.live {
      color: var(--flame);
      border-color: color-mix(in srgb, var(--flame) 30%, transparent);
      background: color-mix(in srgb, var(--flame) 7%, transparent);
    }

    &.bad {
      color: var(--danger);
      border-color: color-mix(in srgb, var(--danger) 32%, transparent);
    }

    &.ok {
      color: var(--good);
      border-color: color-mix(in srgb, var(--good) 30%, transparent);
    }
  }

  .problem {
    border: 1px solid color-mix(in srgb, var(--danger) 32%, transparent);
    border-left-width: 3px;
    border-radius: 10px;
    padding: 0.6rem 0.8rem;
    margin: 0 0 1rem;
    background: color-mix(in srgb, var(--danger) 6%, transparent);
    color: #ffb3b3;
  }

  .empty {
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: var(--mute);
  }

  .hint {
    color: var(--mute);
    font-size: 0.9rem;
  }

  .dim {
    color: var(--mute);
  }

  /* A pass is a thing that will happen again; the gauge says how soon. */
  .meter {
    height: 3px;
    border-radius: 2px;
    background: #23262b;
    overflow: hidden;

    & > i {
      display: block;
      height: 100%;
      border-radius: 2px;
      background: linear-gradient(90deg, var(--flame), var(--ember));
      transition: width 0.6s ease-out;
    }
  }

  .toasts {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 4;
    display: grid;
    gap: 0.5rem;
    justify-items: end;
  }

  .toast {
    background: var(--raise);
    border: 1px solid var(--line);
    border-left: 2px solid var(--flame);
    border-radius: 10px;
    padding: 0.55rem 0.9rem;
    color: var(--chrome);
    font-size: 0.9rem;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
    animation: rise 0.22s ease-out;
  }

  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(6px);
    }
  }

  .skeleton {
    display: grid;
    gap: 0.75rem;

    & > i {
      display: block;
      height: 7.5rem;
      border-radius: var(--radius);
      background: linear-gradient(90deg, var(--panel), #1b1e23, var(--panel));
      background-size: 200% 100%;
      animation: shift 1.4s linear infinite;
    }
  }

  @keyframes shift {
    to {
      background-position: -200% 0;
    }
  }

  /* A closed set with more than one answer: a checkbox each, because a select
     that multi-selects is a control nobody operates correctly. */
  .choices {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.5rem 0.7rem 0.6rem;
    margin: 0;
    min-width: 0;

    & legend {
      padding: 0 0.3rem;
    }
  }

  .choice {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    margin-top: 0.25rem;

    /* A checkbox's own word is a value, not a field name: `for parts` is what the
       enum says, and small capitals would make it read as a heading. */
    & > span {
      font: 400 0.85rem/1.4 var(--ui);
      letter-spacing: 0;
      text-transform: none;
      color: var(--steel);
    }

    & input {
      accent-color: var(--flame-mid);
      width: auto;
      margin: 0;
    }
  }

  .chip {
    padding: 0.2rem 0.65rem;
    font: 500 0.78rem/1.6 var(--display);
    border-radius: var(--pill);
    border: 1px solid var(--line);
    background: none;
    color: var(--mute);

    /* Spelled out rather than inherited. A chip used to pick this up from the
       generic button hover, by the accident of `button:hover` outranking a bare
       class; now that the layer settles that, what it does has to be said. */
    &:hover {
      color: var(--chrome);
      border-color: #3a4049;
    }

    /* After the hover and not before: both are one class and one qualifier, so
       what keeps a pressed chip orange under the pointer is standing later. */
    &[aria-pressed="true"] {
      color: var(--flame);
      border-color: color-mix(in srgb, var(--flame) 35%, transparent);
      background: color-mix(in srgb, var(--flame) 9%, transparent);
    }
  }

  /* What a filter or a watch is looking for, as a reader says it rather than as
     the query string spells it. */
  .reading {
    color: var(--steel);
    font-size: 0.88rem;
    margin: 0 0 0.9rem;
  }

  /* A table's answer to a narrow screen is to scroll sideways. */
  .sheet {
    overflow-x: auto;
    margin-bottom: 2rem;
  }

  .no-image {
    font: 500 0.7rem/1 var(--display);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #454b53;
  }

  /* An instrument cluster rather than a list: every fact is a dial of the same
     size, and the hairlines between them are each cell's own ring, meeting in the
     one-pixel gap. The ring and not the grid's background, because a listing with
     an awkward number of facts leaves a cell empty on the last row — and that
     cell would be a hole the color of the hairlines. */
  .facts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
    gap: 1px;
    margin: 1.25rem 0 0;
    background: var(--panel);
    border-radius: 12px;
    overflow: hidden;
  }

  .fact {
    padding: 0.6rem 0.8rem;
    box-shadow: 0 0 0 1px var(--line);

    & dt {
      font: 600 0.64rem/1 var(--display);
      letter-spacing: 0.12em;
      text-transform: uppercase;
      color: var(--mute);
    }

    & dd {
      margin: 0.35rem 0 0;
      color: var(--chrome);
      font-family: var(--data);
      font-size: 0.9rem;
      font-variant-numeric: tabular-nums;
    }
  }

  .spark {
    display: block;
    width: 100%;
    height: auto;
    margin: 0.75rem 0 0.25rem;
  }

  .spark-ends {
    display: flex;
    justify-content: space-between;
    font-family: var(--data);
    font-size: 0.78rem;
    color: var(--mute);
    margin-bottom: 1.25rem;
  }

  /* ------------------------------------------------------------------------
     The gallery
     ------------------------------------------------------------------------ */

  /* The gallery is a custom element, and an unknown tag is laid out inline until
     something says otherwise; everything else about it is `.viewer`. */
  listing-gallery {
    display: block;
  }

  .viewer:focus-visible {
    outline: none;
  }

  .stage {
    position: relative;
    aspect-ratio: 16 / 10;
    background: #0e1013;
    border-radius: var(--radius);
    overflow: hidden;
    display: grid;
    place-items: center;

    & img {
      width: 100%;
      height: 100%;
      object-fit: contain;
    }
  }

  /* Which of how many, in the corner the eye already goes to. */
  .counter {
    position: absolute;
    top: 0.7rem;
    left: 0.7rem;
    padding: 0.2rem 0.55rem;
    border-radius: var(--pill);
    background: color-mix(in srgb, var(--ground) 72%, transparent);
    backdrop-filter: blur(6px);
    font-family: var(--data);
    font-size: 0.76rem;
    color: var(--chrome);
  }

  .step {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 2.6rem;
    height: 2.6rem;
    padding: 0;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: color-mix(in srgb, var(--ground) 60%, transparent);
    backdrop-filter: blur(6px);
    color: var(--chrome);

    &:hover {
      background: color-mix(in srgb, var(--ground) 85%, transparent);
    }

    & svg {
      width: 1.15rem;
      height: 1.15rem;
    }

    &.prev {
      left: 0.7rem;
    }

    &.next {
      right: 0.7rem;
    }
  }

  .zoom {
    position: absolute;
    left: 0.7rem;
    bottom: 0.7rem;
    padding: 0.3rem 0.75rem;
    font-size: 0.8rem;
    background: color-mix(in srgb, var(--ground) 60%, transparent);
    backdrop-filter: blur(6px);
  }

  .rail {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0.6rem 0 0.2rem;
    scrollbar-width: thin;

    & button {
      flex: 0 0 5.5rem;
      height: 4rem;
      padding: 0;
      border-radius: 8px;
      overflow: hidden;

      &[aria-current="true"] {
        border-color: var(--flame);
      }
    }

    & img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }
  }

  /* ------------------------------------------------------------------------
     The picture, filling the screen
     ------------------------------------------------------------------------ */

  /* The page behind must not scroll while this is over it: a wheel meant for the
     picture would otherwise move the article underneath. */
  .held {
    overflow: hidden;
  }

  /* A modal dialog: the browser draws it in its top layer, above every stacking
     context on the page, so nothing an ancestor does can move it. Sized to the
     screen here because a dialog's own default is to shrink to its contents. */
  .lightbox {
    width: 100vw;
    max-width: 100vw;
    /* `dvh` second, so a browser that does not know it keeps the `vh` line. */
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    padding: 3rem 1rem;
    border: 0;
    background: none;
    display: grid;
    place-items: center;
    overflow: hidden;

    /* Nearly opaque *and* blurred: at 6% the page behind stayed legible, and a
       photograph with a readable table of figures under it reads as a mistake. */
    &::backdrop {
      background: rgba(6, 7, 9, 0.97);
      backdrop-filter: blur(6px);
    }

    & .frame {
      max-width: 100%;
      max-height: 100%;
      overflow: auto;
      display: grid;
      place-items: center;

      /* Natural size, and the frame scrolls over it — which is what a magnifier
         is. `max-width: none` is the half that matters: without it the picture
         would be held to the frame and the zoom would do nothing at all. */
      &.zoomed img {
        max-width: none;
        max-height: none;
        cursor: zoom-out;
      }
    }

    & img {
      max-width: 100%;
      max-height: calc(100vh - 6rem);
      cursor: zoom-in;
    }

    /* Against the dialog, which is the screen — `fixed` would answer to whatever
       containing block an ancestor's filter happened to create. */
    & .counter,
    & .step,
    & .shut {
      position: absolute;
    }

    & .counter {
      top: 1.1rem;
      left: 1.1rem;
    }

    & .shut {
      top: 1rem;
      right: 1rem;
      width: 2.6rem;
      height: 2.6rem;
      padding: 0;
      border-radius: 50%;
      font-size: 1rem;
      line-height: 1;
    }

    & .step.prev {
      left: 1rem;
    }

    & .step.next {
      right: 1rem;
    }
  }
}

@layer screens {
  /* ------------------------------------------------------------------------
     The bar
     ------------------------------------------------------------------------ */

  #topbar {
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 1.75rem;
    padding: 0.7rem 1.5rem;
    background: color-mix(in srgb, var(--ground) 82%, transparent);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);

    /* The specular band the logo's metal has, drawn as one pixel and swept once
       on load — the only ornament in the interface. */
    &::after {
      content: "";
      position: absolute;
      inset: auto 0 -1px;
      height: 1px;
      background: linear-gradient(
        90deg,
        transparent,
        color-mix(in srgb, var(--chrome) 50%, transparent) 50%,
        transparent
      );
      transform: scaleX(0.2);
      opacity: 0;
      animation: sweep 1.4s ease-out 0.2s 1;
    }
  }

  @keyframes sweep {
    20% {
      opacity: 1;
    }
    100% {
      transform: scaleX(1);
      opacity: 0;
    }
  }

  .brand img {
    display: block;
    height: 30px;
    width: auto;
  }

  #nav {
    display: flex;
    gap: 0.25rem;

    & a {
      font-family: var(--display);
      position: relative;
      padding: 0.4rem 0.75rem;
      border-radius: var(--pill);
      text-decoration: none;
      color: var(--mute);
      font-weight: 500;

      &:hover {
        color: var(--chrome);
      }

      &[aria-current="page"] {
        color: var(--chrome);

        /* The needle: the one place a screen name is marked, and the same orange
           the gauge on a watch is drawn in. */
        &::after {
          content: "";
          position: absolute;
          left: 0.75rem;
          right: 0.75rem;
          bottom: -0.05rem;
          height: 2px;
          border-radius: 2px;
          background: linear-gradient(90deg, var(--ember), var(--flame));
        }
      }
    }
  }

  .account {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
  }

  .who {
    font-family: var(--data);
    font-size: 0.85rem;
    color: var(--mute);
  }

  main {
    max-width: 68rem;
    margin: 0 auto;
    padding: 2rem 1.5rem 5rem;
  }

  /* ------------------------------------------------------------------------
     The gate
     ------------------------------------------------------------------------ */

  .gate {
    max-width: 25rem;
    margin: 4rem auto;
    text-align: center;

    & img {
      width: 15rem;
      max-width: 80%;
      height: auto;
    }

    & .panel {
      padding: 1.25rem;
      text-align: left;
    }

    & form {
      display: grid;
      gap: 0.9rem;

      & button[type="submit"] {
        justify-content: center;
        margin-top: 0.25rem;
      }
    }
  }

  .lede {
    color: var(--mute);
    margin: 0.75rem 0 2rem;
  }

  .switch {
    display: flex;
    gap: 0.25rem;
    padding: 0.2rem;
    margin-bottom: 1.25rem;
    background: #0f1114;
    border: 1px solid var(--line);
    border-radius: var(--pill);

    & button {
      flex: 1;
      justify-content: center;
      border: none;
      background: none;
      color: var(--mute);
      padding: 0.4rem;

      &[aria-selected="true"] {
        background: var(--raise);
        color: var(--chrome);
        box-shadow: inset 0 0 0 1px var(--line);
      }
    }
  }

  /* ------------------------------------------------------------------------
     Listings
     ------------------------------------------------------------------------ */

  .filter {
    padding: 0.85rem;
    margin-bottom: 1.5rem;

    & .more {
      margin-top: 0.8rem;
      border-top: 1px solid var(--line);
      padding-top: 0.8rem;

      & > summary {
        cursor: pointer;
        font: 500 0.82rem/1.6 var(--display);
        color: var(--mute);
        list-style-position: inside;

        &:hover {
          color: var(--chrome);
        }
      }

      &[open] > summary {
        margin-bottom: 0.8rem;
      }
    }
  }

  /* Controls, not a query string. `key=value` is the chat's language, where a line
     of text is all there is; a browser has selects. Both spell one vocabulary —
     see criteria.js. */
  .filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(11rem, 100%), 1fr));
    gap: 0.7rem 0.9rem;
  }

  .filter-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    justify-content: space-between;
    gap: 0.7rem;
    margin-top: 0.9rem;
  }

  .filter-actions {
    display: flex;
    gap: 0.5rem;
  }

  .chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.7rem;
  }

  .cards {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.6rem;
  }

  /* One height for every card, whatever shape the photograph is. A list is read
     by scanning down one column of prices, and a row that grows to fit a portrait
     photo breaks that scan — so the height is the card's to decide and the
     picture's to obey. */
  .card {
    position: relative;
    display: grid;
    grid-template-columns: 9.5rem 1fr auto;
    align-items: stretch;
    gap: 1.1rem;
    min-height: 9.5rem;
    overflow: hidden;
    transition: border-color 0.15s, transform 0.15s;

    &:hover {
      border-color: #363c44;
      transform: translateY(-1px);
    }

    &:focus-within {
      border-color: var(--flame);
    }
  }

  /* The picture fills its column and the card's full height, and takes part in
     neither measurement: it is out of flow, so a 360x640 photograph cannot make
     its row twice as tall as its neighbours'. An `aspect-ratio` here would not do
     it — the row sets the height, so the ratio would compute the *width* from it
     and the thumbnail would grow sideways over the words. */
  .thumb {
    position: relative;
    display: grid;
    place-items: center;
    width: 100%;
    background: #0e1013;
    overflow: hidden;

    & img {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
  }

  .card-body {
    min-width: 0;
    padding: 0.8rem 0;
    display: grid;
    align-content: start;
    gap: 0.25rem;

    /* Where the car is. Its own line rather than another fact, because distance
       is what decides whether a price is worth the drive. */
    & .where {
      font-size: 0.86rem;
      color: var(--mute);
      margin-top: 0.15rem;
    }
  }

  .card-body p,
  .card-price p {
    margin: 0;
  }

  /* The whole card leads to the listing; the heading is the accessible name, and
     the overlay is what the pointer hits. */
  .title {
    color: var(--chrome);
    font-weight: 600;
    font-size: 1.02rem;
    text-decoration: none;

    &::after {
      content: "";
      position: absolute;
      inset: 0;
    }
  }

  /* The mark and the model on one line, so a scanning eye finds the model in the
     same place on every card whether or not the mark is there. */
  .card-head {
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
    min-width: 0;

    & .tag {
      flex: none;
    }
  }

  /* The seller's own line. Dimmer than the model and clipped to one row: these
     run to trim, gearbox and a phone number, and three of them wrapping turn a
     list into a wall. */
  .said {
    color: var(--steel);
    font-size: 0.88rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .facts {
    color: var(--mute);
    font-size: 0.86rem;
  }

  .where .place {
    color: var(--steel);
  }

  .card-price {
    display: grid;
    align-content: start;
    justify-items: end;
    gap: 0.2rem;
    padding: 0.8rem 1.1rem 0.8rem 0;
    text-align: right;
  }

  .price {
    color: var(--flame);
    font-size: 1.15rem;
    font-weight: 600;
    white-space: nowrap;
  }

  .source {
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    color: var(--mute);
  }

  .pager {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
    margin-top: 1.5rem;

    & .range {
      font-family: var(--data);
      font-size: 0.8rem;
      color: var(--mute);
      margin-inline: 0.5rem;
    }
  }

  /* ------------------------------------------------------------------------
     One listing
     ------------------------------------------------------------------------ */

  .back {
    display: inline-block;
    color: var(--mute);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 1rem;

    &:hover {
      color: var(--chrome);
    }
  }

  /* A marketplace's own words, and a name their owner chose: both can be
     Bulgarian, and the display face has no Cyrillic — half a heading in it and
     half in the fallback is worse than all of it in the fallback. */
  .detail h1,
  .watch-head h3 {
    font-family: var(--ui);
  }

  .detail h1 {
    margin: 0 0 0.35rem;
    font-size: 1.5rem;
  }

  .detail-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 1.25rem;

    & .price {
      font-size: 1.6rem;
    }
  }

  .detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
  }

  .external {
    margin-top: 1.25rem;
  }

  .aside {
    display: grid;
    gap: 1.25rem;
    position: sticky;
    top: 5rem;

    & .panel {
      padding: 1rem;
    }

    & .sheet {
      margin-bottom: 0;
    }
  }

  /* ------------------------------------------------------------------------
     Watches
     ------------------------------------------------------------------------ */

  .watches-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
  }

  .watch-list {
    list-style: none;
    margin: 0 0 2rem;
    padding: 0;
    display: grid;
    gap: 0.75rem;
  }

  .watch {
    padding: 1rem 1.1rem;

    &.paused {
      opacity: 0.6;
    }

    & .reading {
      margin-bottom: 0.9rem;
    }
  }

  .watch-head {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.6rem;

    & h3 {
      margin: 0;
      font-size: 1.02rem;
      margin-right: auto;
    }
  }

  /* The same form that creates a watch, unfolded under the one it edits. */
  .editor {
    margin-top: 1rem;
    border-top: 1px solid var(--line);
    padding-top: 1rem;
  }

  .pass {
    display: flex;
    justify-content: space-between;
    font-family: var(--data);
    font-size: 0.76rem;
    color: var(--mute);
    margin-bottom: 0.35rem;
  }

  .watch-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.9rem;

    & select {
      padding: 0.35rem 1.8rem 0.35rem 0.7rem;
      font-size: 0.85rem;
      border-radius: var(--pill);
      min-width: 5rem;
      flex: none;
    }

    & .images {
      margin-left: auto;
      display: flex;
      align-items: center;
      gap: 0.5rem;
    }
  }

  .link-prompt {
    padding: 1rem 1.1rem;
    margin-bottom: 1rem;

    & .hint {
      margin: 0 0 0.85rem;
    }
  }

  .link-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;

    & code {
      font-family: var(--data);
      color: var(--flame);
      background: #0f1114;
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 0.4rem 0.7rem;
    }
  }

  .link-shown {
    color: var(--mute);
    font-size: 0.88rem;
  }

  .watch-form {
    padding: 1.25rem;

    & h2 {
      margin: 0 0 1rem;
      font-size: 1.05rem;
    }
  }

  .form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(11rem, 100%), 1fr));
    gap: 0.9rem 1.25rem;
    max-width: 48rem;

    & + .form-grid {
      margin-top: 1rem;
      border-top: 1px solid var(--line);
      padding-top: 1rem;
    }
  }

  .form-foot {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.25rem;
  }

  /* ------------------------------------------------------------------------
     Admin
     ------------------------------------------------------------------------ */

  .screen-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
  }

  .screen-tools {
    display: flex;
    align-items: center;
    gap: 0.6rem;
  }

  .health {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr));
    gap: 0.75rem;
    margin-bottom: 2rem;
  }

  .health-card {
    padding: 1rem;
    min-width: 0;

    & .hint {
      margin: 0.35rem 0 0;
    }
  }

  .health-act {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.7rem;
  }

  .stats {
    display: grid;
    /* min() rather than a bare 8rem: a track may not shrink below its content,
       and one long unbroken label — downloaded_images — was enough to push the
       last cell out of the grid. */
    grid-template-columns: repeat(auto-fit, minmax(min(9rem, 100%), 1fr));
    gap: 0.75rem;
    margin-bottom: 2rem;
  }

  .stat-cell {
    padding: 0.9rem 1rem;
    min-width: 0;

    & .eyebrow {
      display: block;
      overflow-wrap: anywhere;
    }
  }

  .stat {
    display: block;
    color: var(--chrome);
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 0.35rem;
  }

  .row-actions {
    display: flex;
    gap: 0.4rem;
    justify-content: flex-end;

    & button {
      padding: 0.3rem 0.6rem;
      font-size: 0.78rem;
    }
  }

  td {
    /* A second line under a cell's name — a description, a watch's criteria. It
       wraps where the nowrap of a table cell would not, and the min-width keeps a
       narrow screen from squeezing it to one word per line: the sheet scrolls
       sideways, which is the answer a table gives to a narrow screen. */
    & .hint {
      margin: 0.2rem 0 0;
      white-space: normal;
      min-width: 13rem;
      max-width: 28rem;
    }

    & .tag + .tag {
      margin-left: 0.3rem;
    }
  }

  .aside-note {
    margin-left: 0.45rem;
    color: var(--mute);
    font-size: 0.78rem;
  }
}

@layer narrow {
  @media (max-width: 52rem) {
    .detail-grid {
      grid-template-columns: 1fr;
    }

    .form-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
  }

  @media (max-width: 40rem) {
    #topbar {
      flex-wrap: wrap;
      gap: 0.75rem 1rem;
      padding: 0.7rem 1rem;
    }

    #nav {
      order: 3;
      width: 100%;
      justify-content: space-between;

      & a {
        flex: 1;
        text-align: center;
      }
    }

    main {
      padding: 1.5rem 1rem 4rem;
    }

    .card {
      grid-template-columns: 8rem 1fr;
      gap: 0.9rem;
    }

    .card-price {
      grid-column: 2;
      justify-items: start;
      align-content: start;
      padding: 0 1rem 0.9rem 0;
      text-align: left;
    }

    /* The price is under the text here rather than beside it, so the text is what
       runs into the card's right edge and has to keep away from it. */
    .card-body {
      padding: 0.8rem 1rem 0.4rem 0;
    }

    .form-grid {
      grid-template-columns: 1fr;
    }

    .watch-actions .images {
      margin-left: 0;
    }
  }
}

/* Unlayered and important both, because this is a promise rather than a
   preference: a reader who asked for less movement gets it whatever any layer,
   selector or inline style below says. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
