/* ============================================================
   Phone walkthrough (shared preview chrome)
   ============================================================ */
.phone-preview {
  background: var(--white);
  border-block: 1px solid var(--line);
}
/* Adjacent preview sections share one divider instead of a double rule. */
.phone-preview + .phone-preview {
  border-top: none;
}
.pw-head {
  text-align: center;
  padding-block: clamp(3rem, 7vh, 5.5rem) 0;
}
.pw-head h2 {
  margin-top: 0.9rem;
  font-family: var(--font-serif);
  font-size: clamp(1.9rem, 3.6vw, 2.8rem);
  font-weight: 500;
}
.pw-head .section-sub { margin-top: 1rem; }

.pw-scroller { position: relative; }

.pw-stage {
  /* vh is the universally-supported base; svh is layered on via @supports below
     so browsers without small-viewport units degrade gracefully instead of
     dropping --phone-h (which would collapse the phone and rail). */
  --phone-h: min(660px, 78vh);
  --phone-w: calc(var(--phone-h) * 0.472);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: clamp(1rem, 2.5vw, 2.75rem);
  padding: 1.5rem clamp(1rem, 4vw, 3rem);
  overflow: hidden;
}

/* ---------- Page submenu + appearance toggle ---------- */
/* Desktop: a left-hand column with the page buttons and the dark/light pill;
   mobile turns it into the pinned control bar. */
.pw-controls {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.9rem;
  width: 8.5rem;
  flex-shrink: 0;
}
.pw-submenu {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  width: 100%;
}
.pw-page {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  color: var(--muted);
  font-family: inherit;
  font-size: 0.86rem;
  cursor: pointer;
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}
.pw-page:hover { border-color: var(--gold-soft); color: var(--ink); }
.pw-page.is-active {
  background: var(--gold-faint);
  border-color: var(--gold-soft);
  color: var(--ink);
  font-weight: 500;
}

/* ---------- Rail ---------- */
.pw-rail {
  position: relative;
  list-style: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: var(--phone-h);
  width: 13rem;
  flex-shrink: 0;
  padding: 0;
}
.pw-rail-track,
.pw-rail-fill {
  position: absolute;
  left: 15px;
  top: 15px;
  width: 2px;
  transform: translateX(-50%);
  border-radius: 2px;
}
.pw-rail-track { bottom: 15px; background: var(--line); }
.pw-rail-fill { height: 0; background: var(--gold); transition: height 0.08s linear; }
.pw-rail li { display: flex; }
.pw-dot {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  color: var(--muted);
  font-family: inherit;
}
.pw-dot-num {
  position: relative;
  z-index: 1;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1.5px solid var(--gold-soft);
  background: var(--white);
  font-size: 0.8rem;
  color: var(--muted);
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}
.pw-dot-label {
  font-size: 0.9rem;
  line-height: 1.25;
  opacity: 0.65;
  transition: color 0.25s ease, opacity 0.25s ease;
}
.pw-dot:hover .pw-dot-num { border-color: var(--gold); color: var(--gold); }
.pw-dot:hover .pw-dot-label { opacity: 0.95; }
.pw-dot.is-active .pw-dot-num {
  background: var(--gold);
  border-color: var(--gold);
  color: #fff;
  transform: scale(1.08);
  box-shadow: 0 0 0 4px var(--gold-faint);
}
.pw-dot.is-active .pw-dot-label { color: var(--ink); opacity: 1; font-weight: 500; }

