.featured_image,
.featured_video {
  display: block;
  width: 100%;
  height: auto;
}

.retired-workflow {
  color: #adb3b8;
  font-weight: normal;
}

/* This helper fold otherwise adds a second paragraph-sized gap above itself. */
#quarto-document-content .compact-data-loading-fold details.code-fold {
  margin-top: 0;
}

/* A figure-number rail separates the label from the caption text. */
#quarto-document-content figcaption.quarto-float-caption {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1rem;
  box-sizing: border-box;
  width: var(--caption-content-width, 100%);
  max-width: none;
  justify-self: start;
  margin-left: var(--caption-content-offset, 0px);
  margin-right: 0;
  margin-top: 16px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: #243d36;
  font-size: 20px;
  font-weight: 400;
  line-height: 1.5;
  text-align: left;
  text-wrap: pretty;
  hyphens: none;
}

#quarto-document-content .caption-number {
  display: flex;
  align-items: center;
  padding-right: 16px;
  border-right: 3px solid #aec0b3;
  color: #243d36;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

#quarto-document-content .caption-description {
  min-width: 0;
}

#quarto-document-content figcaption.quarto-float-caption a,
#quarto-document-content figcaption.quarto-float-caption code {
  color: #315d48;
}

#quarto-document-content figcaption.quarto-float-caption a {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

#quarto-document-content figure.quarto-float-fig > div > img.figure-img {
  margin-bottom: 0;
}

#quarto-document-content figcaption.quarto-subfloat-caption {
  font-size: 18px;
}

@media (max-width: 600px) {
  #quarto-document-content figcaption.quarto-float-caption {
    gap: 12px;
    padding: 0 8px;
    font-size: 18px;
  }

  #quarto-document-content .caption-number {
    padding-right: 12px;
  }
}

.featured-quote {
  position: relative;
  isolation: isolate;
  margin-block: 0.5rem 3rem;
  padding: 0.25rem 0.5rem 1.5rem;
}

.featured-quote::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 1.6rem 0 -0.4rem 3%;
  pointer-events: none;
  background-image:
    linear-gradient(rgb(169 189 187 / 44%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(169 189 187 / 44%) 1px, transparent 1px);
  background-size: 26px 26px;
  transform: perspective(700px) rotateX(34deg) rotateZ(-5deg);
  -webkit-mask-image: linear-gradient(transparent, #000 25%, #000 80%, transparent);
  mask-image: linear-gradient(transparent, #000 25%, #000 80%, transparent);
}

#quarto-document-content .featured-quote blockquote {
  position: relative;
  margin: 0;
  padding: 1.85rem 3.8rem;
  border: 1px solid #adc3ae;
  border-radius: 3px;
  background: var(--bs-body-bg, #fff);
  color: #263e39;
  font-family: inherit;
  font-weight: 500;
  font-size: clamp(1.15rem, 2.5vw, 1.5rem);
  line-height: 1.45;
  box-shadow: 0 2px 3px rgb(28 59 41 / 8%), 17px 28px 22px rgb(41 75 57 / 23%);
}

#quarto-document-content .featured-quote blockquote::before,
#quarto-document-content .featured-quote blockquote::after {
  content: "";
  position: absolute;
  pointer-events: none;
  background: #587361;
}

#quarto-document-content .featured-quote blockquote::before {
  left: 30px;
  bottom: -25px;
  width: 1px;
  height: 25px;
}

#quarto-document-content .featured-quote blockquote::after {
  left: 27px;
  bottom: -28px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

#quarto-document-content .featured-quote blockquote p {
  position: relative;
  margin: 0;
  text-align: left;
  text-wrap: pretty;
  hyphens: none;
}

#quarto-document-content .featured-quote blockquote p:first-child::before,
#quarto-document-content .featured-quote blockquote p:last-child::after {
  position: absolute;
  color: #789386;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 4.6rem;
  font-weight: normal;
  line-height: 1;
  pointer-events: none;
}

#quarto-document-content .featured-quote blockquote p:first-child::before {
  content: "“";
  left: -2.8rem;
  top: -0.6rem;
}

#quarto-document-content .featured-quote blockquote p:last-child::after {
  content: "”";
  right: -2.8rem;
  bottom: -1.2rem;
}

@media (max-width: 30rem) {
  #quarto-document-content .featured-quote blockquote {
    padding: 1.4rem 2.7rem;
  }

  #quarto-document-content .featured-quote blockquote p:first-child::before,
  #quarto-document-content .featured-quote blockquote p:last-child::after {
    font-size: 3.5rem;
  }

  #quarto-document-content .featured-quote blockquote p:first-child::before {
    left: -1.9rem;
  }

  #quarto-document-content .featured-quote blockquote p:last-child::after {
    right: -1.9rem;
    bottom: -0.9rem;
  }
}

