/* Kinglet's website (RM-005): layout, components and motion.
   Colours, spacing, radii, type and shadows come from tokens.css (DS-2), copied from Kinglet by
   `just tokens`. The sizes the tokens don't cover are named once, below. Light only.
   No JavaScript: the motion is scroll-driven CSS, at the end of this file. */

@font-face {
  font-family: "Instrument Sans";
  src: url("../fonts/InstrumentSans-Variable.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/IBMPlexMono-Medium-Latin1.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* Sizes the tokens don't cover.
   The breaks, which a media query can't read from a variable:
     1100px  from here up the kinglet flies down the right margin, behind the content; below it,
             it flies in front of the content at the right edge, small (RM-007)
     1000px  up to it, the hero's spruces and kinglet stand on the hero's bottom edge at 55%
      720px  up to it, they're at 30%, and the header's section links hide */
:root {
  color-scheme: light;

  --content: 1120px;           /* the content column */
  --pad-header: 20px;          /* above and below the header and footer rows */
  --pad-section: 128px;        /* above each section's heading */
  --gap-section: 64px;         /* a section's heading to its content */
  --gap-wide: 40px;            /* between rows of cards */
  --gap-card: 20px;            /* a card's picture to its words */
  --hero-title: clamp(40px, 6vw, 64px);
  --button-text: 18px;
  --ring: 2px;                 /* DS-10: the focus ring and its offset */

  /* The hero's spruces and perched kinglet */
  --fg-frame: 920px;           /* up to 1000px, they stand in a frame this tall on the hero's bottom */
  --fg-scale: 1;               /* their scale: 1, .55 up to 1000px, .3 up to 720px */

  /* The motion's distances */
  --rise: 64px;                /* a block rises this far as it enters */
  --hero-copy-rise: -16vh;

  /* The flying kinglet below 1100px (RM-007). Its box is the hero's perched kinglet at full size,
     220 × 165px; the band's perched kinglet is .4 of it, 88px wide. */
  --fly-scale: .29;            /* flying, it's 64px wide; 48px up to 720px */
  --fly-gap: 12px;             /* flying, from the window's right edge */
  --fly-top: 16dvh;            /* the top of its flight */
  --fly-end: 40dvh;            /* where its flight ends, before it comes in to land */
  /* It leaves the hero's perch this far into the perch's view timeline, a share plus a distance.
     Above 1000px the perch's layout box is then 120px from the window's top: the timeline's end
     less 285px. Up to 1000px, .85 of the timeline. */
  --takeoff: 1;
  --takeoff-shift: -285px;
  --hover-line: .4;            /* it lands when the band's perch is this far into its view timeline: 60% down the window */

  /* macOS's window controls in the Spaces mockups: the only colours that aren't Kinglet's */
  --mac-close: #FF5F57;
  --mac-minimize: #FEBC2E;
  --mac-zoom: #28C840;
}
@media (max-width: 1000px) {
  :root { --fg-scale: .55; --takeoff: .85; --takeoff-shift: 0px; }
}
@media (max-width: 720px) {
  :root { --fg-scale: .3; --fly-scale: .22; }
}

/* Base */

html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); }
img { display: block; }
h1, h2, h3, p { margin: 0; }

a { color: var(--link); }
a:hover { color: var(--ink); }
.w-link { color: inherit; text-decoration: none; }
.w-link:hover { color: inherit; text-decoration: underline; }

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: var(--ring) solid var(--focus);
  outline-offset: var(--ring);
}
/* On spruce, `focus` reads 1.4:1, so the ring is `ground` (RM-005, change 4) */
.on-spruce a:focus-visible,
.on-spruce button:focus-visible,
.on-spruce input:focus-visible {
  outline-color: var(--ground);
}

input::placeholder { color: var(--ink-muted); opacity: 1; }

.page {
  position: relative;
  overflow-x: clip;
  background: var(--ground);
  color: var(--ink);
}

.muted { color: var(--ink-muted); }
.tnum { font-variant-numeric: tabular-nums; }

/* Header and footer */

.site-header {
  max-width: var(--content);
  margin: 0 auto;
  box-sizing: border-box;
  padding: var(--pad-header) var(--space-8);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3) var(--space-6);
}
.lockup { display: flex; }
.lockup img { width: 150px; height: 36px; }
.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-8);
  font-weight: 500;
}

