/* =========================================================
   M-DEAR scroll story: one product, pinned, told in four scenes.
   Without .is-live (no JS, reduced motion) the scenes simply stack.
   ========================================================= */
.mdstory {
  --sage: color-mix(in srgb, var(--forest) 9%, var(--white));
  --product-h: min(62vh, 620px);
  margin-block: clamp(36px, 5vw, 64px);
  border-radius: calc(var(--radius) + 6px);
  background: var(--sage);
  overflow: hidden;
}
.mdstory-pin { position: relative; display: grid; justify-items: center; gap: 40px; padding: 56px 20px; text-align: center; }
.mdstory-word, .mdstory-texture { display: none; }
.mdstory-product { display: block; width: auto; height: var(--product-h); max-width: none; }
.mdstory-product img { display: block; height: 100%; width: auto; filter: drop-shadow(0 26px 26px rgba(36, 64, 15, .2)) drop-shadow(0 3px 4px rgba(43, 38, 33, .14)); }

.mdstory-scene { display: grid; justify-items: center; gap: 14px; width: min(100%, 860px); }
.mdstory-eyebrow { margin: 0; font-family: var(--f-latin); font-size: 12px; font-weight: 500; letter-spacing: .2em; color: var(--forest); text-transform: uppercase; }
.mdstory-head { margin: 0; max-width: 24em; font-family: var(--f-latin); font-size: clamp(22px, 2.5vw, 36px); font-weight: 500; line-height: 1.22; letter-spacing: -.015em; color: var(--dark); text-transform: none !important; }

.mdstory-callouts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 24px; width: 100%; margin: 0; padding: 0; list-style: none; }
.mdstory-callouts ul { display: contents; }
.mdstory-callouts li { display: grid; gap: 2px; }
.mdstory-callouts b { font-family: var(--f-latin); font-size: clamp(19px, 1.9vw, 27px); font-weight: 500; letter-spacing: -.01em; color: var(--dark); }
.mdstory-callouts span { font-size: 13px; line-height: 1.4; color: var(--fg-muted); text-transform: none !important; }