/* Paragraph-aware line breaking; unsupported browsers keep normal wrapping.
   Scope to prose so code, captions, callouts, and figure layouts stay independent.
   https://webkit.org/blog/16547/better-typography-with-text-wrap-pretty/ */
#quarto-document-content > p,
#quarto-document-content section > p,
#quarto-document-content .page-columns.page-full > p {
  text-wrap: pretty;
  -webkit-hyphens: auto;
  hyphens: auto;
  hyphenate-limit-chars: 7 3 3;
}

/* Justify only roomy reading columns, avoiding stretched spaces on phones. */
@media (min-width: 48rem) {
  #quarto-document-content > p,
  #quarto-document-content section > p,
  #quarto-document-content .page-columns.page-full > p {
    text-align: justify;
    text-align-last: start;
  }
}

#quarto-document-content p code {
  -webkit-hyphens: none;
  hyphens: none;
}

#quarto-document-content section.level2:not(.matrix-section) > h2 {
  margin-top: 0.75rem;
  padding-top: 0;
}

.matrix-section > h2 {
  grid-row: 1;
  align-self: start;
  z-index: 3;
  margin: 0;
  padding-block: clamp(1.5rem, 4vw, 3rem);
  border: 0;
  color: #e6ffeb;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  text-shadow: 0 2px 12px #020905, 0 0 24px rgb(40 230 65 / 22%);
}

/* Keep the banner above the website's opaque sidebar (z-index: 1), with
   the heading above the canvas. The fixed navbar remains above both. */
.matrix-section > #gis-matrix-banner {
  display: grid;
  grid-template-columns: subgrid;
  grid-row: 1;
  align-self: start;
  margin-top: 0;
  z-index: 2;
}

#gis-matrix-banner > .gis-matrix-screen {
  grid-column: 1 / -1;
}

#gis-matrix-banner,
#raypeople-intro {
  margin-bottom: 1.25rem;
}

.matrix-section .gis-matrix-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(to bottom, rgb(2 9 5 / 85%), rgb(2 9 5 / 55%) 5rem, transparent 13rem);
}

.matrix-section > h2 .anchorjs-link {
  color: #70eaa0;
}

@media print {
  .matrix-section > h2 {
    grid-row: auto;
    padding-block: 1rem;
    color: inherit;
    text-shadow: none;
  }

  .matrix-section > #gis-matrix-banner {
    grid-row: auto;
  }
}

.workflow-comparison {
  display: grid;
  gap: 1.5rem;
  margin-block: 1.5rem;
}

.workflow-comparison .workflow-option,
.workflow-comparison .cell {
  min-width: 0;
}

.workflow-comparison h3 {
  margin-top: 0;
}

/* Two-digit line numbers need only a small gutter in these narrow panels. */
.workflow-comparison pre.numberSource {
  margin-left: 0;
  padding-left: 1ch;
}

.workflow-comparison pre.numberSource code > span {
  left: 0;
}

.workflow-comparison pre.numberSource code > span > a:first-child::before {
  /* Keep numbers in the line box so even blank lines retain a baseline. */
  position: relative;
  left: 0;
  right: auto;
  width: 2ch;
  margin-right: 1ch;
  padding: 0;
}

/* Shared heading and content rows adapt to wrapping, font size, and zoom.
   Narrow screens and browsers without subgrid retain the stacked layout. */
@media (min-width: 48rem) {
  @supports (grid-template-rows: subgrid) {
    .workflow-comparison {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      grid-template-rows: auto auto;
      row-gap: 1rem;
    }

    .workflow-comparison > .workflow-option {
      display: grid;
      grid-template-rows: subgrid;
      grid-row: span 2;
    }

    .workflow-comparison h3 {
      margin-bottom: 0;
    }

    .workflow-comparison .cell {
      align-self: stretch;
      display: flex;
      flex-direction: column;
    }

    /* Carry the shared row height through Quarto's code/copy wrappers. */
    .workflow-comparison .cell > .code-copy-outer-scaffold,
    .workflow-comparison .cell div.sourceCode {
      display: flex;
      flex-direction: column;
      flex: 1;
      min-width: 0;
      margin-block: 0;
    }

    .workflow-comparison .cell pre.sourceCode {
      flex: 1;
      margin-block: 0;
    }
  }
}

/* Apply a drop cap to the first prose paragraph, even after a leading figure. */
#quarto-document-content > p:first-of-type:not(.has-svg-dropcap)::first-letter,
#quarto-document-content section.level2:not(.matrix-section) > p:first-of-type:not(.has-svg-dropcap)::first-letter,
#quarto-document-content .section-opening > p:not(.has-svg-dropcap)::first-letter,
#quarto-document-content .section-opening > .page-columns > p:not(.has-svg-dropcap)::first-letter {
  float: left;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 3.4em;
  line-height: 0.82;
  padding: 0.08em 0.10em 0 0;
  font-weight: 600;
  color: #263e39;
}

