/* Project NSB stylesheet.
   Night bands (header, hero, page titles, footer) keep their colours in both themes.
   Everything between them follows the reader's colour preference. */

:root {
  color-scheme: dark light;

  --night-0: #060a1a;
  --night-1: #0a1024;
  --night-2: #141e42;
  --night-ink: #eef1f9;
  --night-soft: #c6cee2;
  --night-rule: #2e3a66;
  --sodium: #f4c56a;

  --bg: #0b1228;
  --raised: #121b3a;
  --ink: #e9edf7;
  --soft: #bcc6dc;
  --faint: #98a3bf;
  --rule: #2a3559;
  --field: #66718f;
  --link: #a9c8ff;
  --accent: #f4c56a;
  --line-city: #c8822c;
  --line-dark: #5f8fe8;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7f5ef;
    --raised: #fffdf8;
    --ink: #131b34;
    --soft: #3c4664;
    --faint: #586180;
    --rule: #d9d6cc;
    --field: #7a8197;
    --link: #1c4ea6;
    --accent: #8a5200;
    --line-city: #b8620e;
    --line-dark: #2a5bc0;
  }
}

/* Base */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-wrap: break-word;
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1.16;
  margin: 0;
  text-wrap: balance;
}

h2 { font-size: clamp(1.55rem, 1.25rem + 1.3vw, 2.1rem); }
h3 { font-size: 1.25rem; }

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

a { color: var(--link); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.night :focus-visible, .site-head :focus-visible, .site-foot :focus-visible { outline-color: var(--sodium); }

svg { max-width: 100%; }

.wrap {
  width: 100%;
  max-width: 70rem;
  margin-left: auto;
  margin-right: auto;
  padding-left: clamp(1rem, 4vw, 2.5rem);
  padding-right: clamp(1rem, 4vw, 2.5rem);
}

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: .5rem .9rem;
  background: var(--sodium);
  color: var(--night-0);
  border-radius: 0 0 4px 4px;
}
.skip:focus { top: 0; }

/* Site header */

.site-head { background: var(--night-1); color: var(--night-ink); }

.site-head .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 1.5rem;
  padding-top: .7rem;
  padding-bottom: .5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  padding: .3rem 0;
  color: inherit;
  font-family: var(--serif);
  font-size: 1.25rem;
  letter-spacing: .01em;
  text-decoration: none;
}
.brand svg { flex: none; }

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  color: var(--night-soft);
  font-size: 1rem;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--night-ink); border-bottom-color: var(--night-rule); }
.site-nav a[aria-current] { color: var(--night-ink); border-bottom-color: var(--sodium); }

/* Hero: a walk from the city glow on the left to the dark mountains on the right */

.hero { color: var(--night-ink); background: var(--night-0); }

