/* gichigami.org
   Every color on the page is a function of --depth (feet) and --light (1 at the surface, 0 below 400 ft).
   js/depth.js writes --bg and --ink on :root from the scroll position. Nothing else sets a background. */

@font-face {
  font-family: "Literata";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url("../assets/fonts/literata-latin-standard-normal.woff2") format("woff2-variations");
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../assets/fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2");
}

:root {
  --morning: #e4ecef;
  --shore-ink: #17262e;
  --silt: #b7c1c6;
  --bottom: #000000;

  --bg: var(--morning);
  --ink: var(--shore-ink);
  --depth: 0;
  --light: 1;

  --serif: "Literata", Georgia, "Times New Roman", serif;
  --sans: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;

  --measure: 62ch;
  --wide: 80ch;
  --step--1: 0.9375rem;  /* 15 */
  --step-0: 1.125rem;    /* 18 */
  --step-1: 1.375rem;    /* 22 */
  --step-2: 1.6875rem;   /* 27 */
  --step-3: 2.125rem;    /* 34 */
  --readout: 4rem;       /* 64 */

  color-scheme: light dark;
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
  color: var(--ink);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--serif);
  font-size: var(--step-0);
  line-height: 1.55;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  color: var(--ink);
}

@media (max-width: 600px) {
  :root { --step-0: 1.0625rem; --readout: 2.5rem; }
}

/* Type */

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.15;
  margin: 0 0 0.6em;
  letter-spacing: -0.005em;
}
h1 { font-size: var(--step-3); }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); margin-top: 3rem; }

p { margin: 0 0 1.25em; max-width: var(--measure); }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
  text-decoration-color: color-mix(in srgb, currentColor 55%, transparent);
}
a:hover { text-decoration-color: currentColor; }

i[lang="oj"] { font-style: italic; }
cite { font-style: italic; }

figcaption, .fig-note, .readout-name, .index, .droplet-label, .names-note, .review-note {
  font-family: var(--sans);
  font-size: var(--step--1);
  line-height: 1.45;
}

/* Focus: a double ring in current ink and current background works at every depth */
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  box-shadow: 0 0 0 3px var(--bg);
  border-radius: 2px;
}

/* Skip link */
.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  padding: 0.5rem 0.75rem;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--sans);
  z-index: 20;
}
.skip:focus { top: 1rem; }

/* Layout */

main {
  position: relative;
  z-index: 1;
  padding: 0 clamp(1rem, 6vw, 5rem);
}

.stratum {
  max-width: var(--wide);
  margin: 0 auto 0 0;
  padding: min(20vh, 8rem) 0 0;
}
@media (min-width: 1100px) {
  .stratum { margin-left: max(0px, calc(50vw - 40ch - 8vw)); }
}

/* Open water between strata. Each stratum's gap is set in strata.css in proportion to the depth drop. */
.stratum { margin-bottom: var(--gap, 40vh); }
.stratum:last-child { margin-bottom: 30vh; }

