/* ==========================================================================
   Cardgine product page
   Flat and geometric: #202020 page, #101010 shapes (logo tab, screens),
   tilted card plates behind the screens, a light stripe under the logo.
   No shadows, no glows.
   ========================================================================== */

:root {
  --bg: #202020;
  --plate: #101010;
  --text: #f6f6f6;
  --text-soft: #e6e6e6;
  --text-muted: #8c8c8c;
  /* Stripes under the logo. The top one shows the cards behind it inverted
     (light), with their contrast boosted so the pattern is visible even where
     the background is faded. Both fade out toward the left.
     Saved alternatives (put in .logo-stripe-1 > i as background, without the
     backdrop-filter):
     pale yellow -> amber -> dark orange (liked):
       linear-gradient(to right, #ffe766 0%, #f7b21b 45%, #e0620f 100%)
     fading in from the left, yellow -> orange -> red:
       linear-gradient(to right, rgba(255, 214, 64, 0) 0%, rgba(252, 196, 40, 0.85) 30%,
                       #f58a18 62%, #e2401a 85%, #c81f1f 100%) */
  --stripe-filter: invert(1) brightness(0.57) contrast(11) brightness(1.65);
  /* the second stripe: plain, translucent white, drawn over both stripes */
  --stripe-2: rgba(255, 255, 255, 0.16);
  /* fully visible at the tip (by the logo), fading out toward the left */
  --stripe-fade: linear-gradient(to left, #000 0%, rgba(0, 0, 0, 0.5) 30%, transparent 85%);
  /* Letterboxing: darkening toward both sides, only on wide windows */
  --letterbox: rgba(0, 0, 0, 0.45);   /* at the very edge of the window */
  /* Tilted plates behind the trailer and the demo, like cards under the top card */
  --card-plate: #303030;

  /* Steam button: deep Steam blue, a hint of purple in the bottom-left corner,
     a slightly lighter green tint in the top-right corner */
  --steam-gradient: linear-gradient(65deg, #3b479f 0%, #2157ad 25%, #1c69aa 60%, #1f8679 100%);

  /* Light from below the viewport */
  --underlight: 30, 190, 210;   /* cyan, as r, g, b */

  --pad: clamp(1rem, 3vw, 2.25rem);
  /* Logo tab width; also shrinks on short windows to leave room for the trailer */
  --tab-w: clamp(160px, min(17.5vw, 28vh), 260px);

  /* Width shared by the trailer and the demo: as large as possible while the
     top, the trailer, the Steam button and the top ~3/4 of the demo's headline
     all fit on the first screen. Fitted to measurements: the space above the
     trailer is ~1.104 x the logo width - 5px, the space between trailer and
     demo is ~0.05 x the window height + 75px, and the visible part of the
     headline is ~0.068 x the width. Solving
       H = above + w * 9/16 + between + 0.068 w   for w gives the formula below.
     Never narrower than 320px (or the screen, if that's smaller). */
  --w-product: max(
    min(1240px, 100vw - 2 * var(--pad), (95svh - 1.104 * var(--tab-w) - 70px) * 1.586),
    min(320px, 100vw - 2 * var(--pad))
  );
  --w: var(--w-product);   /* /how-it-works widens it on short windows */
  /* How far the logo tab sticks out to the left of the trailer */
  --overhang: clamp(0px, (100vw - var(--w)) / 2 - var(--pad), 4.5rem);
  /* x of the logo tab's left edge */
  --logo-left: max(var(--pad), 50% - var(--w) / 2 - var(--overhang));
  /* Community links (top-right): their right edge lines up with the trailer's */
  --community-size: calc(var(--tab-w) * 0.21);
  --community-right: calc(50% - var(--w) / 2);

  --font: "Ubuntu", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { background: var(--bg); }

/* body deliberately doesn't form a stacking context, so the logo stripe can
   blend with the background layers (and the extension can filter them) */
body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* Background layers, bottom to top (all fixed, behind the content; explicit
   z-indexes because they share the root stacking context with the page):
   1. html::before  cards laid like bricks (img/cards-pattern.svg is generated
                    by tools/make-cards-pattern.py), seen slightly from above
                    like a wall of cards (the lower rows are a little farther
                    away and smaller), then tilted. The layer is oversized so
                    its edges never show.
   2. html::after   fades the cards into plain grey toward the top-left corner;
                    they are fully visible in the bottom-right corner
   3. body::after   a faint cyan light from below the bottom of the window
   4. body::before  letterboxing: from a point well outside the content the
                    page darkens gradually toward the left and right edges, so
                    it only shows on wide windows. Drawn above the logo
                    extension (the stripes stay on top). */
html::before {
  content: "";
  position: fixed;
  inset: -60%;
  z-index: -6;
  background: url("/img/cards-pattern.svg") 0 0 / 544px 368px repeat;
  /* Read right to left: lean the card wall back along its own columns
     (rotateX), then tilt it, then project. This keeps the perspective lined
     up with the cards instead of with the screen. */
  transform: perspective(1000px) rotate(6deg) rotateX(-24deg);
  pointer-events: none;
}

html::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -5;
  background: linear-gradient(to bottom right,
    rgba(32, 32, 32, 0.92) 0%,
    rgba(32, 32, 32, 0.55) 35%,
    rgba(32, 32, 32, 0) 85%);
  pointer-events: none;
}

body::after {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 34vh;
  z-index: -4;
  background: linear-gradient(to top,
    rgba(var(--underlight), 0.11) 0%,
    rgba(var(--underlight), 0.035) 45%,
    rgba(var(--underlight), 0) 100%);
  pointer-events: none;
}

body::before {
  /* fully transparent up to this far from the centre of the page... */
  --inner: max(calc(var(--w) / 2 + var(--overhang) + 6rem), 700px);
  /* ...then darkening over at least this distance; on wide windows it reaches
     full strength exactly at the window edge, on narrower ones the full-strength
     end lies outside the window (so only the faint start of it shows) */
  --min-band: 340px;
  --t: calc(50% - var(--inner));                       /* left threshold */
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  background: linear-gradient(to right,
    var(--letterbox) min(0px, var(--t) - var(--min-band)),
    transparent var(--t),
    transparent calc(100% - var(--t)),
    var(--letterbox) max(100%, 100% - var(--t) + var(--min-band)));
  pointer-events: none;
}


img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }
.nowrap { white-space: nowrap; }

:focus-visible {
  outline: 3px solid var(--text);
  outline-offset: 3px;
}

/* Browsers without the small-viewport unit (svh; before ~2022) use vh */
@supports not (height: 1svh) {
  :root {
    --w: max(
      min(1240px, 100vw - 2 * var(--pad), (95vh - 1.104 * var(--tab-w) - 70px) * 1.586),
      min(320px, 100vw - 2 * var(--pad))
    );
  }
}

/* ---------- Top: logo tab (a little left of the trailer) + tagline ---------- */

.top {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: clamp(1.25rem, 2.5vw, 2.25rem);
  /* Left edge = trailer's left edge minus the overhang; the tagline may run
     past the trailer's right edge, up to the page padding */
  margin: 0 var(--pad) 0 calc(var(--logo-left));
}

/* The tab hangs from the very top of the page. Its bottom edge is slanted,
   and a light stripe runs along it. The slanted edge and the stripe carry on
   at the same angle to the left edge of the page; the dark shape above them
   continues there too, slightly see-through. */
.logo-tab {
  --slope: 0.13;   /* slant height / width; if changed, update .logo-wedge's angle */
  --slant: calc(var(--tab-w) * var(--slope));
  /* the stripes' length (incl. their fade), proportional to the logo */
  --stripe-len: calc(var(--tab-w) * 3.2);
  /* distance from the page's left edge to the tab (a few px extra is harmless:
     it just runs off-screen) */
  --ext: max(var(--pad), 50vw - var(--w) / 2 - var(--overhang));
  --ext-drop: calc(var(--ext) * var(--slope));    /* how much lower the edge is at the page edge */
  position: relative;
  display: block;
  width: var(--tab-w);
  padding: 1.4rem 0.95rem calc(var(--slant) + 0.45rem);
  margin-bottom: calc(var(--tab-w) * 0.04);
}
.logo-tab::before,
.logo-tab::after {
  content: "";
  position: absolute;
  top: 0;
  z-index: -1;
}
/* the tab itself */
.logo-tab::before {
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--plate);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--slant)), 0 100%);
}
/* its extension to the left page edge: darkens what's behind it while keeping
   the cards' contrast. On dark shades, color-burn with a light grey works like
   subtraction: every shade drops by about the same amount (~18/255 here). */
