/* Hermes CV-01 — P01 Meridian Atlas commodity reference (catalog view).
   Visual system inherited from samples/01-meridian-atlas/styles.css: warm paper, dark ink,
   sea-route accent, coordinate rules, keyed callouts, rectangular legend plates. */

:root {
  color-scheme: light;
  --paper: #f4f0e4;
  --paper-deep: #e9e1ce;
  --paper-light: #fffdf7;
  --ink: #17231d;
  --ink-soft: #46564c;
  --line: #65756a;
  --line-light: #b7b9aa;
  --sea: #006d76;
  --sea-dark: #004c54;
  --sea-pale: #d9ebe6;
  --terra: #974122;
  --terra-pale: #f1ddd4;
  --focus: #a83e00;
  --white: #fffefa;
  /* category route colours (always paired with a text label and a marker shape) */
  --cat-energy: #974122;
  --cat-base-metals: #005f67;
  --cat-bulk: #3b4a78;
  --cat-critical-minerals: #6b2a5c;
  --cat-agri: #3c6b2a;
  --cat-softs: #7a5510;
  --measure: 72rem;
  --gutter: clamp(1rem, 4vw, 4.5rem);
  --serif: Charter, "Bitstream Charter", Georgia, "Times New Roman", serif;
  --sans: "Liberation Sans", "DejaVu Sans", Arial, Helvetica, sans-serif;
  --mono: "Liberation Mono", "DejaVu Sans Mono", Menlo, Consolas, monospace;
}

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

html {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 100%;
}

body {
  margin: 0;
  min-width: 0;
  background:
    linear-gradient(90deg, rgba(23, 35, 29, 0.035) 1px, transparent 1px) 0 0 / 5rem 5rem,
    linear-gradient(rgba(23, 35, 29, 0.025) 1px, transparent 1px) 0 0 / 5rem 5rem,
    var(--paper);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.65;
  overflow-wrap: break-word;
}

a {
  color: var(--sea-dark);
  text-decoration-thickness: 0.12em;
  text-underline-offset: 0.2em;
}

button {
  font: inherit;
}

button,
a {
  touch-action: manipulation;
}

a:focus,
button:focus {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

a,
button,
[data-commodity-id] {
  scroll-margin-block-start: 5.5rem;
}

[hidden] {
  display: none !important;
}

h1,
h2,
h3,
h4 {
  font-family: var(--serif);
  line-height: 1.15;
  margin: 0 0 0.6em;
  overflow-wrap: anywhere;
}

p,
ul,
ol,
dl {
  margin: 0 0 1rem;
}

.wrap {
  width: min(100%, calc(var(--measure) + (2 * var(--gutter))));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- skip link ---------- */
.skip-link {
  position: fixed;
  z-index: 100;
  inset: 0.75rem auto auto 0.75rem;
  padding: 0.75rem 1rem;
  min-height: 44px;
  background: var(--ink);
  color: var(--white);
  border: 3px solid var(--white);
  transform: translateY(-180%);
}

.skip-link:focus {
  transform: translateY(0);
}

/* ---------- header, notice, nav ---------- */
.site-header {
  background: rgba(244, 240, 228, 0.98);
  border-bottom: 1px solid var(--line);
}

.catalog-notice {
  margin: 0;
  padding: 0.7rem var(--gutter);
  background: var(--ink);
  color: var(--white);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: 0.01em;
  text-align: center;
}

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1.25rem;
  padding-block: 1.1rem 0.9rem;
}

.brand {
  font-family: var(--serif);
  font-size: clamp(1.65rem, 3vw, 2.35rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  margin: 0;
}

.brand-context {
  margin: 0;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.primary-nav {
  border-bottom: 1px solid var(--line);
  background: var(--paper-deep);
}

.primary-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  margin: 0;
  padding: 0.35rem 0;
  list-style: none;
}

.primary-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.35rem 0.75rem;
  color: var(--ink);
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  border-bottom: 3px solid transparent;
}

.primary-nav a:hover {
  border-bottom-color: var(--sea-dark);
}

/* ---------- overview: coordinate panel ---------- */
.overview {
  padding-block: 2.5rem 2rem;
}

.overview__grid {
  display: grid;
  gap: 1.5rem 2.5rem;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: start;
}

.overview h1 {
  font-size: clamp(2.1rem, 4.6vw, 3.6rem);
  max-width: 16ch;
  margin-bottom: 1rem;
}

.overview__lead {
  font-size: 1.125rem;
  max-width: 60ch;
}

.coordinate {
  padding: 1.1rem 1.25rem;
  background: var(--paper-light);
  border: 1px solid var(--line);
  box-shadow: 0.6rem 0.6rem 0 var(--paper-deep);
}

.coordinate p:last-child {
  margin-bottom: 0;
}

.coordinate__label {
  margin-bottom: 0.4rem;
  color: var(--sea-dark);
  font-family: var(--mono);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.dataset-line {
  font-family: var(--mono);
  font-size: 1rem;
  line-height: 1.5;
}

/* ---------- route section ---------- */
.route-section {
  padding-block: 1rem 2.5rem;
}

.route-section > .wrap > h2,
.catalog-section > .wrap > h2,
.next-step-section h2,
.limits-section h2 {
  font-size: clamp(1.7rem, 3vw, 2.5rem);
}

.legend {
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--paper-light);
  border: 1px solid var(--line);
  border-left: 0.55rem solid var(--ink);
}

.legend h3 {
  font-family: var(--mono);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}

.legend ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin: 0 0 0.5rem;
  padding: 0;
  list-style: none;
}

.legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
}

.legend p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 1rem;
}

.cat-glyph {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  overflow: visible;
}

.cat-glyph--energy { color: var(--cat-energy); }
.cat-glyph--base-metals { color: var(--cat-base-metals); }
.cat-glyph--bulk { color: var(--cat-bulk); }
.cat-glyph--critical-minerals { color: var(--cat-critical-minerals); }
.cat-glyph--agri { color: var(--cat-agri); }
.cat-glyph--softs { color: var(--cat-softs); }

.route-field {
  min-width: 0;
  padding: clamp(1rem, 2.5vw, 2rem);
  background:
    repeating-radial-gradient(
      ellipse at 74% 36%,
      transparent 0 1.2rem,
      rgba(0, 76, 84, 0.1) 1.25rem 1.34rem,
      transparent 1.4rem 2.5rem
    ),
    var(--paper-light);
  border: 1px solid var(--line);
  box-shadow: 0.85rem 0.85rem 0 var(--paper-deep);
}

.route-field__header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1rem;
}

.route-field__header h3 {
  margin: 0;
  max-width: 16ch;
  font-size: clamp(1.4rem, 2.6vw, 2.2rem);
}

.route-disclaimer {
  max-width: 20rem;
  margin: 0;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.45;
  text-align: right;
}

.route-field__help,
.route-field__narrow {
  margin: 0 0 1rem;
  max-width: 62ch;
}

.route-field__narrow {
  display: none;
  margin-bottom: 0;
}

.route-canvas {
  position: relative;
  min-height: 31rem;
  border-block: 1px solid var(--line);
  background:
    linear-gradient(90deg, transparent 49.75%, rgba(23, 35, 29, 0.12) 50%, transparent 50.25%),
    linear-gradient(transparent 49.75%, rgba(23, 35, 29, 0.1) 50%, transparent 50.25%);
}

