/* A scroll-built notebook. The default is a complete, static presentation. */
.scroll-story {
    --lid-angle: 0deg;
    --device-scale: 1;
    --intro-opacity: 1;
    --intro-y: 0px;
    --editor-opacity: 0;
    --editor-shift: -8%;
    --preview-opacity: 1;
    --preview-shift: 0%;
    --preview-scale: 1;
    --build-nav: 1;
    --build-hero: 1;
    --build-cards: 1;
    --build-footer: 1;
    --finish-opacity: 1;
    --camera-scale: 1;
    --camera-x: 0px;
    --camera-y: 0px;
    --story-chrome-opacity: 1;
    --device-opacity: 1;
    position: relative;
    z-index: 2;
    padding: 125px 0 52px;
    isolation: isolate;
}
.scroll-story::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    background: radial-gradient(ellipse at 50% 29%, #ffc2764d, transparent 53%);
}
.story-pin {
    width: 100%;
    max-width: 1440px;
    margin-inline: auto;
    padding-inline: 38px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.story-head {
    position: relative;
    width: 100%;
    min-height: 175px;
    text-align: center;
    z-index: 3;
}
.story-intro { opacity: 1; transform: none; }
.story-eyebrow {
    display: block;
    margin-bottom: 12px;
    color: #6a2903;
    font-size: .63rem;
    font-weight: 600;
    letter-spacing: .17em;
    text-transform: uppercase;
}
.scroll-story .story-title.hero__title {
    max-width: 1200px;
    margin: 0 auto 16px;
    font-size: clamp(2.5rem, 5.25vw, 4.8rem);
    font-weight: 900;
    line-height: .99;
    letter-spacing: -.055em;
}
.scroll-story .story-title .highlight { padding-bottom: 6px; }
.scroll-story .story-title .highlight::after { height: 4px; }
.story-lede, .story-chapter > p:last-child {
    max-width: 650px;
    margin-inline: auto;
    font-size: .9rem;
    line-height: 1.6;
    color: #fff;
}
.story-chapter {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 0 15px 10px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(18px);
    transition: opacity .28s ease, transform .38s var(--ease, ease), visibility .28s;
}
.story-chapter h2 {
    max-width: 1080px;
    margin-bottom: 14px;
    color: white;
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    line-height: 1.01;
    letter-spacing: -.055em;
    font-weight: 800;
    text-wrap: balance;
}
.story-device-zone {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 26px;
    padding: 0 32px 23px;
    perspective: 1500px;
    perspective-origin: 50% 30%;
}
.laptop {
    position: relative;
    width: min(820px, 78vw);
    margin-inline: auto;
    transform: scale(var(--device-scale, 1));
    transform-origin: 50% 85%;
}
.story-camera {
    width: 100%;
    display: flex;
    justify-content: center;
    transform-origin: 0 0;
    transform: translate3d(var(--camera-x), var(--camera-y), 0) scale(var(--camera-scale));
}
.laptop-lid {
    position: relative;
    z-index: 2;
    padding: 17px 10px 11px;
    border: 2px solid #bbc0c4;
    border-bottom-color: #52565b;
    border-radius: 20px 20px 6px 6px;
    background: linear-gradient(120deg, #282c30, #0a0c0d 18%, #181b1e 80%, #3b4046);
    box-shadow: 0 0 0 1px #34373b, inset 0 1px 0 #e4e5e7, inset 2px 0 0 #676c73, inset -2px 0 0 #15171a;
    transform: rotateX(var(--lid-angle, 0deg));
    transform-origin: 50% 100%;
    transform-style: preserve-3d;
    backface-visibility: hidden;
}
.laptop-camera {
    position: absolute;
    top: 6px;
    left: 50%;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #203944, #0b0c0e 75%);
    box-shadow: 0 0 0 1px #1a1c1f;
}
.laptop-wordmark { position: absolute; left: 50%; bottom: 2px; transform: translateX(-50%); color: #747b82; font-size: 5px; font-weight: 500; letter-spacing: .04em; }
.laptop-notch { display: none; }
.laptop-display {
    position: relative;
    container-type: inline-size;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    isolation: isolate;
    border: 1px solid #070809;
    border-radius: 5px;
    background: #10141d;
}
.laptop-display::after {
    content: '';
    position: absolute;
    z-index: 8;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1px #ffffff0a;
    background: linear-gradient(125deg, #ffffff05, transparent 35%, transparent 75%, #ffffff02);
}
.screen-chrome {
    position: relative;
    z-index: 6;
    height: 28px;
    padding-inline: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
    border-bottom: 1px solid #ffffff0b;
    background: #22262c;
    color: #b8bec6;
    font-size: 8px;
}
.screen-dots { flex-shrink: 0; }
.screen-address {
    position: absolute;
    left: 25%;
    right: 25%;
    padding: 3px 5px;
    text-align: center;
    color: #b8bec6;
    font-size: 7px;
    line-height: 1.2;
    letter-spacing: .015em;
    background: #ffffff08;
    border: 1px solid #ffffff08;
    border-radius: 4px;
}
.screen-chrome > .screen-dots { display: flex; gap: 4px; width: auto; height: auto; border-radius: 0; background: none; }
.screen-dots > i { display: block; width: 5px; height: 5px; border-radius: 50%; background: #616773; }
.screen-dots > i:nth-child(1) { background: #f37f70; }
.screen-dots > i:nth-child(2) { background: #e8c76f; }
.screen-dots > i:nth-child(3) { background: #8dbf8f; }
.screen-chrome > .screen-brand { width: auto; height: auto; background: transparent; color: #a4acb6; margin-left: auto; font-size: 7px; font-weight: 600; letter-spacing: -.03em; }
.screen-workspace {
    position: relative;
    height: calc(100% - 28px);
    overflow: hidden;
    background: #10141d;
}
.screen-idle { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: white; background: radial-gradient(ellipse at 50% 45%, #ff751f0e, transparent 64%), #10141d; opacity: clamp(0, calc(1 - var(--editor-opacity, 0) - var(--preview-opacity, 1)), 1); }
.screen-idle strong { font-family: Consolas, monospace; font-size: clamp(17px, 2.5vw, 34px); font-weight: 400; letter-spacing: -.04em; }
.screen-idle > span { color: #7e8b9e; font-size: clamp(6px, .8vw, 11px); margin-top: 11px; letter-spacing: .03em; }
.screen-idle > i { width: 28px; height: 2px; margin-top: 22px; border-radius: 3px; background: #ff9a56; }
.screen-editor {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    color: #d4d9e3;
    background: #111722;
    opacity: var(--editor-opacity, 0);
    transform: translateX(var(--editor-shift, -8%));
    font-family: Consolas, 'SFMono-Regular', 'Courier New', monospace;
}
.editor-rail {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding-top: 18px;
    border-right: 1px solid #ffffff09;
    background: #171e29;
    color: #728096;
    font-size: 13px;
}
.editor-code { min-width: 0; padding: 13px 19px; overflow: hidden; }
.editor-file {
    display: inline-flex;
    gap: 8px;
    margin-bottom: 17px;
    padding: 5px 10px;
    border-bottom: 1px solid #ffad6b;
    background: #202938;
    color: #ced5dd;
    font-size: 9px;
}
.editor-file small { color: #73839b; font-size: 7px; margin-left: 22px; }
.editor-status { display: flex; justify-content: space-between; gap: 10px; margin-top: 15px; padding-top: 9px; border-top: 1px solid #ffffff0b; color: #8594aa; font-size: 7px; }
.code-line {
    --line-reveal: 1;
    min-height: 1.45em;
    font-size: clamp(9px, 1vw, 10px);
    line-height: 1.45;
    white-space: pre;
    color: #c9d0dc;
    clip-path: inset(0 calc((1 - var(--line-reveal, 1)) * 100%) 0 0);
}
.code-line > em { font-style: normal; color: #f1b375; }
.code-line > b { display: inline-block; width: 18px; margin-right: 12px; text-align: right; color: #4f5c70; font-size: .8em; font-weight: 400; }
.code-caret { display: inline-block; width: 5px; height: 1em; background: #f5c891; margin-left: 3px; vertical-align: -.1em; }
.code-punctuation { color: #718397; }
.code-line .code-tag, .code-line .code-keyword { color: #c2a1f4; }
.code-line .code-attr, .code-line .code-property { color: #88c9ef; }
.code-line .code-string { color: #c5d88c; }
.code-line .code-comment { color: #718297; }
.screen-build {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    background: #fbf9f1;
    color: #22251f;
    opacity: var(--preview-opacity, 1);
    transform: translateX(var(--preview-shift, 0%)) scale(var(--preview-scale, 1));
    transform-origin: 50% 50%;
}
.screen-finish {
    position: absolute;
    z-index: 9;
    left: 50%;
    bottom: 6%;
    transform: translateX(-50%) translateY(calc((1 - var(--finish-opacity, 1)) * 15px));
    padding: 8px 13px;
    border: 1px solid #ecf4c130;
    border-radius: 100px;
    background: #23281ff2;
    color: #f8f36a;
    box-shadow: 0 4px 14px #0000001a;
    opacity: var(--finish-opacity, 1);
    font-size: clamp(6px, .7vw, 9px);
    line-height: 1.4;
    white-space: nowrap;
}
.laptop-base {
    position: relative;
    z-index: 3;
    height: 25px;
    width: 112%;
    left: -6%;
    margin-top: -1px;
    border-top: 1px solid #f2f3f4;
    border-radius: 2px 2px 35% 35% / 2px 2px 90% 90%;
    background: linear-gradient(90deg, #74797e, #c9ccd0 4%, #edf0f2 13%, #c4c8cc 49%, #eaedef 86%, #afb4ba 96%, #646a70);
    box-shadow: 0 2px 0 #747b82, inset 0 -5px 2px #6a70783d;
}
.laptop-base::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 43%;
    width: 14%;
    height: 9px;
    border-radius: 0 0 12px 12px;
    background: linear-gradient(#757b81, #c4c8cc 80%, #e3e5e7);
    box-shadow: inset 1px 0 2px #575d6330, 0 1px 0 #f3f4f5;
}
.laptop-base::after { content: ''; position: absolute; left: 4%; right: 4%; top: 11px; height: 1px; background: #ffffff35; }
.laptop-shadow { position: absolute; z-index: 0; bottom: -13px; left: -3%; right: -3%; height: 18px; border-radius: 50%; background: #65250045; filter: blur(12px); }
.story-footer {
    position: relative;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 18px 30px;
    width: 100%;
    max-width: 980px;
    margin-top: 18px;
}
.story-actions { display: flex; align-items: center; gap: 23px; margin-left: auto; }
.scroll-story:not(.story-ready) .story-actions { margin-inline: auto; }
.story-actions > .btn-primary { min-height: 43px; padding: 12px 22px; font-size: .8rem; }
.story-stepper { display: none; align-items: center; gap: 8px; margin-right: auto; }
.story-stepper > span { position: relative; width: 26px; height: 3px; overflow: hidden; border-radius: 3px; background: #ffffff55; font-size: 0; }
.story-stepper > span.is-active { background: var(--yellow, #f8f36a); }
.story-stepper > span.is-complete { background: white; }
.story-skip { font-size: .75rem; text-decoration: none; color: white; padding: 8px 0; }
.story-skip:hover { text-decoration: underline; text-underline-offset: 5px; }
.story-scroll-cue { display: none; color: white; font-size: .64rem; letter-spacing: .07em; text-align: center; margin-top: 15px; }
.story-accessible { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Only the initialized scroll controller opts into the long, pinned scene. */
.scroll-story.story-ready { height: 420svh; padding: 0; }
.story-ready .story-pin { position: sticky; top: 0; height: 100svh; max-width: none; padding-top: 106px; padding-bottom: 21px; justify-content: center; overflow: clip; isolation: isolate; }
.story-ready .story-head { flex: 0 0 216px; min-height: 0; }
.story-ready .story-head, .story-ready .story-footer { opacity: var(--story-chrome-opacity); }
.story-ready .story-camera { opacity: var(--device-opacity); }
.story-ready .story-intro { opacity: var(--intro-opacity, 1); transform: translateY(var(--intro-y, 0px)); }
.story-ready .story-chapter.is-active { opacity: 1; visibility: visible; transform: translateY(0); }
.story-ready .story-device-zone { flex-shrink: 0; margin-top: 15px; padding-bottom: 16px; }
.story-ready .laptop { width: min(820px, calc((100svh - 480px) * 1.6), 79vw); min-width: 340px; }
.story-ready .story-footer { flex-shrink: 0; margin-top: 8px; }
.story-ready .story-stepper, .story-ready .story-scroll-cue { display: flex; }
.story-ready .story-scroll-cue { justify-content: center; flex-shrink: 0; margin-top: 12px; }
.story-ready[data-stage="3"] .story-scroll-cue { opacity: .7; }

@media (max-height: 760px) and (min-width: 769px) {
    .story-ready .story-pin { padding-top: 96px; padding-bottom: 15px; }
    .story-ready .story-head { flex-basis: 135px; }
    .scroll-story .story-title.hero__title { font-size: 3.05rem; margin-bottom: 11px; }
    .story-eyebrow { font-size: .55rem; margin-bottom: 8px; }
    .story-lede, .story-chapter > p:last-child { font-size: .78rem; }
    .story-chapter h2 { font-size: 3rem; margin-bottom: 11px; }
    .story-ready .laptop { width: min(700px, calc((100svh - 350px) * 1.6), 75vw); min-width: 300px; }
    .story-ready .story-device-zone { margin-top: 8px; padding-bottom: 12px; }
    .story-ready .story-scroll-cue { margin-top: 8px; font-size: .55rem; }
    .story-actions > .btn-primary { min-height: 39px; padding: 10px 19px; }
}
@media (max-width: 1000px) and (min-width: 769px) {
    .story-pin { padding-inline: 30px; }
    .story-footer { max-width: 740px; }
}
@media (max-width: 768px) {
    .scroll-story { padding: 112px 0 50px; }
    .story-pin { padding-inline: 18px; }
    .story-head { min-height: 158px; }
    .story-eyebrow { margin-bottom: 13px; font-size: .56rem; letter-spacing: .13em; }
    .scroll-story .story-title.hero__title { font-size: clamp(2rem, 9.35vw, 3.4rem); margin-bottom: 15px; line-height: 1.01; letter-spacing: -.055em; }
    .scroll-story .story-title .highlight { padding-bottom: 5px; }
    .scroll-story .story-title .highlight::after { height: 3px; }
    .story-lede, .story-chapter > p:last-child { max-width: 410px; font-size: .78rem; line-height: 1.6; }
    .story-chapter { padding: 0 0 10px; }
    .story-chapter h2 { font-size: clamp(2.2rem, 8.3vw, 3.1rem); line-height: 1.03; margin-bottom: 13px; }
    .story-device-zone { margin-top: 25px; padding: 0 10px 18px; perspective: 950px; }
    .laptop { width: 100%; max-width: 560px; transform: none; }
    .laptop-lid { padding: 12px 6px 7px; border-width: 1.5px; border-radius: 12px 12px 3px 3px; }
    .laptop-camera { width: 3px; height: 3px; top: 4px; }
    .laptop-display { border-radius: 3px; }
    .laptop-base { width: 108%; left: -4%; height: 17px; }
    .laptop-base::before { height: 6px; }
    .laptop-base::after { top: 8px; }
    .laptop-shadow { height: 11px; bottom: -9px; filter: blur(8px); }
    .screen-chrome { height: 20px; padding-inline: 8px; gap: 4px; }
    .screen-address { font-size: 5px; left: 22%; right: 22%; padding: 2px 3px; }
    .screen-workspace { height: calc(100% - 20px); }
    .screen-editor { grid-template-columns: 23px minmax(0, 1fr); }
    .editor-rail { gap: 13px; padding-top: 10px; font-size: 9px; }
    .editor-code { padding: 8px 9px; }
    .editor-file { font-size: 6px; margin-bottom: 8px; padding: 3px 5px; }
    .code-line { font-size: 9px; line-height: 1.45; min-height: 1.45em; }
    .screen-finish { padding: 5px 8px; font-size: 5px; bottom: 5%; }
    .story-footer { margin-top: 12px; gap: 13px 20px; max-width: 570px; }
    .story-actions { gap: 17px; }
    .story-actions > .btn-primary { min-height: 42px; font-size: .75rem; padding: 12px 18px; }
    .story-skip { font-size: .67rem; }
    .story-stepper { gap: 5px; }
    .story-stepper > span { width: 16px; height: 3px; }
    .scroll-story.story-ready { height: 380svh; padding: 0; }
    .story-ready .story-pin { padding-top: 100px; padding-bottom: 68px; justify-content: center; }
    .story-ready .story-head { flex: 0 0 159px; }
    .story-ready .story-device-zone { margin-top: 14px; padding-bottom: 15px; }
    .story-ready .laptop { width: 100%; min-width: 0; max-width: min(560px, calc((100svh - 370px) * 1.65)); transform: none; }
    .story-ready .story-footer { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; margin-top: 10px; }
    .story-ready .story-stepper { grid-column: 1; grid-row: 1; margin: 0; }
    .story-ready .story-scroll-cue { grid-column: 2; grid-row: 1; justify-content: end; font-size: .56rem; margin-top: 0; letter-spacing: .04em; }
    .story-ready .story-actions { grid-column: 1 / -1; display: flex; justify-content: space-between; width: 100%; margin-left: 0; }
    .editor-file small { display: none; }
    .editor-status { font-size: 5px; margin-top: 9px; padding-top: 6px; }
    .code-line > b { width: 11px; margin-right: 7px; }
    .screen-chrome > .screen-dots { gap: 3px; }
    .screen-dots > i { width: 4px; height: 4px; }
    .screen-chrome > .screen-brand { font-size: 5px; }
    .laptop-wordmark { font-size: 3px; bottom: 1px; }
}
@media (max-width: 768px) and (max-height: 700px) {
    .story-ready .story-pin { padding-top: 91px; padding-bottom: 43px; }
    .story-ready .story-head { flex-basis: 139px; }
    .scroll-story .story-title.hero__title { font-size: clamp(1.95rem, 8.9vw, 2.8rem); margin-bottom: 11px; }
    .story-eyebrow { margin-bottom: 8px; font-size: .5rem; }
    .story-lede, .story-chapter > p:last-child { font-size: .72rem; }
    .story-chapter h2 { font-size: 2.2rem; }
    .story-ready .laptop { max-width: min(510px, calc((100svh - 335px) * 1.6)); }
    .story-ready .story-device-zone { margin-top: 7px; }
    .story-ready .story-footer { margin-top: 5px; gap: 9px 15px; }
    .story-ready .story-scroll-cue { margin-top: 9px; font-size: .52rem; }
}
@media (max-width: 380px) {
    .story-pin { padding-inline: 14px; }
    .story-chapter h2 { font-size: 2rem; }
    .story-lede, .story-chapter > p:last-child { max-width: 308px; }
    .story-actions > .btn-primary { padding-inline: 15px; font-size: .7rem; }
    .story-skip { font-size: .62rem; }
    .story-device-zone { padding-inline: 8px; }
}
@media (max-width: 540px) {
    .laptop-display { aspect-ratio: 16 / 10; }
    .editor-code { padding: 6px 8px; }
    .editor-file { margin-bottom: 6px; padding: 2px 5px; font-size: 6px; }
    .code-line { font-size: 7.5px; line-height: 1.35; min-height: 1.35em; }
    .editor-status { margin-top: 5px; padding-top: 4px; font-size: 5px; }
}
@media (max-width: 380px) and (max-height: 700px) {
    .story-chapter { padding-bottom: 8px; }
    .story-chapter h2 { font-size: 1.75rem; margin-bottom: 9px; }
}

/* Both decorative views are derived from the real section, with the same layout. */
section[data-story-destination] { min-height: 100svh; background: var(--primary); scroll-margin-top: 0; }
.screen-build { background: var(--primary); color: white; }
.screen-site-preview { width: var(--site-width, 100%); height: var(--site-height, 100%); transform: scale(var(--site-preview-scale, 1)); transform-origin: 0 0; }
.screen-site-fallback { display: flex; height: 100%; align-items: center; justify-content: center; flex-direction: column; gap: 12px; padding: 20px; text-align: center; }
.screen-site-fallback strong { font-size: clamp(18px, 3vw, 32px); letter-spacing: -.05em; }
.screen-site-fallback span { font-size: 9px; }
.screen-site-preview .section-header { opacity: var(--build-hero); transform: translateY(calc((1 - var(--build-hero)) * 25px)); }
.screen-site-preview .bento-grid { opacity: var(--build-cards); transform: translateY(calc((1 - var(--build-cards)) * 35px)); }
.story-live-screen {
    position: absolute;
    z-index: 8;
    left: 0;
    top: 0;
    width: var(--site-width);
    height: var(--site-height);
    background: var(--primary);
    color: white;
    overflow: hidden;
    pointer-events: none;
    transform-origin: 0 0;
    transform: translate3d(var(--live-x, 0px), var(--live-y, 0px), 0) scale(var(--live-scale, 1));
    clip-path: inset(0 0 var(--live-clip-bottom, 0px) 0);
}
.site-continuation { position: relative; z-index: 3; background: var(--primary); }
.story-ready + .site-continuation { margin-top: -100svh; opacity: 0; pointer-events: none; transform: translateY(var(--continuation-offset, 0px)); }
.story-ready + .site-continuation.is-revealed,
.story-ready + .site-continuation:focus-within { opacity: 1; pointer-events: auto; }
.story-ready .story-footer:focus-within { opacity: 1; z-index: 11; }
.story-ready .story-footer:focus-within .story-actions { padding: 4px 8px; background: #ff751f; border-radius: 100px; }
/* The controller owns .story-ready so collapse preserves the scroll position. */
@media (prefers-reduced-motion: reduce) {
    .scroll-story *, .scroll-story *::before, .scroll-story *::after {
        animation: none !important;
        transition: none !important;
    }
}