.logo-tab::after {
  right: 100%;
  width: var(--ext);
  height: calc(100% + var(--ext-drop));
  background: #ebebeb;
  mix-blend-mode: color-burn;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--ext-drop)), 0 100%);
}
.logo-tab img { width: 100%; height: auto; }

/* The stripes: long wedges ending in a point at the tab's bottom-right
   corner, their length proportional to the logo. Each is a thin rectangle
   rotated to the slant (atan(0.13) = 7.407deg) about its top-right corner and
   clipped to a wedge; drawing them rotated keeps their boxes tight, which
   keeps Chrome from showing the effect's bounding box.
   - .logo-stripe-1  the top wedge (2.86deg wide): inverts what's behind it
   - .logo-stripe-2  a wedge twice as wide in translucent white (see below) */
.logo-wedge {
  position: absolute;
  right: 0;
  top: calc(100% - var(--slant));
  width: var(--stripe-len);
  transform-origin: 100% 0;
  rotate: -7.407deg;
  pointer-events: none;
}
/* The inverting stripe. Its wedge shape and its fade both come from the mask
   (two gradients, intersected): a clip-path would stop browsers from applying
   the mask to the backdrop filter. The diagonal stop is softened by ~1px so
   the long edge is anti-aliased. */
.logo-stripe-1 {
  height: calc(var(--stripe-len) * 0.05);          /* tan(2.862deg) */
  -webkit-backdrop-filter: var(--stripe-filter);
  backdrop-filter: var(--stripe-filter);
  --wedge: linear-gradient(to bottom right, #000 calc(50% - 0.6px), transparent calc(50% + 0.6px));
  -webkit-mask-image: var(--wedge), var(--stripe-fade);
  -webkit-mask-composite: source-in;
  mask-image: var(--wedge), var(--stripe-fade);
  mask-composite: intersect;
}
@supports not ((backdrop-filter: none) or (-webkit-backdrop-filter: none)) {
  .logo-stripe-1 { background: #fff; mix-blend-mode: difference; }
}
/* A wedge twice as wide, covering both stripes, in plain translucent white:
   lightens the top stripe a little and forms the lower stripe. Because it
   covers the seam, there's no anti-aliasing gap between the two. */
.logo-stripe-2 {
  height: calc(var(--stripe-len) * 0.10025);       /* tan(2 x 2.862deg) */
  clip-path: polygon(0 0, 100% 0, 0 100%);
  background: var(--stripe-2);
  -webkit-mask-image: var(--stripe-fade);
  mask-image: var(--stripe-fade);
}

.tagline {
  margin: 0;
  font-style: italic;
  font-weight: 500;
  line-height: 1.15;
  container-type: inline-size;   /* so the lines can size themselves to its width */
}
/* Size: scales with the logo, but shrinks if needed so the longer second line
   (about 16.3x the main size wide, incl. its indent; 16.7 leaves a margin) still fits the space next to the
   logo. If it ever has to wrap anyway, it only breaks after the full stop. */
.tagline-main,
.tagline-sub {
  --tl: max(1.05rem, min(var(--tab-w) * 0.145, 100cqi / 16.7));
}
.tagline-main { display: block; font-size: var(--tl); }
.tagline-sub {
  display: block;
  margin: 0.2em 0 0 1.4em;
  font-size: calc(var(--tl) * 0.82);
  font-weight: 400;
  color: var(--text);
}

@media (max-width: 640px) {
  .top { grid-template-columns: 1fr; }
  .tagline-sub { margin-left: 0.8em; }
}

/* ---------- Community links (top-right, mirroring the logo's position) ---------- */

.community {
  --size: var(--community-size);   /* scales with the logo */
  position: absolute;
  top: calc(var(--tab-w) * 0.09);
  right: calc(var(--community-right));
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
.community a {
  display: grid;
  place-items: center;
  width: var(--size);
  height: var(--size);
  --icon: #d4d4d4;   /* icon colour, and the square's colour on hover */
  color: var(--icon);
}
.community svg { width: 76%; height: 76%; }   /* same icon size as before, roomier square */
/* on hover the square turns light and the icon dark, like it's cut out */
.community a:hover,
.community a:focus-visible {
  background: var(--icon);
  color: var(--bg);
}
/* leave room for the links at the right end of the top area */
.top { margin-right: calc(var(--community-right) + var(--community-size) + 1.25rem); }
@media (max-width: 640px) {
  .top { margin-right: var(--pad); }   /* the tagline sits below the logo there */
}


/* ---------- Screens (trailer, demo) ---------- */

.stage,
.demo {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stage { padding-top: clamp(1.25rem, 3.5vh, 2.25rem); }
.demo  { padding-top: clamp(1.75rem, 4.5vh, 2.75rem); }

.screen {
  position: relative;
  width: var(--w);
  aspect-ratio: 16 / 9;
  background: var(--plate);
}

/* A flat, lighter plate behind each screen, turned a few degrees, like the
   next card in a pile peeking out. */
.screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--card-plate);
  rotate: -3.5deg;
  pointer-events: none;
}

.screen:fullscreen::before { display: none; }

.screen iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  outline: 0;
}

.screen-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  color: #333;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

/* ---------- Steam button + release info ---------- */

/* "Coming soon to [Windows] [Apple]" and the Steam button, centred together.
   The text uses exactly the Steam button's label style. */
.cta-row {
  --cta-size: clamp(1.3rem, 2.15vw, 1.7rem);   /* the bottom bar sets its own size */
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  column-gap: clamp(1.1rem, 2vw, 1.75rem);
  row-gap: 0.75rem;
  max-width: calc(100vw - 2 * var(--pad));   /* as wide as its content; may be wider than the trailer */
  margin-top: clamp(1.1rem, 3vh, 1.75rem);
}
.release {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0;
  color: #fff;
  font-size: var(--cta-size);
  font-weight: 700;
  white-space: nowrap;
}
.platforms { display: flex; flex: none; align-items: center; gap: 0.85rem; padding-inline: 0.2em; }
.platform-icon { flex: none; max-width: none; overflow: visible; }   /* the Apple logo touches its box edge; don't clip its anti-aliasing */
/* Sized to look as big as the Steam logo (a 1.15em circle): the Windows logo
   fills its whole box, the Apple and Linux (Tux) logos much less of it */
.platform-windows { width: 0.98em; height: 0.98em; }
.platform-apple   { width: 1.24em; height: 1.24em; margin-top: -0.12em; translate: 0 -0.5px; }
.platform-linux   { width: 1.2em; height: 1.2em; margin-left: -0.15em; translate: 0 0.05em; }   /* nudged closer to the Apple logo and a hair lower */

@media (max-width: 640px) {
  /* stacked: button first, release info below it */
  .cta-row .steam-button { order: -1; }
}

.steam-button {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.45em 2.1em 0.45em 1.8em;
  background: var(--steam-gradient);
  color: #fff;
  font-size: var(--cta-size);
  font-weight: 700;
  white-space: nowrap;
  text-decoration: none;
}
.steam-button:hover { filter: brightness(1.12); }
.steam-logo { width: 1.15em; height: 1.15em; flex: none; }

@media (max-width: 480px) {
  .steam-button { padding-inline: 1.4em; }
}

/* Steam bar docked at the bottom once the main button has scrolled away
   (created by js/main.js) */
:root {
  --bar-cta: clamp(1.15rem, 1.8vw, 1.45rem);
  --bar-h: calc(var(--bar-cta) * 2.3 + 1.1rem);
}
body.has-steam-bar { padding-bottom: var(--bar-h); }   /* so it never covers the end */
.steam-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  justify-content: center;
  align-items: center;
  height: var(--bar-h);
  background: var(--plate);   /* same as the logo tab */
  /* slid down out of view by --slide (set by js/main.js while scrolling) */
  translate: 0 var(--slide, 0px);
}
.steam-bar .cta-row {
  --cta-size: var(--bar-cta);
  flex-wrap: nowrap;
  width: auto;
  margin: 0;
}
@media (max-width: 640px) {
  .steam-bar .release { display: none; }   /* just the button on phones */
}