/* Georgia's descending numerals need a slightly smaller box to wrap two lines. */
#quarto-document-content section.level2.numeric-drop-cap > p:first-of-type:not(.has-svg-dropcap)::first-letter {
  font-size: 3.2em;
}

/* Let the browser align the cap to exactly two text lines when supported. */
@supports (initial-letter: 2) or (-webkit-initial-letter: 2) {
  #quarto-document-content > p:first-of-type:not(.has-svg-dropcap)::first-letter,
  #quarto-document-content section.level2:not(.matrix-section) > p:first-of-type:not(.has-svg-dropcap)::first-letter,
#quarto-document-content .section-opening > p:not(.has-svg-dropcap)::first-letter,
#quarto-document-content .section-opening > .page-columns > p:not(.has-svg-dropcap)::first-letter {
    float: none;
    -webkit-initial-letter: 2;
    initial-letter: 2;
    font-size: inherit;
    line-height: normal;
    padding: 0;
    margin-right: 0.1em;
  }

  #quarto-document-content section.level2.numeric-drop-cap > p:first-of-type:not(.has-svg-dropcap)::first-letter {
    -webkit-initial-letter: 1.9 2;
    initial-letter: 1.9 2;
    font-size: inherit;
  }
}

/* The larger illustration occupies three lines; its source letter stays selectable. */
#quarto-document-content .floating-dropcap {
  position: relative;
  float: left;
  display: block;
  height: 4.5em;
  height: 3lh;
  aspect-ratio: var(--cap-ratio);
  margin: 0 0.18em 0 0;
  padding: 0;
}

#quarto-document-content .floating-dropcap svg {
  display: block;
  width: 100%;
  height: 100%;
}

#quarto-document-content .floating-dropcap-letter {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.zoolander-exchange {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  background: #161616;
  container-type: inline-size;
}

.zoolander-panel {
  position: relative;
  aspect-ratio: 1.15;
  overflow: hidden;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  text-align: center;
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000, 0 2px 3px #000;
}

.zoolander-panel img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.zoolander-rayshader img { object-position: left center; }
.zoolander-user img { object-position: 70% center; }

.zoolander-name {
  position: absolute;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-size: clamp(14px, 3.1cqi, 30px);
}

.zoolander-user .zoolander-name { top: 10%; left: 50%; }

.zoolander-dialogue {
  position: absolute;
  bottom: 5%;
  left: 4%;
  right: 4%;
  color: #fff243;
  font-size: clamp(13px, 2.8cqi, 26px);
  line-height: 1.15;
}

/* Match panel A's native crop; cover also trims panel B's renderer HUD. */
#fig-crazy-roads .quarto-layout-cell img {
  display: block;
  width: 100%;
  aspect-ratio: 1964 / 1016;
  object-fit: cover;
  object-position: center top;
}

/* Match the median brightness of lit terrain in the two original renders
   (0.936 and 0.585) at their geometric midpoint, without changing the PNGs. */
#fig-crazy-roads-humps img {
  filter: brightness(0.791);
}

#fig-crazy-roads-decks img {
  filter: brightness(1.264);
}

#fig-haze {
  width: 100%;
  max-width: 600px;
  margin-inline: auto;
  justify-self: center;
}

#fig-water-fit {
  width: 100%;
  max-width: none;
}

#fig-water-fit video {
  display: block;
  max-width: 600px;
  margin-inline: auto;
}

/* Inline image reveal, also available on keyboard focus. */
a.image-hover {
  text-decoration-style: dotted;
  text-underline-offset: 0.15em;
}

.tippy-box[data-theme="image-preview"] {
  background: #fff;
  color: #fff;
  box-shadow: 0 4px 24px #0004;
}

.tippy-box[data-theme="image-preview"] .tippy-content {
  padding: 4px;
}

.image-hover-preview {
  display: block;
  width: auto;
  max-width: min(472px, calc(100vw - 32px));
  height: auto;
  max-height: calc(50vh - 3rem);
  max-height: calc(50dvh - 3rem);
  border-radius: 3px;
}

/* Give the paired videos the page width; their source aspect ratios match. */
.intro-rotations { padding-inline: clamp(0.5rem, 2vw, 2rem); }
.intro-rotation-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(0.5rem, 2vw, 2rem);
  align-items: center;
}
.intro-rotation-pair video { display: block; width: 100%; height: auto; }