.site-footer { position: relative; z-index: 2; background: var(--ground); }
.footer-inner {
  max-width: var(--content);
  min-height: 76px;
  margin: 0 auto;
  box-sizing: border-box;
  padding: var(--pad-header) var(--space-8);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-6);
  color: var(--ink-muted);
}
.footer-inner nav { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-6); }

/* Buttons and the waitlist form (after components/Button: `ink` fill, `on-ink` label) */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  height: 44px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-md);
  background: var(--ink);
  color: var(--on-ink);
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { color: var(--on-ink); }
.btn-lg { height: 48px; padding: 0 var(--gap-card); }

.join {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.join label { font-weight: 500; }
.join-row { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.join input[type="email"] {
  flex: 1 1 240px;
  min-width: 0;
  height: 48px;
  box-sizing: border-box;
  margin: 0;
  padding: 0 var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--raised);
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
}
.join button {
  flex: none;
  height: 48px;
  margin: 0;
  padding: 0 var(--gap-card);
  border: 0;
  border-radius: var(--radius-md);
  background: var(--ink);
  color: var(--on-ink);
  font-family: inherit;
  font-size: var(--button-text);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.join .note { margin-top: var(--space-1); color: var(--ink-muted); text-wrap: pretty; }

/* The one `crown` call to action, on the band */
.on-spruce .join input[type="email"] { border-color: var(--ground); }
.on-spruce .join button { background: var(--crown); color: var(--on-crown); }
.on-spruce .join .note { color: var(--line); }

/* Sections */

.sec { position: relative; overflow: clip; }
.sec-raised { background: var(--raised); }
.sec-ground { background: var(--ground); border-top: 1px solid var(--line); }
.sec-inner {
  position: relative;
  z-index: 2;
  max-width: var(--content);
  margin: 0 auto;
  box-sizing: border-box;
  padding: var(--pad-section) var(--space-8) 136px;
  display: flex;
  flex-direction: column;
  gap: var(--gap-section);
}
.sec-head { max-width: 680px; display: flex; flex-direction: column; gap: var(--space-4); }
.sec-head h2 { text-wrap: balance; }
.sec-head p { color: var(--ink-muted); text-wrap: pretty; }

.art { position: absolute; inset: 0; pointer-events: none; }
.art img { position: absolute; left: 0; width: 100%; object-fit: cover; object-position: center bottom; }

/* Hero */

.hero {
  position: relative;
  overflow: clip;
  min-height: clamp(680px, 100vh, 920px);
  background: var(--ground);
}
.hero .art img { bottom: 0; height: auto; min-height: 58%; }
.fg { position: absolute; inset: 0; pointer-events: none; transform-origin: 100% 100%; }
.fg img, .fg .perch-hero { position: absolute; }
.spruce-near { right: -70px; top: 520px; width: 320px; height: 610px; }
.spruce-back { right: calc(13% + 190px); top: 590px; width: 230px; height: 438px; }
.spruce-tall { right: calc(13% - 81px); top: 405px; width: 400px; height: 762px; }
.perch-hero { right: 13%; top: 250px; width: 220px; height: 165px; }
.perch-hero img { width: 100%; height: 100%; }

.hero-inner { position: relative; z-index: 2; }
.hero-copy {
  max-width: var(--content);
  margin: 0 auto;
  box-sizing: border-box;
  padding: var(--gap-section) var(--space-8) 240px;
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}
.hero-text { max-width: 600px; display: flex; flex-direction: column; gap: var(--space-6); }
.hero h1 { font-size: var(--hero-title); line-height: 1; text-wrap: balance; }
.hero-text .lead { max-width: 540px; color: var(--ink-muted); text-wrap: pretty; }

/* Memory */

.big-figure {
  position: absolute;
  right: calc(var(--space-8) * -1);
  top: 72px;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: clamp(96px, 21vw, 304px);
  line-height: 1;
  letter-spacing: -0.04em;
  white-space: nowrap;
  color: var(--sidebar);
  pointer-events: none;
  user-select: none;
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: var(--gap-wide) var(--space-6);
}
.card { display: flex; flex-direction: column; gap: var(--gap-card); }
.card-art {
  height: 248px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--sidebar);
}
.card-text, .feature-text { display: flex; flex-direction: column; gap: var(--space-2); }
.card-text p, .feature-text p { color: var(--ink-muted); text-wrap: pretty; }

.mock { color: var(--ink); }

.meter {
  width: 248px;
  box-sizing: border-box;
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.meter-art { position: relative; display: flex; flex-direction: column; }
.meter-trees { display: block; width: 100%; height: 30px; }
.meter-trees .back { fill: var(--line); }
.meter-trees .front { fill: var(--mantle); }
.meter-trees .snow { fill: var(--raised); }
.meter-bird {
  position: absolute;
  left: 0;
  bottom: var(--space-2);
  display: flex;
  justify-content: flex-end;
  width: 62%;
  min-width: 24px;
  box-sizing: border-box;
}
.meter-bird img { width: 24px; height: 18px; }
.meter-track {
  display: block;
  position: relative;
  height: 8px;
  margin-top: calc(var(--space-1) * -1);
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--raised);
  overflow: hidden;
}
.meter-fill { display: block; width: 62%; height: 100%; border-radius: var(--radius-full); background: var(--ok); }
.status { display: flex; align-items: center; gap: var(--space-2); }
.state { flex: none; display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.dot-warn { background: var(--warn); }

.notice {
  width: 280px;
  box-sizing: border-box;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  border-radius: var(--radius-lg);
  background: var(--raised);
  box-shadow: var(--shadow-panel);
}
.notice-head { display: flex; flex-direction: column; gap: var(--space-1); }
.notice-head .state { font-weight: 600; }
.notice-actions { display: flex; align-items: center; gap: var(--space-3); }
.mini-btn {
  flex: none;
  height: 28px;
  box-sizing: border-box;
  padding: 0 var(--space-3);
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-md);
  background: var(--ink);
  color: var(--on-ink);
  font-weight: 500;
}

/* A sidebar row: tile, name, figure. Resting rows are grey with an outlined tile. */
.tabs { width: 264px; display: flex; flex-direction: column; gap: 2px; }
.row {
  height: 30px;
  box-sizing: border-box;
  padding: 0 var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.row-open { border-radius: var(--radius-sm); background: var(--raised); box-shadow: var(--shadow-row); }
.row-resting { color: var(--ink-muted); }
.tile {
  flex: none;
  width: 20px;
  height: 20px;
  box-sizing: border-box;
  border-radius: var(--radius-sm);
  background: var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  line-height: 1;
  font-weight: 600;
}
.row-resting .tile { background: none; border: 1px solid var(--line); }
.name { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .figure { flex: none; color: var(--ink-muted); }

/* Spaces */

.spaces-art .far-range { bottom: -56px; height: 700px; }
.spaces-art .far-trees { bottom: -28px; height: 420px; }
.spaces-art .near-trees { bottom: -12px; height: 420px; }
.spaces-art .snow { bottom: 0; height: 420px; }
.sec-spaces .sec-inner { padding-bottom: 250px; }

.space-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: var(--space-8);
}
.space { flex: 0 1 300px; min-width: 264px; }
.space-low { margin-top: var(--gap-wide); }
.sidebar {
  box-sizing: border-box;
  padding: var(--space-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--sidebar);
  box-shadow: var(--shadow-panel);
}
.sidebar-body { display: flex; flex-direction: column; }
.sidebar-top {
  height: 28px;
  padding: 0 var(--space-1) 0 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.lights { display: flex; align-items: center; gap: var(--space-2); }
.lights span { width: 12px; height: 12px; border-radius: 50%; }
.lights .close { background: var(--mac-close); }
.lights .minimize { background: var(--mac-minimize); }
.lights .zoom { background: var(--mac-zoom); }
.kbd {
  flex: none;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 16px;
  font-weight: 500;
  color: var(--ink-muted);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0 5px;
}
.address {
  margin-top: var(--space-2);
  height: 32px;
  box-sizing: border-box;
  padding: 0 var(--space-2);
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--raised);
}
.address svg, .space-name svg { flex: none; color: var(--ink-muted); }
.sidebar .ui-label { margin-top: var(--space-3); padding: 0 var(--space-2); text-transform: uppercase; color: var(--ink-muted); }
.sidebar .rows { margin-top: var(--space-1); display: flex; flex-direction: column; gap: 2px; }
.space-name {
  margin-top: var(--space-3);
  height: 26px;
  padding: 0 var(--space-2);
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-weight: 600;
}

/* Workflow */

.workflow-art .mid-range { bottom: -56px; height: 620px; opacity: 0.55; }
.sec-workflow .sec-inner { padding-bottom: 144px; gap: 80px; }
.split { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-12) var(--gap-section); }
.split .sec-head { flex: 1 1 320px; max-width: 420px; }
.split-art { flex: 2 1 420px; min-width: 0; display: flex; justify-content: flex-end; }

.command-bar {
  width: 560px;
  max-width: 100%;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--raised);
  box-shadow: var(--shadow-panel);
}
.command-input {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--line);
  font-size: 17px;
  line-height: 24px;
}
.caret { width: 1.5px; height: 20px; margin-left: -6px; background: var(--focus); }
.command-list { padding: var(--space-2); display: flex; flex-direction: column; gap: 2px; }
.command-list .ui-label { padding: var(--space-2) var(--space-2) var(--space-1); text-transform: uppercase; color: var(--ink-muted); }
.command-row {
  height: 34px;
  padding: 0 var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  border-radius: var(--radius-md);
}
.command-row-selected { background: var(--sidebar); }
.command-row .figure { flex: none; color: var(--ink-muted); }
.command-row b { font-weight: 600; }
.site-icon { flex: none; width: 16px; height: 16px; box-sizing: border-box; border-radius: 4px; background: var(--ink-muted); }
.site-icon-resting { background: none; border: 1.5px solid var(--border); }

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: var(--gap-wide) var(--space-8);
}
.feature { display: flex; flex-direction: column; gap: var(--space-4); }
.feature-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--sidebar);
  color: var(--ink);
}
.feature-text a { align-self: flex-start; font-weight: 500; }