/* ---------- Demo ---------- */

.demo-screen { container-type: inline-size; }   /* overlay text scales with the frame */

.demo-start {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: var(--plate);
  color: var(--text);
  font: inherit;
  text-align: right;
  cursor: pointer;
}
.demo-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
/* The invitation: at the top on the right, clear of the deck in the top-left
   corner. Each line sits on its own solid black box. On hover the boxes and
   the play triangle invert, like the community links. */
.demo-pitch {
  position: absolute;
  top: 1.6cqi;
  right: 2.2cqi;   /* leaves about as much of the card outline visible on the right as on top */
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.6cqi;
  line-height: 1.15;
}
.demo-title,
.demo-sub {
  padding: 0.25em 0.55em;
  background: #000;
  color: var(--text);
}
.demo-title {
  padding: 0.08em 0.32em 0.12em;
  font-size: max(1.15rem, 4.2cqi);
  font-weight: 700;
}
.demo-sub {
  font-size: max(0.85rem, 2.65cqi);
  font-weight: 500;
}
.demo-start:hover .demo-title,
.demo-start:hover .demo-sub {
  background: var(--text);
  color: #000;
}

/* a play triangle in the middle, for anyone who skips the text */
.demo-play {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  width: max(2rem, 7cqi);
  height: max(2rem, 7cqi);
  translate: -40% -50%;
  color: #fff;
}
.demo-start:hover .demo-play {
  width: max(2.2rem, 7.7cqi);
  height: max(2.2rem, 7.7cqi);
}

