/* ==========================================================================
   Cambium — flourishes
   Loaded after site.css and app.css, on every page. It adds a light organic
   layer on top of them:

   - the ring fields of the page-top bands and the green band brighten under
     the cursor
   - the Engine Integrations heading is set in Spectral, the serif the
     Ridgeway wordmark already comes from
   - a green band for the engine plugins, zoomed in on the real editors
   - a four-part split closing the page, each part opening on a real glimpse
   ========================================================================== */

/* Spectral SemiBold, SIL Open Font License (see assets/fonts/OFL-Spectral.txt).
   Latin only: it sets one heading. */
@font-face {
  font-family: "Spectral";
  src: url("../assets/fonts/Spectral-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-serif: "Spectral", "Spectral SC", ui-serif, Georgia, serif;
}

html[data-theme="dark"] {
  --ring-glow: #9BE0B3;
  --forest-glow: rgba(214, 240, 220, 0.5);
  --forest-band: #1D3A28;
  --forest-band-edge: #28503A;
  --forest-ring: rgba(190, 230, 200, 0.12);
  --forest-text: #EDF3EC;
  --forest-dim: #B9CDBD;
  --forest-accent: #9FDDB4;
}

html[data-theme="light"] {
  --ring-glow: #1F7A45;
  --forest-glow: rgba(244, 240, 227, 0.55);
  --forest-band: #24533A;
  --forest-band-edge: #1C4630;
  --forest-ring: rgba(239, 234, 218, 0.14);
  --forest-text: #F4F0E3;
  --forest-dim: #CBD9C8;
  --forest-accent: #F0D59A;
}

/* ------------------------------------------------------------ serif splash
   One heading only: the plugin band, where the page changes key. */

.engines .section-title {
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: -0.012em;
  font-size: clamp(1.8rem, 2.7vw, 2.4rem);
  line-height: 1.1;
}

/* ------------------------------------------------------------ living rings
   The top band's field fades in as one piece, highlight and all. */

.band > .band-rings { animation: rings-in 0.9s var(--ease) both; }

@keyframes rings-in { from { opacity: 0; } }

/* The highlight is a second copy of a ring field in a brighter ink, seen
   through a soft-edged disc at the pointer. The page-top bands keep it lit at
   a resting spot; the other ring fields light up on hover.

   It is a spotlight, built so that moving it costs no painting at all:

   - .rings-glow-art holds the bright rings, the size of the band. They never
     move relative to the page and are drawn once. A still mask on it, opaque
     except softly over the text, keeps the highlight off every line of copy
     (flourish.js draws it, and redraws it on resize).
   - .rings-glow-window is a disc, --glow-r in radius, with a fixed soft edge.
     It contains the art.
   - A move translates the window to the pointer and the art back by the same
     amount. Two transforms: the browser only recomposites the disc's area. */
.rings-glow {
  --glow-r: 420px;
  color: var(--ring-glow);
  overflow: hidden;
  /* Nothing inside affects the page and nothing outside affects it, so the
     browser can skip it when restyling or laying out anything else. */
  contain: strict;
  opacity: 0;
  transition: opacity 0.6s var(--ease);
}

.rings-glow-window {
  position: absolute;
  left: 0;
  top: 0;
  width: calc(var(--glow-r) * 2);
  height: calc(var(--glow-r) * 2);
  overflow: hidden;
  -webkit-mask-image: radial-gradient(circle closest-side, #000 0%, rgba(0, 0, 0, 0.6) 30%, transparent 70%);
          mask-image: radial-gradient(circle closest-side, #000 0%, rgba(0, 0, 0, 0.6) 30%, transparent 70%);
  will-change: transform;
  contain: strict;
}

.rings-glow-art {
  position: absolute;
  left: 0;
  top: 0;
  -webkit-mask-size: 100% 100%;
          mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
  will-change: transform;
  contain: strict;
}

.band > .rings-glow,
.is-hot > .rings-glow { opacity: 1; }

/* A band's glow is built after load, so it fades in rather than popping. */
.band > .rings-glow { animation: rings-in 0.9s var(--ease) both; }

.engines > .rings-glow { color: var(--forest-glow); }

/* ------------------------------------------------------ engine integrations */

.engines {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--forest-band);
  border-top: 1px solid var(--forest-band-edge);
  border-bottom: 1px solid var(--forest-band-edge);
  color: var(--forest-text);
  padding: clamp(64px, 8vw, 116px) 0;
}

.engines-rings {
  position: absolute;
  inset: 0;
  z-index: -1;
  color: var(--forest-ring);
  pointer-events: none;
}

.engines-rings svg {
  position: absolute;
  width: 3200px;
  height: 3200px;
  left: 108%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.engines-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(36px, 5vw, 80px);
  align-items: center;
}

.engines .intro-lede { color: var(--forest-dim); }
.engines .text-link { color: var(--forest-accent); }
.engines .text-link:hover { color: var(--forest-text); }

.engine-tabs {
  display: flex;
  gap: 10px;
  margin: 30px 0 26px;
}

.engine-tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 150px;
  padding: 11px 16px 10px;
  border-radius: var(--radius-btn);
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.14);
  color: var(--forest-dim);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.engine-tab:hover { border-color: rgba(255, 255, 255, 0.34); color: var(--forest-text); }

.engine-tab[aria-selected="true"] {
  background: var(--forest-text);
  border-color: var(--forest-text);
  color: var(--forest-band);
}

.engine-tab-name { font-weight: 600; font-size: 15px; }
.engine-tab-ver { font-family: var(--font-mono); font-size: 11.5px; opacity: 0.75; }

/* ---- the stage: one shot, zoomed 1.5x on its subject ---- */

.engine-stage {
  position: relative;
  margin: 0;
}

.engine-shot {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1), 0 24px 60px -12px rgba(0, 0, 0, 0.55);
  background: #1a1a1a;
  aspect-ratio: 1389 / 832;
}