.route-canvas > svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.route-canvas > svg polyline {
  fill: none;
  stroke-width: 4;
  stroke-dasharray: 4 9;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.route-canvas polyline.leg--connector {
  stroke: var(--line);
  stroke-width: 2;
  stroke-dasharray: 2 8;
}

.leg--energy { stroke: var(--cat-energy); }
.leg--base-metals { stroke: var(--cat-base-metals); }
.leg--bulk { stroke: var(--cat-bulk); }
.leg--critical-minerals { stroke: var(--cat-critical-minerals); }
.leg--agri { stroke: var(--cat-agri); }
.leg--softs { stroke: var(--cat-softs); }

.route-marker {
  position: absolute;
  display: grid;
  grid-template-columns: 1.15rem auto minmax(0, 1fr);
  align-items: center;
  gap: 0.3rem;
  width: 13.8%;
  min-width: 8.6rem;
  min-height: 48px;
  padding: 0.35rem 0.3rem 0.35rem 0.3rem;
  color: var(--ink);
  background: var(--paper-light);
  border: 2px solid var(--ink);
  border-radius: 0;
  box-shadow: 0.35rem 0.35rem 0 rgba(23, 35, 29, 0.16);
  font-size: 0.875rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
  transition: box-shadow 160ms ease, transform 160ms ease;
}

.route-marker:hover {
  transform: translate(-2px, -2px);
  box-shadow: 0.5rem 0.5rem 0 rgba(23, 35, 29, 0.2);
}

.route-marker[aria-pressed="true"] {
  color: var(--white);
  background: var(--sea-dark);
  box-shadow: 0.4rem 0.4rem 0 var(--terra);
}

.route-marker[aria-pressed="true"] .cat-glyph {
  color: var(--white);
}

.route-marker__numeral {
  display: grid;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.2rem;
  place-items: center;
  border: 2px solid currentColor;
  font-family: var(--mono);
  font-size: 0.8125rem;
  letter-spacing: 0;
}

.route-marker__name {
  min-width: 0;
  font-size: 0.875rem;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.stop-readout {
  min-height: 7.5rem;
  margin-top: 1.25rem;
  padding: 1rem 1.15rem;
  background: var(--ink);
  color: var(--white);
  border-left: 0.55rem solid var(--terra);
}

.stop-readout__label {
  margin-bottom: 0.45rem;
  color: #bee5df;
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.stop-readout__name {
  margin-bottom: 0.3rem;
  color: var(--white);
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
}

.stop-readout__category {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.5rem;
  font-weight: 700;
}

.stop-readout__category .cat-glyph {
  color: var(--white);
}

.stop-readout p:last-child {
  margin-bottom: 0;
}

.stop-readout a {
  color: #bee5df;
}

.route-field noscript p {
  margin: 0.75rem 0 0;
}

/* itinerary (static equivalent) */
.itinerary {
  margin-top: 2rem;
  padding: 1.25rem 1.25rem 0.5rem;
  background: var(--paper-light);
  border: 1px solid var(--line);
}

.itinerary h3 {
  font-size: clamp(1.4rem, 2.6vw, 2rem);
  margin-bottom: 0.25rem;
}

.itinerary > p {
  color: var(--ink-soft);
  max-width: 62ch;
}

.itinerary ol {
  display: grid;
  gap: 0.35rem 1.5rem;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}

.itinerary li {
  display: grid;
  grid-template-columns: 2.6rem 1.4rem 1fr;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.25rem 0;
  border-top: 1px solid var(--line-light);
}

.itinerary .numeral {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--sea-dark);
}

.itinerary a {
  font-weight: 700;
}

.itinerary .cat-name {
  display: block;
  font-size: 1rem;
  font-weight: 400;
  color: var(--ink-soft);
}

/* ---------- catalog: stops ---------- */
.catalog-section {
  padding-block: 1.5rem 2rem;
}

.key-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 1.25rem;
  margin: 0 0 1.5rem;
  padding: 0.5rem 0.9rem;
  background: var(--paper-deep);
  border: 1px solid var(--line);
  font-size: 1rem;
  font-weight: 700;
}

.key-strip span.key-strip__title {
  font-family: var(--mono);
  letter-spacing: 0.11em;
  text-transform: uppercase;
  font-size: 0.875rem;
}

.key-strip span.key-strip__item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.leg-heading {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 2.5rem 0 1rem;
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
}

.leg-heading .cat-glyph {
  width: 1.5rem;
  height: 1.5rem;
}

.stop {
  position: relative;
  margin: 0 0 2rem;
  padding: 0;
  background: var(--paper-light);
  border: 1px solid var(--line);
  box-shadow: 0.6rem 0.6rem 0 var(--paper-deep);
}

.stop.is-selected {
  outline: 3px solid var(--sea-dark);
  outline-offset: 2px;
}

.stop__head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1rem;
  align-items: start;
  padding: 1rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--line);
}

.stop__numeral {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: start;
  gap: 0.4rem;
  width: max-content;
  min-width: 3.4rem;
  min-height: 3.4rem;
  padding: 0.25rem 0.5rem;
  border: 2px solid var(--ink);
  font-family: var(--mono);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--ink);
}

.stop__title h3 {
  font-size: clamp(1.5rem, 2.6vw, 2.1rem);
  margin-bottom: 0.25rem;
}

.stop__category {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-weight: 700;
}

.stop__body {
  padding: 1rem 1.25rem 0.5rem;
}

.stop__summary {
  font-size: 1.0625rem;
  max-width: 72ch;
}

/* price plate: keyed callout */
.price-plate {
  display: grid;
  gap: 0.35rem 1rem;
  grid-template-columns: max-content minmax(0, 1fr);
  margin: 0 0 1.25rem;
  padding: 0.9rem 1rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 0.55rem solid var(--sea-dark);
}

