/* Science page: one continuous 3D shot driven by scroll. */
#film {
  height: calc(1200 * var(--vh));
  background: var(--ground3);
}
/* the film's frame (base.css, .pinned) */
#filmstage {
  --scene-bg: var(--ground3);
  --fg: #fff;
  --fg2: #d6eef0;
  --accent: #62dae2;
  color: #fff;
}
/* the film runs on below the frame like the rest of the scene (film.js renders that strip too) */
#gl {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: calc(100% + var(--bleed));
  transform-origin: 50% calc(50% - var(--bleed) / 2);
  display: block;
  opacity: 0;
  transform: scale(1.035);
  transition:
    opacity 1.8s cubic-bezier(0.25, 0.6, 0.25, 1),
    transform 2.6s cubic-bezier(0.2, 0.7, 0.2, 1);
  will-change: opacity, transform;
}
/* film.js adds film-on once the first frame is drawn: the scene fades and settles in, like the home page's logo */
.film-on #gl {
  opacity: 1;
  transform: none;
}
.fshade {
  pointer-events: none;
  background: linear-gradient(
    90deg,
    rgba(3, 26, 32, 0.94) 0%,
    rgba(3, 26, 32, 0.8) 26%,
    rgba(3, 26, 32, 0.32) 44%,
    rgba(3, 26, 32, 0) 60%
  );
}
/* 46vw keeps the caption in the left part of a narrow wide-screen (an unfolded iPhone Duo held sideways is 890 wide,
   where 560 px reached far into the scene); from 1218 px up it is the full 560. */
.cap {
  --cap-left: max(24px, 5vw);
  --cap-bottom: calc(var(--scene-bottom) + clamp(44px, 9vh, 96px));
  position: absolute;
  left: var(--cap-left);
  bottom: var(--cap-bottom);
  max-width: min(560px, 46vw);
  opacity: 0;
  visibility: hidden;
  will-change: opacity, transform;
}
/* White captions need a dark ground, whatever the 3D scene draws behind them. Each chapter caption brings its own,
   sized by the caption itself, so it fits every language and screen and fades in and out with its caption. The
   shades sized as a share of the screen (.fshade) did not reach: the airborne LiDAR forest lay bright behind the end
   of the lines of "Measure the structure" on a 1280 screen, and behind its heading on short phones. On wide screens
   the ground is a soft halo around the text (a shadow, drawn once into the caption's own layer); phones use a band
   (below). The opening text is left out: it sits on the dark country map. */
.cap:not(.intro)::before {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
  inset: -16px -24px;
  border-radius: 48px;
  background: rgba(3, 26, 32, 0.6);
  box-shadow: 0 0 96px 64px rgba(3, 26, 32, 0.6);
}
.cap .no {
  font-size: 15px;
  color: var(--bright);
  letter-spacing: 0.08em;
  font-weight: 600;
}
.cap h2 {
  font-size: clamp(32px, 4.6vw, 68px);
  line-height: 1.08;
  margin: 8px 0 14px;
  font-weight: 900;
}
html.zh .cap h2 {
  line-height: 1.3;
}
.cap p {
  font-size: clamp(15.5px, 1.25vw, 18px);
  color: var(--fg2);
  text-wrap: pretty;
}
/* The opening text is centred in the space under the navigation; auto margins centre it only while it fits, so a
   text taller than the screen starts under the navigation instead of running off both ends. */