/* When pointing at the deck, it gets the white outline Cardgine draws around
   things you can click: a transparent image the same size as the screenshot.
   .demo-deck-hit is an invisible area over the deck (in % of the frame, from
   the screenshot: x 66-370 px, y 35-438 px of 2480 x 1395). */
.demo-deck-hit {
  position: absolute;
  left: 2.66%;
  top: 2.51%;
  width: 12.26%;
  height: 28.89%;
}
.demo-poster-hover { display: none; pointer-events: none; }
.demo-deck-hit:hover + .demo-poster-hover { display: block; }

/* While the demo loads, its frame sits underneath and the screenshot stays on
   top (it is the game's first frame), without the invitation, with a spinner in place of the play
   triangle and no hover effects. main.js hides it once the game reports its
   first frame drawn, so there is no black flash in between. */
.demo-spinner { display: none; }
.demo-start.is-loading { cursor: progress; }
.demo-start.is-loading .demo-play,
.demo-start.is-loading .demo-pitch { display: none; }
.demo-start.is-loading .demo-spinner {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  display: block;
  width: max(2rem, 7cqi);
  height: max(2rem, 7cqi);
  translate: -50% -50%;
  color: #fff;
  animation: demo-spin 0.9s linear infinite;
}
@keyframes demo-spin { to { rotate: 1turn; } }
.demo-start.is-loading .demo-deck-hit:hover + .demo-poster-hover { display: none; }

