/*
 * VAR Portal theme — matches vanamersfoortracing.nl.
 * All brand tokens live here as CSS custom properties; Bootstrap is overridden
 * to match. Change a value here and it propagates across the portal.
 */

:root {
  /* Brand colours.
     These are the reference portal's tokens, value for value (its index.css
     @theme block), so a screen built here and a screen built there land on the
     same colour. The orange is NOT the one sampled from VAR-orange-flat.pdf —
     the reference runs a hotter, less red orange, and matching it matters more
     than matching the print swatch. */
  --var-orange: #f55702;       /* --primary */
  --var-orange-alt: #ff5200;   /* --accent / --ring; the hover, brighter */
  --var-black: #1a1a1a;        /* --sidebar: the header bar */
  --var-dark: #202020;         /* --background */
  --var-fg: #f5f5f5;           /* --foreground: body text, not pure white */
  --var-grey: #484848;
  --var-grey-muted: #a3a3a3;   /* --muted-foreground */
  --var-light: #f2f2f2;
  --var-white: #ffffff;
  --var-footer: #1a1a1a;
  --var-green: #24ba4b;

  /* Surface scale, mapped onto the reference's card/secondary/muted steps.
     Borders there are white at low alpha rather than a grey hex, so they sit
     correctly on any surface instead of only on the one they were picked for. */
  --var-surface: #2a2a2a;                        /* --card / --popover */
  --var-surface-2: #2e2e2e;                      /* --secondary / --muted */
  --var-raised: #2e2e2e;
  --var-sunken: #1a1a1a;
  --var-line: rgba(255, 255, 255, 0.1);          /* --border */
  --var-line-strong: rgba(255, 255, 255, 0.15);  /* --input */
  --var-dim: #a3a3a3;

  /* Status accents. Named because they mean something, not because of how
     they look — "danger" stays danger if the red is ever retuned. */
  --var-danger: #ef4444;                         /* --destructive */
  --var-danger-line: rgba(239, 68, 68, 0.3);
  --var-danger-text: #ef4444;
  --var-warn: #e8b13a;

  /* Typography */
  --var-font: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  --var-heading-spacing: 1px;

  /* Layout */
  --var-container-max: 1400px;
  --var-header-height: 48px;

  /* Map Bootstrap's theme onto VAR tokens */
  --bs-primary: var(--var-orange);
  --bs-body-bg: var(--var-dark);
  --bs-body-color: var(--var-fg);
  --bs-body-font-family: var(--var-font);
  --bs-link-color: var(--var-orange);
  --bs-link-hover-color: var(--var-orange-alt);
  /* Bootstrap's default secondary/tertiary colours are near-black — unreadable
     on the dark theme. Remap them to the readable brand grey so utilities like
     .text-muted / .text-secondary stay legible everywhere. */
  --bs-secondary-color: var(--var-grey-muted);
  --bs-secondary-color-rgb: 171, 171, 171;
  --bs-tertiary-color: var(--var-dim);
  --bs-emphasis-color: var(--var-white);
}

/* --- Base ----------------------------------------------------------------- */

/* One knob for the whole portal's text size. Every size in this file, in
   accounts.css and in the sections' own <style> blocks is expressed in rem, so
   raising the root raises all of them together and keeps every proportion —
   rather than each screen being nudged separately and drifting apart. The
   reference portal is a Tailwind app running on the browser default, so this
   sits at 16px too — every rem below then means the same thing in both. */
html {
  font-size: 16px;
}

body {
  font-family: var(--var-font);
  background-color: var(--var-dark);
  color: var(--var-fg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* The pointer says what a click does, and nothing else. The hand over what
   does something — a link, a button, a tab, a row that opens a panel — and the
   plain arrow over everything else: a name, a label, a figure is read, not
   selected, so it shows no I-beam. The one place the I-beam belongs is where
   you type.

   All of it inside :where(), which weighs nothing, so a screen that wants its
   own cursor — the planner's grab handle, a cell you type into — only has to
   say so, without out-shouting this. Something made clickable in script is
   covered the moment it is marked up as one (a <button>, or role="button"
   with a tabindex, as it should be for the keyboard anyway). */
body { cursor: default; }

:where(
  input:not([type="button"], [type="submit"], [type="reset"], [type="checkbox"],
            [type="radio"], [type="file"], [type="color"], [type="range"]),
  textarea,
  [contenteditable]:not([contenteditable="false"])
) { cursor: text; }

:where(
  a[href], button, summary, select, .btn, .dropdown-item, .nav-link,
  .form-check-input, .form-check-label, label:has(> input[type="checkbox"], > input[type="radio"]),
  [role="button"], [role="tab"], [role="link"], [role="menuitem"], [role="option"],
  [role="checkbox"], [role="switch"], [data-bs-toggle], [data-bs-dismiss],
  input[type="button"], input[type="submit"], input[type="reset"],
  input[type="checkbox"], input[type="radio"], input[type="file"],
  input[type="color"], input[type="range"]
) { cursor: pointer; }

/* Switched off is not clickable: back to the arrow. Last, so it wins over the
   hand among rules that weigh the same. */
:where(:disabled, [aria-disabled="true"], .disabled) { cursor: default; }

main {
  flex: 1 0 auto;
}

h1, h2, h3, h4, h5, h6,
.heading {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--var-heading-spacing);
}

/* Opt out of the brand's uppercase. Section titles shout because they are
   signage; a person's name is not signage, and "LUDOVICO DI LORENZO" wrapped
   over two lines reads worse than the name does. */
.var-plain-heading {
  text-transform: none;
  letter-spacing: 0;
}

.container-var {
  max-width: var(--var-container-max);
  margin-inline: auto;
  padding-inline: 1.5rem;
}

/* --- Header --------------------------------------------------------------- */
.var-header {
  background-color: var(--var-black);
  border-bottom: 1px solid var(--var-line);
  min-height: var(--var-header-height);
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 1030;
}

/* The brand: the drawn wordmark beside one typed word, on a bar 48px tall
   with 1rem of side padding (the reference's h-12 px-4). */
.var-header .navbar-brand {
  display: inline-flex;
  /* Baseline, not center: the wordmark's bottom edge sits on the word's
     baseline. Centring lines up the word's whole line box, whose capitals
     sit above its middle, and left VAR hanging lower than PORTAL. */
  align-items: baseline;
  gap: 0.375rem;
  opacity: 0.9;
  transition: opacity 0.15s ease;
  text-decoration: none;
}

.var-header .navbar-brand:hover {
  opacity: 1;
}

/* 10px, the reference's h-[10px]. Smaller than the cap height of the word
   beside it on purpose: the drawn wordmark has no descenders and no side
   bearing, so matching it to the type's cap height makes it read as the
   larger of the two. */
.var-header .brand-wordmark {
  height: 0.625rem;
  width: auto;
  display: block;
}

.var-header .brand-accent {
  color: var(--var-orange-alt);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: -0.025em;
  font-size: 0.875rem;
  line-height: 1;
}

/* Wordmark and section, one group: the bar spreads its children with
   space-between, so a section on its own would drift to the middle. */
.var-topbar-left {
  display: flex;
  align-items: center;
  min-width: 0;
}

/* "| WORKBOOK" — the type of "Portal", size and weight alike, in the muted
   grey rather than white. White on the bar's near-black has about three times
   the contrast of the orange (17:1 against 5:1), and at the same size it read
   as the larger word of the two; the grey (7:1) sits level with it. A label,
   not a link: it says where you are and does nothing. The bar is drawn rather
   than typed so its height and colour are set here and not by the glyph. */
.var-header .brand-section {
  display: inline-flex;
  align-items: center;
  color: var(--var-grey-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: -0.025em;
  font-size: 0.875rem;
  line-height: 1;
  white-space: nowrap;
}

/* The trail after the section — WORKBOOK › F2T01MUG › Runsheet — in the
   section's own type and grey. Every step but the last is a link one level
   up, and only those take the pointer: white under it, as the way back. A
   long name is cut short with its whole self on hover, so the trail can
   never push the clock and the account off the bar. */
.var-header a.brand-section,
.var-header .brand-crumb {
  color: var(--var-grey-muted);
  text-decoration: none;
}
.var-header a.brand-section:hover,
.var-header a.brand-crumb:hover,
.var-header a.brand-section:hover .brand-crumb,
.var-header a.brand-section:hover .brand-crumb-sep {
  color: #fff;
}
.var-header .brand-crumb {
  display: inline-block;
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: -0.025em;
  font-size: 0.875rem;
  line-height: 1;
}
.var-header .brand-crumb-sep {
  margin: 0 0.45rem;
  color: var(--var-grey-muted);
  font-size: 0.875rem;
  line-height: 1;
  opacity: 0.6;
}

.var-header .brand-section::before {
  content: "";
  width: 1px;
  height: 0.875rem;
  background: currentColor;
  margin: 0 0.6rem;
}

/* The header carries no nav links any more: the brand is Home and your own
   name is User Management, so the collapsing menu, its toggler and the old
   user-menu span all went with them. The identity strip is in accounts.css. */

/* Release string in the header — present on every screen, never shouting. */
/* Which database this browser is writing to. Shares the version chip's metrics
   so the two sit level, and inverts its colours so it cannot be skimmed past:
   the whole job of this element is to be noticed on a screen you were not
   looking at. Only rendered when the database is a shared one — see
   config/settings/dev.py. */
.var-db-banner {
  background: var(--var-orange);
  color: var(--var-white);
  font-size: 0.75rem;
  line-height: 1rem;
  letter-spacing: 0.04em;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border: 1px solid var(--var-orange);
  white-space: nowrap;
}

.var-version {
  color: var(--var-grey-muted);
  font-size: 0.75rem;
  line-height: 1rem;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--var-line);
  padding: 0.125rem 0.5rem;
}

/* Update-available banner: offered, never forced. */
.var-update-banner {
  background: var(--var-orange);
  color: var(--var-white);
  font-size: 0.9rem;
  padding: 0.6rem 0;
}

.var-update-banner .btn-outline-light {
  border-radius: 0;
}

/* Engineering read in a browser (apps/core/view_only.py): the bar says why
   nothing on the page can be changed here, and where it can. Quieter than the
   update banner — it is a standing fact of the page, not news. */
.var-view-only-bar {
  background: var(--var-surface-2);
  border-bottom: 1px solid var(--var-line-strong);
  color: var(--var-fg);
  font-size: 0.9rem;
  padding: 0.5rem 0;
}

.var-view-only-bar .var-icon {
  color: var(--var-orange);
}

.var-view-only-bar .btn {
  border-radius: 0;
}

.var-view-only-soon {
  color: var(--var-grey-muted);
}

/* --- Flash messages ------------------------------------------------------- */
/* News about what just happened, shown in the header bar rather than in the
   page. The alert this replaces sat in the document flow: a one-line "saved"
   pushed every panel on the screen down by its own height and then stayed
   there, so the page it was reporting on never came back to where it was.

   The bar already carries the page's standing facts — the clocks, the release,
   who is signed in — so a passing one belongs in the same strip, styled like
   them (see .var-version) and dressed in the colour of the news it brings.

   Centred on the screen, not on the bar's spare width: those two differ,
   because the identity group on the right is far wider than the wordmark on
   the left. Being centred means it can reach the clocks, so its width is
   capped to what is actually clear of them — measured in the script at the
   foot of core/base.html, since no stylesheet can know how wide a display name
   renders. It is fixed rather than in flow, so it is not part of the bar's
   layout and cannot push anything. */
.var-toasts {
  position: fixed;
  top: calc(var(--var-header-height) / 2);
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1031; /* over the sticky header, which sits at 1030 */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  width: max-content;
  max-width: var(--var-toast-max, 26rem);
  /* Only the chip is a target; the air around it belongs to the bar. */
  pointer-events: none;
}

.var-toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 100%;
  min-height: 1.75rem;
  padding: 0.2rem 0.3rem 0.2rem 0.6rem;
  background-color: var(--var-surface);
  border: 1px solid var(--var-line);
  /* The one flash of colour: which kind of news this is. */
  border-left: 2px solid var(--var-toast-accent, var(--var-grey-muted));
  color: var(--var-fg);
  font-size: 0.78rem;
  line-height: 1.3;
  animation: var-toast-in 0.18s ease-out;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

/* It drops out of the bar rather than appearing on top of it. */
@keyframes var-toast-in {
  from {
    opacity: 0;
    transform: translateY(-0.4rem);
  }
}

/* Set when the toast is on its way out; the script removes it after the fade. */
.var-toast-leaving {
  opacity: 0;
  transform: translateY(-0.4rem);
}

/* The accents, in the colours the portal already uses for each kind of news. */
.var-toast-success {
  --var-toast-accent: var(--var-green);
}

.var-toast-error {
  --var-toast-accent: var(--var-danger);
}

.var-toast-warning {
  --var-toast-accent: var(--var-warn);
}

.var-toast-info,
.var-toast-debug {
  --var-toast-accent: var(--var-orange);
}

.var-toast-text {
  min-width: 0;
}

/* Another message waiting its turn behind this one (core/base.html). */
.var-toast-more {
  flex: 0 0 auto;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--var-grey-muted);
  font-variant-numeric: tabular-nums;
}

