/* Sections below the hero: 3D shelf, how-it-works card flip, step stack, features, FAQ, orbit CTA, footer. */

.library, .steps, .features, .faq, .cta, .foot { width: min(var(--max), calc(100% - 2 * var(--margin))); margin-inline: auto; }

/* ---- Library: horizontal shelf; cards turn toward you as they reach the middle ---- */
.library { padding-top: clamp(72px, 10vw, 140px); }
.library__head { display: grid; gap: 16px; max-width: 60ch; }
.library h2 { font-size: var(--step-head); }
.library__head p { color: var(--ink-soft); max-width: 46ch; }
.library__more { margin-top: 24px; color: var(--ink-soft); max-width: 60ch; }

.shelf { position: relative; margin-top: 36px; }
.tiles {
  list-style: none; margin: 0; padding: 24px 0 28px;
  display: grid; grid-auto-flow: column; grid-auto-columns: clamp(232px, 24vw, 320px); gap: clamp(14px, 1.6vw, 24px);
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: none;
  /* bleed to the screen edges, keep the first card on the page margin */
  margin-inline: calc(50% - 50vw); padding-inline: max(var(--margin), calc(50vw - var(--max) / 2));
  scroll-padding-inline: max(var(--margin), calc(50vw - var(--max) / 2));
}
.tiles::-webkit-scrollbar { display: none; }
.tiles li { scroll-snap-align: start; }
.tile {
  display: block; width: 100%; padding: 0; border: 0; text-align: left; background: none;
  border-radius: var(--r-surface); overflow: hidden;
  box-shadow: 0 24px 40px -28px rgba(var(--shadow), .55);
  transition: transform .45s var(--spring), box-shadow .45s var(--ease);
}
.tile__img { display: block; background: var(--paper); overflow: hidden; }
.tile img { aspect-ratio: 1; width: 100%; object-fit: cover; transition: transform .7s var(--ease); }
.tile:hover { transform: translateY(-6px); box-shadow: 0 34px 50px -28px rgba(var(--shadow), .65); }
.tile:hover img { transform: scale(1.06); }
.tile:active { transform: scale(.97); }
.tile__strip {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; min-height: 92px; padding: 14px 16px;
  font-size: var(--step-small); font-variant-numeric: tabular-nums; transition: background-color .3s, color .3s;
}
.tile__strip b { font-weight: 650; font-size: var(--step-body); }
.tile__strip span:nth-child(2) { align-self: center; opacity: .8; }
.tile__strip span:nth-child(3) { grid-column: 1 / -1; opacity: .8; }
.tiles li:nth-child(4n+1) .tile__strip { background: #f07f23; color: #1f1c19; }
.tiles li:nth-child(4n+2) .tile__strip { background: #24201c; color: #f3f3f1; }
.tiles li:nth-child(4n+3) .tile__strip { background: var(--tone); color: var(--ink); }
.tiles li:nth-child(4n+4) .tile__strip { background: #8f4410; color: #f3f3f1; }
.tile[aria-pressed=true] { outline: 3px solid var(--accent); outline-offset: 4px; }
.tile[aria-pressed=true] .tile__strip { background: #1f1c19; color: #f07f23; }
.shelf__nav { display: flex; gap: 8px; justify-content: flex-end; }


/* ---- How it works: orange words, dark stage, the screen turns over for each stop ---- */
.how {
  width: min(var(--max), calc(100% - 2 * var(--margin))); margin: clamp(88px, 12vw, 160px) auto 0;
  display: grid; grid-template-columns: 1fr 1fr; border-radius: var(--r-surface); overflow: hidden;
  min-height: min(88svh, 820px);
}
.how__copy {
  background: #f07f23; color: #1f1c19; padding: clamp(32px, 5vw, 72px);
  display: grid; grid-template-rows: 1fr auto auto; gap: 24px;
}
.how__body { display: grid; align-content: start; gap: 22px; }
.how__desc { font-size: var(--step-lead); line-height: 1.4; max-width: 30ch; }
.how__strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; max-width: 520px; margin-top: 8px; perspective: 800px; }
.how__strip img {
  aspect-ratio: 1; width: 100%; object-fit: cover; border-radius: var(--r-media); background: #fbfaf7;
  box-shadow: 0 18px 30px -18px rgba(31, 28, 25, .6);
}
.how__strip.is-swapping img { animation: strip-out .28s var(--ease) both; }
.how__strip.is-entering img { animation: strip-in .6s var(--spring) both; }
.how__strip img:nth-child(2) { animation-delay: .05s; }
.how__strip img:nth-child(3) { animation-delay: .1s; }
.how__strip img:nth-child(4) { animation-delay: .15s; }
@keyframes strip-out { to { opacity: 0; transform: translateY(-14px) rotateX(40deg); } }
@keyframes strip-in { from { opacity: 0; transform: translateY(24px) rotateX(-50deg) scale(.9); } }
.how__desc.is-swapping { animation: words-out .28s var(--ease) both; }
.how__desc.is-entering { animation: words-in .6s var(--ease) both .06s; }
.how__text { font-size: var(--step-display); font-weight: 650; font-stretch: 112%; letter-spacing: -0.035em; line-height: 1; max-width: 11ch; text-wrap: balance; }
.how__text.is-swapping { animation: words-out .28s var(--ease) both; }
.how__text.is-entering { animation: words-in .6s var(--ease) both; }
@keyframes words-out { to { opacity: 0; transform: translateY(-18px) rotateX(30deg); } }
@keyframes words-in { from { opacity: 0; transform: translateY(24px) rotateX(-30deg); } }
.how__names { list-style: none; padding: 6px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; border-radius: 999px; background: rgba(31, 28, 25, .12); }
.how__names button {
  width: 100%; min-height: 48px; border: 0; border-radius: 999px; background: none; color: #1f1c19;
  font-weight: 600; white-space: nowrap; transition: background-color .3s, color .3s, transform .3s var(--spring);
}
.how__names button:hover { transform: translateY(-1px); }
.how__names button[aria-pressed=true] { background: #1f1c19; color: #f07f23; }
.how__progress { height: 3px; border-radius: 999px; overflow: hidden; }
.how__progress span { display: block; height: 100%; width: 100%; background: #1f1c19; transform-origin: left; transform: scaleX(0); }
.how__progress.is-running span { animation: fill var(--how-ms, 4500ms) linear forwards; }
@keyframes fill { to { transform: scaleX(1); } }

.how__shot { background: #24201c; display: grid; place-items: center; padding: clamp(28px, 4vw, 56px); perspective: 1200px; }
.how__card { transform-style: preserve-3d; transform: rotateX(var(--rx)) rotateY(var(--ry)); transition: transform .6s var(--ease); }
.how__card img {
  height: min(66svh, 660px); width: auto; border-radius: var(--r-surface);
  box-shadow: 0 40px 70px -30px rgba(0, 0, 0, .8);
  transition: transform .35s cubic-bezier(.55, 0, .7, .2), opacity .35s;
}
.how__card img.is-out { transform: rotateY(-85deg) scale(.92); opacity: .4; }
.how__card img.is-in { transform: rotateY(85deg) scale(.92); opacity: .4; transition: none; }
.how__card img.is-back { transition: transform .7s var(--spring), opacity .4s; }

/* ---- Step by step: the passes as a row of sheets ---- */
.steps { padding-top: clamp(88px, 12vw, 160px); display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; }
.steps__head { font-size: var(--step-display); }
.steps__intro { margin-top: 16px; color: var(--ink-soft); max-width: 44ch; }
/* The passes: sheets in a row; first and last can reach the middle of the screen */
.passes { --pw: clamp(240px, 28vw, 380px); width: 100vw; justify-self: center; }
.passes__track {
  position: relative; list-style: none; margin: 0; display: grid; grid-auto-flow: column; grid-auto-columns: var(--pw); gap: clamp(16px, 2vw, 28px);
  padding: clamp(32px, 5vw, 56px) calc(50vw - var(--pw) / 2);
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: none;
}
.passes__track::-webkit-scrollbar { display: none; }
.pass {
  position: relative; scroll-snap-align: center; aspect-ratio: 1; background: var(--paper); border-radius: var(--r-media);
  border: 1px solid rgba(31, 28, 25, .08);
  box-shadow: 0 2px 0 rgba(31, 28, 25, .06), 0 30px 50px -30px rgba(var(--shadow), .55);
  transition: box-shadow .4s var(--ease);
}
.pass img { width: 100%; height: 100%; object-fit: contain; padding: 6%; mix-blend-mode: multiply; }
.pass.is-on { box-shadow: 0 0 0 3px var(--accent), 0 40px 60px -30px rgba(var(--shadow), .6); }

.steps__list { position: relative; list-style: none; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 760px; }
.steps__list button {
  min-height: 48px; padding: 0 20px; border: 1px solid var(--line); border-radius: 999px; background: var(--raised);
  transition: background-color .25s, color .25s, transform .3s var(--spring);
}
.steps__list button:hover { transform: translateY(-2px); }
.steps__list button:active { transform: scale(.96); }
.steps__list button.is-on { background: var(--accent); border-color: var(--accent); color: #1f1c19; font-weight: 600; }

/* ---- Features: media panel (sticky, tilts) + grouped feature cards ---- */
.features {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: clamp(20px, 3vw, 48px); align-items: start;
  padding-top: clamp(88px, 12vw, 160px);
}
.features__media-wrap { grid-column: 1 / 7; position: sticky; top: 88px; perspective: 1400px; }
.features__media {
  height: min(calc(100dvh - 112px), 760px); border-radius: var(--r-surface); background: var(--paper);
  display: grid; place-items: center; padding: 28px; overflow: hidden;
  transform: rotateX(var(--rx)) rotateY(var(--ry)); transition: transform .6s var(--ease);
  box-shadow: 0 40px 70px -40px rgba(var(--shadow), .55);
}
.features__media > * { grid-area: 1 / 1; transition: opacity .3s var(--ease), transform .45s var(--ease); }
.features__media.is-swapping > * { opacity: 0; transform: translateZ(-80px) rotateY(-14deg) scale(.94); }
.features__media img { max-width: 100%; max-height: calc(min(calc(100dvh - 112px), 760px) - 56px); width: auto; height: auto; object-fit: contain; mix-blend-mode: multiply; border-radius: var(--r-media); }
.features__media img.is-tall { mix-blend-mode: normal; }
.features__media video { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--r-media); }

.features__list { grid-column: 7 / 13; display: grid; gap: 24px; padding-top: 8px; }
.features h2 { font-size: var(--step-head); max-width: 12ch; }
.tabs {
  display: flex; gap: 4px; padding: 5px; border-radius: 999px; background: var(--tone);
  overflow-x: auto; scrollbar-width: none; width: max-content; max-width: 100%;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  flex: none; min-height: 44px; padding: 0 18px; border: 0; border-radius: 999px; background: none;
  white-space: nowrap; font-weight: 500; transition: background-color .25s, color .25s;
}
.tabs button[aria-selected=true] { background: var(--raised); font-weight: 650; box-shadow: 0 4px 12px -6px rgba(var(--shadow), .4); }
.feats { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.feats:not([hidden]) li { animation: card-in .6s var(--ease) both; }
.feats li:nth-child(2) { animation-delay: .05s; }
.feats li:nth-child(3) { animation-delay: .1s; }
.feats li:nth-child(4) { animation-delay: .15s; }
.feats li:nth-child(5) { animation-delay: .2s; }
.feats li:nth-child(6) { animation-delay: .25s; }
@keyframes card-in { from { opacity: 0; transform: perspective(700px) translateY(16px) rotateX(-14deg); } }
.feat {
  width: 100%; height: 100%; display: flex; align-items: center; gap: 16px; padding: 10px 18px 10px 10px;
  border: 1px solid var(--line); border-radius: var(--r-media); text-align: left; background: var(--raised);
  transition: background-color .25s, border-color .25s, transform .35s var(--spring);
}
.feat__thumb { flex: none; width: 72px; height: 72px; object-fit: cover; border-radius: 12px; background: var(--paper); transition: transform .4s var(--spring); }
.feat:hover { transform: translateX(4px); }
.feat:hover .feat__thumb { transform: scale(1.08) rotate(-3deg); }
.feat:active { transform: scale(.98); }
.feat__text { display: grid; gap: 4px; }
.feat b { font-weight: 650; }
.feat__text span { font-size: var(--step-small); color: var(--ink-soft); }
.feat.is-on { background: var(--accent); border-color: var(--accent); color: #1f1c19; }
.feat.is-on .feat__text span { color: #1f1c19; }

/* Search fragment (data-ui): how Explore looks, built in HTML */
.search-ui { width: min(100%, 440px); background: #fff; color: #1f1c19; padding: 16px; border-radius: var(--r-surface); box-shadow: 0 24px 50px -30px rgba(32, 22, 12, .5); }
.search-ui__field { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 999px; background: #ecebe7; font-size: 16px; }
.search-ui__grid { margin-top: 12px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.search-ui__grid img { aspect-ratio: 1; object-fit: cover; border-radius: 12px; mix-blend-mode: normal; }

/* ---- FAQ: accordion cards in two columns ---- */
.faq { padding-top: clamp(88px, 12vw, 160px); }
.faq h2 { font-size: var(--step-head); }
.faq__list { margin-top: 32px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: start; }
.faq details { border-radius: var(--r-media); background: var(--raised); border: 1px solid var(--line); transition: background-color .25s; }
.faq details[open] { background: var(--tone); }
.faq summary {
  list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 64px; padding: 14px 20px; font-weight: 600; cursor: pointer;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 999px;
  background: var(--accent); color: #1f1c19; font-size: 22px; font-weight: 500; line-height: 1;
  transition: transform .4s var(--spring);
}
.faq details[open] summary::after { transform: rotate(135deg); }
.faq details p { padding: 0 20px 20px; color: var(--ink-soft); max-width: 60ch; }
@supports selector(::details-content) {
  .faq details { interpolate-size: allow-keywords; }
  .faq details::details-content { block-size: 0; overflow: hidden; transition: block-size .45s var(--ease), content-visibility .45s allow-discrete; }
  .faq details[open]::details-content { block-size: auto; }
}

/* ---- CTA: picture sets turning around the app icon ---- */
.cta { padding: clamp(88px, 12vw, 160px) 0 clamp(96px, 12vw, 160px); display: grid; justify-items: center; text-align: center; gap: 24px; }
.orbit {
  --r: clamp(140px, 22vw, 280px); --s: clamp(56px, 8vw, 120px);
  position: relative; width: 100%; height: calc(var(--r) * 1.1 + var(--s)); perspective: 1100px;
  display: grid; place-items: center; transform-style: preserve-3d;
}
.orbit__ring { position: absolute; inset: 0; transform-style: preserve-3d; transform: rotateX(-14deg); animation: spin 36s linear infinite; }
/* With JS the ring only turns while on screen (motion.js adds .is-spinning). Off screen it rests at its start
   angle: a turned ring makes Chrome report a full-screen layout shift whenever the page above it reflows. */
.js .orbit:not(.is-spinning) .orbit__ring { animation: none; }
.js .orbit:not(.is-spinning) .orbit__icon { animation-play-state: paused; }
.orbit__ring img {
  position: absolute; left: 50%; top: 50%; width: var(--s); height: var(--s); margin: calc(var(--s) / -2) 0 0 calc(var(--s) / -2);
  object-fit: contain; padding: 6px; background: var(--paper); border-radius: var(--r-media);
  box-shadow: 0 16px 30px -16px rgba(var(--shadow), .5);
  transform: rotateY(calc(var(--k) * 45deg)) translateZ(var(--r));
}
@keyframes spin { from { transform: rotateX(-14deg) rotateY(0); } to { transform: rotateX(-14deg) rotateY(360deg); } }
.orbit__icon {
  position: relative; width: calc(var(--s) * 1.35); border-radius: 26%;
  box-shadow: 0 30px 50px -20px rgba(240, 127, 35, .6); animation: bob 5s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translateY(-10px) rotate(-3deg); } }
.cta__line { font-size: clamp(1.9rem, 1.1rem + 2.6vw, 3.4rem); font-weight: 650; font-stretch: 112%; letter-spacing: -0.035em; line-height: 1.05; max-width: 22ch; text-wrap: balance; }
.cta__row { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 28px; margin-top: 8px; }
.cta__qr { display: flex; align-items: center; gap: 16px; font-size: var(--step-small); color: var(--ink-soft); max-width: 300px; text-align: left; }
.cta__note { font-size: var(--step-small); color: var(--ink-soft); }
#qrCode { width: 96px; height: 96px; background: #fff; padding: 6px; border-radius: 12px; }
#qrCode img, #qrCode canvas { width: 100% !important; height: 100% !important; }

/* ---- Footer: a single quiet line ---- */
.foot {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: baseline; gap: 12px;
  padding: 28px 0 32px; border-top: 1px solid var(--line); font-size: var(--step-small); color: var(--ink-soft);
}
.foot > span:last-of-type { justify-self: end; }
.foot__links { display: flex; gap: 24px; }
.foot__links a { color: var(--ink); }
.credits { grid-column: 1 / -1; margin-top: 8px; }
.credits a { color: var(--ink); }

@media (max-width: 900px) {
  .how { grid-template-columns: 1fr; min-height: auto; }
  .how__copy { grid-template-rows: auto; padding: 28px 20px 24px; }
  .how__text { font-size: clamp(2.1rem, 9vw, 3rem); min-height: 2.1em; }
  .how__shot { padding: 32px 20px; }
  .how__card img { height: min(60svh, 520px); }
  .features { display: block; }
  .features__media-wrap { position: static; }
  .features__media { height: min(58svh, 520px); padding: 16px; }
  .features__media img { max-height: calc(min(58svh, 520px) - 32px); }
  .features__list { padding-top: 28px; gap: 18px; }
  .features h2 { max-width: none; }
  .tabs { width: auto; margin-inline: calc(var(--margin) * -1); border-radius: 0; background: none; padding: 0 var(--margin); }
  .tabs button { background: var(--tone); }
  .tabs button[aria-selected=true] { background: var(--ink); color: var(--ground); }
  /* Cards become a swipeable row so the panel above stays in sight. */
  .feats {
    grid-auto-flow: column; grid-auto-columns: 82%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
    margin-inline: calc(var(--margin) * -1); padding: 2px var(--margin) 8px; scroll-padding-inline: var(--margin);
  }
  .feats::-webkit-scrollbar { display: none; }
  .feats li { scroll-snap-align: start; }
  .feat { align-items: flex-start; }
  .faq__list { grid-template-columns: 1fr; }
  .cta__qr { display: none !important; }
  .foot { display: flex; flex-direction: column; gap: 8px; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
}
@media (max-width: 640px) {
  .shelf__nav { display: none; }
  .tiles { grid-auto-columns: 72%; }
  .steps__list { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; width: calc(100% + 2 * var(--margin)); padding: 4px var(--margin); scroll-snap-type: x proximity; }
  .steps__list::-webkit-scrollbar { display: none; }
  .steps__list li { flex: none; scroll-snap-align: center; }
  .steps__list button { white-space: nowrap; }
  .how__names button { font-size: 15px; min-height: 44px; }
}

/* ==== Scroll story (.scrolly only): tall chapters whose frame stays on screen while the scroll scrubs it ==== */
/* clip (not hidden): keeps the sideways rows from widening the phone viewport without breaking sticky */
.scrolly .chapter { position: relative; overflow: clip; }
/* --frame-top (JS): negative when a frame is taller than the screen, so it sticks by its bottom edge */
.scrolly .chapter > .frame { position: sticky; top: var(--frame-top, 0px); }
.scrolly .chapter--hero { height: 260svh; }
.scrolly .chapter--how { height: 400svh; }
/* .chapter--library / --steps heights come from JS: frame height + the row's sideways travel */

.scrolly .library { min-height: 100svh; padding: 96px 0 32px; display: flex; flex-direction: column; justify-content: center; }
.scrolly .tiles { overflow: visible; scroll-snap-type: none; will-change: transform; }
.scrolly .shelf__nav { display: none; }
.shelf__giant { display: none; }
.scrolly .shelf__giant {
  display: block; position: absolute; left: 0; top: 50%; translate: 0 -50%; z-index: 0; pointer-events: none;
  white-space: nowrap; font-size: clamp(6rem, 17vw, 19rem); font-weight: 750; font-stretch: 125%; letter-spacing: -0.05em; line-height: .8;
  color: transparent; -webkit-text-stroke: 2px var(--line);
}
.tiles { position: relative; z-index: 1; }

.scrolly .how { width: 100%; margin: 0; height: 100svh; min-height: 0; border-radius: 0; will-change: clip-path; }
.scrolly .how__copy { padding-top: 112px; }
.scrolly .how__card img { height: min(calc(100svh - 170px), 700px); }

.scrolly .steps { min-height: 100svh; padding: 88px 0 24px; align-content: center; }
.scrolly .passes__track { overflow: visible; scroll-snap-type: none; will-change: transform; }
.scrolly .passes { --pw: min(28vw, 380px, 46svh); }

@media (max-width: 900px) {
  .scrolly .chapter--hero { height: 220svh; }
  /* the always-on dock covers the bottom 66px: pinned frames keep their content above it */
  .scrolly .library { padding-bottom: 84px; }
  .scrolly .how { padding-bottom: 72px; }
  .scrolly .how__card img { height: min(calc(100svh - 460px), 520px); }
  .scrolly .steps { padding-bottom: 84px; }
  .scrolly .chapter--how { height: 340svh; }
  .scrolly .library { padding-top: 80px; }
  .scrolly .how { grid-template-rows: auto minmax(0, 1fr); }
  .scrolly .how__copy { padding-top: 84px; }
  .scrolly .how__shot { padding: 16px; min-height: 0; }
  .scrolly .how__card img { height: min(calc(100svh - 390px), 560px); }
  .scrolly .passes { --pw: min(66vw, 300px, 42svh); }
  .how__strip { display: none; }
  .how__desc { font-size: 1rem; }
}