/* Scaled about the subject itself, so a centred menu stays centred and the
   Unity panel in the corner stays in the corner. A transform and an opacity
   only: both are composited, neither repaints. */
.engine-shot img {
  display: block;
  width: 100%;
  height: auto;
  transform-origin: calc(var(--fx, 0.5) * 100%) calc(var(--fy, 0.5) * 100%);
  transform: scale(var(--zoom, 1.5));
  transition: opacity 0.35s var(--ease);
}

.engine-stage.is-swapping .engine-shot img { opacity: 0; }

.engine-caption {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--forest-dim);
}

.engine-dots { display: flex; gap: 6px; }

.engine-dot {
  width: 22px;
  height: 4px;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.22);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.engine-dot[aria-current="true"] { background: rgba(255, 255, 255, 0.28); }

/* Fills while the shot is on screen, so the auto-advance is never a surprise. */
.engine-dot[aria-current="true"]::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--forest-accent);
  transform-origin: left;
  /* Stepped: 5 updates a second is smooth enough for a progress bar, and a
     continuous one would keep the compositor drawing at the display's full
     rate for as long as the band is up. */
  animation: dot-fill var(--dwell, 7s) steps(35) forwards;
}

.engine-stage.is-held .engine-dot::after,
.engine-stage:not(.is-running) .engine-dot::after { animation-play-state: paused; }

@keyframes dot-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------------------------------------------------- designed for artists */