/* A full-page theater; the screen always occupies 80% of its width. */
.movie-theater {
  --theater-apron: clamp(3rem, 7vw, 7rem);
  --audience-overlap: clamp(0.875rem, 2.4vw, 2rem);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin-block: 2rem 0;
  padding-block: clamp(2rem, 4vw, 4.5rem) var(--theater-apron);
  background: radial-gradient(ellipse at 50% 35%, #252329, #111115 60%, #070709);
  /* Carry the audience's darkness through the page's final padding without
     adding a tall empty element or changing the background above the theater. */
  box-shadow: inset 0 1px 0 #ffffff0d, 0 100vh 0 100vh #030305;
  clip-path: inset(0 0 -100vmax);
}

.movie-theater::before,
.movie-theater::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset-block: 0;
  width: 9%;
  pointer-events: none;
  background:
    linear-gradient(to bottom, #0008, transparent 24%, #0009),
    repeating-linear-gradient(90deg, #210c13 0%, #521b2c 18%, #2e101b 40%, #17090f 58%, #421524 80%, #210c13 100%);
  background-size: 100% 100%, clamp(18px, 3vw, 48px) 100%;
  box-shadow: 0 0 22px 8px #0009;
}

.movie-theater::before { left: 0; }
.movie-theater::after { right: 0; transform: scaleX(-1); }

.theater-valance {
  position: absolute;
  z-index: 3;
  inset: 0 0 auto;
  height: clamp(0.75rem, 1.6vw, 1.75rem);
  pointer-events: none;
  background: linear-gradient(#391321, #220c15);
  border-bottom: 2px solid #705438;
  box-shadow: 0 8px 18px #0009;
}

.theater-screen {
  position: relative;
  z-index: 2;
  width: 80%;
  margin-inline: auto;
  background: #000;
  box-shadow: 0 0 0 5px #08090b, 0 0 0 6px #ffffff17, 0 0 55px #ffffff0a;
}

.theater-exit {
  position: absolute;
  z-index: 3;
  top: 50%;
  /* Account for the cutout's transparent margins; its brass frame fills
     almost all of its curtain. Perspective is already in the artwork. */
  right: -0.2%;
  transform: translateY(-50%);
  display: block;
  width: 8.4%;
  height: auto;
  filter: url(#theater-exit-light) drop-shadow(2px 4px 4px #0009);
  pointer-events: none;
}

.theater-screen video {
  display: block;
  width: 100%;
  height: auto;
}

.theater-audience {
  position: absolute;
  z-index: 4;
  inset: auto 0 0;
  display: block;
  width: 100%;
  height: calc(var(--theater-apron) + var(--audience-overlap));
  pointer-events: none;
  filter: drop-shadow(0 -2px 1px #ffffff08);
  transition: transform 180ms ease-out;
}

/* The heads overlap the film, but slide below it when someone uses the player. */
.theater-screen:hover ~ .theater-audience,
.theater-screen:focus-within ~ .theater-audience {
  transform: translateY(var(--audience-overlap));
}

@media (prefers-reduced-motion: reduce) {
  .theater-audience { transition: none; }
}

/* Quarto stacks figure cells on narrow screens but retains the inter-column
   margin on the first cell. Remove it so matched media keep equal widths. */
@media (max-width: 767.98px) {
  #fig-water-methods .quarto-layout-cell,
  #fig-ggplot-states-edges .quarto-layout-cell,
  #fig-ggplot-gallery .quarto-layout-cell {
    margin-right: 0;
  }
}

/* Figure 7: keep the pointer grid aligned with the unpadded raster image. */
.raster-viewer {
  overflow: hidden;
  border: 1px solid #d4dfdc;
  border-radius: 8px;
  background: #f6f9f8;
  color: #213d36;
  text-align: left;
}
.raster-viewer-heading { padding: 14px 18px; }
.raster-viewer-heading strong { display: block; font-size: 1rem; }
.raster-viewer-heading span { font-size: 0.8rem; color: #526960; }
.raster-viewer-map { position: relative; cursor: crosshair; }
.raster-viewer-map:focus-visible { outline: 3px solid #127e83; outline-offset: -3px; }
.raster-viewer-map img.figure-img { display: block; width: 100%; height: auto; margin: 0; }
.raster-viewer-marker {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid white;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #163d3f, 0 1px 5px #163d3f;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.raster-viewer-readout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 14px 18px 8px;
  margin: 0;
  font-variant-numeric: tabular-nums;
}
.raster-viewer-readout dt { color: #526960; font-size: 0.75rem; font-weight: 500; }
.raster-viewer-readout dd { margin: 0; font-size: 0.95rem; white-space: nowrap; }
.raster-viewer-footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 18px 14px;
  font-size: 0.75rem;
}
@media (max-width: 480px) {
  .raster-viewer-readout { padding-inline: 10px; gap: 4px; }
  .raster-viewer-readout dd { font-size: 0.8rem; }
}
@media print {
  .raster-viewer-heading span, .raster-viewer-marker { display: none; }
}
