:root {
  color-scheme: light;
  --blue: #257180;
  --blue-deep: #174c58;
  --orange: #cb6040;
  --paper: #f5f4ee;
  --surface: #fffefa;
  --ink: #1d2929;
  --muted: #647170;
  --line: #dce1db;
  --soft-blue: #e7f0ef;
  --soft-orange: #faeee8;
  --serif: Georgia, "Times New Roman", serif;
  --sans: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --content: 1180px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.55 var(--sans);
}

a { color: inherit; }

button, input { font: inherit; }

.wrap {
  width: min(var(--content), calc(100% - 48px));
  margin-inline: auto;
}

.topbar {
  border-bottom: 1px solid var(--line);
  background: rgba(255, 254, 250, .88);
}

.topbar-inner {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  font-size: .92rem;
  font-weight: 750;
  letter-spacing: -.025em;
}

.brand-mark {
  display: block;
  width: 36px;
  height: 27px;
  object-fit: contain;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 26px;
  color: var(--muted);
  font-size: .85rem;
}

.topnav a {
  text-decoration: none;
  transition: color .18s ease;
}

.topnav a:hover { color: var(--blue); }

.hero {
  position: relative;
  overflow: hidden;
  padding: 82px 0 64px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.hero::after {
  position: absolute;
  top: -20px;
  right: max(-40px, calc((100vw - var(--content)) / 2 - 100px));
  width: 442px;
  height: 323px;
  background: url("symbol.svg") center / contain no-repeat;
  opacity: .12;
  content: "";
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 760px;
}

.eyebrow, .section-kicker {
  margin: 0 0 14px;
  color: var(--blue);
  font-size: .73rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  max-width: 720px;
  margin-bottom: 20px;
  font: 500 clamp(2.7rem, 6vw, 4.5rem)/.99 var(--serif);
  letter-spacing: -.055em;
}

h1 em {
  color: var(--blue);
  font-weight: 400;
}

.hero-copy {
  max-width: 600px;
  margin-bottom: 28px;
  color: var(--muted);
  font-size: 1.06rem;
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 11px;
}

.button {
  display: inline-flex;
  min-height: 43px;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  border: 1px solid var(--blue);
  border-radius: 4px;
  background: var(--blue);
  color: white;
  font-size: .86rem;
  font-weight: 700;
  text-decoration: none;
  transition: background .18s ease, transform .18s ease;
}

.button:hover { background: var(--blue-deep); transform: translateY(-1px); }

.button.secondary {
  background: transparent;
  color: var(--blue-deep);
}

.button.secondary:hover { background: var(--soft-blue); }

main { padding: 44px 0 76px; }

.overview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 64px;
}

.stat-card {
  min-height: 115px;
  padding: 19px 21px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
}

.stat-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: .77rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.stat-value {
  display: block;
  font: 500 2rem/1.15 var(--serif);
  letter-spacing: -.035em;
}

.stat-note {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: .78rem;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 23px;
}

.section-heading h2 {
  margin-bottom: 6px;
  font: 500 clamp(2rem, 4vw, 3rem)/1.08 var(--serif);
  letter-spacing: -.04em;
}

.section-heading p:last-child {
  max-width: 630px;
  margin-bottom: 0;
  color: var(--muted);
}

.benchmark-section { margin-bottom: 75px; }

.benchmark-index {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 54px;
}

.index-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--surface);
  color: var(--muted);
  font-size: .78rem;
  text-decoration: none;
}

.index-link::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--orange);
  content: "";
}

.index-link:hover { border-color: var(--blue); color: var(--blue-deep); }

.results-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(250px, .9fr);
  gap: 18px;
  align-items: stretch;
}

.panel {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 15px;
}

.panel h3 {
  margin-bottom: 4px;
  font: 500 1.35rem/1.2 var(--serif);
  letter-spacing: -.02em;
}

.panel-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: .8rem;
}