/* ---------- How was this game made: editor screenshots, step by step ---------- */

/* Editor screenshots (3× UI scale), all shown at the same scale: 2480 px = the full column. */
.making {
  width: var(--w);
  margin: 0 auto;
  /* close under the demo's icons, so the headline peeks in while the demo
     is being played */
  padding-top: clamp(0.25rem, 1vh, 0.75rem);
  padding-bottom: clamp(2rem, 6vh, 3.5rem);
}

.making-title {
  margin: 0 0 clamp(1.5rem, 4vh, 2.5rem);
  font-size: clamp(1.4rem, 2.8vw, 2.1rem);
  font-weight: 700;
  font-style: italic;
  color: var(--text);
}

.step + .step { margin-top: clamp(2rem, 6vh, 3.5rem); }

.step-title {
  margin: 0 0 0.9rem;
  font-size: clamp(1.1rem, 1.9vw, 1.45rem);
  font-weight: 500;
  color: var(--text-soft);
}

/* the step number in a small square box, the logo tab's colour */
.step-num {
  display: inline-block;
  width: 1.25em;            /* square: line-height + padding = width */
  line-height: 1.17em;
  padding-bottom: 0.08em;   /* the box sits ~1px lower, so the digit looks centred (smaller values round away to nothing) */
  margin-right: 0.15em;
  text-align: center;
  background: var(--plate);   /* same as the logo tab */
  color: var(--text);
}

.step-note {
  margin: -0.5rem 0 0.9rem;
  max-width: 52em;
  font-size: clamp(0.95rem, 1.5vw, 1.1rem);
  color: var(--text-soft);
}
.step-note-after { margin: 0.9rem 0 0; }

.shots img {
  display: block;
  width: 100%;
  height: auto;
}

/* 2 px narrower than the rest, kept at the same scale */
.shots img.shot-2478 { width: calc(100% * 2478 / 2480); }

/* two 1220 px screenshots: same scale as the rest, outer edges on the column's */
.shots-pair {
  display: flex;
  justify-content: space-between;
}
.shots-pair img { width: calc(100% * 1220 / 2480); }

@media (max-width: 640px) {
  .shots-pair { flex-direction: column; gap: 1rem; }
  .shots-pair img { width: 100%; }
}

/* ---------- Multiplayer: text, then the second demo ---------- */

.multiplayer {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: var(--w);
  margin: 0 auto;
  padding-bottom: clamp(2rem, 6vh, 3.5rem);   /* room before the Steam bar at the end */
}
.multiplayer > :not(.screen, .screen-tools) { align-self: stretch; }
/* so the gap to the next section is the padding alone, as after the walkthrough */
.multiplayer > :last-child { margin-bottom: 0; }

/* same look as the "How was Solitaire made" headline */
.section-title {
  margin: 0 0 clamp(1rem, 2.5vh, 1.5rem);
  font-size: clamp(1.4rem, 2.8vw, 2.1rem);
  font-weight: 700;
  font-style: italic;
  color: var(--text);
}