.mdstory-apply { display: grid; justify-items: center; gap: 28px; width: min(100%, 1040px); }
.mdstory-circle { width: min(84vw, 440px); aspect-ratio: 1; border-radius: 50%; overflow: hidden; background: var(--surface-hi); }
.mdstory-circle video { display: block; width: 100%; height: 100%; object-fit: cover; }
.mdstory-benefits { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.mdstory-benefits li { font-family: var(--f-latin); font-size: clamp(18px, 1.8vw, 25px); font-weight: 400; line-height: 1.3; color: var(--dark); text-transform: none !important; }
.mdstory-howto { margin: 0; font-size: 14px; color: var(--fg-muted); text-transform: none !important; }

/* ---------- Pinned version ---------- */
.mdstory.is-live {
  height: 420vh;
  width: calc(100vw - var(--sbw, 0px));
  margin-inline: calc((100% - (100vw - var(--sbw, 0px))) / 2);
  border-radius: 0;
  background: none;
  overflow: visible;
}
.is-live .mdstory-pin {
  position: sticky; top: 0;
  display: block;
  height: 100vh; height: 100svh;
  padding: 0;
  overflow: hidden;
  isolation: isolate;
  background: radial-gradient(46% 62% at 50% 44%, var(--white), transparent 72%), var(--sage);
}
.is-live .mdstory-word {
  display: grid; place-items: center;
  position: absolute; inset: 0 0 8%; z-index: -1;
  font-family: var(--f-latin); font-size: clamp(170px, 38vw, 680px); font-weight: 600; line-height: 1; letter-spacing: -.05em;
  color: color-mix(in srgb, var(--forest) 15%, var(--white));
  user-select: none;
}
.is-live .mdstory-texture {
  display: block;
  position: absolute; inset: 0; z-index: 2;
  background: url("../img/mdear/texture.jpg") center / cover no-repeat;
  clip-path: inset(100% 0 0 0);
}
.is-live .mdstory-product {
  position: absolute; left: 50%; top: 45%; z-index: 5;
  margin: calc(var(--product-h) / -2) 0 0;
  transform: translateX(-50%);
  will-change: transform, opacity;
  pointer-events: none;
}
.is-live .mdstory-product img { animation: mdstory-float 7s ease-in-out infinite; }
@keyframes mdstory-float { 50% { transform: translateY(-10px); } }

.is-live .mdstory-scene, .is-live .mdstory-apply {
  position: absolute; z-index: 4;
  opacity: 0;
  width: auto; margin: 0;
  will-change: opacity, transform;
}
.is-live .mdstory-s1 { left: 50%; bottom: 5vh; width: min(92vw, 780px); margin-left: calc(min(92vw, 780px) / -2); }

/* ingredients, either side of the bottle */
.is-live .mdstory-s2 { inset: 0; display: block; width: auto; }
.is-live .mdstory-s2 .mdstory-eyebrow { position: absolute; left: 0; right: 0; bottom: 7vh; }
.is-live .mdstory-callouts { position: absolute; inset: 0; display: block; }
.is-live .mdstory-callouts ul { position: absolute; top: 50%; display: grid; gap: clamp(26px, 6vh, 56px); margin: 0; padding: 0; list-style: none; transform: translateY(-50%); }
.is-live .mdstory-callouts ul:first-child { right: calc(50% + clamp(110px, 12vw, 190px)); text-align: right; justify-items: end; }
.is-live .mdstory-callouts ul:last-child { left: calc(50% + clamp(110px, 12vw, 190px)); text-align: left; justify-items: start; }
.is-live .mdstory-callouts li { position: relative; align-content: start; min-height: 62px; max-width: 23vw; will-change: opacity, transform; }
.is-live .mdstory-callouts li::after {
  content: ""; position: absolute; top: .85em; width: clamp(24px, 5vw, 76px); height: 1px;
  background: color-mix(in srgb, var(--forest) 45%, var(--white));
}
.is-live .mdstory-callouts ul:first-child li::after { left: calc(100% + 14px); }
.is-live .mdstory-callouts ul:last-child li::after { right: calc(100% + 14px); }

/* how it is used: copy left, clip in a circle right, bottle on the edge */
.is-live .mdstory-apply { inset: 0; display: block; width: auto; }
.is-live .mdstory-circle {
  position: absolute; top: 50%; left: 70%;
  width: min(64vh, 34vw); margin: calc(min(64vh, 34vw) / -2) 0 0 calc(min(64vh, 34vw) / -2);
  will-change: transform;
}
.is-live .mdstory-apply-copy {
  position: absolute; top: 50%; left: max(var(--gutter, 24px), calc(50% - 620px)); width: min(36vw, 480px);
  display: grid; justify-items: start; gap: 18px; text-align: left;
  transform: translateY(-50%);
}

/* closing line on the cream */
.is-live .mdstory-s4 { left: 50%; top: 50%; width: min(90vw, 1000px); margin: 0 0 0 calc(min(90vw, 1000px) / -2); transform: translateY(-50%); }
.is-live .mdstory-s4 .mdstory-head { font-size: clamp(30px, 5vw, 76px); line-height: 1.08; letter-spacing: -.03em; }
.is-live .mdstory-s4 .mdstory-eyebrow { color: var(--dark); }

@media (max-width: 720px) {
  .mdstory { --product-h: 46vh; }
  .is-live .mdstory-product { top: 36%; }
  .is-live .mdstory-word { inset: 0 0 26%; }
  .is-live .mdstory-s1 { bottom: 7vh; }

  .is-live .mdstory-s2 .mdstory-eyebrow { top: 76px; bottom: auto; }
  .is-live .mdstory-callouts { inset: auto 16px 4vh; position: absolute; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .is-live .mdstory-callouts ul, .is-live .mdstory-callouts ul:first-child, .is-live .mdstory-callouts ul:last-child {
    position: static; transform: none; gap: 14px; text-align: left; justify-items: start;
  }
  .is-live .mdstory-callouts li { max-width: none; min-height: 0; }
  .is-live .mdstory-callouts li::after { display: none; }
  .is-live .mdstory-callouts b { font-size: 18px; }
  .is-live .mdstory-callouts span { font-size: 12px; }

  .is-live .mdstory-circle { top: 18vh; left: 60%; width: 68vw; margin: 0 0 0 -34vw; }
  .is-live .mdstory-apply-copy { top: auto; bottom: 5vh; left: 16px; right: 16px; width: auto; gap: 12px; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .mdstory-product img { animation: none !important; }
}