.var-toast[hidden] {
  display: none;
}

.var-toast-close {
  flex: 0 0 auto;
  background: none;
  border: 0;
  padding: 0 0.25rem;
  color: var(--var-grey-muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.var-toast-close:hover,
.var-toast-close:focus-visible {
  color: var(--var-fg);
}

/* The drop is decoration. Without it the toast still appears and still goes. */
@media (prefers-reduced-motion: reduce) {
  .var-toast {
    animation: none;
    transition: none;
  }
}

/* No room left in the middle of the bar — either the viewport is narrow or the
   identity group has grown into the centre. Hang the stack under the bar
   instead: still attached to the header, still out of the page's layout. The
   class is set by the script when it measures; the media query below is the
   floor for a browser that never ran it. */
.var-toasts-below {
  top: var(--var-header-height);
  left: 0;
  right: 0;
  transform: none;
  width: auto;
  max-width: none;
  align-items: stretch;
  padding: 0.4rem 0.5rem 0;
  z-index: 1029; /* under the header it hangs from */
}

@media (max-width: 991.98px) {
  .var-toasts {
    top: var(--var-header-height);
    left: 0;
    right: 0;
    transform: none;
    width: auto;
    max-width: none;
    align-items: stretch;
    padding: 0.4rem 0.5rem 0;
    z-index: 1029;
  }
}

/* --- Print: summary and roll-up views save cleanly as PDF (spec §9) ------- */
@media print {
  .var-header,
  .var-update-banner,
  .wb-sidebar,
  .no-print {
    display: none !important;
  }

  body,
  .wb-work,
  .wb-work .container-var {
    background: #fff !important;
    color: #000 !important;
  }

  .table,
  .table-dark {
    --bs-table-bg: #fff;
    --bs-table-color: #000;
    --bs-table-striped-bg: #f4f4f4;
    --bs-table-striped-color: #000;
    border-color: #999;
  }

  a {
    text-decoration: none;
    color: #000;
  }
}

/* --- Buttons (signature black -> orange hover) ---------------------------- */
.btn-var {
  background-color: var(--var-black);
  color: var(--var-white);
  border: 1px solid var(--var-line-strong);
  border-radius: 0;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.75px;
  padding: 0.65rem 1.6rem;
  transition: background-color 0.18s ease-in-out, color 0.18s ease-in-out,
    border-color 0.18s ease-in-out;
}

.btn-var:hover,
.btn-var:focus {
  background-color: var(--var-orange);
  border-color: var(--var-orange);
  color: var(--var-white);
}

/* The toolbar in the top-right of a section page: one or two buttons that must
   match each other exactly. `.btn-var` carries its own padding, which overrides
   `.btn-sm`, so the size is set on the group rather than per button — otherwise
   a ghost next to a solid one is a few pixels short and it shows. */
.var-tools {
  display: flex;
  gap: 0.5rem;
}

.var-tools .btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border-radius: 0;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.75px;
  font-size: 0.72rem;
  line-height: 1;
  padding: 0.62rem 1.15rem;
  border-width: 1px;
}

.var-tools .btn i {
  font-size: 0.9rem;
  line-height: 1;
}

/* The quieter half of the pair: a way back, or a sideways step. Reads as a
   button without competing with the one action the page is really for. */
.btn-ghost {
  background-color: transparent;
  color: #c8c8c8;
  border: 1px solid var(--var-line-strong);
  transition: border-color 0.18s ease-in-out, color 0.18s ease-in-out,
    background-color 0.18s ease-in-out;
}

.btn-ghost:hover,
.btn-ghost:focus {
  background-color: #241a17;
  border-color: var(--var-orange);
  color: var(--var-white);
}

.btn-ghost i {
  color: var(--var-orange);
}

/* --- Section bands -------------------------------------------------------- */
.band {
  padding: 3.5rem 0;
}
.band-dark { background-color: var(--var-dark); color: var(--var-white); }

/* --- Hero ----------------------------------------------------------------- */
/* The dark band the legacy tools open their pages with (each sets its own
   padding). The homepage no longer has one: it is drawn as the other choosers
   are — see core/home.html. */
.var-hero {
  background-color: var(--var-dark);
  text-align: center;
  padding: 3rem 0 2.5rem;
}

/* --- Icons ----------------------------------------------------------------- */
/* The sprite element itself must never take layout space. */
.var-icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* size-6 inside a size-12 chip, as the reference sets it. */
/* inline-block, not block: several of these sit mid-sentence — the verified
   mark after a name, the icon inside a button — and a block-level SVG there
   breaks the line. Flex and grid parents ignore the difference. */
.var-icon {
  width: 1.5rem;
  height: 1.5rem;
  display: inline-block;
  vertical-align: middle;
  flex: 0 0 auto;
}

.var-icon-sm {
  width: 1rem;
  height: 1rem;
}

.var-icon-xs {
  width: 0.875rem;
  height: 0.875rem;
}

/* --- Tiles -------------------------------------------------------------------
   The portal's one card. The launcher on the homepage, the Workbook's chooser
   and the Event Planner's sheets are all drawn from it, so a change to the
   card is made here once and every page that chooses something follows.

   A tile is a fixed width, never a share of the row: what it holds is a name
   and a few short facts, and stretching it to divide a wide screen only padded
   those with empty space. The row wraps and runs from the left like a page of
   work.

   Parts, all optional but the title:
     .var-tile-head   the title, with the series' mark or an icon in the far
                      corner, on the title's baseline;
     .var-tile-meta   one fact a line, small and grey, each led by an orange
                      icon, cut short rather than wrapped so a row stands level;
   and two variants: `--accent` draws the series' colour (--cat-color) as a
   strip down the left edge, and `--new` is the dashed tile that starts one.

   Hover lifts it and lights the border and the title — in the series' colour
   where there is one, VAR orange where there is not. */
.var-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

/* A page that is a set of tiles and nothing else: the same inset from the
   header and the window's edge as the Workbook's working area, so a chooser
   starts in the same place whichever section it is in. */
.var-page { padding: 1.5rem 2rem; }

/* The label over a group of tiles — a year of sheets, a section of the
   launcher. Small, grey and spaced out: a heading that sorts, not one that
   announces, so the tiles under it stay the loudest thing on the page. */
.var-group-label {
  margin: 0 0 0.6rem;
  font-size: 0.62rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--var-grey-muted);
}