.cap.intro {
  top: calc(72px + env(safe-area-inset-top, 0px));
  bottom: 40px;
  display: flex;
  flex-direction: column;
  max-width: min(760px, 88vw);
  opacity: 1;
  visibility: visible;
}
.cap.intro > :first-child {
  margin-top: auto;
}
.cap.intro > :last-child {
  margin-bottom: auto;
}
.cap.intro h1 {
  font-size: clamp(36px, 5.2vw, 78px);
  line-height: 1.08;
  font-weight: 900;
  margin: 10px 0 16px;
}
html.zh .cap.intro h1 {
  line-height: 1.3;
}
.specbars {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 44px;
  margin-top: 14px;
}
.specbars i {
  display: block;
  width: 22px;
  border-radius: 3px 3px 0 0;
}
.specbars .s1 {
  height: 38%;
  background: #4d8cff;
}
.specbars .s2 {
  height: 72%;
  background: #3fd3dc;
}
.specbars .s3 {
  height: 100%;
  background: #3fe88d;
}
.specbars .s4 {
  height: 58%;
  background: #f2ea59;
}
.specbars .s5 {
  height: 30%;
  background: #ff8c52;
}
.gauge {
  position: relative;
  width: min(320px, 70vw);
  height: 6px;
  border-radius: 3px;
  background: rgba(214, 238, 240, 0.2);
  margin-top: 18px;
}
.gauge i {
  position: absolute;
  left: 58%;
  top: -5px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bright);
  box-shadow: 0 0 16px 3px rgba(63, 211, 220, 0.7);
}
.gauge u {
  position: absolute;
  left: 46%;
  top: -9px;
  width: 1px;
  height: 24px;
  background: #fff;
}
.tag4 {
  position: absolute;
  right: 16px;
  bottom: calc(var(--scene-bottom) + 12px);
  font-size: 12px;
  color: var(--fg2);
}
.lab {
  position: absolute;
  left: 0;
  top: 0;
  padding-left: 14px;
  font-size: clamp(13px, 1.2vw, 17px);
  font-weight: 600;
  white-space: nowrap;
  --wbr: none;
  opacity: 0;
  pointer-events: none;
  text-shadow: 0 1px 8px #031a20;
}

/* chapter buttons */
#fdots {
  position: absolute;
  right: max(10px, calc(3vw - 12px));
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  z-index: 3;
}
#fdots button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 44px;
  height: 44px;
  padding: 0 13px;
  background: none;
  border: 0;
  color: #fff;
  font: inherit;
  cursor: pointer;
}
#fdots .dot {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(214, 238, 240, 0.42);
  transition:
    background 0.25s,
    transform 0.25s;
}
#fdots button:hover .dot,
#fdots button:focus-visible .dot {
  background: #fff;
  transform: scale(1.35);
}
#fdots button[aria-current="true"] .dot {
  background: var(--bright);
  transform: scale(1.75);
}
#fdots .tiplabel {
  position: absolute;
  right: 38px;
  top: 50%;
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(3, 26, 32, 0.82);
  font-size: 13.5px;
  white-space: nowrap;
  --wbr: none;
  opacity: 0;
  pointer-events: none;
  transform: translate(6px, -50%);
  transition:
    opacity 0.18s,
    transform 0.18s;
}
#fdots button:hover .tiplabel,
#fdots button:focus-visible .tiplabel {
  opacity: 1;
  transform: translate(0, -50%);
}
@media (hover: none) {
  #fdots .tiplabel {
    display: none;
  }
}
@media (max-width: 820px) {
  .fshade {
    background: linear-gradient(
      0deg,
      rgba(3, 26, 32, 0.94) var(--bleed),
      rgba(3, 26, 32, 0.72) calc(var(--bleed) + 0.36 * var(--scene-h)),
      rgba(3, 26, 32, 0) calc(var(--bleed) + 0.62 * var(--scene-h))
    );
  }
  .cap,
  /* on a phone the opening text rests at the bottom like the chapter captions after it, with the map above it;
     centred, it left the lower part of a tall screen empty */
  .cap.intro {
    --cap-bottom: calc(var(--scene-bottom) + 32px);
    bottom: var(--cap-bottom);
    max-width: calc(100% - var(--cap-left) - 64px);
  }
  /* the caption's ground on a phone: a band from a little above its first line to the bottom of the screen, across
     the full width (an iPhone in Safari, the iPhone SE and a folded iPhone Duo had the forest behind the heading),
     running on under the browser's bar with the rest of the picture (--bleed) */
  .cap:not(.intro)::before {
    inset: -96px auto calc(-1 * (var(--cap-bottom) + var(--bleed))) calc(-1 * var(--cap-left));
    width: 100vw;
    border-radius: 0;
    box-shadow: none;
    background: linear-gradient(180deg, rgba(3, 26, 32, 0) 0, rgba(3, 26, 32, 0.78) 96px, rgba(3, 26, 32, 0.9) 100%);
  }
  .cap.intro > :last-child {
    margin-bottom: 0;
  }
  .cap p {
    font-size: 14.5px;
  }
  .cap h2 {
    font-size: 30px;
    margin: 4px 0 8px;
  }
  .cap.intro h1 {
    font-size: 32px;
    line-height: 1.15;
    margin: 6px 0 10px;
  }
  .cap.intro .rank {
    margin-top: 16px;
  }
  .cap.intro .rank b {
    font-size: 40px;
  }
  .lab {
    font-size: 12px;
  }
  .specbars {
    height: 30px;
    margin-top: 8px;
  }
}

