/* Story acts. Three layouts, all readable without JS:
   1. narrow / portrait (default): picture, then copy, in normal flow;
   2. wide + reduced motion: picture with the copy over its empty left third, in flow;
   3. wide + motion allowed: each act's stage is sticky and the next act slides over it
      (js/story-motion.js adds the scroll-linked choreography on top). */
.story { position: relative; }
.act { position: relative; display: flex; flex-direction: column; padding-bottom: var(--s8); }
.act__stage { position: relative; background: var(--paper); }
.act__frame { position: relative; display: flex; flex-direction: column; }
.act__media { order: -1; position: relative; aspect-ratio: 11 / 10; overflow: hidden; }
.act__img { width: 100%; height: 100%; object-fit: cover; object-position: 78% 50%; }
.act__copy { position: relative; z-index: 2; padding: var(--s5) var(--s4) 0; max-width: 40rem; }
.act--hero { padding-top: var(--nav-h); }
.act--hero .act__copy { order: -2; padding-top: var(--s6); }
.act__eyebrow { font-size: 1rem; font-weight: 600; color: var(--violet); }
.act h1, .act h2 { margin-top: var(--s3); font-weight: 650; letter-spacing: -0.025em; line-height: 1.06; color: var(--ink); text-wrap: balance; }
.act h1 { font-size: var(--fs-display); }
.act h2 { font-size: var(--fs-h2); }
.act__lead { margin-top: var(--s4); font-size: var(--fs-lead); line-height: 1.55; color: var(--body); max-width: 32em; text-wrap: pretty; }
.act .cta-row, .act .cta-mobile { margin-top: var(--s5); }

/* Soft edges so every illustration melts into the page paper. */
/* Masked on the clipping box, not the img: GSAP zooms the img past the box, which would hide its fade and leave square edges. */
.act__media, .finale__img {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 14%, #000 86%, transparent), linear-gradient(to bottom, transparent, #000 14%, #000 86%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent, #000 14%, #000 86%, transparent), linear-gradient(to bottom, transparent, #000 14%, #000 86%, transparent);
  mask-composite: intersect;
}