/* --- Series tabs and folding years ------------------------------------------
   How a list of a series' things is laid out — the Event Planner's sheets and
   the Workbook's workbooks alike: the series as a row of their marks along the
   top, and under the chosen one its things grouped by year.

   The tabs are drawn only when there is more than one series to choose. The
   chosen one is underlined in its own colour (--cat-color); the rest are
   dimmed until pointed at, so the row reads as a choice already made. Marks
   by height only, no width cap: they are not one shape — FREC's is nearly
   twice as wide as the rest (5.7:1 against 3:1) — and a cap shrank it.

   A year is a <details>: a small label over its tiles (.var-group-label's
   type), with a chevron and how many it holds, so a folded year still says it
   is not empty. Past seasons start folded.

   var-series-tab, not var-tab: the user console's tab bar owns that name
   (accounts.css), and its grey pill showed behind the series' marks. */
.var-series-tabs {
  display: flex;
  align-items: stretch;
  gap: 0.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid #2a2a2a;
}
.var-series-tab {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 0.9rem 0.65rem;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  opacity: 0.45;
  text-decoration: none;
  transition: opacity 0.12s, border-color 0.12s;
}
.var-series-tab:hover { opacity: 0.8; }
.var-series-tab.is-active {
  opacity: 1;
  border-bottom-color: var(--cat-color, var(--var-orange));
}
.var-series-tab-mark { display: block; height: 1rem; width: auto; }
.var-series-tab-name { color: #fff; font-weight: 700; font-size: 0.9rem; }

.var-fold + .var-fold { margin-top: 1.5rem; }
/* A folded year is only its label, so the next one sits close under it. */
details.var-fold:not([open]) + .var-fold { margin-top: 0.6rem; }
.var-fold-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.var-fold-label::-webkit-details-marker { display: none; }
.var-fold-label:hover { color: #fff; }
details.var-fold:not([open]) > .var-fold-label { margin-bottom: 0; }
.var-fold-chevron { font-size: 0.6rem; transition: transform 0.12s; }
details[open] > .var-fold-label .var-fold-chevron { transform: rotate(90deg); }
.var-fold-count {
  padding: 0 0.35rem;
  border: 1px solid #333;
  border-radius: 3px;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

/* The homepage's groups, a little apart. */
.home-group + .home-group { margin-top: 1.5rem; }

/* --- The greeting panel ------------------------------------------------------
   On arrival the greeting rises, the next round slides in and the season's
   progress runs out to today; after that only the faint streaks drift and a
   glint crosses now and then. --hero-go is the moment it all sets off from.
   --cat-color is the next round's series, which tints the glow behind the
   countdown. */
.home-hero {
  --cat-color: var(--var-orange);
  --hero-go: 0.1s;
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.75rem 2.5rem;
  margin-bottom: 1.5rem;
  padding: 0.8rem 1.25rem 1.6rem;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  /* Two washes, kept apart: the orange pattern on the left, fading out
     before the series' glow on the right takes over — laid over each other,
     a green and the orange mixed to mud. */
  background:
    radial-gradient(ellipse 45% 120% at 88% 50%, color-mix(in srgb, var(--cat-color) 16%, transparent), transparent 70%),
    radial-gradient(ellipse 30% 90% at 0% 0%, rgba(245, 87, 2, 0.07), transparent 70%),
    linear-gradient(180deg, #252525, #1c1c1c);
}

/* The wordmark's letters as strips — V A V A, the V's point on the A's foot
   line, every bar at sixty degrees — turned sixty degrees, as the brand's
   pattern is: one bar of each letter lies flat and the strips run down to
   the right. Faint outline, drifting along the strips; strongest at the
   left edge and gone by the middle, where the series' glow begins.

   The tile is drawn upright on an oversized layer that is then rotated, so
   the panel (which clips it) is always covered. One tile is one V and one
   A, and the drift is one tile's width, so the loop has no seam. */
.home-hero-streaks {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, #000 10%, transparent 55%);
          mask-image: linear-gradient(90deg, #000 10%, transparent 55%);
}
.home-hero-streaks::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2400px;
  height: 2400px;
  margin: -1200px 0 0 -1200px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='66' height='52' viewBox='0 0 66 52'%3E%3Cg fill='none' stroke='%23f55702' stroke-opacity='0.16' stroke-width='1.3' stroke-linejoin='round' transform='translate(0 6)'%3E%3Cpath d='M0 0h12l11.1 19.2L34.2 0h12L23.1 40Z'/%3E%3Cpath d='M33 40h12l11.1-19.2L67.2 40h12L56.1 0Z'/%3E%3Cpath d='M-33 40h12l11.1-19.2L1.2 40h12L-9.9 0Z'/%3E%3C/g%3E%3C/svg%3E") 0 0 / 66px 52px;
  transform: rotate(60deg);
  animation: home-streaks 5s linear infinite;
}
@keyframes home-streaks { to { background-position: -66px 0; } }

/* A glint crossing the panel — first on arrival, then every so often. */
.home-hero-sweep {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -40%;
  width: 30%;
  z-index: -1;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.045), transparent);
  transform: skewX(-20deg);
  animation: home-sweep 11s cubic-bezier(0.5, 0, 0.3, 1) var(--hero-go) infinite;
}
@keyframes home-sweep {
  0% { left: -40%; }
  14%, 100% { left: 140%; }
}

.home-hello { min-width: 0; }

.home-greeting {
  margin: 0;
  color: #fff;
  font-size: clamp(1.25rem, 1.9vw, 1.6rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-transform: none;  /* the portal's headings are capitals; a greeting is a sentence */
}
.home-greeting > span {
  display: inline-block;
  animation: home-rise 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) var(--hero-go) both;
}
/* The name catches the light once as it arrives, and keeps its colour: the
   band sweeps through and leaves it orange. At rest the gradient sits on its
   orange end, so with no animation the name is simply orange. */
.home-greeting > .home-greeting-name {
  background: linear-gradient(100deg, var(--var-orange) 0 40%, #ffd2b3 50%, #fff 60% 100%) 0 0 / 260% 100% no-repeat;
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  animation:
    home-rise 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) calc(var(--hero-go) + 0.1s) both,
    home-shine 1.4s ease-in-out calc(var(--hero-go) + 0.5s) both;
}
@keyframes home-rise {
  from { opacity: 0; transform: translateY(0.6em); filter: blur(4px); }
  to { opacity: 1; transform: none; filter: none; }
}
/* The greeting turning with the day while the page is open (home.html): the
   old words drop away, then the new rise in as on arrival. */
.home-greeting > .home-greeting-word.is-leaving,
.home-date.is-leaving {
  animation: home-leave 0.4s cubic-bezier(0.4, 0, 1, 1) both;
}
@keyframes home-leave {
  to { opacity: 0; transform: translateY(-0.5em); filter: blur(4px); }
}
@media (prefers-reduced-motion: reduce) {
  .home-greeting > .home-greeting-word.is-leaving,
  .home-date.is-leaving { animation-duration: 0.01s; }
}
@keyframes home-shine {
  from { background-position: 100% 0; }
  to { background-position: 0 0; }
}

.home-date {
  margin-top: 0.3rem;
  color: var(--var-grey-muted);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  animation: home-fade 0.6s ease-out calc(var(--hero-go) + 0.3s) both;
}
.home-date-sep { color: var(--var-orange); margin: 0 0.25rem; }
@keyframes home-fade { from { opacity: 0; } }

/* The next round, as a timing screen would put it: what and where, then the
   countdown beside it rather than under it, so the panel stays one band. */
.home-next {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 1.1rem;
  text-align: right;
  animation: home-slide 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) calc(var(--hero-go) + 0.15s) both;
}
@keyframes home-slide {
  from { opacity: 0; transform: translateX(1.5rem); }
}
.home-next-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--cat-color);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.home-live-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--var-green);
  animation: home-pulse 1.6s ease-out infinite;
}
@keyframes home-pulse {
  0% { box-shadow: 0 0 0 0 rgba(36, 186, 75, 0.7); }
  100% { box-shadow: 0 0 0 0.5rem rgba(36, 186, 75, 0); }
}
.home-next-dates { color: var(--var-grey-muted); font-weight: 500; }

