/*
 * The app's screens as a carousel (founder, 2026-10-13: "ek center ma, baki
 * side py 1 1", the rest a swipe away, instead of a wall of tall pictures).
 *
 * Without JavaScript it is a plain row that scrolls sideways and stops on
 * each phone (scroll snap). carousel.js adds the depth: the phone in the
 * middle full size, its neighbours turned and smaller, the rest fading out,
 * plus the arrows, the counter and the group chips. With reduced motion
 * nothing turns or scales; the row still scrolls and the arrows still work.
 *
 * Every phone has one frame size (a 390 x 844 screen); a taller capture shows
 * its top, a shorter one sits on the frame's own colour, and the whole
 * capture opens in the enlarge dialog (app.js).
 */

.screen-carousel {
  --slide-w: clamp(214px, 62vw, 286px);
  --slide-gap: clamp(14px, 3vw, 34px);
  --frame-bg: #f4f7f5;
  --frame-edge: rgb(255 255 255 / 22%);
  --rail: rgb(255 255 255 / 16%);
  --rail-fill: var(--lime);
  --control-bg: rgb(255 255 255 / 10%);
  --control-edge: rgb(255 255 255 / 26%);
  --control-ink: #fff;
  --chip-ink: #d8e7e1;
  --chip-on-bg: var(--lime);
  --chip-on-ink: #0b3d37;
  margin-top: 18px;
  position: relative;
}

/* On a light section (the shops page's workspace). */
.screen-carousel.on-light {
  --frame-edge: rgb(18 85 77 / 18%);
  --rail: rgb(18 85 77 / 14%);
  --rail-fill: var(--teal);
  --control-bg: #fff;
  --control-edge: rgb(18 85 77 / 22%);
  --control-ink: var(--teal);
  --chip-ink: var(--teal);
  --chip-on-bg: var(--teal);
  --chip-on-ink: #fff;
}

/* The frame takes the app's own background in each look (app.js sets it). */
[data-shots="dark"] .screen-carousel {
  --frame-bg: #12181a;
}

/* --- jump to a group ----------------------------------------------------- */

.carousel-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 0 auto 6px;
  max-width: 760px;
}

.carousel-groups button {
  background: transparent;
  border: 1px solid var(--control-edge);
  border-radius: 999px;
  color: var(--chip-ink);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  min-height: 40px;
  padding: 7px 16px;
  transition:
    background 260ms ease,
    color 260ms ease,
    border-color 260ms ease;
}

.carousel-groups button:hover {
  border-color: var(--chip-on-bg);
}

.carousel-groups button[aria-pressed="true"] {
  background: var(--chip-on-bg);
  border-color: var(--chip-on-bg);
  color: var(--chip-on-ink);
}

/* --- the row ------------------------------------------------------------- */

.carousel-viewport {
  position: relative;
  /* The far phones fade into the section instead of being cut off. */
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 14%, #000 86%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 14%, #000 86%, transparent 100%);
}

