/* The calculator's tour on the home page (js/tour.js, js/tour-scene.js; captain, 2026-11-25): a pinned stage
   that the scroll drives. Theme tokens only. Its height is there from the first paint, so nothing moves when
   the 3D comes or fails. A browser with no WebGL, or saving data, has .is-flat from the start: the captions, one
   after another. */
.tour { scroll-margin-top: 0; }
.theme-vapor-sunset .tour { --tour-k: .7; }
.tour-top { padding-block: 40px 0; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; }
.tour-links { display: flex; flex-wrap: wrap; gap: 0 24px; }
.tour-skip { font-weight: 700; font-size: 15px; min-height: 44px; display: inline-flex; align-items: center; }
/* The page is a sheet over the stage (captain, 2026-11-25): the stage waits behind it, one screen up and one screen
   down from the track, and the sheets' edges are the bottom of .tour-head and the top of what follows. Behind
   everything in main: the stage, then the sheets. The run is in the place of the track, so no part of the page is
   higher than it was. */
main{position:relative;isolation:isolate}
.tour{position:relative;display:flow-root;pointer-events:none}
.tour-head,#tour-stage,.tour::after{pointer-events:auto}
.tour-head{position:relative;padding-bottom:28px}
.tour-head::before,.tour::after{content:"";position:absolute;z-index:-1;left:0;right:0;box-sizing:border-box;background:var(--bg);border:0 solid var(--line);box-shadow:0 0 48px color-mix(in srgb,var(--text) 10%,#0006)}
.tour-head::before{top:-100vh;top:-100lvh;bottom:0;border-radius:0 0 28px 28px;border-bottom-width:1px}
.tour::after{top:100%;height:100vh;height:100lvh;border-radius:28px 28px 0 0;border-top-width:1px}
#tour-run{position:relative;z-index:-2;height:calc(620vh + 200vh);height:calc(620vh + 200lvh);margin-block:-100vh;margin-block:-100lvh}
#tour-track{position:absolute;left:0;right:0;top:100vh;top:100lvh;height:620vh;pointer-events:none}
/* As tall as the screen with a phone's toolbar away; --tour-b keeps what is at the bottom above the toolbar. */
/* Under the page and not near yet: nothing of it counts as seen, or as moved, while the page loads (js/tour.js). */
@media(scripting:enabled){.tour:not(.is-near,.is-flat) #tour-run{clip-path:inset(0 0 100%)}.tour:not(.is-near)::after,.tour:not(.is-near) .tour-head::before{visibility:hidden}}
/* A field has the focus: the stage scrolls with the page, so that a phone's keyboard can bring the field up. */
.tour:not(.is-flat):has(#tour-email:focus) #tour-stage{position:absolute;left:0;right:0;top:auto;bottom:100vh;bottom:100lvh;opacity:1!important}
#tour-stage{--tour-b:calc(100lvh - 100svh);position:sticky;top:0;height:100vh;height:100lvh;overflow:hidden}
#tour-stage canvas{position:absolute;inset:0;width:100%;height:100%;display:block}
.tour-cap{position:absolute;inset:0 0 auto;padding:max(56px,9svh) max(20px,env(safe-area-inset-right,0px)) 0 max(20px,env(safe-area-inset-left,0px));text-align:center;opacity:0;pointer-events:none;will-change:opacity,transform}
.tour-cap:first-child{opacity:1}
.tour-cap h3{margin:0;font-family:var(--font-display);font-weight:var(--display-weight);font-size:calc(var(--tour-k, 1)*clamp(34px,6vw,68px));letter-spacing:var(--display-tracking);line-height:1.04;text-wrap:balance}
.tour-cap p{margin:10px auto 0;max-width:30em;font-size:clamp(16px,1.6vw,20px);line-height:1.4;color:var(--text-muted);text-wrap:balance}
#tour-rail{position:absolute;z-index:4;right:env(safe-area-inset-right,0px);top:50svh;height:min(58svh,460px);width:44px;transform:translateY(-46%);touch-action:pan-y pinch-zoom;-webkit-touch-callout:none;cursor:grab;user-select:none;-webkit-user-select:none;-webkit-tap-highlight-color:transparent}
#tour-rail b{transition:scale .18s}#tour-rail.drag b{scale:1.45}
#tour-rail:active{cursor:grabbing}
#tour-rail i{position:absolute;left:24px;width:4px;border-radius:4px;top:0;background:var(--line)}
#tour-rail i.all{height:100%}
#tour-rail i.done{height:100%;background:var(--accent);transform-origin:top;transform:scaleY(0)}
#tour-rail b{position:absolute;left:17px;top:0;width:18px;height:18px;margin-top:-9px;border-radius:50%;background:var(--accent);box-shadow:0 0 0 4px var(--bg),0 3px 10px #0004}
#tour-rail button{position:absolute;right:0;height:44px;width:44px;margin:-22px 0 0;padding:0;border:0;background:none;cursor:inherit;font:500 14px var(--font-ui);color:var(--text)}
#tour-rail button::before{content:"";position:absolute;left:21px;top:17px;width:10px;height:10px;box-sizing:border-box;border-radius:50%;background:var(--bg);border:2.5px solid var(--text-muted)}
#tour-rail button.past::before{border-color:var(--accent);background:var(--accent)}
#tour-rail span{position:absolute;right:34px;top:50%;translate:0 -50%;white-space:nowrap;padding:5px 11px;border-radius:99px;background:var(--bg);border:1px solid var(--line);opacity:0;transform:translateX(6px);transition:opacity .2s,transform .2s;pointer-events:none}
#tour-rail.busy button[aria-current] span,#tour-rail.drag span,#tour-rail button:focus-visible span{opacity:1;transform:none}
@media(hover:hover) and (min-width:900px){#tour-rail{right:20px}#tour-rail button span{opacity:.55;transform:none;border-color:transparent;background:none}#tour-rail button[aria-current] span{opacity:1;font-weight:800}}
#tour-bench.on{visibility:visible;pointer-events:auto}#tour-bench:focus-visible{outline:3px solid var(--accent);outline-offset:3px}
@media(min-width:900px){#tour-stage #tour-cue{bottom:22px}}
/* Beside the keyboard of the first part, whose half width is at most 34.2svh and 31vw. */
@media(min-width:900px) and (max-height:500px){#tour-stage #tour-cue{left:220px;bottom:40px}}
@media(min-width:1280px) and (min-aspect-ratio:7/5){#tour-stage #tour-cue{left:calc(50% - min(34.2svh,31vw) - 78px)}}
#tour-foot{position:absolute;left:108px;right:48px;bottom:calc(66px + env(safe-area-inset-bottom,0px) + var(--tour-b));margin:0;text-align:center;font-size:13px;color:var(--text-muted);opacity:0;transition:opacity .2s;pointer-events:none}
@media(min-width:900px){#tour-foot{left:32px;right:auto;bottom:28px;text-align:left}}
#tour-dev{color:var(--text);font-weight:800;font-size:1.15em}
#tour-stage{touch-action:pan-y pinch-zoom}
#tour-dots{display:flex;justify-content:center;margin-top:-8px;visibility:hidden}
#tour-dots.on{visibility:visible;pointer-events:auto}
#tour-dots button{width:34px;height:44px;border:0;background:none;padding:0;position:relative;cursor:pointer}
#tour-dots button::after{content:"";position:absolute;left:50%;top:50%;width:10px;height:10px;border-radius:9px;translate:-50% -50%;background:var(--line);transition:width .25s,background .25s}
#tour-dots button[aria-pressed=true]::after{width:26px;background:var(--accent)}
.tour-brow{margin:0 auto 6px!important;font-weight:700;font-size:15px!important;color:var(--accent)!important}
.tour-also{display:flex;gap:6px 22px;flex-wrap:wrap}
.tour-also a{color:var(--text);font-weight:500;font-size:15px;min-height:44px;display:inline-flex;align-items:center}
#tour-end.on .tour-end-text > *{pointer-events:auto} /* Get one's calculator beside it takes presses (js/sim-model.js) */
#tour-stage .sim-lay{opacity:.01!important}#tour-end:not(.on) :is(input,button,a,label,iframe){visibility:hidden}
#tour-cue{position:absolute;left:50%;bottom:calc(90px + env(safe-area-inset-bottom,0px) + var(--tour-b));translate:-50% 0;display:grid;justify-items:center;gap:4px;min-height:44px;padding:0 14px;white-space:nowrap;border:0;background:none;font:800 17px var(--font-ui);color:var(--accent);cursor:pointer;will-change:opacity}
#tour-cue svg{animation:tour-bob 1.5s cubic-bezier(.45,0,.55,1) infinite alternate}
@keyframes tour-bob{to{transform:translateY(8px)}}
@media (prefers-reduced-motion: reduce){#tour-cue svg{animation:none}#tour-rail span{transition:none}}
.tour button:focus-visible{outline:3px solid var(--accent);outline-offset:2px}

#tour-bench { margin-top: 16px; visibility: hidden; }
#tour-bench.on { visibility: visible; pointer-events: auto; }
.tour-anchor { position: absolute; left: 0; bottom: 100vh; bottom: 100lvh; }
#tour-end form { margin: 12px 0 0; max-width: 430px; text-align: left; }
.tour-end-text { width: min(100% - 32px, var(--content)); margin-inline: auto; text-align: left; }
#tour-end .tour-end-text > p { margin-inline: 0; max-width: 34em; }
#tour-end .tour-end-text > p:not(.tour-brow) { font-size: clamp(15px, 1.4vw, 18px); text-wrap: pretty; }
.tour-list { margin: 10px 0 0; padding: 0 0 0 20px; display: grid; gap: 6px; line-height: 1.4; color: var(--text-soft); font-size: clamp(15px, 1.3vw, 17px); }
.tour-list strong { color: var(--text); }
@media (min-width: 900px) and (min-aspect-ratio: 11/10), (min-width: 640px) and (max-height: 500px) {
  #tour-end { inset: 0; display: grid; align-items: center; padding-top: 0; }
  .tour-end-text { display: grid; justify-items: start; }
  .tour-end-text > * { max-width: min(40vw, 480px) !important; }
}
@media (min-width: 900px) and (max-aspect-ratio: 11/10) { .tour-end-text { width: min(100% - 160px, 620px); } }
@media (max-width: 899px) and (max-height: 740px) { .tour:not(.is-flat) :is(.tour-list, .tour-end-text > .small) { display: none; } }
@media (max-height: 640px) and (min-width: 900px) {
  .tour:not(.is-flat) :is(.tour-list, .tour-end-text > .small) { display: none; }
  .tour:not(.is-flat) .tour-cap h3 { font-size: calc(var(--tour-k, 1) * 34px); }
  .tour:not(.is-flat) .tour-cap { padding-top: 20px; }
}
@media (max-width: 899px) and (max-height: 600px) { .tour:not(.is-flat) #tour-end .tour-end-text > p:not(.tour-brow, .tour-also) { display: none; } }
@media (max-width: 359px) { #tour-end form .field-row { flex-wrap: wrap; } #tour-end .input { flex-basis: 100%; } }
/* A phone on its side: the text and the model side by side, and only what fits. */
@media (max-width: 899px) and (max-height: 500px) {
  .tour:not(.is-flat) .tour-cap { padding-top: 12px; }
  .tour:not(.is-flat) .tour-cap h3 { font-size: calc(var(--tour-k, 1) * 24px); }
  .tour:not(.is-flat) .tour-cap p:not(.tour-brow, .form-note) { font-size: 14px; margin-top: 4px; }
  .tour:not(.is-flat) #tour-end .tour-end-text > p:not(.tour-brow, .tour-also), .tour:not(.is-flat) .tour-brow { display: none; }
  .tour:not(.is-flat) #tour-bench { margin-top: 6px; }
  #tour-stage #tour-cue { left: 186px; bottom: 60px; }
  #tour-stage #tour-foot { left: 16px; right: auto; bottom: 16px; }
  .tour-play { bottom: 42px; }
}
.tour.at-end .tour-play { visibility: hidden; } /* nothing moves there */
#tour-end .tour-brow { margin-inline: 0 !important; }
@media (max-width: 899px) {
  #tour-end { padding-top: max(28px, 4svh); padding-right: 40px; }
  /* A phone: the device leads, so the words are only the line, the form and the links (captain, 2026-11-27). */
  .tour:not(.is-flat) :is(.tour-list, .tour-end-text > .small) { display: none; }
  #tour-end .tour-end-text > p:not(.tour-brow) { font-size: 15px; }
  #tour-end .tour-also { gap: 0 18px; }
  #tour-end .tour-also a { font-size: 14px; }
  #tour-end .tour-also a[href="/where-we-are"] { display: none; } /* one row; the menu has it */
}
#tour-end form .field-row { display: flex; gap: 8px; }
#tour-end .input { min-width: 0; flex: 1; }
#tour-end .thanks { margin-top: 16px; }
.tour-play { position: absolute; left: 16px; bottom: calc(72px + env(safe-area-inset-bottom, 0px) + var(--tour-b)); z-index: 4; }
@media (min-width: 900px) { .tour-play { left: 32px; bottom: 56px; } }
/* Not there until its turn: the form's own Turnstile loads when the form is near the screen (js/forms.js). */
#tour-end:not(.on) form { display: none; }
.tour.is-flat #tour-end form { display: block; }
.tour-also + .small { margin-top: 4px; font-size: 14px; }
.tour.is-flat :is(#tour-run, #tour-track) { position: static; height: auto; margin: 0; }
.tour.is-flat::after, .tour.is-flat .tour-head::before { display: none; }
.tour.is-flat #tour-stage { position: static; height: auto; padding-block: 24px 56px; }
.tour.is-flat .tour-cap { position: static; opacity: 1 !important; padding-block: 28px; transform: none !important; pointer-events: auto; }
.tour.is-flat :is(#tour-cue, #tour-rail, #tour-dots, .tour-play) { display: none; }
.tour.is-flat #tour-bench { visibility: visible; }
.tour.is-flat #tour-end :is(input, button, a, label, iframe) { visibility: visible; }
.tour.is-flat .tour-anchor { bottom: 0; }
.tour.is-flat #tour-foot { position: static; opacity: 1; }
.tour.is-flat #tour-foot:empty { display: none; }