.hero-sky {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(62% 40% at 6% 100%, rgba(244, 170, 84, .62), rgba(178, 106, 76, .26) 50%, transparent 76%),
    linear-gradient(90deg, transparent 38%, rgba(4, 6, 18, .78) 100%),
    linear-gradient(180deg, var(--night-1) 0%, #0e1738 56%, #27305e 100%);
}

.hero-stars {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
}

.st { fill: none; stroke: #fff; stroke-linecap: round; }

@media (max-width: 40rem) {
  .hero-sky > .hero-stars { opacity: .55; }
}

.hero-copy { padding-top: clamp(2.5rem, 7vw, 5.5rem); padding-bottom: clamp(1.5rem, 4vw, 3rem); }

.eyebrow {
  margin-bottom: 1rem;
  color: var(--sodium);
  font-family: var(--mono);
  font-size: .8125rem;
  letter-spacing: .04em;
}

.hero h1 {
  max-width: 15em;
  font-size: clamp(2.2rem, 1.2rem + 4.6vw, 4.1rem);
  line-height: 1.07;
}

.hero .lede {
  max-width: 35rem;
  margin-top: 1.25rem;
  color: var(--night-soft);
  font-size: clamp(1.0625rem, 1rem + .35vw, 1.25rem);
  line-height: 1.55;
}

.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.75rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.875rem;
  padding: .55rem 1.2rem;
  border: 1px solid var(--sodium);
  border-radius: 3px;
  background: var(--sodium);
  color: var(--night-0);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: #ffd98c; border-color: #ffd98c; }

.btn-line { background: transparent; color: var(--night-ink); border-color: var(--night-soft); }
.btn-line:hover { background: rgba(255, 255, 255, .08); border-color: var(--night-ink); }

.on-page .btn-line { color: var(--ink); border-color: var(--field); }
.on-page .btn-line:hover { background: transparent; border-color: var(--ink); }

.hero-horizon {
  display: flex;
  width: 100%;
  height: clamp(5.5rem, 15vw, 15rem);
  margin-top: clamp(0rem, 3vw, 2.5rem);
}

.transect { padding-bottom: 1.75rem; }

.transect ol {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 3px solid;
  border-image: linear-gradient(90deg, #f4b45e, #b58aa0 34%, #6d8fda 66%, #2b3a7a) 1;
}

.transect li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: .55rem 0;
  border-bottom: 1px solid var(--night-rule);
}

.t-name { color: var(--night-soft); font-size: .9375rem; }
.t-val { font-family: var(--mono); font-size: 1.25rem; font-variant-numeric: tabular-nums; }

.transect p { margin: .85rem 0 0; color: var(--night-soft); font-size: .875rem; }

@media (min-width: 48rem) {
  .transect ol { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .transect li { display: grid; gap: .1rem; padding: .8rem 1rem .2rem 0; border-bottom: 0; }
  .t-val { order: -1; font-size: 1.75rem; line-height: 1.2; }
}

/* Sections */

.section { padding-top: clamp(3rem, 7vw, 5.25rem); padding-bottom: clamp(3rem, 7vw, 5.25rem); }
.section + .section { border-top: 1px solid var(--rule); }

.split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem 3.5rem; }

.split-head p { margin-top: .8rem; color: var(--soft); }

@media (min-width: 58rem) {
  .split { grid-template-columns: 17rem minmax(0, 1fr); }
}

.prose { max-width: 42rem; }
.prose h2 { margin: 2.2em 0 .55em; font-size: 1.5rem; }
.prose h2:first-child { margin-top: 0; }
.prose ul, .prose ol { margin: 0 0 1em; padding-left: 1.3rem; }
.prose li { margin-bottom: .45em; }
.prose li::marker { color: var(--accent); }

.reasons { display: grid; gap: 1.4rem; margin: 0; padding: 0; list-style: none; }
.reasons h3 { margin-bottom: .3rem; }
.reasons p { color: var(--soft); }

/* Three skies */

.skies {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(.6rem, 2.5vw, 1.75rem);
  margin: 2.25rem 0 0;
  padding: 0;
  list-style: none;
}

.skies li { text-align: center; }
.patch { display: flex; width: 100%; height: auto; }
.skies b { display: flex; justify-content: center; margin-top: .6rem; font-family: var(--mono); font-size: clamp(1rem, .9rem + .7vw, 1.3rem); font-weight: 400; }
.skies span { display: flex; justify-content: center; color: var(--soft); font-size: .875rem; line-height: 1.3; }

.fig-note { margin-top: 1rem; color: var(--faint); font-size: .875rem; }

/* Headline figures */

.facts {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.75rem clamp(1.5rem, 4vw, 3rem);
  margin: 0;
}

.fact { padding-top: .8rem; border-top: 2px solid var(--accent); }
.fact dd { margin: .35rem 0 0; color: var(--soft); }
.fact dt { font-family: var(--serif); font-size: clamp(2.8rem, 2rem + 3vw, 4rem); line-height: 1; }

@media (min-width: 44rem) {
  .facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Chart */

.chart { margin: 0; }
.chart svg { width: 100%; height: auto; }
.chart-wide { display: none; }
.chart-narrow { display: flex; }

@media (min-width: 38rem) {
  .chart-wide { display: flex; }
  .chart-narrow { display: none; }
}

.legend { display: flex; flex-wrap: wrap; gap: .2rem 1.5rem; margin: 0 0 .75rem; padding: 0; list-style: none; color: var(--soft); font-size: .9375rem; }
.legend li { display: flex; align-items: center; gap: .5rem; }
.key { flex: none; width: 1.5rem; height: 3px; border-radius: 2px; }
.key-city { background: var(--line-city); }
.key-dark { background: var(--line-dark); }

.c-grid { stroke: var(--rule); stroke-width: 1; }
.c-text { fill: var(--soft); font-family: var(--sans); }
.c-num { fill: var(--soft); font-family: var(--mono); }
.c-strong { fill: var(--ink); font-family: var(--sans); font-weight: 600; }
.c-line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.c-city { stroke: var(--line-city); }
.c-dark { stroke: var(--line-dark); }
.c-dot { stroke: var(--bg); stroke-width: 2; }
.c-dot-city { fill: var(--line-city); }
.c-dot-dark { fill: var(--line-dark); }
.c-gap { stroke: var(--faint); stroke-width: 1; }
.c-hit { fill: transparent; }
.c-hit:hover { fill: var(--soft); fill-opacity: .18; }

details { margin-top: 1.25rem; }
summary { color: var(--link); cursor: pointer; }
details[open] summary { margin-bottom: .75rem; }

/* Tables */

.table-wrap { max-width: 100%; margin: 1.25rem 0; overflow-x: auto; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: .9375rem;
  line-height: 1.4;
}

.data caption { margin-bottom: .5rem; color: var(--soft); font-size: .875rem; text-align: left; }

.data th, .data td { padding: .5rem .75rem .5rem 0; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
.data th:last-child, .data td:last-child { padding-right: 0; }
.data thead th { color: var(--soft); font-size: .8125rem; font-weight: 500; border-bottom: 2px solid var(--field); vertical-align: bottom; }
.data thead .num { white-space: normal; }
.code { white-space: nowrap; }

@media (max-width: 24rem) {
  table.data { font-size: .875rem; }
  .data th, .data td { padding-right: .45rem; }
}
.data tbody th { font-weight: 400; }
.data .num { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.data tr.flag th, .data tr.flag td { font-weight: 600; }

.table-note { margin-top: -.5rem; color: var(--faint); font-size: .875rem; }

/* Logbook list of notes */

.log { margin: 0; padding: 0; list-style: none; }

.log li {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: .15rem 2rem;
  padding: 1.15rem 0;
  border-top: 1px solid var(--rule);
}
.log li:last-child { border-bottom: 1px solid var(--rule); }

.log time { color: var(--faint); font-family: var(--mono); font-size: .875rem; line-height: 1.9; }
.log h3 a { color: var(--ink); text-decoration-color: var(--field); }
.log h3 a:hover { color: var(--link); }
.log p { margin-top: .3rem; color: var(--soft); }

@media (min-width: 40rem) {
  .log li { grid-template-columns: 9.5rem minmax(0, 1fr); }
}

.more { margin-top: 1.25rem; }

/* Call to volunteer */

.join {
  background: var(--night-2);
  color: var(--night-ink);
  border-top: 0;
}
.section + .join { border-top: 0; }
.join h2 { max-width: 16em; }
.join p { max-width: 42rem; color: var(--night-soft); }
.join .join-lede { margin-top: 1rem; }
.join a:not(.btn) { color: #cfe0ff; }

/* Page title band */

.page-head {
  --glow: 0;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(70% 90% at 12% 100%, rgba(244, 170, 84, var(--glow)), transparent 72%),
    linear-gradient(180deg, var(--night-1) 0%, #101a3e 100%);
  color: var(--night-ink);
}

.page-head .hero-stars { z-index: -1; }

.page-title { padding-top: clamp(2rem, 5vw, 3.75rem); padding-bottom: 1rem; }

.page-head h1 { max-width: 19em; font-size: clamp(2rem, 1.35rem + 3vw, 3.25rem); line-height: 1.1; }

.page-head .lede { max-width: 38rem; margin-top: .9rem; color: var(--night-soft); font-size: 1.125rem; line-height: 1.5; }

.meta { margin-bottom: .75rem; color: var(--sodium); font-family: var(--mono); font-size: .8125rem; }
.meta a { color: inherit; }

.ph-foot { position: relative; }
.ph-horizon { display: flex; width: 100%; height: clamp(2.75rem, 7vw, 4.75rem); }

.sky-tag {
  margin: 0;
  background: var(--night-0);
  color: var(--night-soft);
  font-family: var(--mono);
  font-size: .75rem;
}
.sky-tag .wrap { padding-top: .2rem; padding-bottom: .55rem; }

/* Method page */

.conditions { margin: 0; }
.conditions div { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 1.5rem; padding: .6rem 0; border-top: 1px solid var(--rule); }
.conditions div:last-child { border-bottom: 1px solid var(--rule); }
.conditions dt { font-weight: 600; }
.conditions dd { margin: 0; color: var(--soft); }

@media (min-width: 36rem) {
  .conditions div { grid-template-columns: 6.5rem minmax(0, 1fr); }
}

.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { position: relative; counter-increment: step; padding: 0 0 1.05rem 2.6rem; }
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: .1rem;
  width: 1.75rem;
  height: 1.75rem;
  border: 1px solid var(--accent);
  border-radius: 50%;
  color: var(--accent);
  font-family: var(--mono);
  font-size: .875rem;
  line-height: 1.65rem;
  text-align: center;
}
.steps li:last-child { padding-bottom: 0; }

.ladder { margin: 1.5rem 0 0; padding: 0; list-style: none; }

.ladder li {
  display: grid;
  grid-template-columns: 3.75rem minmax(0, 1fr);
  gap: 0 1rem;
  align-items: start;
  padding: .9rem 0;
  border-top: 1px solid var(--rule);
}
.ladder li:last-child { border-bottom: 1px solid var(--rule); }
.ladder h3 { font-family: var(--sans); font-size: 1rem; font-weight: 600; line-height: 1.4; }
.ladder .range { margin-right: .4rem; color: var(--accent); font-family: var(--mono); font-weight: 400; }
.ladder p { color: var(--soft); font-size: .9375rem; line-height: 1.5; }

@media (min-width: 36rem) {
  .ladder li { grid-template-columns: 5rem minmax(0, 1fr); gap: 0 1.25rem; }
}

/* About page */

.timeline { margin: 0; padding: 0; list-style: none; border-left: 2px solid var(--rule); }
.timeline li { position: relative; padding: 0 0 1.1rem 1.25rem; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -6px;
  top: .55rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--bg);
}
.timeline li:last-child { padding-bottom: 0; }
.timeline time { display: flex; color: var(--faint); font-family: var(--mono); font-size: .875rem; }

.team {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem clamp(1.5rem, 4vw, 3rem);
  margin: 0;
  padding: 0;
  list-style: none;
}
.team h3 { margin-bottom: .1rem; }
.team .role { margin-bottom: .35rem; color: var(--faint); font-family: var(--mono); font-size: .8125rem; }
.team p { color: var(--soft); }

@media (min-width: 38rem) {
  .team { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.principles { margin: 0; padding: 0; list-style: none; }
.principles li { padding: .85rem 0; border-top: 1px solid var(--rule); }
.principles li:last-child { border-bottom: 1px solid var(--rule); }
.principles h3 { font-family: var(--sans); font-size: 1.0625rem; font-weight: 600; line-height: 1.4; }
.principles p { margin-top: .15rem; color: var(--soft); }

/* Note footer navigation */

.note-nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: .75rem 2rem;
  max-width: 42rem;
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}
.note-nav a { display: grid; text-decoration: none; }
.note-nav span { color: var(--faint); font-family: var(--mono); font-size: .8125rem; }
.note-nav b { font-weight: 500; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .18em; }

@media (min-width: 36rem) {
  .note-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .note-nav .next { grid-column: 2; text-align: right; }
}

/* Portal */

.portal-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2.5rem clamp(2rem, 6vw, 5rem); align-items: start; }

@media (min-width: 52rem) {
  .portal-grid { grid-template-columns: minmax(0, 24rem) minmax(0, 1fr); }
}

.portal-form {
  display: grid;
  gap: .3rem;
  padding: clamp(1.25rem, 4vw, 1.9rem);
  background: var(--raised);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--accent);
  border-radius: 3px;
}

.portal-form h2 { margin-bottom: .6rem; font-size: 1.5rem; }
.portal-form label { margin-top: .6rem; font-size: .9375rem; font-weight: 600; }

.portal-form input {
  width: 100%;
  min-height: 2.875rem;
  padding: .5rem .7rem;
  background: var(--bg);
  border: 1px solid var(--field);
  border-radius: 3px;
  color: var(--ink);
  font: inherit;
}

.portal-form .btn { margin-top: 1rem; width: 100%; }

.on-page .btn { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.on-page .btn:hover { filter: brightness(1.08); }
.on-page .btn.btn-line { background: transparent; color: var(--ink); border-color: var(--field); }

.notice {
  margin: .9rem 0 0;
  padding: .7rem .85rem;
  border-left: 3px solid var(--accent);
  background: var(--bg);
  font-size: .9375rem;
  line-height: 1.45;
}
.notice:empty { display: none; }

/* 404 */

.lost { font-family: var(--mono); font-size: clamp(3.25rem, 2rem + 8vw, 6.5rem); line-height: 1; }
.lost small { display: flex; margin-top: .4rem; color: var(--sodium); font-size: 1rem; }

.link-list { display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; margin: 0; padding: 0; list-style: none; }

/* Site footer */

.site-foot { background: var(--night-0); color: var(--night-soft); font-size: .9375rem; }

.foot-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem 3rem;
  padding-top: 2.5rem;
  padding-bottom: 1.5rem;
}

@media (min-width: 44rem) {
  .foot-grid { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr); }
}

.foot-name { margin-bottom: .3rem; color: var(--night-ink); font-family: var(--serif); font-size: 1.2rem; }

.site-foot h2 { margin-bottom: .4rem; color: var(--night-ink); font-family: var(--sans); font-size: .9375rem; font-weight: 600; line-height: 1.5; }
.site-foot ul { margin: 0; padding: 0; list-style: none; }
.site-foot li { padding: .1rem 0; }
.site-foot a { color: var(--night-soft); }
.site-foot a:hover { color: var(--night-ink); }

.foot-base { padding-top: 0; padding-bottom: 1.75rem; }
.foot-base p { padding-top: 1rem; border-top: 1px solid var(--night-rule); font-size: .8125rem; }

/* A slow shimmer on the brightest hero stars, only for readers who are fine with motion */

@media (prefers-reduced-motion: no-preference) {
  .shimmer { animation: shimmer 6s ease-in-out infinite alternate; }
  @keyframes shimmer { from { opacity: .95; } to { opacity: .55; } }
}
