/* A quick middle sequence flows into a larger result; one black heading per step. */
.custom-nail-story {
  --story-gap:20px;
  --story-source-width:clamp(290px,49cqi,350px);
  --story-output-half:min(calc((100cqi - var(--story-gap))/2),310px);
  --story-height:calc(var(--story-source-width) + var(--story-output-half) + 156px);
  --story-source-center:calc((var(--story-height) - var(--story-source-width))/2);
  container-type:inline-size;
  isolation:isolate;
  position:relative;
  display:grid;
  place-items:center;
  width:100%;
  min-width:0;
  padding:30px clamp(22px,3vw,44px);
  background:var(--miso-rose);
  color:#000;
}
.custom-story-scene { position:relative; width:100%; height:var(--story-height); }
.custom-nail-story figure { margin:0; min-width:0; }
.custom-story-header { position:absolute; z-index:2; top:0; left:0; width:100%; text-align:center; transform:translateY(0); transition:transform 650ms var(--miso-ease); }
.custom-story-header>span { display:block; font:400 clamp(32px,5.2cqi,44px)/1.2 var(--serif); letter-spacing:-.035em; color:#000; animation:custom-story-heading-in 220ms var(--miso-ease) both; }
.custom-story-inspiration {
  position:absolute;
  z-index:3;
  top:0;
  left:50%;
  width:var(--story-source-width);
  padding:9px;
  background:var(--paper);
  border-radius:9px;
  box-shadow:0 9px 25px #4b639014;
  transform:translate(-50%,80px) rotate(-4deg);
  transition:transform 650ms var(--miso-ease),opacity 300ms var(--miso-ease);
}
.custom-story-inspiration img { display:block; width:100%; height:auto; aspect-ratio:1; object-fit:cover; border-radius:4px; }
.custom-story-pointer { position:absolute; width:34px; height:34px; right:15px; bottom:22px; color:#000; fill:var(--paper); opacity:0; transition:opacity 180ms var(--miso-ease); }
.custom-story-outputs { position:absolute; left:50%; bottom:0; width:min(100%,640px); display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:var(--story-gap); opacity:1; transform:translate(-50%,0) scale(1); transition:opacity 650ms var(--miso-ease),transform 650ms var(--miso-ease); }
.custom-story-outputs img { display:block; width:100%; height:auto; aspect-ratio:1; object-fit:cover; border-radius:19px; background:var(--paper); }
.custom-story-outputs figcaption { padding-top:12px; font:400 20px/1.3 var(--serif); color:#000; }
.custom-story-demo { position:absolute; left:50%; top:50%; width:min(100%,540px); height:420px; overflow:hidden; padding:18px; border-radius:24px; background:var(--paper); opacity:0; transform:translate(-50%,calc(-50% + 12px)) scale(.98); transition:opacity 350ms var(--miso-ease),transform 650ms var(--miso-ease); pointer-events:none; }
.custom-story-drop { display:grid; height:100%; width:100%; place-items:center; border:1px dashed var(--line); border-radius:15px; color:#000; transition:opacity 180ms var(--miso-ease); }
.custom-story-drop>svg { width:44px; height:44px; stroke-width:1.5; }
.custom-story-designing { position:absolute; inset:18px; display:flex; align-items:center; justify-content:center; flex-direction:column; gap:30px; opacity:0; text-align:center; transition:opacity 300ms var(--miso-ease); }
.custom-story-design-mark { font:400 88px/1 var(--serif); color:#000; }
.custom-story-progress { display:block; width:min(74%,260px); height:5px; overflow:hidden; border-radius:4px; background:var(--blue); }
.custom-story-progress>span { display:block; height:100%; background:var(--miso-action); transform:scaleX(0); transform-origin:left; }
.custom-nail-story:not([data-phase='result']) .custom-story-header { transform:translateY(110px); }
.custom-nail-story:not([data-phase='result']) .custom-story-outputs { opacity:0; transform:translate(-50%,24px) scale(.97); transition-duration:300ms,650ms; }
.custom-nail-story[data-phase='ready'] .custom-story-inspiration { transform:translate(calc(-50% - clamp(12px,4cqi,32px)),var(--story-source-center)) rotate(-4deg); }
.custom-nail-story[data-phase='dragging'] .custom-story-inspiration,
.custom-nail-story[data-phase='uploaded'] .custom-story-inspiration,
.custom-nail-story[data-phase='designing'] .custom-story-inspiration { transform:translate(-50%,calc(var(--story-source-center) + 12px)) rotate(1deg) scale(.92); }
.custom-nail-story[data-phase='dragging'] .custom-story-pointer { opacity:1; }
.custom-nail-story[data-phase='dragging'] .custom-story-demo,
.custom-nail-story[data-phase='uploaded'] .custom-story-demo,
.custom-nail-story[data-phase='designing'] .custom-story-demo { opacity:1; transform:translate(-50%,calc(-50% + 12px)) scale(1); }
.custom-nail-story[data-phase='designing'] .custom-story-inspiration { opacity:0; }
.custom-nail-story[data-phase='designing'] .custom-story-demo { transform:translate(-50%,-50%) scale(1); }
.custom-nail-story[data-phase='designing'] .custom-story-drop { opacity:0; }
.custom-nail-story[data-phase='designing'] .custom-story-designing { opacity:1; }
.custom-nail-story[data-phase='designing'] .custom-story-progress>span { animation:custom-story-design 1600ms linear forwards; }
.custom-nail-story[data-phase='result'] .custom-story-outputs { transition-delay:120ms; }
@keyframes custom-story-design { to { transform:scaleX(1); } }
@keyframes custom-story-heading-in { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:translateY(0); } }
@media(min-width:701px) and (max-width:1100px) {
  .custom-nail-story { --story-gap:16px; --story-source-width:clamp(260px,76cqi,310px); padding:30px 22px; }
  .custom-story-header>span { font-size:34px; }
  .custom-story-demo { height:360px; }
  .custom-nail-story:not([data-phase='result']) .custom-story-header { transform:translateY(70px); }
}
@media(max-width:700px) {
  .custom-nail-story { --story-gap:10px; --story-source-width:clamp(230px,82cqi,310px); padding:28px 8px; }
  .custom-story-header>span { font-size:34px; }
  .custom-story-outputs figcaption { padding-top:10px; font-size:18px; }
  .custom-story-demo { height:330px; padding:15px; }
  .custom-nail-story:not([data-phase='result']) .custom-story-header { transform:translateY(70px); }
}
@media(max-width:380px) {
  .custom-nail-story { --story-gap:10px; --story-source-width:230px; padding-left:8px; padding-right:8px; }
  .custom-story-header>span { font-size:30px; }
  .custom-story-outputs figcaption { font-size:17px; }
  .custom-story-demo { height:300px; }
  .custom-story-design-mark { font-size:72px; }
  .custom-nail-story:not([data-phase='result']) .custom-story-header { transform:translateY(55px); }
}
@media(prefers-reduced-motion:reduce) {
  .custom-story-header,.custom-story-inspiration,.custom-story-pointer,.custom-story-outputs,.custom-story-demo,.custom-story-drop,.custom-story-designing { transition:none; }
  .custom-story-progress>span { animation:none!important; }
  .custom-story-header>span { animation:none; }
}
