/* The Fold: the catalog as one printed sheet that folds in half with every swipe (fold.js).
 * The engine first, then the three places it is used: the hero, #scale and the closing box. All three sit on the
 * ink stage in both themes; the sheet is paper, light in both themes, like the product cards. */

/* ================================================================ the engine */

.fold {
  position: relative; isolation: isolate; outline: none; cursor: grab;
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
.fold.is-held { cursor: grabbing; }
.fold.is-done { cursor: default; }
.fold:focus-visible { outline: 3px solid var(--accent); outline-offset: 8px; border-radius: 14px; }
.fold [hidden] { display: none !important; }

/* the sheet: positioned and scaled by the camera, one composited layer */
/* no will-change: its 3D transform already gives it a layer, and the hint made Chrome drop the stage's paint on load */
.fold-sheet { position: absolute; left: 0; top: 0; transform-origin: 0 0; pointer-events: none; }
.fold-panel, .fold-shadow { position: absolute; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.fold-panel { overflow: hidden; background: #fff; }
/* --edge: the cut edge of the stock and the pile set aside; --ground: the shadow on the desk (fold.js) */
.fold-shadow { background: #fff; box-shadow: var(--edge); }
.fold-ground { position: absolute; left: 0; top: 0; pointer-events: none; box-shadow: var(--ground); }
.fold.is-bending .fold-ground { visibility: hidden; }
.fold.is-bending .fold-shadow { box-shadow: var(--edge), var(--ground); }
.fold.is-zoomed .fold-shadow, .fold.is-zoomed .fold-ground { box-shadow: none; }
/* zoomed in (the intro, an unfold) the sheet is many times the frame: the frame clips it, so it never covers the page */
.fold.is-zoomed { overflow: hidden; }
.fold-panel canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* one raking light for the whole sheet, from the top left, laid across both halves in sheet coordinates */
.fold-light {
  position: absolute; inset: 0; pointer-events: none; background-repeat: no-repeat;
  background-image:
    /* the lamp: warm, from the top left, falling off across the sheet */
    radial-gradient(85% 120% at 6% -18%, rgba(255, 245, 226, .26), rgba(255, 245, 226, .08) 42%, rgba(255, 245, 226, 0) 70%),
    /* the sheen of coated stock: one soft band where the light glances off */
    linear-gradient(112deg, rgba(255, 255, 255, 0) 24%, rgba(255, 255, 255, .11) 34%, rgba(255, 255, 255, .03) 41%, rgba(255, 255, 255, 0) 50%),
    /* the far corner, away from the lamp */
    linear-gradient(152deg, rgba(18, 20, 28, 0) 38%, rgba(18, 20, 28, .09) 72%, rgba(18, 20, 28, .26) 100%),
    /* the paper curls a hair at its edges */
    radial-gradient(130% 140% at 50% 45%, rgba(18, 20, 28, 0) 62%, rgba(18, 20, 28, .1) 100%);
}
/* shading that moves: the half turning away from the light darkens towards its free edge; the half that stays
   catches a bright line where the paper bends over the crease */
.fold-shade { position: absolute; opacity: 0; pointer-events: none; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.fold-flap-shade {
  background: linear-gradient(var(--to, to right), rgba(34, 28, 22, .34) 0%, rgba(14, 15, 20, .8) 55%, rgba(8, 9, 12, .96) 100%);
}
.fold-glint {
  background: linear-gradient(var(--to, to right), rgba(255, 250, 240, .5) 0%, rgba(255, 250, 240, .16) 10%, rgba(255, 250, 240, 0) 34%);
}
.fold-keep-shade {
  background: linear-gradient(var(--to, to right),
    rgba(0, 0, 0, 0) calc(100% - 46px), rgba(14, 16, 24, .16) calc(100% - 7px),
    rgba(255, 255, 255, .85) calc(100% - 1.5px), rgba(255, 255, 255, .2) 100%);
}

/* the full-resolution photo the intro starts on, sitting exactly on its tile */
.fold-hero {
  position: absolute; left: 0; top: 0; transform-origin: 0 0; pointer-events: none; visibility: hidden;
  will-change: transform, opacity; max-width: none; background: #F3F4F6;
}

.fold-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ================================================================ hero */

.stage {
  position: relative; isolation: isolate; overflow: hidden; color: var(--d-text);
  /* a dark desk, lit from the top left; the pool of light falls where the sheet lies */
  background:
    radial-gradient(60% 55% at 50% 64%, rgba(255, 244, 226, .075), rgba(255, 244, 226, 0) 70%),
    radial-gradient(110% 80% at 0% -10%, rgba(255, 240, 214, .06), rgba(255, 240, 214, 0) 55%),
    var(--d-bg);
  margin-top: -64px; padding: 82px 0 24px; min-height: min(100svh, 1040px);
  display: flex; align-items: center;
}
.stage [hidden] { display: none !important; }
.stage-grid {
  display: grid; gap: 12px 40px; width: 100%;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "copy" "count" "sheet" "foot";
}
/* words and buttons sit above the sheet's layer, so neither its shadow nor the intro's close-up covers them */
.stage-copy, .stage-count, .stage-foot { position: relative; z-index: 2; }
.stage-copy { grid-area: copy; }
.stage h1 { font-size: clamp(2.6rem, 5.3vw, 5.1rem); line-height: .9; max-width: 14ch; }

/* the count: the number is the hero */
.stage-count { grid-area: count; display: flex; align-items: flex-end; gap: 14px; }
.count-n { margin: 0; }
.count-n b {
  display: block; font-family: var(--font-display, "Manrope", sans-serif); font-weight: 600; font-stretch: 84%;
  font-size: clamp(4.75rem, 13vw, 12rem); line-height: .78; letter-spacing: -0.06em;
  font-variant-numeric: tabular-nums; color: var(--d-text);
  transition: color .35s ease, text-shadow .35s ease;
}
.count-label { margin: 0 0 4px; max-width: 17em; color: var(--d-text2); font-size: 15px; font-weight: 600; line-height: 1.35; }
.count-label b { color: var(--d-text); font-weight: 800; white-space: nowrap; }
.stage-count.is-found .count-n b { color: var(--accent); text-shadow: 0 0 60px color-mix(in srgb, var(--accent) 35%, transparent); }

.stage-sheet { grid-area: sheet; position: relative; z-index: 1; }
/* the pool of lamplight on the desk the sheet lies on: it is what lets the sheet's shadow read on a dark stage */
.stage-sheet::before {
  content: ""; position: absolute; inset: -14% -10% -22%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(closest-side at 50% 50%, rgba(255, 240, 218, .2), rgba(255, 240, 218, .14) 58%, rgba(255, 240, 218, .05) 82%, rgba(255, 240, 218, 0) 100%);
}
/* wider than tall, on phones too: the first fold is then a sideways drag and a vertical swipe still scrolls.
   Taller than half the width, so a square half gets more room than the whole sheet did and the photos grow. */
.hero-frame {
  width: 100%; aspect-ratio: 1.5;
}
/* the intro's close-up stays inside the frame, never over the words; the sheet's shadow may spill out after */
.js .stage.is-intro .hero-frame { overflow: hidden; }
.hero-frame.is-card .fold-sheet { opacity: 0; transition: opacity .3s ease .12s; }
/* the card's photo replaces the full-resolution one the moment the card appears */
.hero-frame.is-card .fold-hero { visibility: hidden !important; }
.hero-frame:focus-visible { outline-offset: 2px; }

.stage-foot { grid-area: foot; display: grid; gap: 14px; }
.stage-lede { margin: 0; max-width: 34em; color: var(--d-text2); font-size: 16px; font-weight: 500; }
.stage-actions { display: flex; flex-wrap: wrap; gap: 10px; }

@media (min-width: 900px) {
  .stage { padding: 80px 0 22px; }
  .stage-grid {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "copy count" "sheet sheet" "foot foot";
    align-items: end; gap: 12px 48px;
  }
  .stage-count { flex-direction: column; align-items: flex-end; gap: 8px; text-align: right; }
  .count-label { margin: 0; max-width: none; white-space: nowrap; }
  .count-n b { font-size: clamp(4.75rem, 11.5vw, 10.5rem); }
  .hero-frame { width: 100%; aspect-ratio: 1.8; max-height: calc(100svh - 350px); min-height: 380px; margin: 0; }
  .stage-foot { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 32px; }
  .stage-lede { max-width: 46em; }
}
@media (max-width: 899px) {
  .stage-count { justify-content: space-between; }
  .stage-count .count-label { text-align: right; }
}

/* the one product left, as a product card, grown out of the last tile */
.hero-card {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%; width: min(300px, 74%);
  color: var(--ink); transform-origin: 50% 50%; will-change: transform; z-index: 2;
}
.hero-card::before {
  content: ""; position: absolute; inset: 0; border-radius: 24px; z-index: -1; background: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,.3), 0 40px 90px -24px rgba(0,0,0,.85);
  opacity: 0; transition: opacity .3s ease .1s;
}
.hero-card-art { aspect-ratio: 1; border-radius: 24px 24px 0 0; overflow: hidden; background: #F3F4F6; }
.hero-card-art img { width: 100%; height: 100%; object-fit: cover; }
.hero-card-body { padding: 14px 18px 18px; display: grid; gap: 2px; opacity: 0; transition: opacity .3s ease .12s; }
.hero-card.in::before, .hero-card.in .hero-card-body { opacity: 1; }
.hero-card-brand { font-size: 12px; font-weight: 600; color: var(--muted, #8A909C); }
.hero-card-name { font-family: var(--font-display, "Manrope", sans-serif); font-size: 22px; line-height: 1.1; letter-spacing: -0.03em; font-weight: 600; margin: 0; }
.hero-card-price { font-size: 15px; font-weight: 700; }
.hero-card-why { margin: 6px 0 0; font-size: 13.5px; line-height: 1.4; color: var(--secondary, #5B616E); }
@media (max-width: 899px) {
  /* the frame is wide and short here: the card lies on its side, photo left, words right, inside the frame */
  .hero-card { width: min(400px, 100%); display: grid; grid-template-columns: 44% minmax(0, 1fr); align-items: stretch; }
  .hero-card-art { border-radius: 20px 0 0 20px; aspect-ratio: auto; min-height: 100%; }
  .hero-card::before { border-radius: 20px; }
  .hero-card-body { padding: 12px 14px; align-content: center; }
  .hero-card-name { font-size: 19px; }
  .hero-card-why { font-size: 12.5px; line-height: 1.35; margin-top: 4px; }
}

/* the first two seconds: the copy arrives after the view has pulled back */
/* in reading order, 60ms apart: headline, count label, lede and buttons */
.js .stage.is-intro .stage-copy > *, .js .stage.is-intro .stage-foot, .js .stage.is-intro .count-label { opacity: 0; transform: translateY(8px); }
.stage-copy > *, .stage-foot, .count-label { transition: opacity .4s cubic-bezier(.23,1,.32,1), transform .4s cubic-bezier(.23,1,.32,1); }
.count-label { transition-delay: 60ms; }
.stage-foot { transition-delay: 120ms; }

/* ================================================================ your catalog, to scale */

.scale {
  position: relative; isolation: isolate; overflow: hidden; color: var(--d-text); padding: 88px 0;
  background:
    radial-gradient(55% 60% at 74% 50%, rgba(255, 244, 226, .07), rgba(255, 244, 226, 0) 70%),
    var(--d-bg);
}
.scale-grid { display: grid; gap: 28px; align-items: center; }
.scale-copy { display: grid; justify-items: start; }
.scale h2 { font-size: clamp(2.5rem, 5.4vw, 4.75rem); margin: 0; max-width: 11ch; }
.scale-n { margin: 22px 0 0; color: var(--d-text2); font-weight: 600; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.scale-n b {
  font-family: var(--font-display, "Manrope", sans-serif); font-weight: 600; font-stretch: 84%;
  font-size: clamp(4rem, 9vw, 8.5rem); letter-spacing: -0.06em; line-height: .85; color: var(--d-text);
  font-variant-numeric: tabular-nums;
}
.scale-range { width: min(460px, 100%); margin: 18px 0 14px; accent-color: var(--accent); height: 28px; cursor: pointer; }
.scale .ask-chips { justify-content: flex-start; }
.scale-math { margin: 20px 0 22px; font-size: clamp(18px, 2vw, 22px); color: var(--d-text2); }
.scale-math b { color: var(--d-text); }
.scale-math .lit { color: var(--accent); }
.scale-frame { height: min(120vw, 480px); margin: 0 -8px; }
@media (min-width: 900px) {
  .scale { padding: 120px 0; }
  .scale-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 48px; }
  .scale-frame { height: clamp(360px, 34vw, 520px); margin: 0; }
}

/* ================================================================ closing box */

.final { padding-top: 0; }
.final-box {
  position: relative; isolation: isolate; overflow: hidden; text-align: center;
  background: radial-gradient(70% 50% at 50% 100%, rgba(255, 244, 226, .08), rgba(255, 244, 226, 0) 70%), var(--d-bg);
  color: var(--d-text); border-radius: 32px; padding: 88px 24px 0; min-height: clamp(640px, 54vw, 780px);
  display: grid; align-content: start; justify-items: center;
  outline: 1px solid var(--band-edge); outline-offset: -1px;   /* drawn over the sheet, so the rim stays whole */
}
/* the sheet lies on the desk below the numbers, seen at an angle, and folds once */
.final-frame {
  position: absolute; left: 6%; right: 6%; top: 67%; height: 60%; z-index: -2; cursor: default;
  transform: perspective(1400px) rotateX(42deg); transform-origin: 50% 0%;
}
.final-scrim {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(to bottom, var(--d-bg) 0%, var(--d-bg) 60%, rgba(21, 23, 28, .5) 72%, rgba(21, 23, 28, 0) 88%),
    radial-gradient(90% 60% at 50% 100%, rgba(21, 23, 28, 0) 50%, rgba(21, 23, 28, .7) 100%);
}
.final-count {
  margin: 0 0 28px; white-space: nowrap; font-variant-numeric: tabular-nums;
  font-family: var(--font-display, "Manrope", sans-serif); font-weight: 600; font-stretch: 84%;
  font-size: clamp(4.25rem, 15.5vw, 14rem); line-height: .8; letter-spacing: -0.06em; color: var(--d-text);
}
.final-arrow { font-weight: 300; color: var(--d-text2); margin: 0 .06em 0 .04em; }
.final-count .lit { color: var(--accent); text-shadow: 0 0 70px color-mix(in srgb, var(--accent) 30%, transparent); }
.final-box h2 { margin: 0 auto 32px; max-width: 16ch; font-size: clamp(2rem, 4.4vw, 3.5rem); }
@media (max-width: 639px) {
  .final .wrap { padding: 0; }
  .final-box { border-radius: 0; padding: 72px 16px 0; min-height: 640px; }
  .final-frame { left: -10%; right: -10%; top: 60%; height: 52%; }
}

@media (prefers-reduced-motion: reduce) {
  .stage-copy > *, .stage-foot, .count-label, .count-n b, .hero-card::before, .hero-card-body { transition: opacity .2s ease; transition-delay: 0s; }
  .js .stage.is-intro .stage-copy > *, .js .stage.is-intro .stage-foot, .js .stage.is-intro .count-label { opacity: 1; transform: none; }
}