.carousel-track {
  align-items: flex-start;
  display: flex;
  gap: var(--slide-gap);
  list-style: none;
  margin: 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 26px calc(50% - var(--slide-w) / 2) 22px;
  perspective: 1400px;
  /* Slides measure their place from here (carousel.js). */
  position: relative;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.carousel-track::-webkit-scrollbar {
  display: none;
}

.carousel-track:focus-visible {
  outline: 3px solid var(--rail-fill);
  outline-offset: -3px;
}

.carousel-track.dragging {
  cursor: grabbing;
  scroll-snap-type: none;
}

.carousel-track.dragging * {
  pointer-events: none;
}

/* The figures keep the classes the rest of the page knows them by
   (.screen-card, .workspace-phone); here they are slides, so the grid
   cards' own boxes are undone. */
.screen-carousel .carousel-slide {
  background: none;
  border: 0;
  border-radius: 0;
  display: block;
  flex: 0 0 var(--slide-w);
  margin: 0;
  overflow: visible;
  padding: 0;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  transform-origin: 50% 42%;
  transition: none;
  will-change: transform, opacity;
}

.screen-carousel .carousel-slide:hover {
  background: none;
  transform: none;
}

.carousel-slide .carousel-frame {
  aspect-ratio: 390 / 844;
  background: var(--frame-bg);
  border: 0;
  border-radius: 30px;
  box-shadow:
    0 0 0 7px #0d1b19,
    0 0 0 8px var(--frame-edge),
    0 30px 60px -24px rgb(0 0 0 / 55%);
  cursor: pointer;
  display: block;
  margin: 0 auto;
  overflow: hidden;
  padding: 0;
  position: relative;
  width: 100%;
}

/* The phone's speaker slot, over the top of the capture. */
.carousel-slide .carousel-frame::before {
  background: #0d1b19;
  border-radius: 0 0 12px 12px;
  content: "";
  height: 14px;
  left: 50%;
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  width: 34%;
  z-index: 1;
}

/* A hint that a tall capture goes on: it opens whole when tapped. */
.carousel-slide .carousel-frame::after {
  background: linear-gradient(180deg, transparent 0%, rgb(0 0 0 / 22%) 100%);
  bottom: 0;
  content: "";
  height: 18%;
  left: 0;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  right: 0;
  transition: opacity 300ms ease;
}

.carousel-slide.is-tall .carousel-frame::after {
  opacity: 1;
}

.screen-carousel .carousel-slide .carousel-frame img {
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  display: block;
  height: auto;
  max-width: none;
  object-fit: initial;
  transform: none;
  width: 100%;
}

.carousel-slide figcaption {
  margin: 20px auto 0;
  max-width: 300px;
  padding: 0;
  text-align: center;
}

.carousel-slide figcaption h3 {
  font-size: 19px;
  margin: 0 0 4px;
}

.carousel-slide figcaption p {
  font-size: 15px;
  line-height: 1.5;
  margin: 0;
}

.carousel-slide .small-label {
  display: block;
  margin-bottom: 4px;
}

/* --- arrows, counter and the rail ---------------------------------------- */

.carousel-arrow {
  align-items: center;
  backdrop-filter: blur(8px);
  background: var(--control-bg);
  border: 1px solid var(--control-edge);
  border-radius: 50%;
  box-shadow: 0 12px 30px -16px rgb(0 0 0 / 50%);
  color: var(--control-ink);
  cursor: pointer;
  display: none;
  height: 54px;
  justify-content: center;
  position: absolute;
  top: calc(26px + var(--slide-w) * 844 / 390 / 2);
  transform: translateY(-50%);
  transition:
    transform 220ms ease,
    opacity 220ms ease;
  width: 54px;
  z-index: 3;
}

.carousel-arrow svg {
  height: 22px;
  width: 22px;
}

.carousel-arrow:hover {
  transform: translateY(-50%) scale(1.08);
}

.carousel-arrow:disabled {
  cursor: default;
  opacity: 0.35;
  transform: translateY(-50%);
}

.carousel-arrow.prev {
  left: max(6px, calc(50% - var(--slide-w) * 1.5 - var(--slide-gap) - 40px));
}

.carousel-arrow.next {
  right: max(6px, calc(50% - var(--slide-w) * 1.5 - var(--slide-gap) - 40px));
}

.carousel-foot {
  align-items: center;
  display: none;
  gap: 16px;
  justify-content: center;
  margin: 6px auto 0;
  max-width: 420px;
}

.carousel-rail {
  background: var(--rail);
  border-radius: 999px;
  flex: 1;
  height: 4px;
  overflow: hidden;
}

.carousel-rail span {
  background: var(--rail-fill);
  border-radius: inherit;
  display: block;
  height: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 300ms ease;
}

.carousel-count {
  color: var(--chip-ink);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  min-width: 4.5em;
  text-align: right;
}

/* carousel.js shows the controls once it runs. */
.screen-carousel.is-live .carousel-arrow {
  display: inline-flex;
}

.screen-carousel.is-live .carousel-foot {
  display: flex;
}

.screen-carousel.is-live .carousel-track {
  cursor: grab;
}

/* The caption of a phone not in the middle stays quiet. */
.screen-carousel.is-live .carousel-slide figcaption {
  transition: opacity 300ms ease;
}

.screen-carousel.is-live .carousel-slide:not(.is-current) figcaption {
  opacity: 0.35;
}

@media (max-width: 640px) {
  .carousel-arrow {
    height: 44px;
    width: 44px;
  }

  .carousel-arrow.prev {
    left: 4px;
  }

  .carousel-arrow.next {
    right: 4px;
  }

  .carousel-viewport {
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 7%, #000 93%, transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 7%, #000 93%, transparent 100%);
  }

  .carousel-groups {
    flex-wrap: nowrap;
    justify-content: flex-start;
    margin-inline: -16px;
    overflow-x: auto;
    padding: 2px 16px 6px;
    scrollbar-width: none;
  }

  .carousel-groups button {
    flex: 0 0 auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .carousel-groups button,
  .carousel-arrow,
  .carousel-rail span,
  .screen-carousel.is-live .carousel-slide figcaption {
    transition: none;
  }
}