.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--paper);
}

.segmented button {
  padding: 5px 9px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: .76rem;
  font-weight: 700;
}

.segmented button[aria-pressed="true"] {
  background: var(--blue);
  color: white;
}

.chart-wrap { width: 100%; overflow-x: auto; }
.chart-wrap svg { display: block; width: 100%; height: auto; overflow: visible; }

.chart-empty {
  display: grid;
  min-height: 220px;
  place-items: center;
  padding: 24px;
  color: var(--muted);
  text-align: center;
  font-size: .9rem;
}

.chart-footnote {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: .75rem;
}

.method-list {
  display: grid;
  gap: 0;
  margin: 4px 0 0;
}

.method-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 15px 0;
  border-top: 1px solid var(--line);
}

.method-row:first-child { border-top: 0; padding-top: 3px; }

.method-name {
  display: block;
  margin-bottom: 2px;
  font-size: .9rem;
  font-weight: 750;
}

.method-description {
  display: block;
  margin: 3px 0 5px;
  color: var(--muted);
  font-size: .76rem;
  line-height: 1.45;
}

.method-meta {
  display: block;
  color: var(--muted);
  font-size: .75rem;
}

.method-count {
  align-self: center;
  color: var(--blue-deep);
  font-size: .82rem;
  font-weight: 750;
  text-align: right;
  white-space: nowrap;
}

.method-count small {
  display: block;
  color: var(--muted);
  font-size: .67rem;
  font-weight: 500;
}

.link-arrow {
  color: var(--blue);
  font-size: .78rem;
  font-weight: 700;
  text-decoration: none;
}

.link-arrow:hover { text-decoration: underline; }

.shoreline-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.map-panel { display: flex; flex-direction: column; }

.map-stage {
  position: relative;
  min-height: 280px;
  height: 390px;
  flex: 1;
  overflow: hidden;
  border: 1px solid #d5e0dc;
  border-radius: 4px;
  background-color: #e9f1ed;
}

#leaflet-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.map-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  max-width: 275px;
  margin: auto;
  padding: 22px;
  color: var(--blue-deep);
  text-align: center;
  pointer-events: none;
}

.map-placeholder[hidden] { display: none; }

.map-placeholder strong {
  display: block;
  margin-bottom: 5px;
  font: 500 1.25rem var(--serif);
}

.map-placeholder span {
  display: block;
  color: var(--muted);
  font-size: .78rem;
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 12px;
  color: var(--muted);
  font-size: .72rem;
  line-height: 1.4;
}

.map-legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding-right: 4px;
}

.map-swatch {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border: 1px solid rgba(29, 41, 41, .18);
  border-radius: 2px;
}

.map-swatch.line {
  width: 16px;
  height: 3px;
  border: 0;
  border-radius: 2px;
}

.map-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 13px;
}

.map-caption {
  margin: 0;
  color: var(--muted);
  font-size: .75rem;
}

.upload-button {
  position: relative;
  display: inline-flex;
  min-height: 37px;
  flex: 0 0 auto;
  align-items: center;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--blue-deep);
  cursor: pointer;
  font-size: .76rem;
  font-weight: 700;
}

.upload-button:hover { border-color: var(--blue); background: var(--soft-blue); }
.upload-button input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.drop-active .map-stage { outline: 3px solid var(--orange); outline-offset: -3px; }

.map-error {
  min-height: 24px;
  margin: 8px 0 0;
  color: var(--orange);
  font-size: .76rem;
}

.shoreline-results { display: flex; flex-direction: column; }
.shoreline-results .chart-wrap { margin-top: 4px; }

.score-legend { margin-top: 3px; }

.benchmark-note {
  margin: 21px 0 0;
  padding: 15px 17px;
  border-left: 3px solid var(--orange);
  background: var(--soft-orange);
  color: #64483e;
  font-size: .85rem;
}

.principles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 8px;
}

.principle {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
}

