/* generated copy of /theme.css from the shared source repo: edit it there, then run its vgpu/build.sh --bcs <this folder> */
/* theme.css: the shared electric theme. Three neutrals and one pop color; every other color in this file, hero.js,
   orbit.js and the hero scenes is made from these four with color-mix() or alpha.
   Contrast (WCAG 2.x, checked by tests/hero.test.js): n3 on n1 17.62:1, n3 on n2 14.54:1, pop on n1 6.06:1,
   pop on n2 5.00:1, n1 on pop 6.06:1. Text on a pop fill is n1: n3 on pop is only 2.91:1. */
:root {
  --ex-n1: #080c13; /* deepest neutral: the page base */
  --ex-n2: #182130; /* surface neutral: cards and panels */
  --ex-n3: #f1f3f6; /* light neutral: text */
  --ex-pop: #5b8def; /* the one pop color: links, focus, the glow */
}

/* ---- Electric hero: <section class="ex-hero" data-hero="..."><div class="ex-hero__content">...</div></section> ---- */
.ex-hero {
  --ex-hero-hue: 0; /* hero.js sets these five from data-hero-opts */
  --ex-hero-glow: 0.6;
  --ex-hero-x: 68%;
  --ex-hero-y: 30%;
  --ex-hero-turn: 210deg;
  --ex-hero-pop: var(--ex-pop);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  align-content: end;
  min-height: min(86vh, 820px);
  min-height: min(86svh, 820px);
  padding: clamp(96px, 14vh, 168px) max(16px, env(safe-area-inset-right, 0px)) clamp(40px, 8vh, 88px) max(16px, env(safe-area-inset-left, 0px));
  color: var(--ex-n3);
  color-scheme: dark;
  background-color: var(--ex-n1);
  /* The still background: a pop glow with a light core, a thin arc of current, and a floor of surface neutral. */
  background-image:
    radial-gradient(14% 18% at var(--ex-hero-x) var(--ex-hero-y), color-mix(in oklab, var(--ex-n3) calc(14% + var(--ex-hero-glow) * 26%), transparent), transparent 72%),
    radial-gradient(48% 62% at var(--ex-hero-x) var(--ex-hero-y), color-mix(in oklab, var(--ex-hero-pop) calc(30% + var(--ex-hero-glow) * 45%), transparent), transparent 70%),
    conic-gradient(from var(--ex-hero-turn) at var(--ex-hero-x) var(--ex-hero-y), transparent 0deg, color-mix(in oklab, var(--ex-hero-pop) 50%, transparent) 4deg, transparent 14deg, transparent 150deg, color-mix(in oklab, var(--ex-n3) 18%, transparent) 153deg, transparent 162deg),
    radial-gradient(120% 70% at 50% 120%, color-mix(in oklab, var(--ex-n2) 90%, var(--ex-hero-pop)), transparent 70%),
    linear-gradient(180deg, color-mix(in oklab, var(--ex-n2) 70%, var(--ex-n1)), var(--ex-n1) 75%);
}
@supports (color: oklch(from currentColor l c h)) {
  .ex-hero { --ex-hero-pop: oklch(from var(--ex-pop) l c calc(h + var(--ex-hero-hue))); }
}
/* A faint grid with a slow sweep of light across it: the still hero still feels switched on. The grid is painted once;
   the light is a band in its own element (.ex-hero__sweep, added by hero.js) that only transform moves, so the
   compositor draws it with no repaint (Nov 26: a background-position sweep repainted the whole hero every frame and
   took two thirds of the frames on a 1-core machine). Both share the same soft mask. */