/* same as the notes under the walkthrough steps */
.section-text {
  max-width: 52em;
  margin: 0 0 0.8em;
  font-size: clamp(0.95rem, 1.5vw, 1.1rem);
  color: var(--text-soft);
}
/* the demo follows the text with the same gap as above the first demo */
.multiplayer .screen { margin-top: calc(clamp(1.75rem, 4.5vh, 2.75rem) - 0.8em); }
.section-after { margin-top: 0.5rem; }
/* Ubuntu medium: the font has no 600, so this is its semi-bold */
.semibold { font-weight: 500; color: var(--text); }
.section-text a { color: #40a0e0; }
.section-text a:hover { color: #80d0ff; }

/* ---------- CardScript listings: the editor's own colours and background ---------- */

.code {
  margin: 0.4em 0 1.2em;
  padding: 1.1em 1.4em;
  overflow-x: auto;          /* long lines scroll on narrow screens */
  background: var(--plate);  /* the editor's #101010 */
  color: #d8d8d8;
  font-family: Consolas, "Cascadia Mono", "DejaVu Sans Mono", monospace;
  font-size: clamp(0.85rem, 1.35vw, 1.05rem);
  line-height: 1.45;
  tab-size: 4;
}
.section-text code {
  font-family: Consolas, "Cascadia Mono", "DejaVu Sans Mono", monospace;
  font-size: 0.95em;
  color: var(--text);
}
.cs-c { color: #40a070; }   /* comments */
.cs-k { color: #c792ea; }   /* foreach, in, while, if, :=, : */
.cs-t { color: #82aaff; }   /* types: player, boolean, Card */
.cs-o { color: #c3e88d; }   /* ->, ==, !, not, or, choose, from */
.cs-n { color: #f6c177; }   /* numbers */
.cs-p { color: #89ddff; }   /* parentheses */

/* Explained listing: each line highlights on hover / focus, and main.js shows
   its explanation in a box right below the line, as wide as the listing */
.cs-line {
  display: inline-block;
  width: 100%;
  margin: 0 -0.5em;
  padding: 0 0.5em;
  box-sizing: content-box;
  cursor: help;
  outline: 0;
}
.cs-line:hover,
.cs-line:focus { background: #262626; }
.code-tip {
  position: absolute;
  z-index: 20;
  box-sizing: border-box;
  padding: 0.8em 1.1em;
  background: #000;
  color: var(--text-soft);
  font-size: clamp(0.95rem, 1.5vw, 1.1rem);
  line-height: 1.5;
  pointer-events: none;
}
.code-tip code {
  font-family: Consolas, "Cascadia Mono", "DejaVu Sans Mono", monospace;
  font-size: 0.95em;
  color: #c3e88d;
}

/* ---------- Footer ---------- */

.site-footer {
  width: var(--w);
  margin: 0 auto;
  padding: clamp(1.5rem, 4vh, 2.5rem) 0;
  color: #889594;            /* grey with a hint of teal */
  font-size: clamp(0.95rem, 1.5vw, 1.1rem);   /* as the paragraphs */
}
.site-footer p { margin: 0; }
.site-footer a { color: #40a0e0; text-decoration: none; }
.site-footer a:hover { color: #80d0ff; }

/* Setup screen of the multiplayer demo: a small form in the middle instead of
   a screenshot, on a translucent dark panel. The number sits on a black box;
   the buttons are a muted plum, so they stand apart from the text. */
.demo-setup {
  display: grid;
  place-items: center;
  /* generated by tools/make-one-background.py */
  background: var(--plate) url("/img/one/splash-background.webp") center / cover no-repeat;
  cursor: auto;
  text-align: center;
}
.demo-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.2cqi;
  /* a translucent dark panel behind the controls, sized by its content */
  padding: 2.2cqi 5.6cqi;
  background: rgba(0, 0, 0, 0.75);
  font-size: max(0.95rem, 2.65cqi);
  font-weight: 500;
}
.demo-field {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.6em 1em;
}
.demo-label { padding: 0.25em 0; }
.demo-stepper { display: flex; gap: 0.25em; }
.demo-step,
.demo-count,
.demo-go {
  border: 0;
  background: #000;
  color: var(--text);
  font: inherit;
}
.demo-step,
.demo-go {
  background: #683e69;
  color: var(--text);
}
.demo-step,
.demo-count {
  display: grid;
  place-items: center;
  width: 1.9em;
  height: 1.9em;
  padding: 0;
}
.demo-step { cursor: pointer; }
.demo-step svg { width: 1.1em; height: 1.1em; }
.demo-count { font-weight: 700; }
.demo-step:hover:not(:disabled),
.demo-go:hover { background: #d6d6d6; color: #683e69; }
.demo-step:disabled { background: #2e2130; color: #6e5a6f; cursor: default; }
.demo-go {
  padding: 0.12em 1.6em 0.17em;
  /* never larger than the section's headline (.section-title) */
  font-size: min(1.5em, clamp(1.4rem, 2.8vw, 2.1rem));
  font-weight: 700;
  cursor: pointer;
}
.demo-start.is-loading .demo-form { display: none; }
/* its title: like the Solitaire one, but in the top-left corner and without
   reacting to hover (only the buttons do here) */
.demo-pitch-left {
  right: auto;
  left: 2.2cqi;
  align-items: flex-start;
}
.demo-setup:hover .demo-title { background: #000; color: var(--text); }

/* Fullscreen fallback (iPhone Safari): the frame fills the browser window */
.demo-screen.is-maximized {
  position: fixed;
  inset: 0;
  z-index: 100;
  width: auto;
  height: auto;
  aspect-ratio: auto;
}
.demo-screen.is-maximized::before { display: none; }
html.demo-maximized { overflow: hidden; }
.demo-exit { display: none; }
.is-maximized .demo-exit {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: rgba(16, 16, 16, 0.85);
  color: var(--text);
  cursor: pointer;
}
.is-maximized .demo-exit svg { width: 24px; height: 24px; }
.is-maximized .demo-exit:hover { background: var(--text); color: var(--plate); }

.screen-tools {
  display: flex;
  justify-content: flex-end;
  gap: 0.25rem;
  width: var(--w);
  padding-top: 0.5rem;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
}
.icon-button:hover { color: var(--text); }
.icon-button svg { width: 26px; height: 26px; }


/* ---------- Links in text (same colours as the documentation) ---------- */

.tagline a { color: #40a0e0; }
.tagline a:hover { color: #80d0ff; }

/* ---------- /how-it-works: the article version of the page ---------- */

/* A plain bar across the whole page instead of the logo tab, fixed at the
   top: the logo where the product page has it, the title next to it, the
   platforms on the right (right edge in line with the screens). The logo
   starts as large and as high as on the product page (with extra padding
   above it), and both shrink while the page scrolls: js/main.js sets
   --shrink (0 = large ... 1 = small) so the bar loses exactly as much height
   as the page has scrolled; its bottom edge first moves with the page, then
   stays. */
:root {
  --abar-pad: clamp(0.5rem, 1.2vw, 0.85rem);
  /* extra padding above the large logo: puts it 1.4rem from the top, like
     the logo in the product page's tab */
  --abar-extra: max(0px, 1.4rem - var(--abar-pad));
  --alogo-small: clamp(84px, 8vw, 118px);
  --alogo-large: max(var(--tab-w) - 1.9rem, var(--alogo-small));   /* the logo in the tab */
  --abar-gap: clamp(1rem, 2vw, 1.75rem);
  --arel-size: clamp(0.95rem, 1.45vw, 1.2rem);   /* "Coming soon to" */
}
html:has(.article-bar) {
  /* On short windows, the product page's width (made for the Steam button to
     fit on the first screen) gets very narrow; this page doesn't need that.
     Below 700px of height it widens gradually (3px per px of height lost, so
     there is no jump), as far as a demo still fits below the small bar. */
  --w: max(var(--w-product), min(1240px, 100vw - 2 * var(--pad),
    (100svh - 2 * var(--abar-pad) - 0.75 * var(--alogo-small) - 2rem) * 16 / 9,
    var(--w-product) + (700px - 100svh) * 3));
  /* links to the sections stop below the bar */
  scroll-padding-top: calc(2 * var(--abar-pad) + 0.75 * var(--alogo-small) + 1rem);
}
.article-bar {
  /* the logo's current width */
  --alogo-w: calc(var(--alogo-large) - (var(--alogo-large) - var(--alogo-small)) * var(--shrink, 0));
  /* Room for the title and the byline next to the large logo, left of
     "Coming soon to" (about 7.4em of its own size), with a little to spare */
  --atitle-room: calc(var(--w) + var(--overhang) - var(--alogo-large) - 0.95rem
    - 7.5 * var(--arel-size) - 2 * var(--abar-gap) - 0.75rem);
  /* both as large as fits there without wrapping: the title line is about
     14.9em wide (up to 2.15rem), the byline about 9.3em (up to the size of
     "Coming soon to") */
  --aname-size: min(clamp(1.4rem, 2.8vw, 2.15rem), var(--atitle-room) / 15);
  --aby-size: min(var(--arel-size), var(--atitle-room) / 9.4);
  /* gap between the title and the byline */
  --aby-gap: calc(0.15 * var(--aby-size));
  /* How far the title must move up (next to the large logo) so the byline's
     baseline isn't below the bottom of the logo's lettering (60.96% of the
     logo's width below its top). The byline's baseline is 1.15em of the
     title + the gap + 0.942em of its own size below the title's top. */
  --atitle-up: max(0px, 0.918 * var(--aname-size) + var(--aby-gap) + 0.942 * var(--aby-size) - 0.2346 * var(--alogo-large));
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 15;
  background: var(--plate);
}
.article-bar-space { height: calc(2 * var(--abar-pad) + var(--abar-extra) + 0.75 * var(--alogo-large)); }
.article-bar-inner {
  display: flex;
  align-items: center;
  gap: var(--abar-gap);
  margin: 0 var(--community-right) 0 var(--logo-left);
  padding: calc(var(--abar-pad) + var(--abar-extra) * (1 - var(--shrink, 0))) 0 var(--abar-pad);
}
.article-logo {
  flex: none;
  width: var(--alogo-w);
  margin-left: 0.95rem;   /* the logo sits where it does inside the tab */
}
.article-logo img { width: 100%; height: auto; }
/* The top of its capitals is at the logo's vertical centre (the middle of
   the image, 3/8 of its width down, is also the middle of the lettering);
   the capitals start 0.232em below the top of the line. Moved up if the
   byline needs it, easing back while the byline fades out. */
.article-title {
  position: relative;
  align-self: flex-start;
}
.article-name {
  margin: calc(0.375 * var(--alogo-w) - 0.232em - var(--atitle-up) * max(0, 1 - 2 * var(--shrink, 0))) 0 0;
  white-space: nowrap;
  /* shrinks to 75% as the logo shrinks (--shrink: 0 large ... 1 small, from js/main.js) */
  font-size: calc(var(--aname-size) * (1 - 0.25 * var(--shrink, 0)));
  font-weight: 700;
  line-height: 1.15;
}
/* the byline below the title, left edges aligned: out of the flow, so it
   never makes the bar taller; fades out in the first half of the shrinking.
   The name is a link to GitHub that only shows itself on hover. */
.article-by {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: var(--aby-gap);
  color: #9a9a9a;
  font-size: var(--aby-size);
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
  opacity: calc(1 - 2 * var(--shrink, 0));
}
.article-by a { color: inherit; text-decoration: none; }
.article-by a:hover { color: #c8c8c8; text-decoration: underline; }
.article-bar.is-small .article-by { visibility: hidden; }   /* faded out: not clickable */
.article-release {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4em;
  margin-left: auto;
  color: #fff;
  font-size: var(--arel-size);
  font-weight: 700;
  white-space: nowrap;
}
/* Spaced by what is drawn, not by the icons' boxes: 0.625em between each two
   (Tux 1px closer at the largest size)
   (the Apple logo's box is wider than the logo, the Linux one starts with a
   gap). Vertically, the Apple body (without the leaf) and Tux are centred on
   the Steam circle and the Windows squares. */
.article-release .platforms { gap: 0.625em; padding-inline: 0; }
.platform-steam { width: 1.15em; height: 1.15em; }
.article-release .platform-apple { margin: 0 -0.115em; translate: 0 -0.14em; }
.article-release .platform-linux { margin: 0 -0.113em 0 -0.162em; translate: 0 0.01em; }
.article-steam { display: block; color: inherit; }
.article-steam:hover { color: #66c0f4; }

@media (max-width: 640px) {
  .article-bar-inner { margin-inline: var(--pad); }
  .article-title { display: none; }
}

/* Short screens (phones in landscape): the product page keeps everything
   narrow there so the Steam button fits on the first screen; this page
   doesn't need to, so it is as wide as the screen allows while a demo still
   fits in the window's height. The bar scrolls away with the page instead
   of staying at the top (js/main.js then doesn't shrink it). */
@media (max-height: 500px) and (orientation: landscape) {
  html:has(.article-bar) {
    --w: max(min(1240px, 100vw - 2 * var(--pad), (100svh - 2rem) * 16 / 9),
             min(320px, 100vw - 2 * var(--pad)));
    scroll-padding-top: 1rem;
  }
  .article-bar { position: absolute; }
}

/* intro: a paragraph and links to the sections; the community links on the
   right, right below the bar */
.article-intro {
  /* the square (the icon is 76% of it): halfway between the size of the
     platform icons in the bar and the product page's community links */
  --acom-size: calc((1.15 * var(--arel-size) / 0.76 + var(--community-size)) / 2);
  position: relative;
  width: var(--w);
  margin: 0 auto;
  padding: clamp(1.25rem, 3.5vh, 2.25rem) calc(var(--acom-size) + 2.5rem) 0 0;
}
.article-intro .section-text { margin: 0; }
.community.article-community {
  --size: var(--acom-size);
  top: var(--abar-pad);
  right: 0;
}
.article-toc {
  margin: 1rem 0 0;
  padding-left: 1.4em;
  list-style: square;
  font-size: clamp(0.95rem, 1.5vw, 1.1rem);   /* as the paragraphs */
  color: var(--text-soft);
}
.article-toc li + li { margin-top: 0.2em; }
.article-toc a { color: #40a0e0; }
.article-toc a:hover { color: #80d0ff; }

/* the trailer at the very end, the release info and Steam button above it */
.article-trailer { padding-bottom: clamp(1rem, 3vh, 1.75rem); }
.article-trailer .cta-row { margin: 0 0 clamp(1.75rem, 4.5vh, 2.75rem); }
