/* =====================================================================================================
   SparCrowd homepage shell (site.html, with site-shell.js). The site is six views, one on screen at a
   time: a rail names them, the stage shows the one that is open, the dock steps to the next. Inside a view,
   steps or tabs show one pane at a time. Direction D throughout: every colour and font is a token from
   sparcrowd.css. Without the script nothing here hides anything and the page is one long page.
   ===================================================================================================== */

/* ---------- one view, one pane ---------- */
html.js .view { display: none; }
html.js .view.is-active { display: block; }
html.js .pane { display: none; }
html.js .pane.is-on { display: block; }
/* a link that names a pane must not scroll its steps or tabs out of sight: the browser's own jump lands at the top */
html.js .pane { scroll-margin-top: 200vh; }
html:not(.js) .tabs, html:not(.js) .rail-mark, html:not(.js) .pager { display: none; }

@keyframes view-up { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }
@keyframes view-down { from { opacity: 0; transform: translateY(-28px); } to { opacity: 1; transform: none; } }
@keyframes pane-in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
.view.enter-fwd { animation: view-up .5s cubic-bezier(.2, .75, .25, 1) both; }
.view.enter-back { animation: view-down .5s cubic-bezier(.2, .75, .25, 1) both; }
.pane.pane-in { animation: pane-in .34s cubic-bezier(.2, .75, .25, 1) both; }
@media (prefers-reduced-motion: reduce) {
  .view.enter-fwd, .view.enter-back, .pane.pane-in { animation: none; }
}