.principle h3 {
  margin-bottom: 7px;
  font: 500 1.3rem var(--serif);
}

.principle p { margin-bottom: 0; color: var(--muted); font-size: .87rem; }

footer {
  padding: 27px 0;
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: .79rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.footer-inner p { margin: 0; }

.data-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--orange);
}

.status-dot.loaded { background: #4b8a68; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.compensation-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.comp-image-panel {
  display: flex;
  flex-direction: column;
}

.comp-figure {
  flex: 1;
  min-height: 200px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

.comp-figure img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.comp-results-panel { display: flex; flex-direction: column; }
.comp-results-panel .chart-wrap { margin-top: 4px; }

.comp-chart-label {
  margin: 16px 0 2px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}

@media (max-width: 820px) {
  .results-layout, .shoreline-grid, .compensation-grid { grid-template-columns: 1fr; }
  .results-layout { gap: 14px; }
  .principles { grid-template-columns: 1fr; }
  .hero::after { right: -200px; }
}

@media (max-width: 560px) {
  .wrap { width: min(var(--content), calc(100% - 30px)); }
  .topbar-inner { min-height: 58px; }
  .topnav { gap: 14px; font-size: .76rem; }
  .topnav a:last-child { display: none; }
  .hero { padding: 59px 0 45px; }
  .hero::after { top: 10px; right: -190px; width: 330px; height: 241px; }
  .hero-copy { font-size: .98rem; }
  main { padding-top: 28px; }
  .overview { grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 48px; }
  .stat-card { min-height: 96px; padding: 14px; }
  .stat-card:last-child { grid-column: 1 / -1; min-height: 84px; }
  .stat-value { font-size: 1.65rem; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .panel { padding: 16px; }
  .panel-header { flex-direction: column; }
  .map-controls { align-items: flex-start; }
  .map-stage { min-height: 235px; height: 300px; }
  #river-chart svg { min-width: 640px; }
  #shoreline-chart svg { min-width: 540px; }
  .benchmark-section { margin-bottom: 56px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}

/* ── Phase 5: benchmark cards + benchmark page ─────────────────── */

/* Index benchmark cards */

.benchmark-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 8px;
}

.benchmark-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  text-decoration: none;
  color: var(--ink);
  transition: border-color .18s, box-shadow .18s;
}

.benchmark-card:hover {
  border-color: var(--blue);
  box-shadow: 0 2px 10px rgba(37, 113, 128, .10);
}

.card-kicker {
  margin: 0;
  color: var(--blue);
  font-size: .73rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.card-name {
  display: block;
  font: 500 1.25rem/1.2 var(--serif);
  letter-spacing: -.02em;
}

.card-tagline {
  margin: 0;
  color: var(--muted);
  font-size: .84rem;
  flex: 1;
}

.card-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
}

.card-count {
  color: var(--muted);
  font-size: .75rem;
}

.tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 99px;
  background: var(--soft-blue);
  color: var(--blue-deep);
  font-size: .71rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.tag--value { background: var(--soft-orange); color: #64483e; }
.tag--map { background: #eaf4ee; color: #2d6047; }

/* Benchmark pages */

.page-hero {
  padding: 44px 0 36px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: .78rem;
}

.breadcrumb a {
  color: var(--blue);
  text-decoration: none;
}

.breadcrumb a:hover { text-decoration: underline; }

.breadcrumb::after { content: none; }

.page-title {
  margin-bottom: 10px;
  font: 500 clamp(1.9rem, 4vw, 3rem)/1.08 var(--serif);
  letter-spacing: -.04em;
}

.page-tagline {
  max-width: 640px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 1rem;
}

.benchmark-display {
  margin: 0 0 28px;
  text-align: center;
}

.benchmark-display img {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
}

.meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.meta-tag {
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--paper);
  color: var(--muted);
  font-size: .73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
}

.benchmark-readme {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}

.submission-details {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}

.submission-details > h2 {
  margin: 0 0 20px;
  font: 500 clamp(1.7rem, 3vw, 2.4rem)/1.2 var(--serif);
}

.submission-records {
  display: grid;
  gap: 20px;
}

.submission-record {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
}

.submission-record h3 {
  margin-bottom: 12px;
  font: 500 1.3rem/1.2 var(--serif);
}

.submission-record table {
  width: 100%;
  border-collapse: collapse;
}

.submission-record th,
.submission-record td {
  padding: 8px 12px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.submission-record th {
  width: 1%;
  background: var(--soft-blue);
  white-space: nowrap;
}

.submission-record pre {
  margin: 0;
  overflow-x: auto;
  font: .78rem/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.submission-details-empty {
  color: var(--muted);
}

.benchmark-readme h1,
.benchmark-readme h2,
.benchmark-readme h3,
.benchmark-readme h4 {
  margin: 1.5em 0 .6em;
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1.2;
}

.benchmark-readme h1 { font-size: clamp(1.7rem, 3vw, 2.4rem); }
.benchmark-readme h2 { font-size: 1.8rem; }
.benchmark-readme h3 { font-size: 1.35rem; }
.benchmark-readme h4 { font-size: 1.1rem; }

.benchmark-readme p,
.benchmark-readme ul,
.benchmark-readme ol,
.benchmark-readme blockquote {
  max-width: 860px;
}

.benchmark-readme table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}

.benchmark-readme th,
.benchmark-readme td {
  padding: 8px 12px;
  border: 1px solid var(--line);
  text-align: left;
}

.benchmark-readme th { background: var(--soft-blue); }

.benchmark-readme pre {
  max-width: 100%;
  overflow-x: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
}

.benchmark-readme code {
  padding: .12em .3em;
  border-radius: 3px;
  background: var(--soft-blue);
  font-size: .9em;
}

.benchmark-readme pre code { padding: 0; background: transparent; }

.benchmark-readme blockquote {
  margin-left: 0;
  padding: 4px 16px;
  border-left: 3px solid var(--orange);
  color: var(--muted);
}

.benchmark-readme img {
  max-width: 100%;
  height: auto;
}

@media (max-width: 600px) {
  .benchmark-cards { grid-template-columns: 1fr; }
}

/* ── Domain-color accents ──────────────────────────────────────────
 *
 * .domain-pill is used in index cards (.card-kicker) and benchmark-page
 * eyebrows (.eyebrow) to accent the domain label with a distinct color.
 *
 * Built-in domains (benchmark.yaml `domain` field):
 *   fluvial | coastal | delta | stratigraphy | aeolian | lab | other
 *
 * To add a new domain: append one line following the pattern below.
 * The base .domain-pill rule (no modifier) is the fallback color for any
 * unrecognized or omitted domain value.
 *
 * Color intent:
 *   fluvial       #257180  teal (project primary)
 *   coastal       #2d7a6b  darker cyan-green
 *   delta         #2d7a6b  same as coastal
 *   stratigraphy  #7c5e1e  amber-brown (sediment layers)
 *   aeolian       #a05c1a  sandy orange (wind-blown)
 *   lab           #5b55a5  muted purple (laboratory)
 *   other         var(--muted)  neutral gray (same as fallback)
 * ─────────────────────────────────────────────────────────────────── */

.domain-pill {
  color: var(--domain-color, var(--muted)); /* fallback: muted gray */
}

/* Per-domain color tokens — add new domains here */
.domain--fluvial      { --domain-color: #257180; }
.domain--coastal      { --domain-color: #2d7a6b; }
.domain--delta        { --domain-color: #2d7a6b; }
.domain--stratigraphy { --domain-color: #7c5e1e; }
.domain--aeolian      { --domain-color: #a05c1a; }
.domain--lab          { --domain-color: #5b55a5; }
.domain--other        { --domain-color: var(--muted); }