.ex-hero::before,
.ex-hero__sweep {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(70% 80% at var(--ex-hero-x) var(--ex-hero-y), var(--ex-n1), transparent 75%);
  mask-image: radial-gradient(70% 80% at var(--ex-hero-x) var(--ex-hero-y), var(--ex-n1), transparent 75%);
  transition: opacity .9s ease;
}
.ex-hero::before {
  content: "";
  background-image:
    repeating-linear-gradient(90deg, color-mix(in oklab, var(--ex-n3) 7%, transparent) 0 1px, transparent 1px 72px),
    repeating-linear-gradient(0deg, color-mix(in oklab, var(--ex-n3) 7%, transparent) 0 1px, transparent 1px 72px);
}
.ex-hero__sweep { overflow: hidden; }
.ex-hero__sweep::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 22%, color-mix(in oklab, var(--ex-hero-pop) 30%, transparent) 53.6%, color-mix(in oklab, var(--ex-n3) 22%, transparent) 58.5%, transparent 78%);
  transform: translateX(-121%);
  animation: ex-hero-sweep 9s cubic-bezier(.45, 0, .2, 1) infinite;
}
/* transform only: anything else here would make the browser repaint the band each frame */
@keyframes ex-hero-sweep {
  0%, 30% { transform: translateX(-121%); }
  70%, 100% { transform: translateX(103%); }
}
/* Over the scene and the still background: soft fades into the page above and below, and a scrim for the text. */
.ex-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, color-mix(in oklab, var(--ex-n1) 70%, transparent), transparent 14%),
    linear-gradient(0deg, var(--ex-n1) 0%, color-mix(in oklab, var(--ex-n1) 72%, transparent) 22%, transparent 58%),
    linear-gradient(90deg, color-mix(in oklab, var(--ex-n1) 55%, transparent), transparent 62%);
}
.ex-hero__canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity .9s ease;
  /* The page keeps its vertical scroll when a finger lands on the scene (the fluid example sets touch-action: none). */
  touch-action: pan-y !important;
  -webkit-tap-highlight-color: transparent;
}
.ex-hero.hero-live .ex-hero__canvas { opacity: 1; }
.ex-hero.hero-live::before,
.ex-hero.hero-live .ex-hero__sweep { opacity: 0; }
.ex-hero.hero-live .ex-hero__sweep::before,
.ex-hero.hero-away .ex-hero__sweep::before { animation-play-state: paused; } /* hero-away: hero.js, off screen */
/* hero-soft (hero.js): the browser draws on the CPU, where the moving band makes it redraw the whole hero each frame */
.ex-hero.hero-soft .ex-hero__sweep { display: none; }
/* ...and where it draws on the CPU, the still hero is flat and its glass is plain: the layered glow, grid, scrim and
   shadows are drawn again on the CPU each time anything over them changes (a call card that types, a clock that ticks),
   and on GitHub's software runner they kept the page near 1 frame a second, with the hero on screen or just above it
   (Nov 26). A live scene keeps its scrim for the text. */
.ex-hero.hero-soft:not(.hero-live) { background-image: none; }
.ex-hero.hero-soft:not(.hero-live)::before,
.ex-hero.hero-soft:not(.hero-live)::after,
.ex-hero.hero-soft .ex-glass::before { display: none; }
.ex-hero.hero-soft .ex-glass { background: color-mix(in oklab, var(--ex-n2) 81%, var(--ex-n1)); box-shadow: none; }
.ex-hero__content {
  position: relative;
  z-index: 2;
  min-width: 0;
}

/* ---- Liquid glass panel ----
   Smoked glass (Nov 26): a near-opaque fill and a quiet sheen, so text on a panel keeps 4.5:1 even over the brightest
   still hero (intensity 1, the glow's core under the panel, the light sweep at its brightest): --ex-pop 4.58:1,
   pop 80% n3 5.82:1, n3 66% n1 5.31:1 (Chromium; tests/theme.ui.js checks it). Keep it that way when you change the
   layers below. */
.ex-glass {
  position: relative;
  isolation: isolate;
  border-radius: 22px;
  color: var(--ex-n3);
  background:
    linear-gradient(150deg, color-mix(in oklab, var(--ex-n3) 2%, transparent), color-mix(in oklab, var(--ex-n3) 1%, transparent) 42%, color-mix(in oklab, var(--ex-pop) 5%, transparent)),
    color-mix(in oklab, color-mix(in oklab, var(--ex-n2) 81%, var(--ex-n1)) 97%, transparent);
  border: 1px solid color-mix(in oklab, var(--ex-n3) 16%, transparent);
  box-shadow:
    inset 0 1px 0 color-mix(in oklab, var(--ex-n3) 42%, transparent),
    inset 1px 0 0 color-mix(in oklab, var(--ex-n3) 14%, transparent),
    inset 0 -1px 0 color-mix(in oklab, var(--ex-n1) 45%, transparent),
    0 18px 40px -12px color-mix(in oklab, var(--ex-n1) 80%, transparent);
  /* No backdrop-filter: a blur under a card whose content or backdrop moves (the call's wave, the hero's sweep) is
     redone every frame, and on a machine that draws in software that took the page to about 1 frame a second
     (GitHub's runner, Nov 26). The fill is mixed to look like the old blurred, darkened backdrop. */
}
/* The sheen: a soft highlight across the top edge, as if light caught a curved surface. */
.ex-glass::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  background:
    radial-gradient(120% 60% at 18% -10%, color-mix(in oklab, var(--ex-n3) 3%, transparent), transparent 55%),
    radial-gradient(80% 50% at 100% 120%, color-mix(in oklab, var(--ex-pop) 10%, transparent), transparent 60%);
}
@media (prefers-reduced-transparency: reduce) {
  .ex-glass { background: var(--ex-n2); }
}