/* ---------- top bar ---------- */
.site .top {
  max-width: none; margin: 0; padding: 11px clamp(16px, 2.4vw, 28px); gap: 14px;
  background: var(--page); border-bottom: 1.5px solid var(--line);
}
.top-live {
  display: inline-flex; align-items: center; gap: 8px; min-width: 0; margin: 0 0 0 6px; padding: 6px 13px 6px 10px;
  border-radius: 999px; background: #131C4F; color: #FFFFFF;
  font: 500 .6875rem/1.3 var(--f-mono); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .16);
}
.top-live span { overflow: hidden; text-overflow: ellipsis; }
.top-live.is-wait .live-dot, .top-live.is-down .live-dot { background: #9AA6EE; animation: none; }
.site .top .top-pilot { margin-left: auto; min-height: 40px; padding: 7px 18px; }
.site .top .top-signin { margin-left: 0; }
@media (max-width: 760px) { .top-live { display: none; } }
@media (max-width: 460px) { .site .top .top-pilot { display: none; } .site .top .top-signin { margin-left: auto; } }

/* ---------- the rail (narrow screens: a strip that scrolls sideways and stays in reach) ---------- */
.rail {
  position: sticky; top: 0; z-index: 20; background: var(--page); border-bottom: 1.5px solid var(--line);
}
.rail ol { display: flex; gap: 2px; margin: 0; padding: 6px calc(var(--gutter) - 10px); overflow-x: auto; scrollbar-width: none; }
.rail ol::-webkit-scrollbar { display: none; }
.rail li { flex: none; }
.rail a {
  display: flex; align-items: baseline; gap: 8px; padding: 9px 10px; border-radius: 10px;
  text-decoration: none; white-space: nowrap; color: var(--ink);
}
.rail-n { font: 500 .6875rem/1 var(--f-mono); letter-spacing: .06em; color: var(--ink-2); }
.rail-t { font: 400 1.1875rem/1.15 var(--f-display); letter-spacing: -.005em; padding: 0 .22em; margin: 0 -.22em; border-radius: 3px; }
.rail-s { display: none; }
.rail a[aria-current] .rail-t { background: var(--mark-bg); color: var(--mark-ink); }
.rail a[aria-current] .rail-n { color: var(--hot); }
.rail-mark { display: none; }

/* ---------- the dock ---------- */
.site .foot.dock {
  display: grid; gap: 14px; padding: 18px var(--gutter) 28px; border-top: 1.5px solid var(--line);
  font-size: .75rem; line-height: 1.45; color: var(--ink-2);
}
.pager { display: flex; align-items: center; gap: 10px; }
.pager[hidden] { display: none; }
.pager-link {
  display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px; border-radius: 999px;
  font: 500 .75rem/1.2 var(--f-mono); letter-spacing: .03em; text-decoration: none; color: var(--ink);
  box-shadow: inset 0 0 0 1.5px var(--ink); white-space: nowrap;
}
.pager-link:hover { background: var(--page-2); }
.pager-next { margin-left: auto; background: var(--ink); color: var(--page); }
.pager-next:hover { background: var(--hot); color: var(--page); }
@media (prefers-color-scheme: dark) { .pager-next:hover { color: var(--mark-ink); } }
.pager-at { font: 500 .6875rem/1 var(--f-mono); letter-spacing: .08em; color: var(--ink-2); }

/* ---------- inside every view ---------- */
html.js .view .section { padding: clamp(22px, 3vw, 34px) 0 clamp(36px, 5vw, 56px); }
html.js .view .section-alt { background: transparent; }
html.js .view .pane > .wrap { padding-top: clamp(20px, 2.6vw, 30px); padding-bottom: clamp(36px, 5vw, 56px); }
html.js .site .plans-host, html.js .site .evidence-host { min-height: 50vh; }
.view .section-head { margin-bottom: clamp(18px, 2.4vw, 28px); }
.view-head { padding: clamp(22px, 3vw, 34px) 0 clamp(14px, 2vw, 22px); }
.view-head .eyebrow { color: var(--hot); margin-bottom: 10px; }
.view-head h2:focus { outline: none; }
.view h2[tabindex="-1"]:focus, .view h1[tabindex="-1"]:focus { outline: none; }

/* ---------- 01 the first screen: "Built on" sits under the calls to action ---------- */
.site .hero-more .built { width: 100%; padding: 14px 0 0; border: 0; border-top: 1.5px solid var(--line); }
.site .hero-more .built-in { display: grid; gap: 8px; }
.site .hero-more .built .eyebrow { padding: 0; color: var(--ink-2); font-size: .6875rem; }
.site .hero-more .built-main { gap: 8px; }
.site .hero-more .built-marks { gap: 10px 30px; }
.site .hero-more .built-mark { gap: 3px; }
.site .hero-more .built-name { font-size: clamp(1.5rem, 2.2vw, 1.875rem); }
.site .hero-more .built-img { height: 28px; }
.site .hero-more .built-what { font-size: .8125rem; line-height: 1.45; color: var(--ink-2); max-width: 52ch; }
.site .hero-more .built .fine { font-size: .6875rem; }

/* ---------- 02 the range fills its view ---------- */
.view-range { background: var(--stage); }

/* ---------- 03 how it works: four steps on the left, the live proof of the open step on the right ---------- */
.flow { display: grid; gap: 16px; padding-bottom: clamp(36px, 5vw, 56px); }
.flow-steps { display: flex; gap: 8px; margin: 0 calc(var(--gutter) * -1); padding: 2px var(--gutter); overflow-x: auto; scrollbar-width: none; }
.flow-steps::-webkit-scrollbar { display: none; }
.flow-steps li { flex: none; }
.flow-step {
  display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 16px 6px 6px; border: 0; border-radius: 999px;
  background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); cursor: pointer; text-align: left;
}
.flow-n {
  display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%;
  font: 400 1.25rem/1 var(--f-display); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink);
  transition: background-color .25s, color .25s, box-shadow .25s;
}
.flow-t { font: 400 1.125rem/1.15 var(--f-display); white-space: nowrap; }
.flow-d { display: none; }
.flow-step[aria-selected="true"] { box-shadow: inset 0 0 0 1.5px var(--ink); background: var(--surface); }
.flow-step[aria-selected="true"] .flow-n { background: var(--ink); color: var(--page); }
.flow-step[aria-selected="true"] .flow-n-stop { background: #FF5A40; color: #230600; box-shadow: none; }
.flow-panes { min-width: 0; }
.flow .pane { border-radius: 18px; background: var(--surface); box-shadow: 0 0 0 1.5px var(--line); }
.flow .pane.gate { background: var(--c-deep); box-shadow: none; }
.flow .pane > .wrap { max-width: none; padding: clamp(16px, 2.2vw, 28px); }
.view .pane .section-head h2, .view-plans h2, .view-pilot h2 { font-size: clamp(1.625rem, 2.6vw, 2.25rem); }
.flow .pane .section-head { grid-template-columns: minmax(0, 1fr); gap: 10px; }
.flow .pane .section-head p.note { max-width: 70ch; }
.flow .langs-live { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.pane .eg {
  margin: 0 0 18px; padding: 10px 14px; border-radius: 4px 10px 10px 4px; border-left: 4px solid #FF5A40;
  background: var(--page); color: var(--ink); font-size: .875rem; line-height: 1.45; max-width: 80ch;
}
.pane .eg span { display: block; margin-top: 4px; font: 500 .6875rem/1.3 var(--f-mono); color: var(--ink-2); }
.connect { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
.connect-card { display: grid; gap: 10px; align-content: start; min-width: 0; padding: 16px; border-radius: 14px; background: var(--page); font-size: .9375rem; }
.connect-card .eyebrow { color: var(--hot); }
.spec-code {
  margin: 0; padding: 12px 14px; border-radius: 10px; background: #131C4F; color: #DDE3FF;
  font: 400 .75rem/1.6 var(--f-mono); white-space: pre-wrap; overflow-wrap: anywhere;
}
.spec-code:focus-visible { outline-color: var(--focus); }

/* ---------- 04 evidence: tabs ---------- */
.tabs { display: flex; gap: 4px; padding-top: clamp(14px, 2vw, 22px); border-bottom: 1.5px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; padding: 12px 16px 11px; border: 0; border-bottom: 3px solid transparent; margin-bottom: -1.5px; border-radius: 6px 6px 0 0;
  background: transparent; color: var(--ink-2); font: 400 1.3125rem/1.1 var(--f-display); cursor: pointer; white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }

/* =====================================================================================================
   A screen with room for it: the page stops being a page. The top bar, the rail and the dock stay put and
   the open view fills the stage between them, scrolling inside itself only when it has more to show.
   ===================================================================================================== */
@media (min-width: 1001px) and (min-height: 600px) {
  html.js { scroll-behavior: auto; }
  html.js body.site {
    height: 100vh; height: 100dvh; overflow: hidden;
    display: grid; grid-template-columns: clamp(212px, 17vw, 252px) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto;
  }
  html.js .site .top { grid-column: 1 / -1; grid-row: 1; }

  html.js .rail {
    grid-column: 1; grid-row: 2 / 4; position: relative; top: auto; overflow-y: auto; padding: 14px 0 18px;
    border-bottom: 0; border-right: 1.5px solid var(--line);
  }
  html.js .rail ol { display: block; padding: 0; overflow: visible; }
  html.js .rail a {
    display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 3px 8px; align-items: start;
    padding: 13px 16px 14px 20px; border-radius: 0; white-space: normal; transition: background-color .2s;
  }
  html.js .rail a:hover { background: var(--page-2); }
  html.js .rail a[aria-current] { background: var(--surface); }
  html.js .rail-n { grid-row: 1 / 3; padding-top: .62em; }
  html.js .rail-t { justify-self: start; font-size: clamp(1.375rem, 1.9vw, 1.625rem); }
  html.js .rail-s { display: block; grid-column: 2; font: 400 .75rem/1.4 var(--f-body); color: var(--ink-2); }
  html.js .rail-mark {
    display: block; position: absolute; left: 0; top: 0; width: 4px; height: var(--mark-h, 0); opacity: 0;
    background: var(--ink); transform: translateY(var(--mark-y, 0));
    transition: transform .46s cubic-bezier(.2, .75, .25, 1), height .3s, opacity .2s;
  }
  html.js .rail.has-mark .rail-mark { opacity: 1; }

  html.js .views { grid-column: 2; grid-row: 2; position: relative; min-height: 0; overflow: hidden; --gutter: clamp(18px, 2.4vw, 36px); }
  html.js .view.is-active { height: 100%; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }

  html.js .site .foot.dock {
    grid-column: 2; grid-row: 3; display: flex; align-items: center; justify-content: space-between; gap: 18px;
    padding: 7px clamp(18px, 2.4vw, 36px); background: var(--page);
  }
  html.js .pager-link { min-height: 34px; padding: 5px 14px; }
  html.js .pager-next { margin-left: 0; }

  /* 01: the console is as tall as the stage allows, and the first screen does not scroll */
  html.js .site .hero-live { padding-top: 20px; padding-bottom: 20px; gap: 14px clamp(22px, 3vw, 44px); }
  html.js .site .hero-live h1 { font-size: clamp(2.5rem, 4.3vw, 4.5rem); }
  html.js .site .view-home .console { height: clamp(540px, calc(100dvh - 158px), 800px); }

  /* 03: the steps become a column that stays in view while the pane scrolls */
  html.js .flow { grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); gap: clamp(18px, 2.4vw, 32px); align-items: start; }
  html.js .flow-steps { display: block; position: sticky; top: 8px; margin: 0; padding: 0; overflow: visible; }
  html.js .flow-step {
    display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 4px 14px; align-items: start; width: 100%;
    padding: 15px 12px 16px 10px; border-radius: 0; box-shadow: none; border-top: 1.5px solid var(--line);
    transition: background-color .2s;
  }
  html.js .flow-steps li:last-child .flow-step { border-bottom: 1.5px solid var(--line); }
  html.js .flow-step:hover { background: var(--page-2); }
  html.js .flow-step[aria-selected="true"] { background: var(--surface); box-shadow: inset 4px 0 0 0 var(--ink); }
  html.js .flow-n { grid-row: 1 / 3; width: 44px; height: 44px; font-size: 1.375rem; }
  html.js .flow-t { font-size: 1.375rem; white-space: normal; justify-self: start; padding: 0 .2em; margin: 0 -.2em; border-radius: 3px; }
  html.js .flow-step[aria-selected="true"] .flow-t { background: var(--mark-bg); color: var(--mark-ink); }
  html.js .flow-d { display: block; grid-column: 2; font-size: .8125rem; line-height: 1.45; color: var(--ink-2); }
}

/* the stage is shorter than the console was drawn for: tighten it, as on a small laptop */
@media (min-width: 1001px) and (min-height: 600px) and (max-height: 905px) {
  html.js .site .hero-live { padding-top: 12px; padding-bottom: 12px; }
  html.js .site .console-head { padding: 12px 18px 11px; }
  html.js .site .console-sub, html.js .site .try-cap { display: none; }
  html.js .site .pick-row { padding-top: 9px; }
  html.js .site .pick-label { margin-bottom: 4px; }
  html.js .site .pick { min-height: 30px; padding: 4px 11px; font-size: .78125rem; }
  html.js .site .pick-wait { height: 30px; }
  html.js .site .pick-goals .pick-chips { min-height: 66px; }
  html.js .site .pick-langs .pick-chips { min-height: 30px; }
  html.js .site .console-view { margin-top: 9px; }
  html.js .site .console-form { padding-top: 9px; }
  html.js .site .try-input { min-height: 54px; padding: 7px 12px; }
  html.js .site .try-send { min-height: 48px; }
  html.js .site .console-foot { min-height: 30px; padding-top: 3px; }
  html.js .site .console-fine { padding: 3px 18px 12px; }
  html.js .site .view-home .console { height: clamp(520px, calc(100dvh - 142px), 800px); }
  html.js .site .hero-more .built-what { display: none; }
}
@media (min-width: 1001px) and (min-height: 600px) and (max-height: 860px) {
  html.js .site .hero-more .hand-note { display: none; }
}
@media (min-width: 1001px) and (min-height: 600px) and (max-height: 800px) {
  html.js .site .hero-live h1 { font-size: clamp(2.25rem, 3.6vw, 3.5rem); }
  html.js .site .hero-live .lead { margin-top: 12px; font-size: 1.0625rem; }
  html.js .site .hero-more .for { display: none; }
}

/* the launch checklist in its own tab: no rule above it, it is the first thing in the pane */
.view #checklist-host .checklist { margin-top: 0; padding-top: 0; border-top: 0; }
