/* Tuotu Astro-projektista: src/styles/mobile/slider.css (bin/sync-astro.py). */
/* Mobile round (Tapio, 2026-09-25): The WordPress reference slider and the case banners on phones.
   Loaded after wp.css (src/layouts/Site.astro). Phone and tablet rules only: desktop stays as it is. */

/* Stacked layout (phones and small tablets, where global.css already stacks the showcase):
   heading, screenshot, the facts as a plain list, the button, then the slider controls.
   No arrows, nothing over the image, every slide the same height. */
@media (max-width: 900px) {
  /* Every slide as tall as the tallest, so the button and the controls stay put. */
  .ref-slider-track {
    align-items: stretch;
    gap: 1rem;
  }

  .ref-show {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1.25rem;
    padding: 2rem 0 1.25rem;
  }

  /* The row and the media box step aside, so their children can be ordered in the column. */
  .ref-show .ref-show-row,
  .ref-show .ref-show-media {
    display: contents;
  }

  .ref-show .ref-show-heading {
    order: 0;
    margin: 0;
    font-size: 1.6rem;
    text-align: left;
  }

  .ref-show .ref-show-frame {
    order: 1;
  }

  /* One picture height on every slide (jerryketola.webp is 1440x869, the others 16:9),
     so the facts start at the same place after a swipe. */
  .ref-show .ref-show-frame img {
    aspect-ratio: 16 / 9;
    object-fit: cover;
    object-position: top;
  }

  .ref-show .ref-show-note.is-top {
    order: 2;
  }

  .ref-show .ref-show-note.is-left {
    order: 3;
  }

  .ref-show .ref-show-note.is-right {
    order: 4;
  }

  body.product-home .ref-show .ref-show-link {
    order: 5;
  }

  /* The facts: left-aligned, no arrows, a readable width on small tablets. */
  .ref-show .ref-show-arrow {
    display: none;
  }

  .ref-show .ref-show-note {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    width: 100%;
    max-width: 34rem;
    text-align: left;
  }

  .ref-show .ref-show-card {
    gap: 0.3rem;
  }

  /* Statistic: label, then the number with the chart beside it, then the text. */
  .ref-show .ref-show-card.is-stat {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: end;
    column-gap: 1.25rem;
  }

  .ref-show .ref-show-card.is-stat > :not(.ref-show-stat, .ref-show-chart) {
    grid-column: 1 / -1;
  }

  .ref-show .ref-show-stat {
    font-size: 2.2rem;
  }

  .ref-show .ref-show-chart {
    height: 2rem;
  }

  /* The button under the facts, pinned to the slide's bottom; not over the screenshot. */
  body.product-home .ref-show .ref-show-link {
    position: static;
    align-self: flex-start;
    justify-content: center;
    max-width: 100%;
    margin-top: auto;
    white-space: normal;
    text-align: center;
    box-shadow: none;
    translate: none;
  }

  /* Controls right under the slide; bigger touch targets for the dots. */
  .ref-slider {
    padding-bottom: 2rem;
  }

  .ref-slider:has(> .ref-slider-controls[hidden]) {
    padding-bottom: 0.75rem;
  }

  .ref-slider-controls {
    padding-top: 0.5rem;
  }

  .ref-slider-dot {
    position: relative;
  }

  .ref-slider-dot::before {
    content: '';
    position: absolute;
    inset: -0.75rem -0.25rem;
  }

  /* No fly-in here (the script leaves it off too): the facts are simply there, and they
     never fade out while someone scrolls down to the controls. */
  .ref-show.is-armed .ref-show-note:is(.is-top, .is-left, .is-right) {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .ref-show.is-armed :is(.ref-show-arrow, .ref-show-chart) path[pathLength] {
    stroke-dashoffset: 0;
    transition: none;
  }

  .ref-show.is-armed .ref-show-chart-area {
    opacity: 1;
    transition: none;
  }

  .ref-show.is-armed .ref-show-rank {
    transform: none;
    transition: none;
  }
}

/* Small tablets: the three facts side by side under the screenshot. */
@media (min-width: 700px) and (max-width: 900px) {
  .ref-show {
    display: grid;
    justify-items: stretch;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: auto auto 1fr auto; /* heading, screenshot, facts, button */
    column-gap: 1.5rem;
    row-gap: 1.25rem;
  }

  .ref-show:not(:has(> .ref-show-heading)) {
    grid-template-rows: auto 1fr auto; /* case pages: no heading */
  }

  .ref-show .ref-show-heading,
  .ref-show .ref-show-frame,
  body.product-home .ref-show .ref-show-link {
    grid-column: 1 / -1;
  }

  .ref-show .ref-show-note {
    align-self: start;
    max-width: none;
  }

  body.product-home .ref-show .ref-show-link {
    justify-self: start;
  }

  /* Narrow column: the number over its chart. */
  .ref-show .ref-show-card.is-stat {
    grid-template-columns: minmax(0, 1fr);
  }
}
