/* ==========================================================================
   Guardians of Blockchain · product pages
   Shared by guardian-max.html and guardian-mini.html. The two pages differ in
   content and in the modifier on <main>: .product--max / .product--mini.

   Source: Figma "GoB", page "Funnel (#23)", frames "Guardian MAX" and
   "Guardian MINI" (desktop 1440, telefon 390) and the sticky buy bar.

   Below 64rem the page follows the phone frames (one shot per chapter, a
   compact link to the other model). From 64rem it follows the desktop frames
   (sticky scene with thumbnails, full comparison).

   html.has-scene (set in <head> when motion is allowed, taken back by
   assets/js/product.js when 3D cannot run) turns the hero and the tour into
   one scroll scene around the 3D model, as in the approved prototype v2.
   ========================================================================== */

@layer pages {
  /* ------------------------------------------------------------------------
     Product: values and state shared by the whole page
     ------------------------------------------------------------------------ */

  .product {
    /* Space above and below the closing card; the buy bar needs both. */
    --closing-space-top: 0px;
    --closing-space-bottom: var(--space-48);
  }

  /* --render-width: width of the machine in the closing render (Figma).
     --device-ratio: width of the machine on the stage to the height of the
     3D canvas at the hero camera, so render and 3D model match.
     --poster-*: where the machine sits in the 1264 × 1120 colour render:
     empty space above and below (share of the machine width) and its centre. */
  .product--max {
    --render-width: 37.5625rem; /* 601 */
    --device-ratio: 0.667;
    --poster-trim-top: 0.163;
    --poster-trim-bottom: 0.216;
    --poster-center: 47.4%;
  }

  .product--mini {
    --render-width: 35.5rem; /* 568 */
    --device-ratio: 0.71; /* this render looks more from the front than the hero camera */
    --poster-trim-top: 0.199;
    --poster-trim-bottom: 0.241;
    --poster-center: 47.9%;
  }

  @media (min-width: 64rem) {
    .product {
      --closing-space-top: var(--section-space);
      --closing-space-bottom: var(--section-space);
    }
  }

  /* The checked colour is known to the whole page, without JavaScript. The
     case colours and data-color come from base.css. */
  .product:has([name="color"][value="orange-bitcoin"]:checked) {
    --selected-case: var(--case-orange-bitcoin);
  }

  .product:has([name="color"][value="royal-purple"]:checked) {
    --selected-case: var(--case-royal-purple);
  }

  .product:has([name="color"][value="neon-green"]:checked) {
    --selected-case: var(--case-neon-green);
  }

  .product:has([name="color"][value="white"]:checked) {
    --selected-case: var(--case-white);
  }

  .product:has([name="color"][value="black"]:checked) {
    --selected-case: var(--case-black);
  }

  /* Name of the checked colour: every name is in the markup and only the
     matching one is shown. Flex drops the white space between the items. */
  .selected-color {
    display: inline-flex;
  }

  .selected-color > * {
    display: none;
  }

  .product:has([name="color"][value="orange-bitcoin"]:checked) .selected-color > [data-color="orange-bitcoin"],
  .product:has([name="color"][value="royal-purple"]:checked) .selected-color > [data-color="royal-purple"],
  .product:has([name="color"][value="neon-green"]:checked) .selected-color > [data-color="neon-green"],
  .product:has([name="color"][value="white"]:checked) .selected-color > [data-color="white"],
  .product:has([name="color"][value="black"]:checked) .selected-color > [data-color="black"] {
    display: block;
  }

  /* Renders in every colour (stage, closing card): only the checked one
     shows, the others are lazy and load once picked. */
  .color-render {
    display: none;
  }

  .product:has([name="color"][value="orange-bitcoin"]:checked) .color-render[data-color="orange-bitcoin"],
  .product:has([name="color"][value="royal-purple"]:checked) .color-render[data-color="royal-purple"],
  .product:has([name="color"][value="neon-green"]:checked) .color-render[data-color="neon-green"],
  .product:has([name="color"][value="white"]:checked) .color-render[data-color="white"],
  .product:has([name="color"][value="black"]:checked) .color-render[data-color="black"] {
    display: block;
  }

  /* Without :has() the default colour, which comes first, stays. */
  @supports not selector(:has(*)) {
    .color-render:first-of-type {
      display: block;
    }
  }

  /* ------------------------------------------------------------------------
     Story: the stage, the hero and the tour
     One column. Static: the stage is the render above the hero text (phones)
     or in the same grid cell beside it (desktop). Scene: see the end of this
     section.
     ------------------------------------------------------------------------ */

  .story {
    /* Phones: the stage under the header. 40 % of the screen keeps the
       close-ups readable and leaves the rest to the text. */
    --stage-height: clamp(15rem, 40svh, 24rem);
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  /* Stage: render and 3D model. A size container, so the render can take the
     size the 3D model will have (it scales with the canvas height). */
  .stage {
    --canvas-height: min(100cqh, 60rem);
    --device: calc(var(--canvas-height) * var(--device-ratio));
    --model-x: 50%; /* centre of the machine across the stage */
    position: relative;
    isolation: isolate;
    height: var(--stage-height);
    overflow: clip;
    container-type: size;
  }

  /* Glow on the floor under the machine. product.js moves it with the
     camera (--glow-x, --glow-y, --glow-width, --glow-strength). */
  .stage::before {
    --width: var(--glow-width, calc(var(--device) * 1.36));
    content: "";
    position: absolute;
    z-index: -1;
    top: var(--glow-y, calc(50% + var(--device) * 0.25));
    left: var(--glow-x, var(--model-x));
    width: var(--width);
    height: calc(var(--width) * 0.3);
    translate: -50% -45%;
    border-radius: 50%;
    background: radial-gradient(
      closest-side,
      color-mix(in srgb, var(--color-teal) calc(var(--glow-strength, 0.34) * 100%), transparent),
      transparent
    );
    pointer-events: none;
  }

  /* The machine fills 85.9 % of the render width. */
  .stage__poster {
    position: absolute;
    top: 50%;
    left: var(--model-x);
    width: calc(var(--device) / 0.859);
    max-width: none;
    translate: -50% calc(-1 * var(--poster-center));
    transition:
      opacity 600ms var(--ease-out),
      visibility 0s linear 600ms;
  }

  /* The canvas is centred on the machine and never taller than 60rem, so
     the model does not grow without end on tall screens. */
  .stage__model {
    --poster-color: transparent;
    --progress-bar-color: var(--color-teal);
    --progress-bar-height: 2px;
    position: absolute;
    top: 50%;
    left: 0;
    display: block;
    width: 100%;
    height: var(--canvas-height);
    translate: 0 -50%;
    background: transparent;
    opacity: 0;
    transition: opacity 600ms var(--ease-out);
  }

  /* Once the model is in, it takes over from the render. */
  .stage.is-loaded .stage__model {
    opacity: 1;
  }

  .stage.is-loaded .stage__poster {
    visibility: hidden;
    opacity: 0;
  }

  /* Pause for the turning model and the fan (WCAG 2.2.2) */
  .stage__pause {
    position: absolute;
    z-index: 1;
    right: var(--gutter);
    bottom: var(--space-12);
    background-color: var(--color-night);
  }

  .stage__pause[hidden],
  .stage__pause[aria-pressed="true"] .stage__pause-icon,
  .stage__pause:not([aria-pressed="true"]) .stage__play-icon {
    display: none;
  }

  @media (min-width: 64rem) {
    /* Stage and hero share the first grid cell: the hero text on the left,
       the machine 74 % across the content (Figma: centre 889 of 1200). */
    .stage {
      --content: min(100% - 2 * var(--gutter), var(--container));
      --model-x: calc((100% - var(--content)) / 2 + var(--content) * 0.741);
      grid-area: 1 / 1;
      height: auto;
    }

    /* The canvas reaches far to the left and fades out under the text, so
       the exploded parts are never cut off. */
    .stage__model {
      left: calc(var(--model-x) - 50%);
      mask-image: linear-gradient(90deg, transparent, #000 22%);
    }

    .stage__pause {
      right: max(var(--gutter), (100% - var(--container)) / 2);
      bottom: var(--space-32);
    }

    .product-hero {
      position: relative;
      grid-area: 1 / 1;
      pointer-events: none; /* the right half belongs to the model */
    }

    .product-hero__content {
      pointer-events: auto;
    }
  }

  /* ------------------------------------------------------------------------
     Hero: title, key numbers and the purchase form
     ------------------------------------------------------------------------ */

  .product-hero__inner {
    padding-block: 1.375rem var(--space-48); /* 22 under the stage */
  }

  .product-hero__content {
    display: grid;
    justify-items: start;
    gap: var(--space-16);
  }

  .product-hero__title {
    --title-gradient-end: #99f2d9; /* Figma: gradient on the model name */
    /* 52 → 80 and 56 → 80: one size above the shared display style */
    font: 600 clamp(3.25rem, 2.6rem + 2.667vw, 5rem) / clamp(3.5rem, 2.943rem + 2.286vw, 5rem) var(--font-display);
    letter-spacing: -0.02em;
  }

  /* Gradient text (.text-gradient) */
  .product-hero__model {
    background-image: linear-gradient(90deg, var(--color-teal), var(--title-gradient-end));
  }

  .product-hero__stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--space-8) var(--space-16);
    width: 100%;
  }

  /* The number stands above its label, the markup keeps term before value. */
  .product-hero__stat {
    display: flex;
    flex-direction: column-reverse;
    gap: 2px;
  }

  .product-hero__stat dd {
    font: 600 1.125rem/1.5rem var(--font-display);
  }

  @media (min-width: 48rem) {
    .product-hero__stats {
      justify-content: flex-start;
      column-gap: var(--space-32);
    }
  }

  @media (min-width: 64rem) {
    /* The hero fills the screen under the header (Figma: 780 with the header),
       within limits, and the stage beside it takes the same height. */
    .product-hero {
      display: grid;
      align-items: center;
      min-height: clamp(40rem, 100svh - var(--header-height), 60rem);
    }

    .product-hero__inner {
      /* 580 + 620: the right column is the stage */
      display: grid;
      grid-template-columns: minmax(0, 580fr) minmax(0, 620fr);
      padding-block: var(--space-48);
    }

    .product-hero__content {
      grid-area: 1 / 1;
      gap: var(--space-24);
    }

    .product-hero__title {
      letter-spacing: -0.03em;
    }

    .product-hero__stat dd {
      font-size: var(--text-h3);
      line-height: var(--leading-h3);
      letter-spacing: -0.01em;
    }
  }

  /* Purchase form: colour, quantity, Add to cart. A plain GET form to the cart;
     the buy bar and the closing card submit it through the form attribute. */

  .purchase {
    display: grid;
    justify-items: start;
    gap: var(--space-16);
    width: 100%;
  }

  .color-picker__legend {
    margin-bottom: var(--space-16);
    padding: 0;
    color: var(--color-mist);
    font-size: 0.875rem;
    line-height: 1.25rem;
  }

  .color-picker__legend .selected-color {
    margin-left: var(--space-4);
    color: var(--color-white);
    font-weight: 500;
  }

  .color-picker__options {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-12);
  }

  /* Swatch: a 44 px target around a 32 px dot. The radio itself is visually
     hidden, so the label carries the checked and the focus state. */
  .swatch {
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    border: 1px solid var(--color-line);
    border-radius: 50%;
    cursor: pointer;
    transition: border-color var(--duration-fast) ease;
  }

  .swatch::before {
    content: "";
    width: 2rem;
    height: 2rem;
    /* 3.8 : 1 against the page, so Black and Royal Purple stay findable (WCAG 1.4.11) */
    border: 1px solid var(--color-control);
    border-radius: 50%;
    background-color: var(--swatch);
  }

  .swatch:hover {
    border-color: var(--color-line-hover);
  }

  .swatch:has(:checked) {
    border: 2px solid var(--swatch-ring, var(--swatch));
  }

  /* Two fills are too dark to read as the ring of the selected swatch. */
  .swatch[data-color="royal-purple"] {
    --swatch-ring: #7a5cb5; /* Figma: lighter ring */
  }

  .swatch[data-color="black"] {
    --swatch-ring: var(--color-control);
  }

  .swatch:has(:focus-visible) {
    outline: 2px solid var(--color-teal);
    outline-offset: 2px;
  }

  /* The steppers need product.js, which adds .is-ready. Until then they keep
     their place but stay out of sight and out of the tab order; the number
     can be typed. */
  .quantity:not(.is-ready) .quantity__button {
    visibility: hidden;
  }

  .purchase__action {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: var(--space-16);
    width: 100%;
  }

  .purchase__action .button {
    grid-column: 1 / -1;
  }

  .purchase__price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: var(--space-8);
  }

  /* A list of .icon-text items */
  .purchase__notes {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-8) var(--space-16);
  }

  @media (min-width: 48rem) {
    .purchase__action {
      display: flex;
      flex-wrap: wrap;
      width: auto;
    }

    .purchase__price {
      margin-right: var(--space-8);
    }
  }

  @media (min-width: 64rem) {
    .purchase__notes {
      column-gap: var(--space-24);
    }
  }

  /* ------------------------------------------------------------------------
     Product body: everything below the hero
     ------------------------------------------------------------------------ */

  /* A flex column, so phones can show the sections in their own order. */
  .product__body {
    display: flex;
    flex-direction: column;
  }

  @media (width < 64rem) {
    /* Phones list the specifications before the link to the other model.
       Nothing in the specifications takes focus, so the tab order still
       follows what is on screen. */
    .compare,
    .compare ~ :not(.specs) {
      order: 1;
    }
  }

  /* ------------------------------------------------------------------------
     Tour: "Take a Closer Look"
     Phones: one camera shot per chapter. Desktop: chapters on the left, the
     scene on the right with a stage and thumbnails that switch the shot.
     ------------------------------------------------------------------------ */

  .tour {
    /* Share of the active chapter the camera has covered. A fixed value here;
       the 3D scene sets it while the page scrolls. */
    --chapter-progress: 62.5%;
    padding-block: var(--space-40);
  }

  .tour__chapters {
    display: grid;
    gap: var(--space-80);
  }

  .chapter,
  .chapter__body {
    display: grid;
    gap: var(--space-16);
  }

  .chapter__shot {
    aspect-ratio: 358 / 262;
    overflow: clip;
    border: 1px solid var(--color-line);
    border-radius: var(--radius-card);
  }

  .chapter__shot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .chapter__note {
    color: var(--color-mist);
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1rem;
  }

  /* Live network numbers (Figma: Živá data z mempool.space) */

  .live-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .live-stats__item {
    display: grid;
    gap: 2px;
    padding: var(--space-12) var(--space-16);
  }

  .live-stats__item dd {
    font-weight: 500;
  }

  /* Parts of the exploded view */

  .parts {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-8);
  }

  .parts__item {
    padding-block: var(--space-8);
    color: var(--color-mist);
  }

  /* State hook for the 3D scene: the part the visitor points at. */
  .parts__item.is-active {
    border-color: var(--color-teal);
    color: var(--color-white);
  }

  .tour__scene {
    display: none;
  }

  /* The checked thumbnail lights up its shot on the stage and its chapter. */
  .tour:has([name="view"][value="display"]:checked) [data-view="display"],
  .tour:has([name="view"][value="fan"]:checked) [data-view="fan"],
  .tour:has([name="view"][value="heatsink"]:checked) [data-view="heatsink"],
  .tour:has([name="view"][value="inside"]:checked) [data-view="inside"] {
    --view-active: 1;
  }

  @media (width < 64rem) {
    /* Hairlines between the four numbers, on the phone frames only */
    .live-stats__item:nth-child(odd) {
      border-right: 1px solid var(--color-line);
    }

    .live-stats__item:nth-child(n + 3) {
      border-top: 1px solid var(--color-line);
    }
  }

  @media (min-width: 48rem) {
    .chapter {
      grid-template-columns: 1fr 1fr;
      align-items: center;
      column-gap: var(--space-40);
    }
  }

  @media (min-width: 64rem) {
    .tour__title {
      margin-bottom: var(--space-48);
    }

    .tour__layout {
      display: grid;
      grid-template-columns: minmax(0, 440fr) minmax(0, 696fr);
      align-items: start;
      column-gap: var(--space-64);
    }

    .tour__chapters {
      gap: var(--space-32);
    }

    .chapter {
      display: block;
    }

    .chapter__shot {
      display: none;
    }

    .chapter__body {
      gap: var(--space-12);
    }

    /* Progress of the chapter (Figma: Průběh kapitoly) */
    .chapter__body::before {
      content: "";
      width: 4rem;
      height: 2px;
      border-radius: 1px;
      background: linear-gradient(
        to right,
        var(--color-teal) calc(var(--view-active, 0) * var(--chapter-progress)),
        var(--color-line) 0
      );
    }

    /* Only the title dims on the chapters that are not active. The body text
       keeps its contrast; at the 40 % of the Figma frame it drops to 2:1. */
    .chapter__title {
      opacity: calc(0.4 + 0.6 * var(--view-active, 0));
      font: 600 var(--text-h3) / var(--leading-h3) var(--font-display);
      letter-spacing: -0.01em;
      transition: opacity var(--duration) ease;
    }

    .chapter__note {
      font-size: 0.875rem;
      font-weight: 400;
      line-height: 1.25rem;
    }

    .live-stats__item {
      gap: var(--space-4);
    }

    .live-stats__item dd {
      font: 600 var(--text-h4) / var(--leading-h4) var(--font-display);
    }

    /* Scene: stays in view while the chapters scroll past */
    .tour__scene {
      position: sticky;
      top: calc(var(--header-height) + var(--space-24));
      display: grid;
      gap: var(--space-16);
    }

    .tour__stage {
      display: grid;
      aspect-ratio: 696 / 540;
      padding: 1.625rem var(--space-24); /* 26 and 24: the shot is 648 × 486 */
      overflow: clip;
      /* Glow under the machine, cut off by the lower edge */
      background-image: radial-gradient(closest-side, color-mix(in srgb, var(--color-teal) 30%, transparent), transparent);
      background-position: 50% 110.8%;
      background-repeat: no-repeat;
      background-size: 80.5% 33.3%;
    }

    /* All shots share one cell, the active one is opaque. */
    .tour__shot {
      grid-area: 1 / 1;
      width: 100%;
      height: 100%;
      object-fit: contain;
      opacity: var(--view-active, 0);
      transition: opacity var(--duration) ease;
    }

    .tour__views {
      display: grid;
      grid-auto-columns: minmax(0, 1fr);
      grid-auto-flow: column;
      gap: var(--space-12);
    }

    .view-thumb {
      display: grid;
      gap: var(--space-8);
      color: var(--color-mist);
      font-size: 0.75rem;
      font-weight: 500;
      line-height: 1rem;
      cursor: pointer;
      transition: color var(--duration-fast) ease;
    }

    .view-thumb img {
      width: 100%;
      height: 6.25rem;
      border: 1px solid var(--color-line);
      border-radius: var(--radius-button);
      object-fit: cover;
      transition: border-color var(--duration-fast) ease;
    }

    .view-thumb:hover img {
      border-color: var(--color-line-hover);
    }

    .view-thumb:has(:checked) {
      color: var(--color-white);
    }

    .view-thumb:has(:checked) img {
      border: 2px solid var(--color-teal);
    }

    .view-thumb:has(:focus-visible) img {
      outline: 2px solid var(--color-teal);
      outline-offset: 2px;
    }
  }

  /* Browsers without :has() keep the first shot on the stage. */
  @supports not selector(:has(*)) {
    .tour [data-view="display"] {
      --view-active: 1;
    }
  }

  /* ------------------------------------------------------------------------
     Scene (html.has-scene): one sticky stage for the hero and the tour
     Phones: the stage sticks under the header, hero and chapters scroll
     under it. Desktop: the stage fills the screen behind the text and every
     chapter is a screen high. The camera follows the chapter that crosses
     the reading line (assets/js/product.js).
     ------------------------------------------------------------------------ */

  .has-scene .story {
    grid-template-rows: var(--stage-height) auto auto;
  }

  /* Focused links and fields in the story scroll clear of the sticky header
     and stage, and everything clear of the buy bar (WCAG 2.4.11). On the
     elements, not the root: below the story the stage no longer sticks. */
  @media (width < 64rem) {
    .has-scene .story :is(a, button, input, select, textarea, summary) {
      scroll-margin-top: var(--stage-height); /* added to the header's scroll-padding-top */
    }
  }

  :root:has(.buy-bar) {
    scroll-padding-bottom: 6rem;
  }

  .has-scene .stage {
    position: sticky;
    z-index: 2;
    top: var(--header-height);
    grid-area: 1 / 1 / -1; /* explicit column: the hero and the tour lie in it too */
    align-self: start;
    /* Text that scrolls up fades out under the stage. */
    background-image: linear-gradient(to bottom, var(--color-night) 82%, transparent);
  }

  .has-scene .product-hero {
    grid-area: 2 / 1;
  }

  .has-scene .tour {
    grid-area: 3 / 1;
  }

  /* The stage shows every camera view: stills and the static scene step aside. */
  .has-scene .chapter__shot,
  .has-scene .tour__scene {
    display: none;
  }

  .has-scene .tour__chapters {
    gap: var(--space-24);
  }

  /* Each chapter fills the screen under the stage, so the camera has time to
     fly. Its text stops right under the stage and stays while the camera
     flies, then leaves with the chapter. "Inside" is longer: the machine
     comes apart while its text stays. */
  .has-scene .chapter {
    --chapter-height: max(24rem, 100svh - var(--header-height) - var(--stage-height));
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    min-height: var(--chapter-height);
  }

  .has-scene .chapter:last-child {
    min-height: calc(var(--chapter-height) * 1.7);
  }

  .has-scene .chapter__body {
    position: sticky;
    top: calc(var(--header-height) + var(--stage-height) + var(--space-8));
  }

  @media (min-width: 64rem) {
    .has-scene .story {
      grid-template-rows: auto auto;
    }

    .has-scene .stage {
      z-index: 0;
      grid-area: 1 / 1 / 3;
      height: calc(100svh - var(--header-height));
      background-image: none;
    }

    .has-scene .product-hero {
      grid-area: 1 / 1;
    }

    /* The tour lies over the stage: only the chapters take the pointer, so
       the pause button stays reachable. */
    .has-scene .tour {
      position: relative;
      grid-area: 2 / 1;
      pointer-events: none;
    }

    .has-scene .tour__chapters {
      gap: 0;
      pointer-events: auto;
    }

    /* A chapter is a screen high, its text stops a fifth down the screen. */
    .has-scene .chapter {
      --chapter-height: calc(100svh - var(--header-height));
      display: block;
    }

    .has-scene .chapter__body {
      top: calc(var(--header-height) + 22svh);
    }
  }

  /* ------------------------------------------------------------------------
     Compare: "Two Ways to Fight Centralization" (#compare)
     Phones show a compact link to the other model, desktop the two cards.
     ------------------------------------------------------------------------ */

  .compare {
    padding-block: var(--space-24) var(--space-48);
  }

  .compare__full {
    display: none;
  }

  .compare__short {
    display: grid;
    gap: var(--space-12);
  }

  .other-model {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--space-12);
    padding: var(--space-16);
    transition:
      background-color var(--duration-fast) ease,
      border-color var(--duration-fast) ease;
  }

  .other-model:hover {
    border-color: var(--color-line-hover);
    background-color: var(--color-slate);
  }

  .other-model img {
    width: min(6.1875rem, 26vw); /* 99 */
  }

  .other-model__text {
    display: grid;
    gap: 2px;
  }

  @media (min-width: 64rem) {
    .compare__short {
      display: none;
    }

    .compare__full {
      display: block;
    }

    .compare__models {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: var(--space-24);
    }

    .compare-card {
      display: grid;
      align-content: start;
      gap: var(--space-24);
      padding: 0 var(--space-32) var(--space-32);
      overflow: clip;
      /* Glow under the machine and a wider one from the lower left corner */
      background-image:
        radial-gradient(closest-side, color-mix(in srgb, var(--color-teal) 30%, transparent), transparent),
        radial-gradient(closest-side, color-mix(in srgb, var(--color-teal) 20%, transparent), transparent);
      background-position:
        50% 11.25rem,
        -12.5625rem 18.6875rem;
      background-repeat: no-repeat;
      background-size:
        25rem 6.875rem,
        35rem 21.25rem;
    }

    .compare-card--current {
      border-color: color-mix(in srgb, var(--color-teal) 50%, transparent);
    }

    /* Both models at one scale: equal height, the width follows the render. */
    .compare-card__render {
      justify-self: center;
      width: auto;
      height: 11.5625rem; /* 185 */
      margin-block: 4.0625rem 0.625rem; /* 65 and 10: the picture area is 260 high */
      object-fit: contain;
    }

    .compare-card__name {
      font-weight: 400;
    }

    .compare-card__name strong {
      font-weight: 700;
    }

    /* As high as the button in the other card */
    .compare-card__current {
      display: flex;
      align-items: center;
      gap: var(--space-8);
      min-height: 3.25rem;
      color: var(--color-teal);
      font-weight: 500;
    }
  }

  /* ------------------------------------------------------------------------
     Specifications
     ------------------------------------------------------------------------ */

  .specs {
    padding-block: var(--space-48);
  }

  .specs__layout {
    display: grid;
    gap: var(--space-16);
  }

  .spec-table {
    --glow-height: 6.25rem;
    padding: var(--space-24) var(--space-16);
    /* Glow in the upper right corner */
    background-image: radial-gradient(
      ellipse 36% var(--glow-height) at 76% -1rem,
      color-mix(in srgb, var(--color-teal) 16%, transparent),
      transparent
    );
    font-size: 0.875rem;
    line-height: 1.25rem;
  }

  .spec-table__row {
    display: flex;
    justify-content: space-between;
    gap: var(--space-8);
    padding-block: var(--space-12);
  }

  .spec-table__row + .spec-table__row {
    border-top: 1px solid var(--color-line);
  }

  .spec-table__row dt {
    color: var(--color-mist);
  }

  .spec-table__row dd {
    font-weight: 500;
    text-align: right;
  }

  .specs__guarantees {
    display: grid;
    gap: var(--space-16);
    font-size: 0.875rem;
    line-height: 1.25rem;
  }

  .specs__guarantee {
    display: flex;
    align-items: center;
    gap: var(--space-12);
  }

  .specs__guarantee .icon {
    width: 1.125rem;
    height: 1.125rem;
    color: var(--color-teal);
  }

  @media (min-width: 64rem) {
    .specs__layout {
      grid-template-columns: minmax(0, 400fr) minmax(0, 736fr);
      grid-template-rows: auto 1fr;
      grid-template-areas:
        "title table"
        "guarantees table";
      gap: var(--space-24) var(--space-64);
    }

    .specs__title {
      grid-area: title;
    }

    .spec-table {
      --glow-height: 9.375rem;
      grid-area: table;
      padding: var(--space-32);
      font-size: 1rem;
      line-height: 1.5rem;
    }

    .spec-table__row {
      justify-content: flex-start;
      gap: var(--space-24);
      padding-block: var(--space-16);
    }

    .spec-table__row dt {
      flex: 0 0 15rem;
    }

    .spec-table__row dd {
      text-align: left;
    }

    .specs__guarantees {
      grid-area: guarantees;
      align-content: start;
      gap: var(--space-24);
      font-size: 1rem;
      line-height: 1.5rem;
    }

    .specs__guarantee .icon {
      width: 1.25rem;
      height: 1.25rem;
    }
  }

  /* ------------------------------------------------------------------------
     Reviews and FAQ: "What Miners Are Saying", "Questions Before You Order"
     Both are shared blocks from base.css; only their place on this page is
     set here. On phones the reviews are the sideways strip of the homepage.
     ------------------------------------------------------------------------ */

  /* The neighbours bring the rest of the space: 48 above and 64 below. */
  .reviews {
    padding-top: var(--space-16);
  }

  .faq {
    padding-block: var(--space-64);
  }

  /* The product phone frames set the questions 12 px under the title and the
     contact links 24 px under the questions. */
  @media (width < 64rem) {
    .faq__layout {
      gap: var(--space-12);
    }

    .faq__contact {
      margin-top: var(--space-12);
    }
  }

  /* ------------------------------------------------------------------------
     Section rhythm
     The phone frames space every section on its own (set above). Desktop uses
     the shared section space, 96 px at 1440.
     ------------------------------------------------------------------------ */

  @media (min-width: 64rem) {
    .tour,
    .compare,
    .specs,
    .reviews,
    .faq {
      padding-block: var(--section-space);
    }
  }

  /* ------------------------------------------------------------------------
     Buy bar (Figma: Lepkavá lišta s nákupem)
     Sticky at the lower edge of the viewport while the product page scrolls,
     so price and "Add to cart" stay on screen. product.js shows it whenever
     the form's own "Add to cart" is out of sight (.buy-bar--waiting is on
     the markup and comes off): after that button has scrolled away, and on
     phones from the start. Without the script the bar stays hidden. The bar
     itself is a line without height that rests inside the closing card, the
     panel hangs above that line. The closing card is stacked over it, so the bar
     slides under the card and never reaches the footer.
     ------------------------------------------------------------------------ */

  .buy-bar {
    --rest: calc(var(--closing-space-top) + 7.5rem);
    position: sticky;
    z-index: 1;
    bottom: calc(var(--space-16) + env(safe-area-inset-bottom, 0px));
    display: flex;
    align-items: flex-end;
    justify-content: center;
    height: 0;
    margin-block: var(--rest) calc(-1 * var(--rest));
    /* Same side space as .container, which cannot be used on the line itself */
    padding-inline: max(var(--gutter), (100% - var(--container)) / 2);
    pointer-events: none; /* the line spans the page, only the panel takes clicks */
  }

  @media (min-width: 64rem) {
    /* On the left the bar passes over text that scrolls on; in the middle it
       would stay on top of the thumbnails of the sticky scene. */
    .buy-bar {
      justify-content: flex-start;
    }
  }

  /* With keyboard focus inside, the bar comes out from under the card. */
  .buy-bar:has(:focus-visible) {
    z-index: 3;
  }

  .buy-bar--waiting .buy-bar__panel {
    visibility: hidden;
    opacity: 0;
    translate: 0 1rem;
    /* visibility switches off only after the fade */
    transition-delay: 0s, 0s, var(--duration-fast);
  }

  .buy-bar__panel {
    display: flex;
    align-items: center;
    gap: var(--space-12);
    width: min(100%, 22.375rem); /* 358 */
    padding: var(--space-8) var(--space-8) var(--space-8) var(--space-16);
    box-shadow: 0 0.5rem 1.5rem color-mix(in srgb, var(--color-ink) 50%, transparent);
    pointer-events: auto;
    transition:
      opacity var(--duration-fast) ease,
      translate var(--duration-fast) ease,
      visibility 0s;
  }

  .buy-bar__dot {
    flex: none;
    width: 1rem;
    height: 1rem;
    border: 1px solid rgb(255 255 255 / 0.25);
    border-radius: 50%;
    background-color: var(--selected-case, transparent);
  }

  .buy-bar__product {
    display: grid;
    flex: 1;
    min-width: 0;
  }

  /* ------------------------------------------------------------------------
     Closing call to action
     ------------------------------------------------------------------------ */

  .closing {
    padding-block: var(--closing-space-top) var(--closing-space-bottom);
  }

  .closing__card {
    --glow-height: 12.5rem;
    position: relative;
    z-index: 2; /* above the buy bar */
    display: grid;
    /* The render may be wider than a 320 px card; its transparent sides
       overflow, the column and the button keep the card's width. */
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    gap: var(--space-12);
    padding: var(--space-24);
    background-image: radial-gradient(closest-side, color-mix(in srgb, var(--color-teal) 28%, transparent), transparent);
    background-position: 50% 3.6875rem;
    background-repeat: no-repeat;
    background-size: min(100%, 50rem) var(--glow-height);
    text-align: center;
  }

  /* The colour render has room around the machine: the margins take the
     empty space above and below away again. */
  .closing__render {
    --device: calc(var(--render-width) * 0.391); /* 235 of 601 */
    width: calc(var(--device) / 0.859);
    max-width: none;
    margin-block: calc(var(--device) * -1 * var(--poster-trim-top)) calc(var(--device) * -1 * var(--poster-trim-bottom));
  }

  .closing__summary {
    font-size: 0.875rem;
    line-height: 1.25rem;
  }

  /* Browsers without :has() cannot tell the colour, so the line leaves it out. */
  @supports not selector(:has(*)) {
    .closing__color {
      display: none;
    }
  }

  .closing__card .button {
    width: 100%;
  }

  @media (min-width: 48rem) {
    .closing__card .button {
      width: auto;
    }
  }

  @media (min-width: 64rem) {
    .closing__card {
      --glow-height: 20rem;
      gap: var(--space-16);
      padding: var(--space-48) var(--space-48) 4.5rem;
    }

    .closing__render {
      --device: calc(var(--render-width) * 0.652); /* 392 of 601 */
    }

    .closing__title {
      font: 700 var(--text-h2) / var(--leading-h2) var(--font-display);
      letter-spacing: -0.02em;
    }

    .closing__summary {
      font-size: 1.25rem;
      line-height: 1.75rem;
    }
  }

  /* ------------------------------------------------------------------------
     Scroll-driven polish
     Without support, or with reduced motion, everything above is the page.
     ------------------------------------------------------------------------ */

  @supports (animation-timeline: view()) {
    @media (prefers-reduced-motion: no-preference) {
      /* The camera moves in on each shot as it scrolls into view. */
      .chapter__shot img,
      .tour__shot {
        animation: shot-move-in linear both;
        animation-timeline: view();
        animation-range: entry 0% entry 100%;
      }
    }

    @keyframes shot-move-in {
      from {
        scale: 1.12;
      }
    }
  }

  /* Forced colours (Windows contrast themes): the dot keeps its colour, which
     is the content, and the checked swatch gets a system-colour ring. */
  @media (forced-colors: active) {
    .swatch::before {
      forced-color-adjust: none;
    }

    .swatch:has(:checked) {
      border: 3px solid Highlight;
    }
  }
}
