/*
 * Desktop design baseline: 1920 x 1080.
 * Layout is reflowed rather than scaled, so text and media keep their ratio.
 */
:root {
  --design-viewport-width: 1920px;
  --design-viewport-height: 1080px;
  --design-content-width: 1652px;
  --design-header-height: 64px;
}

html,
body {
  width: 100%;
  min-width: 320px;
  overflow-x: clip;
}

body img,
body video,
body canvas,
body svg {
  max-width: 100%;
}

/* Preserve the original navigation and keep it visible while reading.
   The story owns an equal top inset so the fixed bar never covers content. */
body.science-mode > .science-story {
  padding-top: var(--design-header-height);
}

body.science-mode .science-nav {
  position: fixed;
  inset: 0 0 auto;
  width: 100%;
  z-index: 130;
}

body.science-mode .science-section {
  scroll-margin-top: calc(var(--design-header-height) + 12px);
}

/* Every narrative screen fills a 1080-high viewport at the design target.
   Dense screens continue growing naturally instead of clipping content. */
@media (min-width: 821px) {
  body.science-mode .science-section,
  body.science-mode .science-section.science-hero {
    width: 100%;
    height: auto !important;
    min-height: calc(100svh - var(--design-header-height));
    max-height: none;
    padding-block: clamp(72px, 7.4vh, 80px);
    padding-inline: clamp(72px, 7vw, 134px);
  }

  body.science-mode .science-inner,
  body.science-mode .science-hero > .science-inner {
    width: min(var(--design-content-width), 100%);
    max-width: var(--design-content-width);
    margin-inline: auto;
  }

  body.science-mode #science-why {
    min-height: calc(100svh - var(--design-header-height));
    padding-bottom: clamp(52px, 6vh, 66px);
  }

  body.science-mode .science-hero-grid {
    width: 100%;
    height: auto;
    min-height: clamp(560px, 61vh, 660px);
    grid-template-columns: minmax(0, 1.08fr) minmax(360px, .92fr);
    gap: clamp(54px, 5vw, 96px);
    align-items: center;
  }

  body.science-mode .science-hero-grid > div:first-child,
  body.science-mode .science-hero h1,
  body.science-mode .science-hero p,
  body.science-mode .science-week,
  body.science-mode .science-overview-copy {
    width: auto;
    max-width: 100%;
    height: auto;
  }

  body.science-mode .science-hero h1 {
    margin-left: 0;
    font-size: clamp(76px, 5.25vw, 101px);
    line-height: 1.08;
    text-wrap: balance;
  }

  body.science-mode .science-hero p,
  body.science-mode .science-week,
  body.science-mode .science-overview-copy {
    margin-left: 0;
  }

  body.science-mode .science-hero-art {
    width: min(100%, 560px);
    height: auto;
    aspect-ratio: 1;
    justify-self: end;
  }

  body.science-mode .science-hero-video,
  #embeddedVideoGuide .guide-backdrop video {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  body.science-mode .science-module-video,
  #embeddedVideoGuide .science-module-video {
    object-fit: contain;
  }

  body.science-mode .science-overview {
    width: 100%;
    height: auto;
  }

  .app {
    width: 100%;
    min-height: 100svh;
  }

  .app .stage {
    min-height: calc(100svh - var(--design-header-height));
    padding-inline: clamp(72px, 7vw, 134px);
  }

  .app .screen {
    width: min(1120px, 100%);
  }

  .app .next {
    width: min(1120px, calc(100vw - 88px));
  }

  .product-shell {
    width: 100%;
    min-height: 100svh;
  }

  .product-shell .product-main {
    width: min(var(--design-content-width), calc(100% - 14vw));
    max-width: var(--design-content-width);
  }

  #embeddedVideoGuide {
    min-height: 100svh;
  }

  #embeddedVideoGuide .guide-shell {
    width: min(var(--design-content-width), calc(100% - clamp(72px, 7vw, 134px)));
    min-height: 100svh;
  }
}

/* Keep the existing reflow model for tablets and phones. */
@media (max-width: 820px) {
  body.science-mode .science-section,
  body.science-mode .science-section.science-hero {
    width: 100%;
    height: auto !important;
    min-height: auto;
  }

  .app .screen,
  .product-shell .product-main,
  #embeddedVideoGuide .guide-shell {
    max-width: 100%;
  }
}