/* ---------- Phone ---------- */
.pw-phone {
  position: relative;
  width: var(--phone-w);
  height: var(--phone-h);
  flex-shrink: 0;
  padding: 11px;
  border-radius: 42px;
  background: linear-gradient(145deg, #3a3b40 0%, #17181b 100%);
  box-shadow:
    inset 0 0 0 1.5px rgba(255, 255, 255, 0.14),
    0 0 0 1.5px #7c7d83,
    0 30px 60px rgba(16, 42, 67, 0.28);
}
.pw-island {
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  width: 82px;
  height: 22px;
  background: #0b0b0d;
  border-radius: 12px;
  z-index: 3;
}
.pw-screen {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 32px;
  overflow: hidden;
  background: #000;
}
.pw-shot {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: auto;
  max-width: none;
  opacity: 0;
  will-change: transform, opacity;
  transition: opacity 0.5s ease;
}
.pw-shot.is-active { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .pw-shot { transition: opacity 0.2s linear; }
}
/* Expand affordance for the mobile lightbox (hidden on desktop) */
.pw-expand { display: none; }
/* Dark/light toggle: lives in the controls column, styled to match the chips */
.pw-mode {
  display: inline-flex;
  align-self: flex-start;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--white);
  box-shadow: inset 0 0 0 1px var(--line);
}
.pw-mode button {
  border: none;
  cursor: pointer;
  padding: 0.32rem 0.85rem;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  transition: background 0.2s ease, color 0.2s ease;
}
.pw-mode button:hover { color: var(--ink); }
.pw-mode button.is-active { background: var(--gold); color: #fff; }

/* ---------- Panel ---------- */
.pw-panel {
  position: relative;
  width: min(330px, 26vw);
  min-width: 240px;
  height: 300px;
  flex-shrink: 0;
}
.pw-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}
.pw-slide.is-active { opacity: 1; transform: none; pointer-events: auto; }
.pw-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1rem;
}
.pw-eyebrow::before {
  content: "";
  width: 1.8rem;
  height: 2px;
  background: var(--gold);
  border-radius: 2px;
}
/* "/ 08 —" stop counter: mobile-only (replaces the hidden rail's orientation) */
.pw-eyebrow-count { display: none; }
.pw-slide h3 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(1.5rem, 2.4vw, 1.9rem);
  line-height: 1.24;
  margin-bottom: 0.85rem;
}
.pw-slide p {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

@media (prefers-reduced-motion: reduce) {
  .pw-shot { transition: none !important; }
  .pw-slide { transition: opacity 0.2s linear; transform: none; }
  .pw-rail-fill { transition: none; }
}

/* ---------- Narrow desktop / tablet: controls become a top chip row ---------- */
@media (max-width: 1080px) {
  .pw-stage { flex-wrap: wrap; row-gap: 1.3rem; }
  .pw-controls {
    flex: 0 0 100%;
    order: -1;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    width: auto;
    gap: 0.5rem 0.9rem;
  }
  .pw-submenu {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    width: auto;
  }
  .pw-mode { align-self: center; }
  .pw-page { width: auto; border-radius: 999px; padding: 0.4rem 0.95rem; font-size: 0.82rem; }
}

/* ---------- Mobile ---------- */
@media (max-width: 860px) {
  .pw-stage {
    /* Phone gets whatever is left after the fixed costs: control bar, gaps,
       padding and the longest description (~330px budget at mobile type
       sizes). Keeps the description from ever scrolling internally. */
    --phone-h: clamp(280px, calc(100vh - var(--pw-hh, 60px) - 330px), 600px);
    --phone-w: calc(var(--phone-h) * 0.472);
    /* Pin below the sticky site header so the control bar stays visible */
    top: var(--pw-hh, 60px);
    height: calc(100vh - var(--pw-hh, 60px));
    flex-direction: column;
    justify-content: flex-start;
    gap: 0.8rem;
    padding: 0.9rem 1.25rem 0.75rem;
  }
  /* Control bar: page chips + dark/light toggle in one pinned row */
  .pw-controls {
    order: -1;
    flex: 0 0 auto;
    gap: 0.5rem 0.7rem;
  }
  .pw-submenu { gap: 0.4rem; }
  .pw-rail { display: none; }
  .pw-phone { order: 1; }
  .pw-mode button { padding: 0.3rem 0.8rem; font-size: 0.7rem; }
  .pw-expand {
    display: grid;
    place-items: center;
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 3;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(20, 20, 22, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
    color: rgba(255, 255, 255, 0.85);
    pointer-events: none;
  }
  .pw-expand svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
  }
  .pw-panel {
    order: 3;
    flex: 1 1 auto;
    width: 100%;
    max-width: 440px;
    min-width: 0;
    min-height: 0;
    height: auto;
    margin-block: 0.1rem 0;
    text-align: center;
  }
  .pw-slide {
    /* Safety net only for extreme viewports; content is sized to fit */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
  }
  .pw-eyebrow { margin-bottom: 0.7rem; }
  .pw-eyebrow-count { display: inline; }
  .pw-slide h3 { font-size: 1.2rem; margin-bottom: 0.5rem; }
  .pw-slide p { font-size: 0.9rem; line-height: 1.55; }
}

/* ---------- Small-viewport units where supported (fits the pinned stage to
   the visible area even with mobile browser toolbars showing) ---------- */
@supports (height: 1svh) {
  .pw-stage {
    --phone-h: min(660px, 78svh);
    height: 100svh;
  }
  @media (max-width: 860px) {
    .pw-stage {
      --phone-h: clamp(280px, calc(100svh - var(--pw-hh, 60px) - 330px), 600px);
      height: calc(100svh - var(--pw-hh, 60px));
    }
  }
}

/* ---------- Mobile lightbox (opened by tapping the phone screen) ---------- */
.pw-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  background: rgba(10, 10, 12, 0.97);
}
.pw-lightbox.is-open { display: block; }
.pw-lightbox-scroll {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.pw-lightbox-scroll img {
  display: block;
  width: 100%;
  max-width: none;
  height: auto;
}
.pw-lightbox-close {
  position: absolute;
  top: calc(0.9rem + env(safe-area-inset-top, 0px));
  right: 0.9rem;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  background: rgba(20, 20, 22, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
  color: #fff;
}
.pw-lightbox-close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}
.pw-lightbox-hint {
  position: absolute;
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  margin: 0;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background: rgba(20, 20, 22, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  white-space: nowrap;
  pointer-events: none;
}
.pw-lightbox-lock,
.pw-lightbox-lock body { overflow: hidden; }

/* Frames mode: each stop is a full-screen phone capture (not a tall pan strip). */
.pw-scroller[data-pw-mode="frames"] .pw-shot {
  height: 100%;
  width: 100%;
  object-fit: cover;
  object-position: top center;
}