/* Each circuit with the marks of the series racing there, side by side,
   arriving one after another behind the panel's own slide. */
.home-next-venues {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.1rem 1.1rem;
  margin: 0.3rem 0 0;
  padding: 0;
  list-style: none;
}
.home-next-venue {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
  animation: home-slide 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) calc(var(--hero-go) + 0.25s + var(--i) * 0.08s) both;
}
.home-next-marks {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.home-next-marks img { display: block; height: 0.7rem; width: auto; }
.home-next-series { font-size: 0.7rem; }

.home-countdown {
  display: flex;
  gap: 0.3rem;
}
.home-cd-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 2.6rem;
  padding: 0.3rem 0.35rem 0.25rem;
  overflow: hidden;
  background:
    var(--cat-stripe, linear-gradient(var(--cat-color), var(--cat-color))) left bottom / 100% 2px no-repeat,
    rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-bottom: 0;
  padding-bottom: calc(0.25rem + 3px);
  border-radius: 4px;
}
.home-cd-cell b {
  display: block;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.home-cd-of { color: var(--var-grey-muted); font-size: 0.8em; }
.home-cd-cell b.is-tick { animation: home-tick 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes home-tick {
  from { opacity: 0.2; transform: translateY(-45%); }
}
.home-cd-cell small {
  margin-top: 0.2rem;
  color: var(--var-grey-muted);
  font-size: 0.55rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* The year so far, along the panel's foot, with the car at today. It spans
   exactly what the timeline's tracks span under it — the .season panel's
   1rem padding and its --season-name column taken off the left, the padding
   off the right — so the car stands over the timeline's today line. */
.home-progress {
  position: absolute;
  left: calc(1rem + 4.5rem);
  right: 1rem;
  bottom: 0.7rem;  /* off the edge, so the car riding it is never cut off */
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.05);
}
.home-progress-bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--progress) * 1%);
  background: linear-gradient(90deg, rgba(245, 87, 2, 0.15), var(--var-orange));
  /* Out to today in --run (set from how far it has to go — see season.py):
     pulling away, up to speed, then a long stop into its place — and no
     further: the curve never passes 1, so the car does not overshoot. */
  animation: home-run var(--run, 5s) cubic-bezier(0.55, 0, 0.2, 1) calc(var(--hero-go) + 0.2s) both;
}
/* Seen from above, riding the line: centred on it, and on today. --car is
   its width, which the streaks and the smoke are placed by. */
.home-progress { --car: 2.9rem; }
.home-car {
  position: absolute;
  right: 0;
  top: 50%;
  width: var(--car);
  height: auto;
  transform: translate(50%, -50%);
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.6));
  animation: home-car-blip 9s ease-in-out calc(var(--hero-go) + 0.2s) infinite;
}

/* Every nine seconds a blip of the throttle: a nudge forward, a rock
   back, settled. The cycle starts with the arrival, so the first blip
   comes a couple of seconds after the car has stopped. `translate`, not
   `transform`, so it adds to the centring rather than replacing it. */
@keyframes home-car-blip {
  0%, 84%, 100% { translate: 0 0; }
  87% { translate: 4px 0; }
  92% { translate: -1px 0; }
  96% { translate: 0.5px 0; }
}

/* Tyre streaks behind the car, on the wheels' lines: they stream while it
   runs out to today, and flash with each blip. Faded toward their tail. */
.home-car-trail {
  position: absolute;
  top: 50%;
  right: calc(var(--car) * 0.47);
  width: calc(var(--car) * 0.7);
  height: calc(var(--car) * 0.36);
  transform: translateY(-50%);
  opacity: 0;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.45) 0 7px, transparent 7px 12px) 0 18% / 100% 1px no-repeat,
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.45) 0 7px, transparent 7px 12px) 0 82% / 100% 1px no-repeat;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000);
          mask-image: linear-gradient(90deg, transparent, #000);
  animation:
    home-trail-stream 0.25s linear infinite,
    home-trail-blip 9s ease-out calc(var(--hero-go) + 0.2s) infinite,
    home-trail-run var(--run, 5s) linear calc(var(--hero-go) + 0.2s);
}
/* The lock-up smoke: an origin at the car's centre (the bar's end), and a
   puff at each tyre — --x and --y are fractions of the car's width — that
   swells, drifts back and out, and thins away. It fires as the car comes to
   rest, once; the blips have none. */
.home-car-smoke {
  position: absolute;
  top: 50%;
  right: 0;
  width: 0;
  height: 0;
}
.home-car-smoke i {
  position: absolute;
  --puff: calc(var(--car) * 0.31);
  left: calc(var(--x) * var(--car) - var(--puff) / 2);
  top: calc(var(--y) * var(--car) - var(--puff) / 2);
  width: var(--puff);
  height: var(--puff);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(235, 235, 235, 0.9), rgba(220, 220, 220, 0.45) 40%, transparent 70%);
  filter: blur(1.5px);
  opacity: 0;
  animation: home-smoke 1.7s cubic-bezier(0.15, 0.6, 0.3, 1) calc(var(--hero-go) + var(--run, 5s) * 0.8 + var(--late, 0s)) both;
}
@keyframes home-smoke {
  0% { opacity: 0; transform: translate(0, 0) scale(calc(0.4 * var(--s))); }
  12% { opacity: 1; }
  45% { opacity: 0.7; }
  /* Spreading back more than out: wide and low, so it stays inside the
     panel under the line. */
  100% { opacity: 0; transform: translate(-26px, var(--dy)) scale(calc(3.4 * var(--s)), calc(1.7 * var(--s))); }
}

@keyframes home-trail-stream { to { background-position: -12px 18%, -12px 82%; } }
/* Streaming while the car is up to speed on its run: in as it pulls away,
   out as it brakes. Listed after the blips' flash, so it is the one shown
   while it runs. */
@keyframes home-trail-run {
  0% { opacity: 0; }
  15%, 70% { opacity: 1; }
  100% { opacity: 0; }
}
/* A flash with each blip of the throttle, late in the nine-second cycle. */
@keyframes home-trail-blip {
  0%, 84% { opacity: 0; }
  86%, 89% { opacity: 0.8; }
  94%, 100% { opacity: 0; }
}
@keyframes home-run { from { width: 0; } }