/* short phones: the opening still fits under the navigation */
@media (max-width: 820px) and (max-height: 700px) {
  .cap.intro h1 {
    font-size: 24px;
    margin: 4px 0 6px;
  }
  .cap.intro .rank {
    margin-block: 8px 10px;
    gap: 6px;
  }
  .cap.intro .rank b {
    font-size: 30px;
  }
  .cap.intro .rank > span {
    padding-top: 10px;
  }
  .cap.intro p,
  .cap.intro .rank > span {
    font-size: 13px;
    line-height: 1.45;
  }
}

/* technical detail */
.sats {
  margin-top: 46px;
}
.detail {
  margin-top: clamp(48px, 6vw, 76px);
  gap: clamp(36px, 6vw, 80px);
}
.detail > div {
  min-width: 0;
}
.detail p {
  color: var(--fg2);
  font-size: 16px;
}
.detail .eyebrow {
  margin-bottom: 10px;
}
.detail p + .eyebrow {
  margin-top: 36px;
}
.from-to {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 10px;
}
.from-to b {
  flex: none; /* a figure and its unit stay whole: squeezed, "50 m" broke into "50" and "m" on a narrow phone */
  white-space: nowrap;
  --wbr: none;
  font-size: clamp(44px, 5.4vw, 76px);
  font-weight: 400;
  line-height: 1;
  color: var(--fg);
}
.from-to b:first-child {
  color: var(--fg3);
}
.from-to i {
  flex: 0 1 120px;
  height: 1px;
  background: linear-gradient(90deg, var(--line), var(--ribbon));
}
.bands {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  align-items: end;
  height: 190px;
  margin-bottom: 12px;
}
.bands > div {
  display: grid;
  align-content: end;
  justify-items: start;
  height: 100%;
  min-width: 0;
}
.bands b {
  font-size: 26px;
  font-weight: 400;
  line-height: 1.2;
}
.bands i {
  display: block;
  width: 100%;
  height: calc(var(--v) * 2.4px + 6px);
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, var(--ribbon), var(--teal));
}
.bands span {
  font-size: 14px;
  color: var(--fg3);
  margin-top: 6px;
}

/* without WebGL or with reduced motion, the film becomes plain text */
html.nogl #film,
html.nofilm #film {
  height: auto;
}
/* ... standing in the page column, like the sections after it (.gutter with .wrap, base.css): Windows with animation
   effects off, a remote desktop or a blocked graphics driver shows this on a wide screen, where 24 px from the edge
   left the text far outside the column (tools/browsers.js, 2026-11-11) */
html.nogl #filmstage,
html.nofilm #filmstage {
  --text-side: calc((100% - var(--column) + 80px) / 2);
  height: auto;
  padding: 110px max(24px, env(safe-area-inset-right, 0px), var(--text-side)) 60px
    max(24px, env(safe-area-inset-left, 0px), var(--text-side));
}
html.nogl .cap,
html.nofilm .cap {
  position: relative;
  left: 0;
  bottom: 0;
  top: 0;
  margin: 0 0 40px;
  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;
}
html.nogl #gl,
html.nofilm #gl,
html.nogl .lab,
html.nofilm .lab,
html.nogl #fdots,
html.nofilm #fdots,
html.nogl .fshade,
html.nofilm .fshade,
html.nogl .tag4,
html.nofilm .tag4,
html.nogl .cap::before,
html.nofilm .cap::before {
  display: none;
}