.artists-copy {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.artists-rings {
  position: absolute;
  inset: 0;
  z-index: -1;
  color: var(--ring-ink);
  pointer-events: none;
  opacity: 0.8;
}

.artists-rings svg {
  position: absolute;
  width: 2600px;
  height: 2600px;
  left: 100%;
  top: 0;
  transform: translate(-50%, -50%);
}

/* ---------------------------------------------------------- license cards
   The artists card's rings, reused: a copy of the page's ring field behind
   each card, centred off one corner. */

.license-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.card-rings {
  position: absolute;
  inset: 0;
  z-index: -1;
  color: var(--ring-ink);
  pointer-events: none;
  opacity: 0.8;
}

.card-rings svg {
  position: absolute;
  width: 2600px;
  height: 2600px;
  transform: translate(-50%, -50%);
}

.card-rings--bottom-left svg { left: 0; top: 100%; }
.card-rings--top-right svg { left: 100%; top: 0; }

/* ------------------------------------------------------------ four parts */

/* Follows the green band, so it opens with the same gap the intro does. */
.parts {
  padding: clamp(64px, 7.5vw, 104px) 0 clamp(72px, 8vw, 118px);
}

.parts-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(20px, 2.2vw, 32px);
}

.part {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

.part-glimpse {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin-bottom: 22px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--card-bg);
  border: 1px solid var(--card-line);
  display: flex;
  align-items: center;
  justify-content: center;
}

.part-title {
  font-size: 1.35rem;
  line-height: 1.2;
  margin-bottom: 10px;
}

.part-text {
  flex: 1;
  color: var(--text-dim);
  font-size: 0.97rem;
  line-height: 1.65;
  margin-bottom: 18px;
}

.part-text code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  color: var(--text);
}

/* Desktop: the app's own toolbar, live, at 1:1. The window it came from is
   implied by a panel-coloured field around it. */
.part-glimpse--app { background: #1a1a1a; border-color: #333; }

.glimpse-app.app-mock {
  width: max-content;
  flex-shrink: 0;
  height: auto;
  border: 1px solid #454545;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  transform: scale(var(--glimpse-scale, 1));
}

.glimpse-app .toolbar { border-bottom: 0; }

/* CLI: the downloads page's own install controls, one per platform. Pinned
   to the dark theme's tokens in both themes, like the other three glimpses,
   which are dark because the app is. */
.part-glimpse--cmd {
  padding: 0 12px;
  background: #1a1a1a;
  border-color: #333;
  --code-bg: #0E100E;
  --line: #2E352F;
  --text: #E7EBE5;
  --text-faint: #79826F;
  --accent: #63BC85;
  --accent-line: rgba(99, 188, 133, 0.42);
}

/* The commands still scroll sideways, but without a visible thumb — it read
   as a stray bar under each line. A fade at the right edge says "continues". */
.part-glimpse--cmd .install-cmd-line {
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
          mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
}

.part-glimpse--cmd .install-cmd-line::-webkit-scrollbar { display: none; }

.cmd-list {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: grid;
  gap: 7px;
}

.cmd-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.cmd-os {
  font-size: 11.5px;
  font-weight: 550;
  color: var(--text-faint);
}

.part-glimpse--cmd .install-cmd { padding: 3px 3px 3px 9px; }
.part-glimpse--cmd .install-cmd-line { font-size: 0.72rem; }

/* Server + engines: a crop of a real screenshot, magnified on its subject. */
.part-glimpse--crop { background: #111; border-color: #2a2a2a; }

.app-shot-crop {
  position: absolute;
  left: 50%;
  top: 50%;
  max-width: none;
  width: calc(var(--zoom) * 100%);
  height: auto;
  transform: translate(calc(var(--fx) * -100%), calc(var(--fy) * -100%));
}

/* --------------------------------------------------------------- reveal */

.fade-up {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}

.fade-up.is-in { opacity: 1; transform: none; }

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

@media (max-width: 1100px) {
  .parts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 48px; }
}

@media (max-width: 900px) {
  .engines-grid { grid-template-columns: 1fr; }
  .engines-rings svg { left: 100%; top: 70%; }
}

@media (max-width: 720px) {
  .engine-tabs { flex-wrap: wrap; }
  .engine-tab { flex: 1 1 140px; min-width: 0; }
}

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

@media (prefers-reduced-motion: reduce) {
  .band > .band-rings { animation: none; }
  .rings-glow { display: none; }
  .engine-dot[aria-current="true"]::after { animation: none; transform: none; }
  .fade-up { opacity: 1; transform: none; }
}