@media (max-width: 767.98px) {
  .home-hero { grid-template-columns: 1fr; }
  .home-next { justify-self: start; flex-wrap: wrap; text-align: left; }
  .home-next-venues { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .home-hero *,
  .home-hero *::after { animation: none !important; }
  .home-hero-sweep { display: none; }
}

/* --- The sections ---------------------------------------------------------------
   A column per homepage section: its round button — mark over name — with
   its tools listed under it in quiet type. Button and list are one button
   that opens the section's wheel; the names are not links. On arrival the
   sections fade up one after another; under the pointer the button glows
   and the list brightens. While its wheel is open the section's button is
   up there (the hub is it, flown), and its list steps back. */
/* The sections are held to one group in the middle rather than spread to
   the page's edges, where four of them read as four things, not one choice;
   their label is centred over that group, on a fine rule as wide as it that
   fades out at both ends. */
.home-apps-label {
  position: relative;
  max-width: 68rem;
  margin: clamp(2rem, 7vh, 5rem) auto 0;
  padding-bottom: 0.7rem;
  text-align: center;
}
.home-apps-label::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.14) 25%, rgba(255, 255, 255, 0.14) 75%, transparent);
}
.home-decks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 2rem 1rem;
  align-items: start;
  max-width: 68rem;
  margin: 2.25rem auto 0;
}
.home-deck { display: flex; justify-content: center; }
/* Only what is drawn answers the pointer — the button and each name's own
   text — not the column round them, which is as wide as the longest name:
   a pointer beside a short name is not on the section. */
.home-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
  cursor: pointer;
  outline: none;
  pointer-events: none;
  animation: home-fade 0.6s ease-out calc(0.15s + var(--i) * 0.1s) both;
}
.home-orb,
.home-tools li { pointer-events: auto; }
.home-tools li { width: fit-content; margin: 0 auto; }

.home-orb {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: 9.5rem;
  height: 9.5rem;
  padding: 0 1rem;
  /* Flat: a surface a shade off the page, drawn by a hairline of light —
     no gradient, no drop shadow. Depth is left to colour: the orange glow
     under the pointer is light, not a lift. */
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  background: #252525;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.25s;
}
.home-orb .var-icon { width: 2.2rem; height: 2.2rem; color: var(--var-orange); transition: color 0.2s; }
.home-orb-name {
  margin: 0;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.1em;
  text-align: center;
  text-transform: uppercase;
}

.home-tools {
  margin: 0;
  padding: 0;
  list-style: none;
  color: #8c8c8c;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.75;
  text-align: center;
  transition: color 0.2s, opacity 0.15s;
}

.home-section:hover .home-orb,
.home-section:focus-visible .home-orb {
  border-color: rgba(245, 87, 2, 0.6);
  background: #2a2420;  /* the surface with a breath of orange in it */
  box-shadow: 0 0 2rem -0.5rem rgba(245, 87, 2, 0.4);
}
.home-section:hover .home-orb .var-icon,
.home-section:focus-visible .home-orb .var-icon { color: #fff; }
.home-section:hover .home-tools,
.home-section:focus-visible .home-tools { color: #d6d6d6; }

/* Lifted: the button is the hub now, so it is not also left here; the list
   steps back at once, and comes back (more slowly) once the hub is home. */
.home-section.is-lifted .home-orb { visibility: hidden; }
.home-section.is-lifted .home-tools { opacity: 0; }
.home-section:not(.is-lifted) .home-tools { transition: color 0.2s, opacity 0.35s 0.05s; }

/* --- The app wheel -------------------------------------------------------------
   Over the whole page, the page dimmed and blurred behind (a layer of its
   own, so that only the dimming fades and the hub stays solid in flight).
   The dial is a square centred on the screen: the hub — the section's
   button, flown in from the page — in its middle, the tools on a circle
   round it, all placed in percentages of the dial so it scales as one. The
   tools burst out from behind the hub as it lands, and fall back into it
   on closing. */
.wheel-lock, .wheel-lock body { overflow: hidden; }
.wheel {
  position: fixed;
  inset: 0;
  z-index: 1080;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  padding: 1rem;
  isolation: isolate;
  user-select: none;
}
.wheel[hidden] { display: none; }
.wheel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(circle at 50% 50%, rgba(24, 24, 24, 0.6), rgba(8, 8, 8, 0.9) 70%);
  -webkit-backdrop-filter: blur(6px);
          backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.35s ease-out;
}
.wheel.is-open::before { opacity: 1; }

.wheel-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: opacity 0.3s, transform 0.35s;
}
.wheel:not(.is-open) .wheel-tabs { opacity: 0; transform: translateY(6px); }
.wheel-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(20, 20, 20, 0.7);
  color: var(--var-grey-muted);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.wheel-tab .var-icon { width: 0.95rem; height: 0.95rem; }