/* ── Act ③: the listing the AI writes ── */
.ai-cards { position: relative; z-index: 2; display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); margin: var(--s5) var(--s4) 0; padding: 0; list-style: none; }
.ai-card { padding: var(--s3) var(--s4); background: var(--white); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: 0 2px 0 rgba(28, 30, 84, .06); }
.ai-card--wide { grid-column: 1 / -1; }
.ai-card__label { display: block; font-size: 13px; font-weight: 600; color: var(--violet); }
.ai-card__value { display: block; margin-top: 2px; font-size: 15px; line-height: 1.4; color: var(--ink); }
.ai-card__value--price { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.ai-three { position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; pointer-events: none; }

/* ── Act ④: flat Vinted listing form + SellMate side panel ── */
.fill-demo { position: relative; z-index: 2; margin: var(--s5) var(--s4) 0; background: var(--white); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; font-size: 13px; color: var(--ink); }
.fill-demo__bar { display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; background: var(--paper-2); border-bottom: 1px solid var(--line); }
.fill-demo__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.fill-demo__url { margin-left: var(--s3); padding: 3px 12px; border-radius: 999px; background: var(--white); color: var(--body); font-size: 12px; }
.fill-demo__body { display: grid; grid-template-columns: minmax(0, 1fr) 168px; }
.fill-form { padding: var(--s4) var(--s5); }
.fill-form__title { font-size: 18px; font-weight: 650; margin-bottom: var(--s3); }
.fill-row { display: grid; grid-template-columns: 34% minmax(0, 1fr); align-items: start; gap: var(--s3); padding: 9px 0; border-bottom: 1px solid #eee9df; }
.fill-row dt { color: var(--body); }
.fill-row dd { min-height: 1.4em; }
.fill-val { display: inline-block; color: var(--ink); }
.fill-row--desc .fill-val { display: block; }
.fill-actions { display: flex; justify-content: flex-end; margin-top: var(--s4); }
.fill-publish { padding: 8px 16px; border-radius: var(--r-sm); background: #007782; color: #fff; font-weight: 600; }
.fill-panel { display: flex; flex-direction: column; gap: var(--s3); padding: var(--s4); background: var(--paper); border-left: 1px solid var(--line); }
.fill-panel__brand { display: flex; align-items: center; gap: var(--s2); font-weight: 600; }
.fill-panel__brand img { width: 20px; height: 20px; border-radius: 5px; }
.fill-panel__thumb { aspect-ratio: 1; border-radius: var(--r-sm); background: var(--paper-2); overflow: hidden; }
.fill-panel__thumb img { width: 100%; height: 100%; object-fit: cover; object-position: 85% 45%; }
.fill-panel__btn { padding: 8px 10px; border-radius: var(--r-sm); background: var(--violet); color: #fff; font-weight: 600; text-align: center; }
.fill-panel__done { color: var(--live); font-weight: 500; }

/* ── Finale ── */
.act--finale { align-items: center; padding: var(--s9) 0 var(--s8); text-align: center; }
.act--finale .act__copy { order: 0; margin: 0 auto; padding-top: 0; }
.act--finale .cta-row { justify-content: center; }
.act--finale .cta-mobile { margin-left: auto; margin-right: auto; text-align: left; }
.finale__media { width: min(100%, 1200px); margin: var(--s7) auto 0; aspect-ratio: 3 / 2; }
.finale__img { width: 100%; height: 100%; }

@media (max-width: 520px) {
  .fill-demo__body { grid-template-columns: 1fr; }
  .fill-panel { flex-direction: row; flex-wrap: wrap; align-items: center; border-left: 0; border-top: 1px solid var(--line); }
  .fill-panel__done { flex-basis: 100%; }
  .fill-panel__thumb { width: 48px; flex-shrink: 0; }
}

/* ── Wide screens: copy sits in the empty left third of the illustration ── */
@media (min-width: 900px) and (min-height: 640px) and (min-aspect-ratio: 5/4) {
  html:not(.story-flow) .act { padding-bottom: 0; }
  html:not(.story-flow) .act--hero { padding-top: 0; }
  html:not(.story-flow) .act__frame { display: block; width: min(100%, 1600px); margin: 0 auto; aspect-ratio: 3 / 2; }
  html:not(.story-flow) .act__media { position: absolute; inset: 0; aspect-ratio: auto; }
  html:not(.story-flow) .act__img { object-fit: contain; }
  html:not(.story-flow) .act__copy { position: absolute; left: 4.5%; top: calc(50% + var(--nav-h) / 2); transform: translateY(-50%); width: 33%; max-width: 30rem; padding: 0; }
  html:not(.story-flow) .act--hero .act__copy { padding-top: 0; width: 30%; }
  html:not(.story-flow) .act--copy-top .act__copy { top: calc(var(--nav-h) + 6%); transform: none; }
  html:not(.story-flow) .act--desk .act__copy { width: 30%; }
  html:not(.story-flow) .act--finale .act__copy { position: relative; left: auto; top: auto; transform: none; width: auto; max-width: 40rem; margin: 0 auto; padding: 0 var(--s4); }
  html:not(.story-flow) .act--ai .act__copy { width: 27%; }
  html:not(.story-flow) .act--fill .act__copy { width: 29%; }
  html:not(.story-flow) .ai-cards { position: absolute; left: 32%; top: 15%; width: 23%; margin: 0; grid-template-columns: 1fr; gap: var(--s3); }
  html:not(.story-flow) .ai-card:nth-child(1) { transform: rotate(-2deg); }
  html:not(.story-flow) .ai-card:nth-child(2) { transform: rotate(1.5deg); }
  html:not(.story-flow) .ai-card:nth-child(3) { transform: rotate(-1deg); }
  html:not(.story-flow) .ai-card:nth-child(4) { transform: rotate(2deg); }
  html:not(.story-flow) .act--fill .fill-demo { width: min(880px, 90%); margin: var(--s6) auto var(--s8); }
  html:not(.story-flow) .act--finale { padding-top: calc(var(--nav-h) + var(--s8)); }
}

/* ── Wide + motion: sticky stages that the next act slides over ── */
@media (min-width: 900px) and (min-height: 640px) and (min-aspect-ratio: 5/4) and (prefers-reduced-motion: no-preference) {
  html:not(.story-flow) .act:not(.act--finale) { height: var(--act-h, 260svh); }
  html:not(.story-flow) .act--fill { --act-h: 380svh; }
  html:not(.story-flow) .act--ai { --act-h: 300svh; }
  html:not(.story-flow) .act:not(.act--finale) + .act { margin-top: -100svh; }
  html:not(.story-flow) .act__stage { position: sticky; top: 0; height: 100svh; overflow: hidden; display: flex; align-items: center; }
  html:not(.story-flow) .act:not(.act--hero) .act__stage { border-radius: 28px 28px 0 0; box-shadow: 0 -1px 0 var(--line); }
  html:not(.story-flow) .act__frame { width: min(100%, 150svh); max-height: 100svh; }
  html:not(.story-flow) .act--finale .act__stage { position: relative; align-self: stretch; height: auto; display: block; padding-top: var(--s8); overflow: visible; border-radius: 28px 28px 0 0; }
  /* The demo lives outside the 3:2 frame (so it can flow below it without motion);
     here it is placed over the frame's right part: frame width = min(100%, 150svh). */
  html:not(.story-flow) .act--fill .fill-demo { --fw: min(100%, 150svh); position: absolute; z-index: 3; width: calc(var(--fw) * .58); left: calc((100% - var(--fw)) / 2 + var(--fw) * .37); top: calc(50% - min(66.67vw, 100svh) * .30); margin: 0; }
}

/* Two story lines (js/story-boot.js sets html[data-line]). The hidden line is
   display:none, so its lazy images are never fetched. Without the attribute
   (no JS) the second-hand line shows. */
html[data-line="etsy"] .act[data-line="vinted"],
html:not([data-line="etsy"]) .act[data-line="etsy"] { display: none; }

.line-switch {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; width: 100%; max-width: 32rem;
  padding: 4px; margin-bottom: var(--s4); background: var(--paper-2); border-radius: 14px;
}
/* One thumb under the pressed segment; html[data-line] moves it (equal columns, so 0 or 100%). */
.line-switch__thumb {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px);
  border-radius: 10px; background: var(--navy); box-shadow: 0 1px 3px rgb(0 0 0 / .18);
  @media (prefers-reduced-motion: no-preference) { transition: translate .28s cubic-bezier(.2, .8, .2, 1); }
}
html[data-line="etsy"] .line-switch__thumb { translate: 100% 0; }
@supports not (translate: 0) { html[data-line="etsy"] .line-switch__thumb { transform: translateX(100%); } }
.line-switch__btn {
  position: relative; z-index: 1; display: flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 8px 12px; border: 0; border-radius: 10px;
  background: transparent; color: var(--navy); font: inherit; font-size: 15px; font-weight: 600;
  line-height: 1.25; text-align: center; text-wrap: balance;
  cursor: pointer; transition: color .2s ease;
}
.line-switch__btn[aria-pressed="true"] { color: var(--white); }
.line-switch__btn:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
@media (max-width: 420px) { .line-switch__btn { padding: 8px; font-size: 14px; } }
@media (max-width: 359px) { .line-switch__btn { padding: 8px 4px; font-size: 13px; } }

/* An act after a hidden hero must not slide up over the page top (the other
   line's hero is display:none but still a sibling). */
@media (min-width: 900px) and (min-height: 640px) and (min-aspect-ratio: 5/4) and (prefers-reduced-motion: no-preference) {
  html:not(.story-flow) .act + .act.act--hero { margin-top: 0; }
}

/* Try-on: copy with numbered steps and notes, then the before/after pair. */
.tryon-steps { margin: var(--s5) 0 0; padding: 0; list-style: none; counter-reset: step; display: grid; gap: var(--s3); }
.tryon-steps li { counter-increment: step; display: grid; grid-template-columns: 28px 1fr; gap: var(--s3); align-items: start; color: var(--ink); line-height: 1.45; }
.tryon-steps li::before { content: counter(step); display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--violet-soft); color: var(--violet); font-weight: 700; font-size: 14px; }
.tryon-notes { margin-top: var(--s4); display: grid; gap: var(--s2); font-size: 0.875rem; line-height: 1.5; color: var(--body); max-width: 34em; }
.tryon-notes a { color: var(--violet); text-decoration: underline; text-underline-offset: 2px; }
.tryon-pair { order: -1; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--s2); padding: var(--s5) var(--s4) 0; }
.tryon-pair__item { margin: 0; }
.tryon-pair__item img { width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 16px; }
.tryon-pair__item figcaption { margin-top: var(--s2); text-align: center; font-size: 0.875rem; font-weight: 600; color: var(--navy); }
.tryon-pair__arrow { color: var(--violet); display: grid; place-items: center; }
@media (min-width: 900px) and (min-height: 640px) and (min-aspect-ratio: 5/4) {
  html:not(.story-flow) .act--tryon .act__frame { display: grid; grid-template-columns: minmax(0, 36%) minmax(0, 1fr); align-items: center; gap: 4%; aspect-ratio: auto; padding: calc(var(--nav-h) + var(--s5)) 4.5% var(--s6); }
  html:not(.story-flow) .act--tryon .act__copy { position: static; transform: none; width: auto; max-width: 30rem; }
  html:not(.story-flow) .act--tryon .tryon-pair { order: 0; padding: 0; }
  html:not(.story-flow) .act--tryon .tryon-pair__item img { aspect-ratio: 1 / 1; }
  html:not(.story-flow) .act--tryon .act__lead { font-size: 1.0625rem; }
}