.price-plate dt {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sea-dark);
  padding-top: 0.15rem;
}

.price-plate dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.price-plate dd[data-field="reference-price"] {
  font-size: 1.0625rem;
  line-height: 1.55;
}

.price-plate dd[data-field="reference-price"] strong {
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.1;
}

/* notes lanes */
.stop__notes {
  display: grid;
  gap: 0.75rem 2rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stop__notes > div {
  min-width: 0;
}

.stop__notes h4,
.stop__questions h4,
.stop__caveats h4,
.stop__sources h4 {
  font-family: var(--mono);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--sea-dark);
  margin: 0.5rem 0 0.35rem;
}

.stop__notes ul,
.stop__caveats ul,
.stop__sources ul {
  padding-left: 1.2rem;
}

.stop__notes li,
.stop__caveats li,
.stop__sources li {
  margin-bottom: 0.3rem;
}

.stop__questions {
  margin-top: 0.75rem;
  padding: 0.85rem 1rem 0.5rem;
  background: var(--sea-pale);
  border: 1px solid var(--sea-dark);
}

.stop__questions ol {
  padding-left: 1.4rem;
}

.stop__questions li {
  margin-bottom: 0.4rem;
}

.stop__caveats {
  margin-top: 0.75rem;
  padding: 0.85rem 1rem 0.35rem;
  background: var(--terra-pale);
  border-left: 0.55rem solid var(--terra);
}

.stop__caveats h4 {
  color: var(--terra);
}

.stop__sources {
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--line);
}

.stop__sources li {
  overflow-wrap: anywhere;
}

.src-url {
  font-family: var(--mono);
  font-size: 1rem;
  color: var(--ink-soft);
}

/* ---------- next step, limits ---------- */
.next-step-section,
.limits-section {
  padding-block: 1.5rem;
}

.next-step-section .coordinate {
  border-left: 0.55rem solid var(--terra);
  max-width: 62rem;
}

.limits-section .coordinate {
  border-left: 0.55rem solid var(--ink);
  max-width: 62rem;
}

.next-step-section p,
.limits-section p {
  font-size: 1.0625rem;
}

/* ---------- footer ---------- */
.site-footer {
  margin-top: 2rem;
  padding: 1.25rem var(--gutter) 2rem;
  background: var(--ink);
  color: var(--white);
}

.site-footer p {
  margin: 0;
  font-family: var(--mono);
  font-size: 1rem;
  text-align: center;
}

/* ---------- JS / no-JS ---------- */
.no-js .route-canvas,
.no-js .stop-readout,
.no-js .route-field__help {
  display: none !important;
}

.js .route-field noscript {
  display: none;
}

/* ---------- responsive ---------- */
@media (min-width: 64rem) {
  .key-strip {
    position: sticky;
    top: 0;
    z-index: 5;
  }
}

@media (max-width: 71.98rem) {
  /* R1: below the wide-desktop breakpoint the two-dimensional route field is not drawn;
     the numbered itinerary (static equivalent) is the route story. */
  .route-canvas,
  .stop-readout,
  .route-field__help {
    display: none !important;
  }
  .route-field__narrow {
    display: block;
  }
}

@media (max-width: 63.98rem) {
  .overview__grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .route-field {
    box-shadow: 0.5rem 0.5rem 0 var(--paper-deep);
  }
  .route-field__header {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .route-disclaimer {
    text-align: left;
    max-width: none;
  }
  .stop__notes {
    grid-template-columns: minmax(0, 1fr);
  }
  .itinerary ol {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 47.98rem) {
  .price-plate {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.15rem;
  }
  .price-plate dt {
    margin-top: 0.5rem;
  }
  .price-plate dt:first-child {
    margin-top: 0;
  }
  .stop__head {
    grid-template-columns: minmax(0, 1fr);
  }
  .stop {
    box-shadow: 0.4rem 0.4rem 0 var(--paper-deep);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0s !important;
    animation-duration: 0s !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
  .route-marker:hover {
    transform: none;
  }
}

@media (forced-colors: active) {
  .route-marker,
  .stop,
  .coordinate,
  .legend,
  .price-plate {
    border: 2px solid CanvasText;
    box-shadow: none;
  }
  .route-marker[aria-pressed="true"] {
    outline: 3px solid Highlight;
  }
}