.wheel-tab:hover { color: #fff; }
.wheel-tab.is-active { color: #fff; border-color: var(--var-orange); background: rgba(245, 87, 2, 0.18); }
/* Either side of the tabs: the previous section, the next. */
.wheel-arrow {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  background: rgba(20, 20, 20, 0.7);
  color: var(--var-grey-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.wheel-arrow svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.wheel-arrow:hover { color: #fff; border-color: var(--var-orange); background: rgba(245, 87, 2, 0.18); }
.wheel-arrow:focus-visible { border-radius: 50%; }

.wheel-dial {
  position: relative;
  width: min(34rem, 92vw, 66vh);
  aspect-ratio: 1;
}

/* Faint spokes from the hub to each tool; the lit one solid orange. */
.wheel-spokes { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.wheel-spokes line {
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 0.35;
  stroke-dasharray: 1 1.2;
  transition: stroke 0.15s;
}
.wheel-spokes line.is-active { stroke: var(--var-orange); stroke-dasharray: none; stroke-width: 0.45; }
.wheel-dial.is-dealt .wheel-spokes line { animation: home-fade 0.4s ease-out calc(0.4s + var(--k) * 0.05s) both; }
.wheel.is-closing .wheel-spokes { opacity: 0; transition: opacity 0.15s; }

/* The hub: the section's button, flown in and grown. In front of the tools,
   so that they come out from behind it. */
.wheel-hub {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 34%;
  aspect-ratio: 1;
  padding: 0 1.2rem;
  border: 1px solid rgba(245, 87, 2, 0.6);
  border-radius: 50%;
  background: #2a2420;
  box-shadow: 0 0 3.5rem -0.75rem rgba(245, 87, 2, 0.4);
  transform: translate(-50%, -50%);
  transition: transform 0.5s cubic-bezier(0.3, 0.8, 0.2, 1);
  cursor: pointer;
}
.wheel-hub .var-icon { width: 2.6rem; height: 2.6rem; color: var(--var-orange); }
.wheel-hub-name {
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.1em;
  text-align: center;
  text-transform: uppercase;
}

/* A tool: a smaller round button on the orbit, its icon over its name —
   flat, like the hub and the sections' buttons. Lit, it is solid orange. */
.wheel-item {
  position: absolute;
  left: var(--x);
  top: var(--y);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 22%;
  aspect-ratio: 1;
  padding: 0 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  background: #252525;
  color: #cfcfcf;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
  transform: translate(-50%, -50%);
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.wheel-item span { text-wrap: balance; }
.wheel-item .var-icon { width: 1.7rem; height: 1.7rem; color: var(--var-orange); transition: color 0.15s; }
.wheel-item.is-active {
  border-color: var(--var-orange);
  background: var(--var-orange);
  box-shadow: 0 0 2.25rem -0.4rem rgba(245, 87, 2, 0.6);
  color: #fff;
}
.wheel-item.is-active .var-icon { color: #fff; }
/* An empty place on the wheel: room for a tool still to be built. A dashed
   outline and nothing else — no name, no light, nothing to click. */
.wheel-item.is-empty {
  border: 1px dashed rgba(255, 255, 255, 0.14);
  background: transparent;
  cursor: default;
  pointer-events: none;
}
/* Stepped onto with the arrow keys, it stays empty: nothing there to light. */
.wheel-item.is-empty.is-active {
  border-color: rgba(255, 255, 255, 0.14);
  background: transparent;
  box-shadow: none;
}
/* Focus follows the light, which already shows; and the portal-wide focus
   ring would square the corners off. */
.wheel-item:focus,
.wheel-item:focus-visible { outline: none; border-radius: 50%; }

/* Out from behind the hub as it lands, one after another... */
.wheel-dial.is-dealt .wheel-item {
  animation: wheel-burst 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.1) calc(0.3s + var(--k) * 0.06s) both;
}
@keyframes wheel-burst {
  from { left: 50%; top: 50%; opacity: 0; transform: translate(-50%, -50%) scale(0.4); }
}
/* ...and back in behind it, all together; only once they are gone does the
   hub fly home. */
.wheel.is-closing .wheel-item { animation: wheel-gather 0.25s cubic-bezier(0.5, 0, 0.75, 0) both; }
@keyframes wheel-gather {
  to { left: 50%; top: 50%; opacity: 0; transform: translate(-50%, -50%) scale(0.4); }
}
.wheel.is-closing .wheel-hub { transition-delay: 0.27s; }
/* The dimming lifts with the hub's flight, not before it. */
.wheel.is-closing::before { transition-delay: 0.27s; }

/* Changing section: the tools in now fall back behind the hub as its name
   and icon fade, and the next section's deal out at once — no wait for a
   flight, as there is on opening. */
.wheel-hub > * { transition: opacity 0.18s, transform 0.3s cubic-bezier(0.3, 0.8, 0.2, 1); }
.wheel-dial.is-swapping .wheel-hub > * { opacity: 0; transform: scale(0.85); }
.wheel-dial.is-swapping .wheel-spokes { opacity: 0; transition: opacity 0.15s; }
.wheel-dial.is-dealt.is-swap .wheel-item { animation-delay: calc(var(--k) * 0.05s); }
.wheel-dial.is-dealt.is-swap .wheel-spokes line { animation-delay: calc(0.12s + var(--k) * 0.04s); }
.wheel-dial .wheel-set.is-leaving .wheel-item {
  animation: wheel-gather 0.2s cubic-bezier(0.5, 0, 0.75, 0) both;
  pointer-events: none;
}

@media (max-width: 575.98px) {
  .wheel-item { font-size: 0.6rem; }
  .wheel-item span { display: none; }
  .wheel-item .var-icon { width: 1.4rem; height: 1.4rem; }
  .wheel-hub-name { font-size: 0.65rem; }
}

@media (prefers-reduced-motion: reduce) {
  .home-section, .home-section *, .wheel, .wheel *, .wheel::before { animation: none !important; transition: none !important; }
}

/* --- The season at a glance (core/season.py) ---------------------------------
   A row per series: its mark in a fixed column, then a track across the year
   on which each round stands at its dates, in the series' colour. Positions
   arrive as percentages of the track; today is a line drawn through every
   track at --today, over the tracks' column only (hence the calc against the
   name column's width). */
.season {
  --season-name: 4.5rem;
  position: relative;
  padding: 0.85rem 1rem 0.5rem;
  background: var(--var-dark);
  border: 1px solid #2a2a2a;
  border-radius: 6px;
}

.season-row {
  display: grid;
  grid-template-columns: var(--season-name) 1fr;
  align-items: center;
  height: 1.6rem;
}

.season-name {
  display: flex;
  align-items: center;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}
/* Height only — the marks are not one shape (FREC's is nearly twice as wide). */
.season-name img { display: block; height: 0.7rem; width: auto; }

/* The year, as a faint rule each round stands on. */
.season-track {
  position: relative;
  height: 100%;
  background: linear-gradient(#2a2a2a, #2a2a2a) left center / 100% 1px no-repeat;
}

/* A round: one dot, centred on the middle of its days — the same size
   however many days it runs, so the lines read as rounds, not lengths. Run
   already, it is dimmed; under the pointer it grows. */
.season-event {
  position: absolute;
  top: 50%;
  width: 0.65rem;
  height: 0.65rem;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--cat-color);
  transition: transform 0.12s, opacity 0.12s;
}
.season-event.is-past { opacity: 0.35; }
/* On the calendar, no workbook for it yet: the outline of the round only. */
.season-event.is-unprepared {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--cat-color);
}
a.season-event:hover,
a.season-event:focus-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.35);
  z-index: 1;
}
/* A test: a diamond, a touch smaller than a race's dot so the two weigh the
   same on the line. One that shares a day with a race on its own line sits
   just above it, clear of the race's dot. */
.season-event.is-test {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 1px;
  transform: translate(-50%, -50%) rotate(45deg);
}
.season-event.is-test.is-lifted { top: calc(50% - 0.55rem); }
a.season-event.is-test:hover,
a.season-event.is-test:focus-visible { transform: translate(-50%, -50%) rotate(45deg) scale(1.35); }

/* The months, under the last line: a label at the start of each. */
.season-axis { height: 1.3rem; }
.season-axis .season-track { background: none; }
.season-month {
  position: absolute;
  top: 0.15rem;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--var-grey-muted);
  padding-left: 0.2rem;
  border-left: 1px solid #333;
  line-height: 1;
}

/* Today: a thin orange line from the first line to the axis, over the tracks'
   column — the name column and the panel's padding taken off its left. */
.season-today {
  position: absolute;
  top: 0.5rem;
  bottom: 1.6rem;
  left: calc(1rem + var(--season-name) + (100% - 2rem - var(--season-name)) * var(--today) / 100);
  width: 1px;
  background: var(--var-orange);
  pointer-events: none;
}
.season-today span {
  position: absolute;
  top: -0.45rem;
  left: 0.3rem;
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--var-orange);
  line-height: 1;
}

/* One size everywhere: 240px across, and the height of a workbook's tile —
   a title and three lines of facts — as the floor. A tile with less to say
   keeps the size and lays out inside it (see --new), so a row of tiles is
   level on every page.

   240 is the width a workbook's whole code needs beside its mark: the longest
   the team writes, 26F4EUROR03MZA, is about 155px of title, and FREC's mark —
   the widest, at 5.7:1 — about 60px. At 190 the codes were cut to
   "26F4EUROR…"; a code is the one thing on a tile that must be read whole. */
.var-tile {
  position: relative;
  flex: 0 0 240px;
  width: 240px;
  min-height: 6.25rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 0.85rem 1rem;
  background: var(--var-dark);
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.12s;
}

.var-tile:hover,
.var-tile:focus-within {
  border-color: var(--cat-color, var(--var-orange));
  transform: translateY(-2px);
}

/* Inside the border, not as it, so tiles with and without a colour line up. */
.var-tile--accent { box-shadow: inset 3px 0 0 var(--cat-color); }

/* A workbook of one of the team's cars wears that car's colour (--car-color)
   too: the series down the left edge, the car down the right. Under the
   pointer the border lights as the two meeting — the series' colour flowing in
   from the left, the car's from the right, blending across the top and the
   bottom. Drawn as two backgrounds, the tile's own over a gradient that only
   the transparent border lets through, because border-image would square off
   the rounded corners. */
.var-tile--car { box-shadow: inset -3px 0 0 var(--car-color); }
.var-tile--accent.var-tile--car {
  box-shadow: inset 3px 0 0 var(--cat-color), inset -3px 0 0 var(--car-color);
}
.var-tile--car:hover,
.var-tile--car:focus-within {
  border-color: transparent;
  background:
    linear-gradient(var(--var-dark), var(--var-dark)) padding-box,
    linear-gradient(90deg, var(--cat-color, var(--var-orange)), var(--car-color)) border-box;
}

/* The homepage's banner (.home-hero-streaks), carried onto every tile: the
   wordmark's letters as strips, turned sixty degrees, in the tile's series
   colour (or the portal's orange) — faint, on the tile's right only, gone
   before its text, and drifting along the strips while the pointer is on
   it. The pattern is a mask over the colour, so it takes whatever colour the
   tile is given. The fade over it is the tile's own dark, kept clear of the
   series' stripe down the left edge. Both lie behind the tile's contents and
   over its background (the tile isolates them). The dashed New tile is a
   place for a thing, not a thing, and stays plain. */
.var-tile:not(.var-tile--new) { overflow: hidden; isolation: isolate; }
.var-tile:not(.var-tile--new)::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 50%;
  left: 50%;
  width: 640px;
  height: 640px;
  margin: -320px 0 0 -320px;
  background: var(--cat-color, var(--var-orange));
  opacity: 0.2;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='66' height='52' viewBox='0 0 66 52'%3E%3Cg fill='none' stroke='%23fff' stroke-width='1.3' stroke-linejoin='round' transform='translate(0 6)'%3E%3Cpath d='M0 0h12l11.1 19.2L34.2 0h12L23.1 40Z'/%3E%3Cpath d='M33 40h12l11.1-19.2L67.2 40h12L56.1 0Z'/%3E%3Cpath d='M-33 40h12l11.1-19.2L1.2 40h12L-9.9 0Z'/%3E%3C/g%3E%3C/svg%3E") 0 0 / 66px 52px;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='66' height='52' viewBox='0 0 66 52'%3E%3Cg fill='none' stroke='%23fff' stroke-width='1.3' stroke-linejoin='round' transform='translate(0 6)'%3E%3Cpath d='M0 0h12l11.1 19.2L34.2 0h12L23.1 40Z'/%3E%3Cpath d='M33 40h12l11.1-19.2L67.2 40h12L56.1 0Z'/%3E%3Cpath d='M-33 40h12l11.1-19.2L1.2 40h12L-9.9 0Z'/%3E%3C/g%3E%3C/svg%3E") 0 0 / 66px 52px;
  transform: rotate(60deg);
  animation: var-tile-streaks 5s linear infinite paused;
  pointer-events: none;
}
.var-tile:not(.var-tile--new)::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(90deg, transparent 0 3px, var(--var-dark) 3px 40%, transparent 85%);
}
.var-tile:not(.var-tile--new):hover::before,
.var-tile:not(.var-tile--new):focus-within::before { animation-play-state: running; }
@keyframes var-tile-streaks {
  to { -webkit-mask-position: -66px 0; mask-position: -66px 0; }
}
@media (prefers-reduced-motion: reduce) {
  .var-tile::before { animation: none; }
}

