/* The image fills the visible viewport; only controls respect the safe area. */
:root{
 --tbg-view-height:100vh;
 --tbg-scroll-height:100vh;
 --tbg-safe-top:env(safe-area-inset-top,0px);
 --tbg-safe-bottom:env(safe-area-inset-bottom,0px);
 --tbg-safe-left:env(safe-area-inset-left,0px);
 --tbg-safe-right:env(safe-area-inset-right,0px);
}
@supports(height:100svh){:root{--tbg-view-height:100svh;--tbg-scroll-height:100svh}}
@supports(height:100dvh){:root{--tbg-view-height:100dvh}}
.roadster-home{--scene-head:calc(72px + var(--tbg-safe-top))}
.roadster-home .site-header{
 height:var(--scene-head);
 padding-top:calc(10px + var(--tbg-safe-top));
 padding-left:max(24px,var(--tbg-safe-left));
 padding-right:max(24px,var(--tbg-safe-right));
}
.roadster-home .film-stage,.roadster-home .scene-stage{height:var(--tbg-view-height)}
.roadster-home .film-ready{height:calc(var(--tbg-scroll-height)*3.4 + var(--tbg-view-height))}
.roadster-home .scene-copy{
 --scene-top:calc(max(108px,13.2svh) + var(--tbg-safe-top));
 bottom:0;
 left:max(24px,var(--tbg-safe-left));
 right:max(24px,var(--tbg-safe-right));
}
.roadster-home .scene-copy .scene-note{
 top:auto;
 bottom:max(26px,calc(var(--tbg-safe-bottom) + 16px));
}
/* The old note-sized scrim stopped 21.5px above the frame. Never shade a
   moving text box: the continuous gradient belongs to the image plane. */
.roadster-home .scene-note::before{content:none}
.roadster-home .film-stage::after,
.roadster-home .enhanced-stage::after,
.roadster-home #elon .scene-stage::after{
 content:'';position:absolute;inset:0;z-index:1;pointer-events:none;
 background:linear-gradient(180deg,transparent 62%,#080b0f12 76%,#080b0fd4 100%);
}
.roadster-home .film-stage::after{
 z-index:3;
 opacity:max(var(--end-visible,0),var(--elon-opacity,0));
}
.roadster-home .scene-invitation{
 bottom:max(32px,calc(var(--tbg-safe-bottom) + 16px));
 left:max(24px,var(--tbg-safe-left));
 right:max(24px,var(--tbg-safe-right));
}
/* Stable story travel prevents a camera jump when browser chrome collapses. */
.roadster-home .story-chain:not([data-static=true]){
 height:calc((var(--tbg-scroll-height) - var(--scene-head))*18.8 + var(--tbg-view-height) - var(--scene-head));
}
.roadster-home .story-chain:not([data-static=true]) .chain-stage{
 height:calc(var(--tbg-view-height) - var(--scene-head));
}
.roadster-home .gesture-story{height:calc(var(--tbg-scroll-height)*3.5 + var(--tbg-view-height))}
.roadster-home .gesture-stage{height:calc(var(--tbg-view-height) - var(--scene-head));min-height:0}
/* These sticky viewports already paint video/canvas over the whole surface.
   Keep their fallback in an image layer, not a solid color that Safari may
   extend into its toolbars. No change to the car or the video color grade. */
.roadster-home .film-stage,
.roadster-home .chain-stage,
.roadster-home .gesture-stage{
 background-color:transparent;
 background-image:linear-gradient(#0a0b0d,#0a0b0d);
}
.roadster-home .site-menu{
 height:var(--tbg-view-height);max-height:var(--tbg-view-height);
 padding-top:calc(18px + var(--tbg-safe-top));
 padding-bottom:calc(30px + var(--tbg-safe-bottom));
 padding-left:max(24px,var(--tbg-safe-left));padding-right:max(24px,var(--tbg-safe-right));
}
.roadster-home .rd-panel{
 max-height:calc(var(--tbg-view-height) - max(32px,var(--tbg-safe-top)) - var(--tbg-safe-bottom));
}
@media(min-width:760px){
 .roadster-home .site-header{padding-left:max(48px,var(--tbg-safe-left));padding-right:max(48px,var(--tbg-safe-right))}
 .roadster-home .scene-copy{--scene-top:calc(clamp(130px,18svh,190px) + var(--tbg-safe-top));left:max(6vw,var(--tbg-safe-left));right:auto}
 .roadster-home .scene-invitation{left:max(6vw,var(--tbg-safe-left));right:auto;bottom:max(40px,calc(var(--tbg-safe-bottom) + 16px))}
}
@media(max-width:359px){
 .roadster-home .scene-copy{left:max(20px,var(--tbg-safe-left));right:max(20px,var(--tbg-safe-right))}
}
@media(max-height:700px) and (max-width:759px){
 .roadster-home .scene-copy{--scene-top:calc(95px + var(--tbg-safe-top))}
}
@media(prefers-reduced-motion:reduce){
 .roadster-home .scene-copy{bottom:auto}
 .roadster-home .scene-copy .scene-note{position:static;margin-top:24px}
 .roadster-home .story-chain:not([data-static=true]),.roadster-home .gesture-story{height:auto!important}
 .roadster-home .story-chain:not([data-static=true]) .chain-stage{height:auto}
 .roadster-home .gesture-stage{min-height:600px}
}