/* Particulate canvas sits behind everything, fixed */
.particulate {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* Surface: the hero */

.surface {
  position: relative;
  min-height: 100svh;
  display: grid;
  grid-template-rows: 1fr auto;
  z-index: 1;
}
.surface-media {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.shore-video, .shore-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.shore-poster { display: none; }
.surface-text {
  position: relative;
  grid-row: 2;
  padding: 2rem clamp(1rem, 6vw, 5rem) 3rem;
  color: #fff;
  text-shadow: 0 1px 12px rgba(0,0,0,0.45);
}
.surface-text h1 { font-weight: 300; font-size: clamp(2.5rem, 7vw, 5rem); margin-bottom: 0.2em; }
.surface-text p { font-family: var(--sans); font-size: var(--step-0); margin: 0; }

/* Under reduced motion or on narrow viewports the video is never loaded; main.js removes the sources. */
@media (prefers-reduced-motion: reduce), (max-width: 599px) {
  .shore-video { display: none; }
  .shore-poster { display: block; }
}

/* Readout: bare type, bottom left on desktop, top left on mobile */

.readout {
  position: fixed;
  left: clamp(1rem, 3vw, 2rem);
  bottom: clamp(1rem, 3vw, 2rem);
  z-index: 10;
  display: grid;
  gap: 0.1rem;
  pointer-events: none;
  color: var(--ink);
  text-shadow: 0 0 6px var(--bg), 0 0 14px var(--bg);
  font-variant-numeric: tabular-nums;
}
.readout-feet {
  font-family: var(--serif);
  font-weight: 300;
  font-size: var(--readout);
  line-height: 1;
  font-variation-settings: "opsz" 72;
}
.readout-meters {
  font-family: var(--serif);
  font-weight: 300;
  font-size: var(--step-1);
  line-height: 1.1;
}
.readout-name { margin-top: 0.25rem; }
.surface-link {
  pointer-events: auto;
  margin-top: 0.6rem;
  font-family: var(--sans);
  font-size: var(--step--1);
  width: max-content;
}
.surface-link[hidden] { display: none; }

@media (max-width: 600px) {
  .readout { left: 1rem; bottom: 1rem; gap: 0; text-shadow: none; }
  .readout-feet { font-size: 2rem; }
  .readout-meters { font-size: var(--step--1); }
  .readout-name { margin-top: 0.1rem; }
  .surface-link { margin-top: 0.3rem; }
  /* The water itself fades up behind the readout row so text scrolls into it rather than under it. */
  .readout::before {
    content: "";
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: 7.5rem;
    background: linear-gradient(to top, var(--bg) 55%, transparent);
    z-index: -1;
    pointer-events: none;
  }
  main { padding-bottom: 6rem; }
}

/* Depth index: a ruler on the right edge, ticks spaced by real depth */

.index {
  position: fixed;
  right: clamp(0.75rem, 2.5vw, 2rem);
  top: 12vh;
  height: 76vh;
  z-index: 10;
  color: var(--ink);
}
.index-toggle {
  display: none;
}
.index-list {
  list-style: none;
  margin: 0;
  padding: 0;
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: 1px;
  background: color-mix(in srgb, currentColor 45%, transparent);
}
.index-list li {
  position: absolute;
  right: 0;
  top: calc(var(--at) / 1332 * 100%);
  height: 0;
}
.index-list a {
  position: absolute;
  right: -0.5rem;
  top: -0.7rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-direction: row-reverse;
  height: 1.4rem;
  padding: 0 0.5rem;
  text-decoration: none;
  white-space: nowrap;
  text-shadow: 0 0 6px var(--bg), 0 0 14px var(--bg);
}
.index-list a::after {
  content: "";
  width: 0.5rem;
  height: 1px;
  background: currentColor;
  flex: none;
}
.index-list a > span { font-variant-numeric: tabular-nums; }
.index-list a span,
.index-list a {
  color: inherit;
}
/* Collapsed: labels hidden, ticks stay */
.index:not(:hover):not(:focus-within) .index-list a > * {
  opacity: 0;
}
.index-list a > * { transition: opacity 120ms; }
.index-list a[aria-current="true"] { font-weight: 700; }

.index-marker {
  position: absolute;
  right: -3px;
  top: calc(var(--depth) / 1332 * 100%);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  transform: translateY(-3px);
}

@media (max-width: 600px) {
  .index { top: auto; bottom: 1rem; right: 1rem; height: auto; }
  .index-toggle {
    display: block;
    font: inherit;
    font-family: var(--sans);
    font-variant-numeric: tabular-nums;
    color: var(--ink);
    background: var(--bg);
    border: 1px solid currentColor;
    border-radius: 2px;
    padding: 0.4rem 0.7rem;
    cursor: pointer;
  }
  .index-list {
    position: fixed;
    inset: auto 0 0 0;
    width: auto;
    height: auto;
    background: var(--bg);
    border-top: 1px solid var(--ink);
    padding: 0.75rem 1rem 1.25rem;
    display: none;
  }
  .index-toggle[aria-expanded="true"] + .index-list { display: block; }
  .index-list li { position: static; height: auto; }
  .index-list a {
    position: static;
    flex-direction: row;
    height: 2.4rem;
    padding: 0;
    text-shadow: none;
    gap: 0.75rem;
  }
  .index-list a::after { display: none; }
  .index:not(:hover):not(:focus-within) .index-list a > * { opacity: 1; }
  .index-marker { display: none; }
}

/* Figures */

.fig {
  margin: 1.5rem 0 2.5rem;
  max-width: var(--measure);
}
.fig-wide { max-width: var(--wide); }
.fig canvas, .fig svg {
  display: block;
  width: 100%;
  height: auto;
}
.fig canvas { aspect-ratio: 800 / 240; }
#copper-vein { aspect-ratio: 800 / 300; }
figcaption { margin-top: 0.6rem; max-width: var(--measure); opacity: 0.85; }
.fig-note { opacity: 0.85; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .index-list a > * { transition: none; }
}

/* Sounding line: a tick every 25 feet down the left of the column, labels every 100, and marks at sourced depths.
   Built by depth.js from the same anchors the readout uses, so a tick is where the readout says it is. */
.sounding {
  position: absolute;
  top: 0;
  left: var(--sounding-left, 1rem);
  width: 1px;
  bottom: 0;
  background: color-mix(in srgb, currentColor 22%, transparent);
  z-index: 0;
  pointer-events: none;
  font-family: var(--sans);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}
.sounding .tick {
  position: absolute;
  left: 0;
  height: 1px;
  width: 0.5rem;
  background: color-mix(in srgb, currentColor 40%, transparent);
}
.sounding .tick.major { width: 1rem; }
.sounding .tick span {
  position: absolute;
  left: 1.4rem;
  top: -0.6rem;
  white-space: nowrap;
  opacity: 0.6;
}
.sounding .mark { width: 100vw; max-width: calc(100vw - var(--sounding-left, 1rem) - 1rem); background: color-mix(in srgb, currentColor 35%, transparent); }
.sounding .mark span { opacity: 0.9; top: -1.3rem; }
@media (max-width: 600px) {
  .sounding { left: 0.35rem; }
  .sounding .tick span { display: none; }
  .sounding .mark span { display: block; }
}
