/* SkyGCS — design 01, in the manner of animejs.com:
   one fixed instrument that the scroll plays, a colour per chapter.
   Colours, radii and type are taken from the app itself. */

@font-face { font-family: "Oxanium"; src: url("assets/fonts/oxanium_regular.b19bd4918b.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Oxanium"; src: url("assets/fonts/oxanium_medium.109f93e40a.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Oxanium"; src: url("assets/fonts/oxanium_semibold.b12b8cda10.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Oxanium"; src: url("assets/fonts/oxanium_bold.ac6e97ef18.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  --bg: #080808;          /* app: cyber_bg */
  --line: #2A2A2A;        /* app: cyber_card_border */
  --fg: #E0E0E0;
  --mid: #A6A6A6;
  --dim: #8C8C8C;         /* smallest labels: 5.9:1 on --bg */
  --orange: #FF6B1A;      /* app: wordmark and connect accent */
  /* The chapter's colour ramp, set by script.js: stroke, secondary stroke, unlit ticks, dial face.
     --accent-fade is the accent as Anime.js eases it from one chapter to the next. */
  --accent: #FF6B1A;
  --accent-fade: #FF6B1A;
  --c2: #BA4E13;
  --c3: #5c2c0f;
  --c4: #130d09;
  --mono: "Cascadia Mono", "JetBrains Mono", Consolas, ui-monospace, "SF Mono", Menlo, monospace;
  --gutter: clamp(20px, 6vw, 96px);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 500 17px/1.5 "Oxanium", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; }
/* One focus ring for the page's own controls, whatever the chapter; the dial's controls take the chapter colour. */
:focus-visible { outline: 2px solid var(--orange); outline-offset: 4px; border-radius: 4px; }
.stage :focus-visible { outline-color: var(--accent); }
section:focus { outline: none; }

/* One style for every small interface label. */
.label, .top-links a:not(.btn), .bar-title span, .needs dt, .ruler a, .try {
  font-family: var(--mono); font-size: .75rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
}

/* ---------- top bar ---------- */
.top {
  position: fixed; inset: 0 0 auto 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px var(--gutter) 26px;
  background: linear-gradient(#080808 0, #080808 62%, #08080800);
}
.mark { font-weight: 700; font-size: 1.5rem; letter-spacing: .01em; text-decoration: none; color: #fff; }
.mark .gcs { color: var(--orange); }
.top-links { display: flex; align-items: center; gap: clamp(14px, 2.2vw, 30px); }
.top-links a:not(.btn) { color: var(--mid); text-decoration: none; padding: 6px 0; }
.top-links a:not(.btn):hover { color: var(--fg); }

/* ---------- buttons: the app's Connect and Firmware flasher buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 24px;
  border: 0; border-radius: 14px; cursor: pointer;
  background: linear-gradient(135deg, #F57F17, #FF6B1A);
  color: #0A0E1A; font: 700 1rem/1 "Oxanium", sans-serif; letter-spacing: .04em;
  text-decoration: none;
}
/* With the script running, Anime.js eases the hover brightness in and out. */
html:not(.js) .btn:hover { filter: brightness(1.12); }
.btn-small { min-height: 38px; padding: 0 16px; border-radius: 12px; font-size: .9rem; }
.btn-quiet { background: #1E1E1E; color: var(--mid); box-shadow: inset 0 0 0 1px #333; font-weight: 600; }
.btn-quiet:hover { color: var(--fg); }

/* ---------- the instrument ----------
   Colours here are the first frame's; from then on Anime.js sets and eases them (script.js). */
.stage {
  position: fixed; top: 0; left: 68vw; z-index: 0;
  width: 0; height: 100vh; height: 100svh;
  pointer-events: none;
}
.stage svg {
  /* centred on the stage's anchor point; script.js is free to use transform for the opening move */
  position: absolute; left: 0; top: 50%; translate: -50% -50%;
  width: min(112vh, 60vw); height: auto; overflow: visible;
  font-family: "Oxanium", sans-serif;
  transform-origin: center;
  /* The svg is a CSS box, so this reaches its controls (SVG shapes take no touch-action of their own).
     It inherits pointer-events:none from .stage, so a touch anywhere but on a control still scrolls. */
  touch-action: none;
}
.stage .mono { font-family: var(--mono); }
.stage text { font-variant-numeric: tabular-nums; user-select: none; }
.stage .grab { pointer-events: all; cursor: grab; }
.stage .grab:active { cursor: grabbing; }
.stage .grab.locked { pointer-events: none; }   /* a locked slider ignores touches, and lets the page scroll under them */
.stage .grab:focus { outline: none; }           /* the Motors scene draws its own ring round the card */
.stage .press { pointer-events: all; cursor: pointer; }
.stage .press[aria-disabled="true"] { cursor: default; }
.stage .fly-hit:focus { outline: none; }        /* the Fly scene draws its own ring round the button */

.o5 { transform-origin: 500px 500px; }
.own { transform-box: fill-box; transform-origin: center; }

.face { fill: var(--c4); stroke: var(--c3); stroke-width: 1.5; }
.tick { stroke: var(--c3); stroke-width: 2; }
.arc { fill: none; stroke-width: 4; stroke-linecap: round; }
.thread { fill: none; stroke: var(--accent); stroke-width: 5.5; stroke-linecap: round; stroke-linejoin: round; }
.scene { opacity: 0; }

/* ---------- chapters ---------- */
main { position: relative; z-index: 1; pointer-events: none; }
.chapter { position: relative; height: 220vh; }
.chapter-intro { height: 200vh; }
.panel {
  position: sticky; top: 0;
  height: 100vh; height: 100svh;
  width: min(38vw, 560px);
  display: flex; flex-direction: column; justify-content: center;
  padding: 72px 0 64px var(--gutter);
}
.panel > *, .outro { pointer-events: auto; }
/* With the script running, every chapter's words sit in the same pinned spot and swap in place. */
.js .panel { position: fixed; left: 0; }
/* Pinned panels all sit on top of each other until script.js's first frame sets which one shows. */
.js:not(.live) .panel { visibility: hidden; }
.js .panel.off > * { pointer-events: none; }
.js .panel.off .actions { visibility: hidden; }
/* Everything but the heading fades with the chapter; the heading's words are moved by script.js. */
.panel > :not(h1):not(h2) { opacity: var(--o, 1); }

/* The app's toolbar: a 3px accent bar, then the tab name in capitals. */
.bar-title {
  display: flex; align-items: center; gap: 12px; margin: 0 0 22px; min-height: 30px;   /* with or without a tab icon */
  font-weight: 600; font-size: .95rem; letter-spacing: .06em; text-transform: uppercase; color: var(--fg);
}
.bar-title::before { content: ""; flex: none; width: 3px; height: 22px; background: var(--accent-fade); }
.bar-title span { color: var(--mid); }
/* the app's own drawer icon for this tab */
.tab-icon { flex: none; width: 30px; height: 30px; object-fit: contain; margin-right: -2px; }

h1, h2 { margin: 0; font-weight: 700; text-wrap: balance; }
.hero { font-size: clamp(3rem, 6.4vw, 6rem); line-height: .9; letter-spacing: -.025em; }
.hero > span { display: block; }
.hero > span:last-child { color: var(--orange); }
h2 { font-size: clamp(2.1rem, 3.9vw, 3.6rem); line-height: .96; letter-spacing: -.02em; }
/* Word masks for the heading animation (Anime.js's splitText builds them). */
.w { display: inline-block; overflow: hidden; vertical-align: bottom; padding-bottom: .14em; margin-bottom: -.14em; }
.wi { display: inline-block; will-change: transform; }

.panel p:not(.bar-title):not(.try), .lede { margin: 24px 0 0; max-width: 34ch; color: var(--mid); font-size: 1.1rem; line-height: 1.4; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.try { margin: 22px 0 0; color: var(--accent-fade); }

.feats { list-style: none; margin: 30px 0 0; padding: 0; max-width: 38ch; }
.feats li {
  position: relative; padding: 11px 0 11px 22px;
  border-top: 1px solid var(--line);
  font-weight: 600; font-size: .98rem;
}
.feats li::before {
  content: ""; position: absolute; left: 0; top: 1.15em; width: 8px; height: 8px;
  background: var(--accent-fade);
}

/* The opening: the dial starts near the middle and the words sit low on the left, short of the porthole.
   The headline is a size smaller here than its clamp below allows, so it ends before the dial does. */
.chapter-intro .panel { width: min(60vw, 900px); justify-content: flex-end; padding-bottom: 92px; }
.chapter-intro .lede { max-width: 30ch; }
.chapter-intro .hero { font-size: clamp(2.6rem, 4vw, 4.4rem); text-shadow: 0 0 28px #080808, 0 0 10px #080808; }
.chapter-intro .lede { text-shadow: 0 0 14px #080808; }

/* ---------- scroll ruler ---------- */
.ruler {
  position: fixed; left: var(--gutter); right: var(--gutter); bottom: 14px; z-index: 9;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  border-top: 1px solid #3a3a3a;
  /* a tick every tenth of a segment */
  background: repeating-linear-gradient(90deg, #3a3a3a 0 1px, #0000 1px calc(100% / 100)) top / 100% 5px no-repeat;
}
/* a strip of page colour behind the ruler, so text scrolling past does not run through its labels */
.ruler::before { content: ""; position: absolute; z-index: -1; left: -100vw; right: -100vw; top: -26px; bottom: -14px; background: linear-gradient(#08080800, #080808 45%); pointer-events: none; }
.ruler a { padding: 11px 0 2px; color: var(--dim); text-decoration: none; font-size: .68rem; white-space: nowrap; overflow: hidden; }
.ruler a:hover { color: var(--fg); }
.ruler a[aria-current="true"] { color: var(--accent); }
.ruler a:focus-visible { outline-offset: 0; }
.ruler-cursor { position: absolute; top: -8px; left: 0; width: 3px; height: 16px; background: var(--accent-fade); }

/* ---------- beta ---------- */
.outro {
  position: relative; z-index: 2;
  min-height: 100vh; display: flex; flex-direction: column; justify-content: space-between;
  padding: 18vh var(--gutter) 84px;
  background: linear-gradient(#08080800, #080808 30vh);
}
.outro-inner { max-width: 640px; }
.outro h2 { font-size: clamp(2.6rem, 5.4vw, 4.8rem); }
.outro-inner > p:not(.bar-title) { margin: 20px 0 0; color: var(--mid); max-width: 40ch; font-size: 1.1rem; }
.signup { margin-top: 30px; }
.signup label { display: block; margin-bottom: 8px; font-size: .9rem; color: var(--mid); }
.signup-row { display: flex; flex-wrap: wrap; gap: 12px; }
.signup input {
  flex: 1 1 240px; min-height: 48px; padding: 0 16px;
  background: #2D2D2D; color: var(--fg); border: 1px solid #6a6a6a; border-radius: 12px;
  font: 500 1rem "Oxanium", sans-serif;
}
.signup input::placeholder { color: #A0A0A0; }
.signup input:focus-visible { outline: none; border-color: var(--orange); box-shadow: 0 0 0 2px var(--orange); }   /* one ring, not outline + border */
/* An address the form refused: the app's warning red (a 6dp #D32F2F dot, activity_firmware_flasher.xml). */
.signup input[aria-invalid="true"] { border-color: #D32F2F; }
.signup input[aria-invalid="true"]:focus-visible { box-shadow: 0 0 0 2px #D32F2F; }
.form-note { min-height: 1.5em; margin: 10px 0 0; font-size: .92rem; color: var(--mid); }
.form-note.err, .form-note.ok { color: var(--fg); }
.form-note.err::before, .form-note.ok::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 8px; border-radius: 50%; vertical-align: middle; background: #D32F2F; }
.form-note.ok::before { background: var(--orange); }
.privacy { margin: 6px 0 0; max-width: 60ch; font-size: .84rem; color: var(--dim); }

.needs { margin: 48px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; }
.needs div { padding: 14px 0; border-top: 1px solid var(--line); }
.needs .wide { grid-column: 1 / -1; }
.needs dt { color: var(--dim); }
.needs dd { margin: 5px 0 0; font-weight: 600; font-size: .98rem; }

.foot {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px 32px;
  margin-top: 80px; padding: 24px 0 0; border-top: 1px solid var(--line);
}
.foot .mark { font-size: 1.2rem; }
.foot p { margin: 0; color: var(--dim); font-size: .86rem; max-width: 70ch; }
.foot-links { display: flex; flex-wrap: wrap; gap: 12px 24px; font-size: .86rem; }
.foot-links a { color: var(--mid); }
.foot-links a:hover { color: var(--fg); }

/* Under the beta section (script.js sets .at-beta) the dial is an empty ring: no scene, no thread,
   and the header's "Join the beta" is not repeated above the form's own button. */
.at-beta .stage .scene, .at-beta .stage .thread { display: none !important; }
.at-beta .top .btn { visibility: hidden; }

/* Desktop: every chapter's heading starts at the same height, so it doesn't hop at a handover. */
@media (min-width: 861px) {
  .chapter:not(.chapter-intro) .panel { justify-content: flex-start; padding-top: max(96px, calc(50svh - 270px)); }
  .outro { background: none; }   /* the chapter text is hidden here, so the ring can show whole in the empty column */
}

/* ---------- wide screens: let the words grow with the room ---------- */
@media (min-width: 1500px) {
  .panel { width: min(36vw, 700px); }
  .panel p:not(.bar-title):not(.try), .lede { font-size: 1.25rem; }
  .feats li { font-size: 1.08rem; }
  .outro-inner > p:not(.bar-title):not(.form-note):not(.privacy) { font-size: 1.25rem; }
  .needs dd { font-size: 1.08rem; }
  .ruler a { font-size: .72rem; }
}

/* ---------- small screens: instrument on top, words below ---------- */
@media (max-width: 860px) {
  body { font-size: 16px; }
  .top-links a:not(.btn) { display: none; }
  /* The dial's outer arcs only fill 78% of the drawing (39% of its width either side of its centre), so the drawing
     may run past the screen edges. The chapter words sit right under the dial's lower arcs, `--gap` below them, and
     the dial keeps its roomy size (--dial0) while dial and words fit the screen. When the screen is too short for
     both, the dial shrinks just enough (--dial), holding the top of its arcs where they were, so the tallest
     chapter's words (--text-h, ArduPilot Fly or Motors) still end above the ruler. */
  :root {
    --gap: 20px;                                                   /* arcs to chapter label */
    --text-h: 408px;                                               /* tallest chapter text block, up to 380px wide */
    --dial0: min(112vw, 52svh);                                    /* the dial's width on a roomy screen */
    --arcs-top: calc(56px + 23svh - .39 * var(--dial0));          /* where its outer arcs begin on a roomy screen */
    --dial: min(var(--dial0), calc((100svh - 64px - var(--gap) - var(--text-h) - var(--arcs-top)) / .78));
  }
  .stage { left: 50vw; height: 46svh; top: calc(56px - .39 * (var(--dial0) - var(--dial))); }
  .stage svg { width: var(--dial); }
  /* At this size a drawing unit is under half a pixel, so the finest scene text (the `fine` class) is drawn bigger
     than the app's size, to stay readable: 19 units is about 8px at 390 wide. Text that sits inside a fixed app
     shape gets the largest size that stays inside it. The scene geometry itself never changes. */
  .stage text.fine, .stage .fine text { font-size: 19px; }
  .stage text.tab-t { font-size: 14px; letter-spacing: 0; }             /* Tune: the tab labels, 170 units to a tab */
  .stage text.sub-t { font-size: 14px; }                                  /* Tune: "D Gains" under each slider name, 18 units below it */
  .stage .bal text { font-size: 14px; }                                   /* Tune: value balloons, an 84-unit tag */
  .stage .lpill text { font-size: 13.5px; }                               /* Tune: legend pills, 76 x 16 units */
  .stage text.gps-k { font-size: 13px; }                                  /* Mission: the GPS box, 140 units wide */
  .stage text.gps-v { font-size: 18px; }
  .stage text.leg-t { font-size: 16px; }                                  /* Motors: graph legend, 72 units to a name */
  .stage text.fc-t { font-size: 15px; }                                   /* Motors: "FC:1450" under each slider, 73 units to a column */
  .stage text.frame-st { font-size: 14px; }                               /* Frame: the two status sentences, 17 units apart */
  .stage .mval { font-size: 19px; }
  .stage .bat { transform: translateX(70px); }
  .stage .bat text { font-size: 17px; }                     /* Motors: the battery row; 17 so "Amp drawn" clears "Amperage" */
  .stage .stop-t { font-size: 20px; }
  .stage .tv { font-size: 22px; }                           /* Tune: the rates row */
  .stage .mpill-t { font-size: 26px; }                      /* Mission: leg distances, in a wider pill */
  .stage .mpill-r { x: -48px; y: -18px; width: 96px; height: 36px; rx: 18px; }
  .stage .pill-t { font-size: 22px; }
  .stage .press-t { font-size: 25px; }
  .stage .fly-hint { font-size: 21px; }
  .stage .cal-l { font-size: 20px; }
  .stage .cal-warn { font-size: 20px; }
  .stage .tile-t { font-size: 22px; }
  .panel, .chapter-intro .panel { width: 100%; justify-content: flex-start; padding: calc(var(--arcs-top) + .78 * var(--dial) + var(--gap)) 20px 44px; }
  .hero, .chapter-intro .hero { font-size: clamp(2rem, 9vw, 2.8rem); line-height: .95; }
  .chapter-intro .hero, .chapter-intro .lede { text-shadow: none; }
  h2 { font-size: clamp(1.6rem, 6.8vw, 2.1rem); line-height: 1; }
  .panel p:not(.bar-title):not(.try), .lede { margin-top: 12px; font-size: .98rem; }
  .bar-title { margin-bottom: 12px; font-size: .84rem; }
  .feats { margin-top: 14px; }
  .feats li { padding: 7px 0 7px 20px; font-size: .9rem; }
  .try { margin-top: 12px; }
  .actions { margin-top: 18px; }
  .ruler { left: 20px; right: 20px; bottom: 10px; }
  .ruler a { font-size: .6rem; line-height: 16px; padding: 14px 0 10px; }   /* names under the ticks; each segment stays a 40px-tall tap target */
  .panel, .chapter-intro .panel { padding-bottom: 64px; }   /* clear of the taller ruler */
  .outro { padding-top: 12vh; }
  .signup .btn { flex: 1 1 100%; }
  .needs { grid-template-columns: 1fr; }
}

/* The tallest chapter text block, by width (the words wrap differently): 408px up to 380 wide, 396 up to 639, 354 above. */
@media (min-width: 381px) and (max-width: 860px) { :root { --text-h: 396px; } }
@media (min-width: 640px) and (max-width: 860px) { :root { --text-h: 354px; } }

/* The narrowest phones: of the fine scene text, only the important labels stay. */
@media (max-width: 380px) {
  .stage .fine-minor { display: none; }
}

/* Below this width the ten ruler segments are too narrow for their names ("Calibrate" is the longest, about 58px
   at this size, in a segment of (width - 40) / 10; 640 leaves a couple of pixels to spare), so only the current
   chapter's name shows, under its own tick. Every segment keeps its 40px height; the name may run on into the
   empty segment beside it. */
@media (max-width: 639px) {
  .ruler a { font-size: 0; }
  .ruler a[aria-current="true"] { font-size: .6rem; overflow: visible; }
}