/* Plus */

.sec-plus .sec-inner { padding-bottom: 330px; gap: var(--space-12); }
.plans {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: var(--space-6);
  max-width: 880px;
}
.plan {
  height: 100%;
  box-sizing: border-box;
  padding: var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--raised);
}
.plan-head { display: flex; flex-direction: column; gap: var(--space-2); }
.plan-kind { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1) var(--space-3); }
.plan-kind .title { line-height: 36px; }
.plan-body { flex: 1 1 auto; display: flex; flex-direction: column; gap: var(--space-3); }
.plan-body > p { color: var(--ink-muted); }
.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.checks li { display: flex; align-items: flex-start; gap: var(--space-2); }
.checks svg { flex: none; margin-top: 5px; color: var(--ink); }
.plan .btn { align-self: stretch; }
.plus-note { max-width: 680px; color: var(--ink-muted); text-wrap: pretty; }

/* The spruce band */

.band { position: relative; background: var(--spruce); color: var(--ground); }
.treeline { position: absolute; left: 0; right: 0; bottom: 100%; height: 280px; pointer-events: none; }
.treeline img { position: absolute; }
.treeline .line { left: 0; bottom: -1px; width: 100%; height: 240px; object-fit: cover; object-position: center bottom; }
.band-spruce { right: calc(7% - 28px); bottom: -176px; width: 150px; height: 286px; }
.perch-band { right: 7%; bottom: 108px; width: 88px; height: 66px; }
.band-inner {
  position: relative;
  z-index: 2;
  max-width: var(--content);
  min-height: 420px;
  margin: 0 auto;
  box-sizing: border-box;
  padding: 72px var(--space-8);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 28px;
}
.band-inner > img { width: 200px; height: 48px; }
.band h2 { text-wrap: balance; }