.var-tile-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  min-width: 0;
}

/* A tight line-height, so the title's line box is the height of its lettering
   and the mark beside it lines up against the letters, not the leading. */
.var-tile-title {
  min-width: 0;
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.2;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.var-tile:hover .var-tile-title { color: var(--cat-color, var(--var-orange)); }

/* The championship's mark, as tall as the title's capitals (Montserrat's
   capHeight is .7em of the title's .95rem) and on its baseline: an image has
   no baseline of its own, so the row's `align-items: baseline` stands its
   foot on the lettering's. Height only — the marks are not one shape, FREC's
   being nearly twice as wide as the rest, and a width cap shrank it. */
.var-tile-mark {
  display: block;
  flex: 0 0 auto;
  height: 0.665rem;
  width: auto;
}

/* A series the team made itself has no mark, and is lettered instead. */
.var-tile-badge {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  padding: 0 0.35rem;
  font-size: 0.56rem;
  line-height: 1;
}

/* An icon in the corner a series' mark takes on a workbook — the sprite's (an
   <svg>) or Bootstrap's (an <i>), drawn the same size. */
.var-tile-icon {
  flex: 0 0 auto;
  align-self: center;
  width: 1.1rem;
  height: 1.1rem;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--var-orange);
}

.var-tile-meta {
  margin-top: 0.45rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  color: var(--var-grey-muted);
  font-size: 0.8rem;
}

.var-tile-meta > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.var-tile-meta i,
.var-tile-meta .var-icon { color: var(--var-orange); }
/* The sprite's icons centre on the line box; beside .8rem type that rides
   high, so they sit on the baseline as the Bootstrap glyphs do. */
.var-tile-meta .var-icon { vertical-align: -0.17em; }

/* The New tile has no facts to list, so it stands its icon and name in the
   middle of the tile rather than leaving a title in its corner over an empty
   card. It is dashed: it is the place a thing will be, not a thing. */
.var-tile--new {
  align-items: center;
  justify-content: center;
  text-align: center;
}

.var-tile--new {
  border-style: dashed;
  border-color: var(--var-line-strong);
}

.var-tile--new:hover { background: #241a17; }

.var-tile-new-icon {
  font-size: 1.9rem;
  line-height: 1;
  color: var(--var-orange);
  margin-bottom: 0.35rem;
}

@media (prefers-reduced-motion: reduce) {
  .var-tile,
  .var-tile:hover,
  .var-tile:focus-within { transform: none; transition: none; }
}

.feature-empty {
  color: var(--var-grey-muted);
  text-align: center;
  width: 100%;
}

/* --- Inner page shell ----------------------------------------------------- */
/* The reference gives every section page the same frame: p-6 max-w-4xl mx-auto,
   with an h1 at text-2xl/600/tracking-tight. Named here so a new page inherits
   it instead of inventing its own margins. */
.page-shell {
  padding: 1.5rem;
  max-width: 56rem;
  margin-inline: auto;
}

.page-title {
  font-size: 1.5rem;
  line-height: 2rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  text-transform: uppercase;
  margin: 0 0 2rem;
}

.page-title-sub {
  color: var(--var-grey-muted);
  font-size: 0.875rem;
  line-height: 1.25rem;
  margin: 0.25rem 0 0;
  text-transform: none;
  letter-spacing: 0;
}

/* A section that is registered but not written yet. Says so plainly and in the
   portal's own materials — a page dressed up as the finished tool would only
   invite somebody to try using it. */
.var-placeholder {
  background-color: var(--var-surface);
  border: 1px solid var(--var-line);
  color: var(--var-grey-muted);
  padding: 3rem 2rem;
  text-align: center;
  max-width: 34rem;
  margin-inline: auto;
}

.var-placeholder-icon {
  width: 2rem;
  height: 2rem;
  color: var(--var-orange);
  margin-bottom: 1rem;
}

.var-placeholder-lead {
  color: var(--var-fg);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  font-size: 0.875rem;
  margin: 0 0 0.75rem;
}

/* The signed-out screens moved to their own split-screen shell and live in
   accounts.css; the single centred card they used to be is gone. */

/* --- Forms --------------------------------------------------------------- */
.var-form-card {
  background-color: var(--var-surface);
  border: 1px solid var(--var-line);
  border-radius: 8px;
  padding: 1.75rem;
}
.var-form-section-title {
  color: var(--var-orange);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}
form .form-label {
  color: var(--var-light);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}
.form-control,
.form-select {
  background-color: var(--var-sunken);
  border: 1px solid var(--var-line-strong);
  color: var(--var-white);
  border-radius: 5px;
  padding: 0.5rem 0.7rem;
}
.form-control:focus,
.form-select:focus {
  background-color: var(--var-sunken);
  border-color: var(--var-orange);
  box-shadow: 0 0 0 0.15rem rgba(230, 67, 37, 0.2);
  color: var(--var-white);
}
.form-control::placeholder {
  color: var(--var-dim);
}
/* In the portal's dialogs a placeholder is an example (Tatuus, T421), and at
   --var-dim it read as already filled in; dimmed as the chassis dialog's. */
.var-dialog .form-control::placeholder {
  color: #4a4a4a;
}
.form-select option {
  background-color: var(--var-sunken);
  color: var(--var-white);
}
.form-text {
  color: var(--var-grey-muted);
  font-size: 0.84rem;
}
.var-form-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--var-line);
}

/* --- Section shell -----------------------------------------------------------
   A thing with sections of its own — an open workbook, a car — drawn as the
   Workbook draws it: a sidebar headed by the thing that is open, its sections
   listed under small grey group labels, and the chosen one in the working
   area beside it. The class names are the Workbook's, whose shell this was.

   The shell fills whatever room is left between the header and the footer.
   `main` is already the flex item that owns that space (see the body rule) —
   make it a column and the shell takes the rest, with no figure to keep in
   step with the header's height. */
main:has(.wb-shell) { display: flex; flex-direction: column; }
.wb-shell { display: flex; align-items: stretch; flex: 1 1 auto; }

.wb-sidebar {
  flex: 0 0 230px;
  background: var(--var-sunken);
  border-right: 1px solid #2a2a2a;
  padding: 0 0 1rem;
  overflow-y: auto;
}

/* The thing that is open, at the head of the sections that belong to it. The
   orange edge is the signal: a badged column means you are inside one. */