/* ---- Orbit gallery: <div class="ex-orbit"><article class="ex-orbit__card">...</article>...</div> ----
   A flat grid until orbit.js adds "is-orbiting" (and never with reduced motion). */
.ex-orbit {
  --ex-orbit-card: 220px;
  --ex-orbit-r: 260px;
  --ex-orbit-t: 48s;
  --ex-orbit-h: 340px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--ex-orbit-card)), 1fr));
  gap: 16px;
}
.ex-orbit__card {
  box-sizing: border-box;
  padding: 18px 20px;
  border-radius: 18px;
  color: var(--ex-n3);
  background: linear-gradient(160deg, color-mix(in oklab, var(--ex-n2) 85%, var(--ex-pop)), var(--ex-n2));
  border: 1px solid color-mix(in oklab, var(--ex-n3) 14%, transparent);
  box-shadow: inset 0 1px 0 color-mix(in oklab, var(--ex-n3) 18%, transparent), 0 14px 30px -14px color-mix(in oklab, var(--ex-n1) 90%, transparent);
}
.ex-orbit__card:focus-visible,
.ex-orbit__card:focus-within { outline: 2px solid var(--ex-pop); outline-offset: 3px; }
/* The ring's own tab stop (orbit.js, text-only cards): the outline sits inside, because the edge fade masks the outside. */
.ex-orbit:focus-visible { outline: 2px solid var(--ex-pop); outline-offset: -2px; }
.ex-orbit.is-orbiting {
  display: block;
  position: relative;
  height: var(--ex-orbit-h);
  overflow: hidden;
  perspective: 1100px;
  perspective-origin: 50% 0%;
  /* On a narrow screen the side cards pass the edge: fade them out there instead of cutting them off. */
  -webkit-mask-image: linear-gradient(90deg, transparent, var(--ex-n1) 9%, var(--ex-n1) 91%, transparent);
  mask-image: linear-gradient(90deg, transparent, var(--ex-n1) 9%, var(--ex-n1) 91%, transparent);
}
.ex-orbit.is-orbiting .ex-orbit__card {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--ex-orbit-card);
  margin: 0 0 0 calc(var(--ex-orbit-card) / -2);
  translate: 0 -50%;
  animation: ex-orbit var(--ex-orbit-t) linear infinite;
  animation-delay: calc(var(--ex-orbit-t) * var(--ex-i, 0) / var(--ex-n, 1) * -1);
}
/* Each card rides the ring and turns back by the same angle, so it always faces the reader. z-index follows depth and
   the far side dims with brightness (.7 keeps its text above 4.5:1), not opacity, so a card never shows the one behind it through its text. */
@keyframes ex-orbit {
  0% { transform: rotateY(0deg) translateZ(var(--ex-orbit-r)) rotateY(0deg); filter: brightness(1); z-index: 10; }
  50% { transform: rotateY(180deg) translateZ(var(--ex-orbit-r)) rotateY(-180deg); filter: brightness(.7); z-index: 0; }
  100% { transform: rotateY(360deg) translateZ(var(--ex-orbit-r)) rotateY(-360deg); filter: brightness(1); z-index: 10; }
}
.ex-orbit.is-orbiting:hover .ex-orbit__card,
.ex-orbit.is-orbiting:focus-within .ex-orbit__card,
.ex-orbit.is-orbiting.is-away .ex-orbit__card { animation-play-state: paused; } /* is-away: orbit.js, off screen */
/* A card that has keyboard focus comes to the front at full brightness, even if the ring stopped it on the far side
   (!important because animated values beat normal rules). */
.ex-orbit.is-orbiting .ex-orbit__card:focus-within { filter: none !important; z-index: 20 !important; }

/* Until orbit.js has placed a ring, its cards keep their room but stay hidden, so the switch from grid to ring is not
   a layout shift. Browsers without the scripting query skip this; if the script never runs, the cards show after 2.5 s. */
@media (scripting: enabled) and (prefers-reduced-motion: no-preference) {
  .ex-orbit:not(.is-orbiting):not(.is-flat) > .ex-orbit__card { visibility: hidden; animation: ex-orbit-reveal 0s 2.5s forwards; }
}
@keyframes ex-orbit-reveal { to { visibility: visible; } }

@media (prefers-reduced-motion: reduce) {
  .ex-hero__sweep { display: none; }
  .ex-hero__canvas, .ex-hero::before { transition: none; }
  .ex-orbit.is-orbiting { display: grid; height: auto; overflow: visible; perspective: none; -webkit-mask-image: none; mask-image: none; }
  .ex-orbit.is-orbiting .ex-orbit__card { position: static; width: auto; margin: 0; translate: none; transform: none; filter: none; animation: none; }
}
