/* Daylight theme — pages/home. Split from daylight.css (see docs/adr/0002). */

/* ---------- Hero photo deck (real unit photos, portrait) ----------
   Two layouts share one markup. Default (no JS): a scroll-snap strip, so
   slides stay swipeable and crawlable. Under html.js the strip becomes a
   layered pile of prints — js/carousel.js assigns stack-N depth classes.
   Strip: bottom padding + negative margin give the mat shadow room to
   render inside the overflow clip without adding vertical scroll. */
.carousel-track {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding-bottom: 28px;
  margin-bottom: -28px;
}

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

.carousel-track:focus-visible {
  outline: 2px solid var(--c-gran);
  outline-offset: 2px;
}

.carousel-slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.carousel-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding: 12px 4px 0;
}

.carousel-nav button {
  font-size: 1rem;
  line-height: 1;
  padding: 7px 13px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-sm);
  background: var(--c-vit);
  color: var(--c-granit);
  transition: border-color var(--speed), color var(--speed);
}

.carousel-nav button:hover {
  border-color: var(--c-gran);
  color: var(--c-gran);
}

/* Position readout is data — mono facts voice */
.carousel-count {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--c-ink-muted);
}

/* --- JS on: the strip becomes a layered deck of prints --- */
html.js .hero-carousel {
  --stack-x: 16px; /* per-layer offset of the pile */
  --stack-y: 12px;
  --stack-n: 2;    /* edges visible behind the front card */
}

html.js .carousel-track {
  display: block;
  position: relative;
  overflow: visible;
  padding: 0;
  margin: 0;
  touch-action: pan-y;
}

/* First card stays in flow and sizes the deck (all photos share the same
   ratio); the others layer over it. Depth is transform-only. */
html.js .carousel-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  transition: transform 0.55s var(--ease), opacity 0.4s var(--ease);
}

html.js .carousel-slide:first-child {
  position: relative;
}

/* Keep z-indexes below the sticky topnav (z 40) */
html.js .stack-0 { transform: none; z-index: 9; }
html.js .stack-1 { transform: translate(var(--stack-x), var(--stack-y)) scale(0.99); z-index: 8; }
html.js .stack-2 { transform: translate(calc(2 * var(--stack-x)), calc(2 * var(--stack-y))) scale(0.98); z-index: 7; }

/* Third edge only shows on wide screens; buried cards wait at the back */
html.js .stack-3,
html.js .stack-hidden {
  transform: translate(calc(2 * var(--stack-x)), calc(2 * var(--stack-y))) scale(0.98);
  opacity: 0;
  z-index: 1;
}

/* Outgoing front card slides off the pile while fading */
html.js .carousel-slide.is-leaving {
  transform: translate(-40px, 6px);
  opacity: 0;
  z-index: 10;
}

/* Make room below for the fanned edges */
html.js .carousel-nav {
  padding-top: calc(var(--stack-y) * var(--stack-n) + 14px);
}

@media (prefers-reduced-motion: reduce) {
  html.js .carousel-slide {
    transition: none;
  }
}

/* Wide desktops: slightly wider hero and a deeper, wider fan — the deck
   spreads into the right margin that used to sit empty on 1920px screens */
@media (min-width: 1440px) {
  .hero .container {
    width: min(1340px, 100% - 2 * var(--gutter));
  }

  html.js .hero-carousel {
    --stack-x: 44px;
    --stack-y: 16px;
    --stack-n: 3;
  }

  html.js .stack-3 {
    transform: translate(calc(3 * var(--stack-x)), calc(3 * var(--stack-y))) scale(0.97);
    opacity: 1;
    z-index: 6;
  }
}

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

  /* Portrait photos: square crop keeps the mobile hero short without
     gutting the image the way the old 3:2 landscape frame would */
  .hero-photo img {
    aspect-ratio: 1 / 1;
  }
}