.wb-open {
  padding: 0.8rem 1.25rem 0.9rem;
  background: #1f1513;
  border-bottom: 1px solid #2a2a2a;
  border-left: 3px solid var(--var-orange);
}
.wb-open-label {
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--var-orange);
  margin-bottom: 0.15rem;
}
.wb-open-name {
  font-weight: 700;
  color: #fff;
  font-size: 1rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.wb-open-sub {
  font-size: 0.72rem;
  line-height: 1.3;
  margin-top: 0.15rem;
  color: var(--var-grey-muted, var(--var-dim));
}
/* Edit is a bare pencil straight after the name — it changes that name and
   what stands behind it, so it sits on it, quiet until pointed at. There is no
   way back to the list here: the header's trail is that, on every page. */
.wb-open-edit {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0 0.1rem;
  font-size: 0.72rem;
  line-height: 1;
  vertical-align: 0.1em;
  color: var(--var-grey-muted, var(--var-dim));
  text-decoration: none;
}
.wb-open-edit:hover { color: var(--var-orange); }
.wb-sidebar .nav-group {
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--var-grey-muted, var(--var-dim));
  padding: 0.9rem 1.25rem 0.25rem;
}
.wb-sidebar .nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1.25rem;
  color: #cfcfcf;
  text-decoration: none;
  border-left: 3px solid transparent;
  font-size: 0.9rem;
}
.wb-sidebar .nav-item:hover { background: #1f1f1f; color: #fff; }
.wb-sidebar .nav-item.active {
  background: #1f1513;
  color: #fff;
  border-left-color: var(--var-orange);
}
.wb-sidebar .nav-item.active i { color: var(--var-orange); }
.wb-sidebar .nav-item i { width: 1.1rem; text-align: center; opacity: 0.85; }

/* A page that keeps one layout at any window size is wider than a narrowed
   window; it scrolls sideways here, inside the work area, so the header and
   the section nav stay where they are. */
.wb-work {
  flex: 1 1 auto;
  padding: 1.5rem 0;
  background: var(--var-dark);
  min-width: 0;
  overflow-x: auto;
}
.wb-work .container-var { max-width: none; padding-inline: 2rem; }

@media (max-width: 800px) {
  .wb-shell { flex-direction: column; }
  .wb-sidebar { flex-basis: auto; border-right: none; border-bottom: 1px solid #2a2a2a; }
}

/* --- Dialogs -----------------------------------------------------------------
   The portal's small edit dialog, drawn as the Workbook's create/edit dialog
   is: a dark card a little lifted off the page, a small spaced-out eyebrow
   over the title, compact fields under small grey labels, and Cancel and Save
   as one pair in the foot. A modal opts in with `.var-dialog`; the inner class
   names are the Workbook's own (workbook/base.html), so its dialog's markup
   is this markup, and the two cannot be told apart. */
.var-dialog .modal-dialog:not(.modal-lg) { max-width: 440px; }
/* A dialog of two short fields — a car's maker and model — is narrower still:
   wide enough for the pair of fields and for Cancel and Save side by side. */
.var-dialog .modal-dialog.is-small { max-width: 340px; }

/* A list that scrolls inside a dialog (a pick from a pool, the team to bring
   back) scrolls on a thin dark bar, not the browser's light one beside the
   dark rows. Firefox takes the standard properties, the rest the -webkit-
   ones. */
.var-dialog * { scrollbar-width: thin; scrollbar-color: var(--var-grey) transparent; }
.var-dialog *::-webkit-scrollbar { width: 6px; height: 6px; }
.var-dialog *::-webkit-scrollbar-track { background: transparent; }
.var-dialog *::-webkit-scrollbar-thumb { background: var(--var-grey); border-radius: 3px; }
.var-dialog *::-webkit-scrollbar-thumb:hover { background: var(--var-grey-muted); }
.var-dialog .modal-content {
  background: #141414;
  border: 1px solid #303030;
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
}
.var-dialog .wb-edit-header {
  border-bottom: 1px solid var(--var-surface-2);
  padding: 0.85rem 1.15rem;
  align-items: flex-start;
}
.var-dialog .wb-edit-header .modal-title {
  font-family: monospace;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.06em;
}
.var-dialog .wb-edit-eyebrow {
  font-size: 0.58rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--var-grey-muted, var(--var-dim));
}
.var-dialog .wb-edit-body { padding: 1.15rem; }
.var-dialog .wb-edit-label {
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--var-grey-muted, var(--var-dim));
  margin-bottom: 0.15rem;
}
.var-dialog .wb-edit-body .form-control,
.var-dialog .wb-edit-body .form-select {
  background: #1c1c1c;
  color: var(--var-light);
  border: 1px solid #343434;
  border-radius: 4px;
  font-size: 0.83rem;
  padding: 0.3rem 0.55rem;
  height: auto;
}
.var-dialog .wb-edit-body .form-control:focus,
.var-dialog .wb-edit-body .form-select:focus {
  background: #222;
  color: #fff;
  border-color: var(--var-orange);
  box-shadow: 0 0 0 2px rgba(230, 67, 37, 0.18);
}
.var-dialog .wb-edit-footer {
  border-top: 1px solid var(--var-surface-2);
  padding: 0.7rem 1.15rem;
}
/* The portal's confirmation (core/_confirm.html) asked from inside another
   dialog — the track-map editor's Delete — opens over it, and its backdrop
   dims that dialog too. Bootstrap stacks both at one height otherwise. */
#wbConfirm.is-stacked { z-index: 1070; }
.modal-backdrop ~ .modal-backdrop { z-index: 1065; }

/* Cancel and Save are one pair, so they get one footprint. */
.var-dialog .wb-edit-footer .btn {
  min-width: 110px;
  padding: 0.42rem 1rem;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  border-radius: 4px;
}

/* A colour field (core.widgets.ColourInput), the same wherever a colour is
   chosen: the swatch to pick it by eye, its code beside it. The swatch takes
   the height of whatever the code field is in that form — a dialog's compact
   field or a page's full one — so the pair always lines up. */
.var-colour {
  display: flex;
  align-items: stretch;
  gap: 0.4rem;
}
.var-colour > .form-control {
  flex: 1 1 auto;
  min-width: 0;
  text-transform: uppercase;
}
.var-colour > .form-control::placeholder { text-transform: none; }
.var-colour-swatch {
  flex: 0 0 2.4rem;
  width: 2.4rem;
  height: auto;
  padding: 2px;
  background: var(--var-sunken);
  border: 1px solid var(--var-line-strong);
  border-radius: 4px;
  cursor: pointer;
}
.var-colour-swatch:focus-visible { border-color: var(--var-orange); }
.var-colour-swatch::-webkit-color-swatch-wrapper { padding: 0; }
.var-colour-swatch::-webkit-color-swatch { border: 0; border-radius: 2px; }
.var-colour-swatch::-moz-color-swatch { border: 0; border-radius: 2px; }

/* --- Keyboard focus -------------------------------------------------------
   Every interactive thing in the portal is a real link or button, so it can
   all be reached with Tab — but until now nothing showed *where* you were.
   :focus-visible rather than :focus, so the ring appears for keyboard users
   and never after a mouse click.

   SVG links need their own treatment — an outline on an SVG element is drawn
   in user units, which at the size the car is shown would be a hairline — so
   the car page lights the shape instead. See .cp:focus-visible there. */
:where(a, button, [role="button"], input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--var-orange);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Inside a dark panel the ring needs a dark gap around it to stay readable. */
.band-dark :where(a, button, input, select, textarea):focus-visible {
  outline-color: var(--var-orange);
  box-shadow: 0 0 0 4px rgba(230, 67, 37, 0.18);
}

/* Text that does not fit its box scrolls like a banner (core/js/marquee.js).
   At rest the track is plain inline text, so an ellipsis still works; only a
   line that is actually moving drops the ellipsis and becomes a sliding box. */
.var-marquee-track { display: inline; }
.var-marquee { text-overflow: clip !important; }
.var-marquee > .var-marquee-track { display: inline-block; will-change: transform; }


/* --- Two-step sign-in (apps/core/twofactor_views.py) ----------------------- */
.two-step { max-width: 46rem; }
.two-step-steps { padding-left: 1.2rem; display: grid; gap: 1.5rem; }
.two-step-qr { display: inline-block; margin: 0.75rem 0; padding: 0.5rem; background: #fff; }
.two-step-qr svg { display: block; width: 16rem; max-width: 70vw; height: auto; }
.two-step-secret {
  display: inline-block;
  margin-top: 0.25rem;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  word-break: break-all;
}
.two-step-confirm { max-width: 14rem; margin-top: 0.75rem; }
.two-step-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1rem; }
.two-step-card { padding: 1rem; border: 1px solid var(--var-line); background: var(--var-surface); }
.two-step-codes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 12rem));
  gap: 0.4rem 1.5rem;
  margin: 0 0 1rem;
  padding-left: 1.4rem;
  font-size: 1.05rem;
}

.two-step-passkeys { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: 0.5rem; max-width: 40rem; }
.two-step-passkeys li {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.6rem 0.8rem; border: 1px solid var(--var-line); background: var(--var-surface);
}
.two-step-passkey-add { max-width: 22rem; }

/* A person's passkeys in their console dialog: names only, to recognise. */
.um-passkeys { list-style: none; margin: 0.35rem 0 0; padding: 0; font-size: 0.85rem; }
.um-passkeys small { color: var(--var-grey-muted); }
