/* AF Product Story — Apple-style scroll narrative */

:root {
  /* Align with site-wide About / globals (styles.css) */
  --bg: #f2ebe1;
  --accent: #e37222;
  --text: #111;
  --white: #ffffff;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: auto;
}

body.page-why.page-why-story {
  --page-bg: var(--bg);
  margin: 0;
  font-family: var(--font-sans, "Nunito Sans", system-ui, sans-serif);
  background: var(--page-bg, var(--bg));
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ----- Hero (Why AF: text on page background; 3D story follows) ----- */
body.page-why.page-why-story .hero.hero--intro {
  position: relative;
  width: 100%;
  background: var(--page-bg, var(--bg));
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Clear fixed pill nav (~16 + 65 + 16) + comfortable gap before headline */
  padding: calc(16px + 65px + 28px) max(1.25rem, env(safe-area-inset-right, 0px))
    1rem max(1.25rem, env(safe-area-inset-left, 0px));
  text-align: center;
}

body.page-why.page-why-story .hero__intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: min(36rem, 100%);
  margin: 0;
  padding: 0;
}

body.page-why.page-why-story .hero__title {
  margin: 0;
  font-size: clamp(2rem, 5.5vw, 2.85rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.12;
  color: var(--text);
  text-align: center;
  text-wrap: balance;
  max-width: 100%;
}

body.page-why.page-why-story .hero__subtitle {
  margin: 0.45rem 0 0;
  font-size: clamp(0.95rem, 2.2vw, 1.15rem);
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.35;
  color: rgba(17, 17, 17, 0.68);
  text-align: center;
  text-wrap: balance;
  max-width: 22rem;
}

/* ----- Scroll story (sticky viewport; hotspots drive copy + camera) ----- */
.story-scroll {
  position: relative;
  height: 125vh;
  scroll-margin-top: 96px;
}

.story-sticky {
  position: sticky;
  top: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: stretch;
  padding: 0;
  width: 100%;
  isolation: isolate;
  box-sizing: border-box;
}

/* Model + copy: stacked on small screens; side‑by‑side on desktop */
.story-layout {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  max-width: none;
  margin: 0;
}

.story-img-column {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-height: min(52vh, 420px);
  width: 100%;
  display: flex;
  justify-content: stretch;
  align-items: stretch;
}

.story-visual {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: none;
  margin: 0;
  min-height: min(56vh, 520px);
  aspect-ratio: auto;
  will-change: transform;
}

.story-visual__stack {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.story-visual__model {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  min-width: 100%;
  min-height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  background: transparent;
  --poster-color: transparent;
  /* Keep all four hotspots visible / hit-testable when they face away from the camera */
  --min-hotspot-opacity: 1;
  z-index: 1;
  /* Hotspots need hits; camera stays script-driven (no camera-controls). */
  pointer-events: auto;
  touch-action: pan-y;
}

/* 3D hotspots (children of model-viewer): move with the GLB when the camera orbits */
.story-visual__model .story-hotspot {
  display: block;
  box-sizing: border-box;
  min-width: 32px;
  min-height: 32px;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: box-shadow 0.2s ease, filter 0.2s ease;
}

.story-visual__model .story-hotspot:hover,
.story-visual__model .story-hotspot:focus-visible {
  filter: brightness(1.08);
  box-shadow: 0 0 0 3px rgba(227, 114, 34, 0.45);
  outline: none;
}

.story-visual__model .story-hotspot:active {
  filter: brightness(0.95);
}

@media (min-width: 769px) {
  .story-visual__model .story-hotspot {
    min-width: 34px;
    min-height: 34px;
    width: 34px;
    height: 34px;
  }
}

.story-visual__hint {
  position: absolute;
  top: calc(16px + 65px + 6px + 14px);
  left: 50%;
  transform: translateX(-50%);
  bottom: auto;
  z-index: 5;
  margin: 0;
  padding: 0.35rem 0.65rem;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(26, 26, 46, 0.45);
  pointer-events: none;
  user-select: none;
}

.story-copy {
  --story-copy-pad: clamp(0.9rem, 2.5vw, 1.35rem);
  --story-copy-pad-bottom: calc(var(--story-copy-pad) + 0.85rem);
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  width: 100%;
  align-self: stretch;
  padding-top: max(var(--story-copy-pad), env(safe-area-inset-top, 0px));
  padding-right: max(var(--story-copy-pad), env(safe-area-inset-right, 0px));
  padding-bottom: max(var(--story-copy-pad-bottom), env(safe-area-inset-bottom, 0px));
  padding-left: max(var(--story-copy-pad), env(safe-area-inset-left, 0px));
  background: var(--page-bg, var(--bg));
  pointer-events: auto;
}

/* Feature card: centered in the copy strip (below model on phone, right column on desktop) */
.story-copy__slot {
  position: relative;
  top: auto;
  right: auto;
  bottom: auto;
  left: auto;
  transform: none;
  opacity: 1;
  visibility: visible;
  pointer-events: none;
  z-index: 1;
  width: min(22rem, 100%);
  max-width: 100%;
  margin: 0 auto;
  min-height: min(12rem, 28vh);
  padding-bottom: 0.35rem;
}

/* No feature card until the user taps a hotspot (initial sofa-only view) */
.story-copy__slot.story-copy__slot--hidden {
  opacity: 0;
  visibility: hidden;
  min-height: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.feature-panel {
  --feature-pad: clamp(1rem, 2.2vw, 1.25rem);
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  opacity: 0;
  transform: none;
  pointer-events: none;
  transition: opacity 0.45s ease;
  z-index: 0;
  padding: var(--feature-pad);
  border-radius: 24px;
  /* Same glass as floating nav (.desk-header in styles.css) */
  background: rgba(255, 255, 255, 0.26);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  overflow: auto;
  overflow-x: hidden;
  scroll-padding-bottom: 1rem;
  padding-bottom: calc(var(--feature-pad) + 0.85rem);
}

.feature-panel.is-active {
  opacity: 1;
  transform: none;
  /* Let taps pass through to the 3D hotspots; card is display-only. */
  pointer-events: none;
  z-index: 1;
}

.feature-panel__title {
  margin: 0 0 0.65rem;
  font-size: clamp(1.35rem, 4.1vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  font-family: var(--font-heading, "Host Grotesk", system-ui, sans-serif);
  color: var(--text);
  line-height: 1.1;
}

.feature-panel__list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 15px;
  line-height: 1.5;
}

.feature-panel__list li {
  position: relative;
  padding-left: 1.1rem;
  margin-bottom: 0.72rem;
  opacity: 0;
  transform: translateY(8px);
}

.feature-panel__list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.feature-panel.is-active .feature-panel__list li {
  animation: bulletIn 0.5s ease forwards;
}

.feature-panel.is-active .feature-panel__list li:nth-child(1) {
  animation-delay: 0.08s;
}

.feature-panel.is-active .feature-panel__list li:nth-child(2) {
  animation-delay: 0.18s;
}

.feature-panel.is-active .feature-panel__list li:nth-child(3) {
  animation-delay: 0.28s;
}

.feature-panel.is-active .feature-panel__list li:nth-child(4) {
  animation-delay: 0.38s;
}

@keyframes bulletIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  .story-img-column {
    min-height: min(48vh, 380px);
  }

  .story-visual {
    min-height: min(50vh, 440px);
  }
}

@media (min-width: 769px) {
  .story-layout {
    flex-direction: row;
    align-items: stretch;
  }

  .story-img-column {
    flex: 1 1 58%;
    min-width: 0;
    min-height: 0;
  }

  .story-visual {
    flex: 1;
    min-height: min(100dvh, 100vh);
  }

  .story-copy {
    flex: 0 0 clamp(17.5rem, 30vw, 24rem);
    width: auto;
    max-width: none;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: min(100dvh, 100vh);
  }

  .story-copy__slot {
    width: 100%;
    max-width: none;
    margin: 0;
    min-height: min(11rem, 22vh);
  }
}

/* ----- Configurations (infinite horizontal scroll) ----- */
.config {
  padding: 2.75rem 0 1.75rem;
  margin: 0 auto;
  overflow: hidden;
}

.config__headline {
  margin: 0 0 1.35rem;
  padding: 0 1.5rem;
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
  font-size: clamp(1.85rem, 4vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  text-align: center;
}

.config-marquee__live {
  margin: 0 auto 1rem;
  padding: 0 1.25rem;
  max-width: 42rem;
  min-height: 1.45em;
  text-align: center;
  font-family: var(--font-heading, "Host Grotesk", system-ui, sans-serif);
  font-size: clamp(1.05rem, 2.4vw, 1.35rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.config-marquee {
  overflow: hidden;
  padding: 0.5rem 0;
  -webkit-mask-image: linear-gradient(
    90deg,
    transparent,
    #000 10%,
    #000 90%,
    transparent
  );
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}

.config-marquee__track {
  display: flex;
  gap: clamp(1.25rem, 3vw, 2rem);
  width: max-content;
  animation: configMarquee 50s linear infinite;
  will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
  .config-marquee__track {
    animation: none;
  }
}

@keyframes configMarquee {
  to {
    transform: translateX(-50%);
  }
}

.config-marquee__item {
  flex: 0 0 auto;
  width: min(72vw, 340px);
  margin: 0;
  text-align: center;
}

.config-marquee__item img {
  width: 100%;
  height: auto;
  border-radius: 6px;
  display: block;
}

.config-marquee__caption {
  margin: 0.85rem 0 0;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.config__body {
  margin: 1.1rem auto 0;
  padding: 0 1.5rem;
  max-width: 42rem;
  text-align: center;
  font-size: 1.05rem;
  line-height: 1.7;
  color: rgba(26, 26, 46, 0.82);
}

/* ----- Lifestyle ----- */
.lifestyle {
  position: relative;
  margin-top: 0;
  min-height: min(58vh, 440px);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.lifestyle__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lifestyle__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(26, 26, 46, 0.72) 0%,
    rgba(26, 26, 46, 0.25) 45%,
    rgba(26, 26, 46, 0.05) 100%
  );
  pointer-events: none;
}

.lifestyle__content {
  position: relative;
  z-index: 1;
  padding: 2rem 1.25rem 1.65rem;
  max-width: 640px;
}

.lifestyle__title {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  color: var(--white);
  line-height: 1.1;
}

.lifestyle__sub {
  margin: 0.65rem 0 0;
  font-size: clamp(1rem, 2vw, 1.2rem);
  font-weight: 400;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.92);
  max-width: 28rem;
}

/* Desktop: no hero photo — text on page background. Tablet / phone keep image + overlay. */
@media (min-width: 1024px) {
  .lifestyle {
    min-height: 0;
    align-items: center;
    justify-content: center;
    background: var(--page-bg, var(--bg));
    padding: 1.5rem 0;
  }

  .lifestyle__img,
  .lifestyle__overlay {
    display: none;
  }

  .lifestyle__content {
    padding: 1.5rem 1.25rem;
    max-width: 42rem;
    margin: 0 auto;
    text-align: center;
  }

  .lifestyle__title {
    color: var(--text);
  }

  .lifestyle__sub {
    margin-left: auto;
    margin-right: auto;
    color: rgba(17, 17, 17, 0.72);
  }
}

/* ----- CTA / Footer (orange button: .af-shop-cta in styles.css) ----- */
.cta {
  padding: 2rem 1.5rem 2.75rem;
  text-align: center;
}

.cta__btn {
  margin-top: 0;
}

.cta__tagline {
  margin: 1rem 0 0;
  font-size: 0.95rem;
  color: rgba(17, 17, 17, 0.55);
  letter-spacing: 0.02em;
}