/* The flying kinglet: a zero-height layer that sticks to the top of the window */
.fly-layer { position: sticky; top: 0; height: 0; z-index: 1; pointer-events: none; }
.fly { display: none; position: absolute; left: 0; top: 0; width: 220px; height: 165px; }
.fly-drift, .fly-land, .fly-lift, .fly-grow { position: absolute; inset: 0; }
.fly img { position: absolute; left: 0; bottom: 0; width: 100%; height: 150%; }

/* The small pages: the same header, one section and the footer */

.page-simple { display: flex; flex-direction: column; min-height: 100vh; }
.simple { position: relative; flex: 1 0 auto; background: var(--ground); }
.simple-inner {
  max-width: var(--content);
  margin: 0 auto;
  box-sizing: border-box;
  padding: var(--gap-section) var(--space-8) var(--pad-section);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-6);
}
.simple-inner > * { max-width: 680px; }
.simple-inner > a { font-weight: 500; }
.simple .lead { color: var(--ink-muted); text-wrap: pretty; }
.prose { display: flex; flex-direction: column; gap: var(--space-4); }
.prose h2 { margin-top: var(--space-6); }
.prose ul { margin: 0; padding-left: var(--space-6); display: flex; flex-direction: column; gap: var(--space-2); }
.download { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); }
.download code { font-family: var(--font-mono); font-size: 12px; line-height: 16px; overflow-wrap: anywhere; }

/* Narrow screens, as the artboard. Up to 1000px the hero's spruces and kinglet stand in a frame
   on the hero's bottom edge, scaled from its bottom right corner (RM-007), so the perched
   kinglet is always the same distance above the hero's bottom. */

@media (max-width: 1000px) {
  .fg { top: auto; height: var(--fg-frame); transform: scale(var(--fg-scale)); }
}
@media (max-width: 720px) {
  .nav-link { display: none; }
}

/* Motion: scroll-driven, CSS only, and only `transform` and `opacity`. Off under Reduce Motion
   and in browsers without scroll-driven animations; there the page is still and complete. */

@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .tl-hero { view-timeline-name: --hero; }
    .tl-sec { view-timeline-name: --sec; }

    /* Hero: each layer of the scene falls behind the scroll by its own amount */
    @keyframes hx { to { transform: translate3d(0, var(--y), 0); } }
    .hx {
      animation: hx linear both;
      animation-timeline: --hero;
      animation-range: exit 0% exit 100%;
      will-change: transform;
    }
    .hx-1 { --y: 54vh; }
    .hx-2 { --y: 44vh; }
    .hx-3 { --y: 33vh; }
    .hx-4 { --y: 23vh; }
    .hx-5 { --y: 14vh; }
    .hx-6 { --y: 6vh; }
    .hx-7 { --y: -10vh; }
    .hx-8 { --y: -20vh; }
    @keyframes hero-copy { to { transform: translate3d(0, var(--hero-copy-rise), 0); opacity: 0; } }
    .hero-copy {
      animation: hero-copy linear both;
      animation-timeline: --hero;
      animation-range: exit 0% exit 75%;
    }

    /* Sections: layers and cards drift around their resting place as the section crosses the window */
    @keyframes px {
      from { transform: translate3d(0, var(--a), 0); }
      to { transform: translate3d(0, calc(var(--a) * -1), 0); }
    }
    .px {
      animation: px linear both;
      animation-timeline: --sec;
      animation-range: cover 0% cover 100%;
      will-change: transform;
    }
    .px-n3 { --a: -90px; }
    .px-n2 { --a: -56px; }
    .px-n1 { --a: -28px; }
    .px-n0 { --a: -12px; }
    .px-p1 { --a: 22px; }
    .px-p2 { --a: 48px; }
    .px-p3 { --a: 76px; }

    /* Blocks rise in as they enter, the second and third in a row a little later */
    @keyframes rv {
      from { opacity: 0; transform: translate3d(0, var(--rise), 0); }
      to { opacity: 1; transform: translate3d(0, 0, 0); }
    }
    .rv {
      animation: rv cubic-bezier(.2, .7, .2, 1) both;
      animation-timeline: view();
      animation-range: entry 0% cover 30%;
    }
    .rv-2 { animation-range: entry 18% cover 36%; }
    .rv-3 { animation-range: entry 36% cover 42%; }

    /* The flying kinglet's wing flips 96 times over the page, so it flaps only while you scroll */
    @keyframes flap { from { transform: scaleY(1); } to { transform: scaleY(-.72); } }
    .wing {
      transform-origin: 46.9% 65.3%;
      animation: flap linear both;
      animation-iteration-count: 96;
      animation-direction: alternate;
      animation-timeline: scroll();
    }

    /* The kinglet leaves the hero spruce, keeps to the right margin and lands on the band's spruce.
       Its keyframes are shares of the whole page's scroll; the landing is placed from the bottom
       of the window, where the band's spruce is at the end of the page. Below about 1390px the
       margin is narrower than the bird, so it passes behind the right edge of the content column;
       kept as drawn, from 1100px (Rares, 18 Nov 2026). */
    @media (min-width: 1100px) {
      @keyframes fly {
        0% { transform: translate3d(calc(87vw - 220px), 250px, 0) scale(1); opacity: 0; }
        0.5% { transform: translate3d(calc(87vw - 220px), 246px, 0) scale(1); opacity: 1; }
        6% { transform: translate3d(88vw, 16vh, 0) scale(.4); }
        18% { transform: translate3d(90.5vw, 34vh, 0) scale(.4); }
        32% { transform: translate3d(88.5vw, 56vh, 0) scale(.4); }
        46% { transform: translate3d(91vw, 30vh, 0) scale(.4); }
        60% { transform: translate3d(89vw, 52vh, 0) scale(.4); }
        74% { transform: translate3d(91vw, 26vh, 0) scale(.4); }
        88% { transform: translate3d(89.5vw, 40vh, 0) scale(.4); }
        /* On the band's spruce at the end of the page: the band and footer (514px at these widths),
           then the perched mark's 108px offset and 66px height. The swap is short, so the two
           birds never show apart. */
        98.4% { transform: translate3d(calc(93vw - 88px), calc(100vh - 688px), 0) scale(.4); }
        99.6% { transform: translate3d(calc(93vw - 88px), calc(100vh - 688px), 0) scale(.4); opacity: 1; }
        100% { transform: translate3d(calc(93vw - 88px), calc(100vh - 688px), 0) scale(.4); opacity: 0; }
      }
      .fly {
        display: block;
        transform-origin: 0 0;
        animation: fly linear both;
        animation-timeline: scroll();
        will-change: transform, opacity;
      }
      @keyframes perch-off { to { opacity: 0; } }
      .perch-a {
        animation: perch-off linear both;
        animation-timeline: --hero;
        animation-range: exit 0% exit 3%;
      }
      @keyframes land { 0%, 99.6% { opacity: 0; } 100% { opacity: 1; } }
      .perch-b {
        animation: land linear both;
        animation-timeline: scroll();
      }
    }

    /* Below 1100px (RM-007) there's no margin, so the kinglet flies in front of the content at the
       right edge, small. The hero's and the band's heights change with the width here, so each
       perch has a view timeline the kinglet shares, and the swaps are keyed to where each perch is.
       A view timeline measures the layout box, not the drawn one. The kinglet is five nested boxes,
       each moved by one timeline, so their moves add up:
         .fly        the flight down the right edge, on the page's scroll
         .fly-drift  the hero's parallax, as its perch has it
         .fly-land   the approach to the band's perch
         .fly-lift   on the hero's perch, then the lift-off to the top of the flight
         .fly-grow   from the flying size to the band's perched size */
    @media (width < 1100px) {
      .page { timeline-scope: --hero, --perch-a, --perch-b; }
      .perch-hero { view-timeline-name: --perch-a; }
      .perch-b { view-timeline-name: --perch-b; }
      .fly-layer { z-index: 3; }

      /* From 600px, past the latest lift-off, to 80% of the page, before the band's spruce shows.
         Shares of the window from the top of the flight. */
      @keyframes fly-narrow {
        0% { transform: translate3d(0, 0, 0); }
        14% { transform: translate3d(-4px, 18dvh, 0); }
        30% { transform: translate3d(3px, 38dvh, 0); }
        46% { transform: translate3d(-6px, 14dvh, 0); }
        62% { transform: translate3d(0, 34dvh, 0); }
        78% { transform: translate3d(-5px, 10dvh, 0); }
        100% { transform: translate3d(0, calc(var(--fly-end) - var(--fly-top)), 0); }
      }
      .fly {
        display: block;
        animation: fly-narrow linear both;
        animation-timeline: scroll();
        animation-range: 600px 80%;
        will-change: transform;
      }

      /* The hero perch's parallax: .hx-8's distance, times the group's scale */
      .fly-drift {
        --y: calc(-20vh * var(--fg-scale));
        animation: hx linear both;
        animation-timeline: --hero;
        animation-range: exit 0% exit 100%;
        will-change: transform;
      }

      /* On the hero's perch until the takeoff point. The perch is drawn at the group's scale from
         its frame's bottom right corner: right 13%, 220 × 165px, its layout box 670px above the
         frame's bottom, so drawn 670px × (1 − scale) below its layout box. It fades in over the
         perched kinglet, then lifts off to the top of the flight and shrinks to the flying size.
         The top of the flight is set below the hero's parallax, which is spent by the time it flies. */
      @keyframes lift {
        0% { transform: translate3d(var(--perch-x), var(--perch-y0), 0) scale(var(--fg-scale)); opacity: 0; }
        2% { opacity: 1; }
        5% { transform: translate3d(var(--perch-x), var(--perch-y5), 0) scale(var(--fg-scale)); }
        100% {
          transform: translate3d(calc(100vw - var(--fly-gap) - 220px * var(--fly-scale)), calc(var(--fly-top) + 20vh * var(--fg-scale)), 0) scale(var(--fly-scale));
          opacity: 1;
        }
      }
      /* The perch's timeline is the window's height plus its 165px. --perch-y0 and --perch-y5 are
         the perch's drawn top at the start of the range and 5% into it. */
      .fly-lift {
        --perch-x: calc(100vw - (13vw + 220px) * var(--fg-scale));
        --perch-y0: calc(100dvh - var(--takeoff) * (100dvh + 165px) - var(--takeoff-shift) + 670px * (1 - var(--fg-scale)));
        --perch-y5: calc(100dvh - (.95 * var(--takeoff) + .05) * (100dvh + 165px) - .95 * var(--takeoff-shift) + 670px * (1 - var(--fg-scale)));
        transform-origin: 0 0;
        animation: lift linear both;
        animation-timeline: --perch-a;
        animation-range: cover calc(var(--takeoff) * 100% + var(--takeoff-shift)) cover 100%;
        will-change: transform, opacity;
      }
      /* The perched kinglet fades out once the flying one shows in full: 2% to 4% into the range */
      @keyframes narrow-off { to { opacity: 0; } }
      .perch-a {
        animation: narrow-off linear both;
        animation-timeline: --perch-a;
        animation-range:
          cover calc((.98 * var(--takeoff) + .02) * 100% + .98 * var(--takeoff-shift))
          cover calc((.96 * var(--takeoff) + .04) * 100% + .96 * var(--takeoff-shift));
      }

      /* From the band's perch entering the window to it reaching the hover line, where the
         perch's top is 60% down the window less .4 of its 66px. The kinglet settles there at 60%
         and flaps while the spruce rises to it. Over the last .7% it rises with the perch, which
         shows in full, and then it fades out. */
      @keyframes land-narrow {
        0% { transform: translate3d(0, 0, 0); }
        60% { transform: translate3d(var(--land-x), var(--land-y-hold), 0); }
        99.3% { transform: translate3d(var(--land-x), var(--land-y-hold), 0); }
        99.6% { opacity: 1; }
        100% { transform: translate3d(var(--land-x), var(--land-y), 0); opacity: 0; }
      }
      .fly-land {
        /* The band's perch: right 7%, 88 × 66px */
        --land-x: calc(220px * var(--fly-scale) + var(--fly-gap) - 7vw - 88px);
        --land-y: calc((1 - var(--hover-line)) * 100dvh - var(--hover-line) * 66px - var(--fly-end));
        --land-y-hold: calc(var(--land-y) + .007 * var(--hover-line) * (100dvh + 66px));
        animation: land-narrow linear both;
        animation-timeline: --perch-b;
        animation-range: cover 0% cover calc(var(--hover-line) * 100%);
        will-change: transform, opacity;
      }
      @keyframes grow {
        0% { transform: scale(1); }
        60%, 100% { transform: scale(calc(.4 / var(--fly-scale))); }
      }
      .fly-grow {
        transform-origin: 0 0;
        animation: grow linear both;
        animation-timeline: --perch-b;
        animation-range: cover 0% cover calc(var(--hover-line) * 100%);
        will-change: transform;
      }
      /* The perched kinglet shows in full just before the flying one fades */
      @keyframes narrow-on { from { opacity: 0; } to { opacity: 1; } }
      .perch-b {
        animation: narrow-on linear both;
        animation-timeline: --perch-b;
        animation-range: cover calc(var(--hover-line) * 99.3%) cover calc(var(--hover-line) * 99.6%);
      }
    }
  }
}
