:root {
  --navy: #082a55;
  --navy-soft: #123f70;
  --orange: #ec6332;
  --orange-deep: #d94f1f;
  --cream: #f1ede4;
  --paper: #fffdf8;
  --ink: #102b45;
  --muted: #5c6e7d;
  --line: #cfd7dc;
  --success: #1e7657;
  --danger: #a92f2f;
  --shadow: 0 24px 70px rgba(8, 42, 85, .16);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(8,42,85,.035) 1px, transparent 1px),
    linear-gradient(rgba(8,42,85,.035) 1px, transparent 1px),
    var(--cream);
  background-size: 32px 32px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
img { max-width: 100%; }
.masthead .shell { width: min(1440px, calc(100% - 40px)); margin-inline: auto; }
.page-shell { width: min(1220px, calc(100% - 40px)); margin-inline: auto; }
.eyebrow {
  display: block;
  color: var(--orange);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .17em;
  text-transform: uppercase;
}

.masthead { background: var(--paper); border-bottom: 1px solid var(--navy); }
.masthead__inner {
  min-height: 154px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 28px;
  position: relative;
}
.masthead__inner::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 96px;
  height: 7px;
  background: var(--orange);
}
.issue {
  align-self: end;
  margin-bottom: 37px;
  color: var(--orange);
  font-size: .8rem;
  font-weight: 900;
  letter-spacing: .1em;
  white-space: nowrap;
}
.title-block h1 {
  margin: 4px 0 0;
  color: var(--navy);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.8rem, 5.3vw, 5.25rem);
  font-weight: 700;
  letter-spacing: -.06em;
  line-height: .82;
  text-transform: uppercase;
}
.title-block h1 span { display: block; margin-left: clamp(26px, 6vw, 88px); color: var(--orange); }
.brand { width: clamp(180px, 22vw, 300px); height: auto; display: block; }
.account-nav { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; max-width: 290px; }
.account-nav a, .account-nav button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  padding: 0 16px;
  border: 1px solid var(--navy);
  color: var(--navy);
  font-weight: 800;
  text-decoration: none;
  background: transparent;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.account-nav a:hover, .account-nav button:hover { color: #fff; background: var(--navy); }
#account-message { flex-basis: 100%; color: var(--danger); font-size: .875rem; }
#account-message:empty { display: none; }
button:disabled { cursor: not-allowed; }

main.page-shell { padding-block: 34px 82px; }
.loading {
  min-height: 320px;
  display: grid;
  place-items: center;
  color: var(--navy);
  background: var(--paper);
  border: 1px solid rgba(8,42,85,.15);
  font-weight: 700;
}
.featured { background: var(--paper); border: 1px solid rgba(8,42,85,.14); box-shadow: var(--shadow); }

.route-picker {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 58px;
  align-items: stretch;
  background: #eef2f6;
  border-bottom: 1px solid var(--navy);
}
.route-nav {
  min-height: 82px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--paper);
  color: var(--navy);
  font-size: 1.5rem;
  font-weight: 900;
}
.route-nav:hover { color: #fff; background: var(--orange); }
.route-options { display: flex; min-width: 0; overflow-x: auto; scrollbar-width: thin; scroll-behavior: smooth; }
.route-option {
  flex: 1 0 min(260px, 40vw);
  min-width: 0;
  padding: 14px 18px;
  border: 0;
  border-left: 1px solid rgba(8,42,85,.18);
  border-radius: 0;
  background: transparent;
  color: var(--navy);
  text-align: left;
}
.route-option:last-child { border-right: 1px solid rgba(8,42,85,.18); }
.route-option.is-active { color: #fff; background: var(--orange); }
.route-option small, .route-option strong, .route-option span { display: block; color: inherit; }
.route-option small { margin-bottom: 4px; font-size: .75rem; font-weight: 900; letter-spacing: .13em; text-transform: uppercase; }
.route-option strong { overflow: hidden; font-family: Georgia, serif; font-size: 1.08rem; line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; }
.route-option span { margin-top: 4px; font-size: .8rem; opacity: .9; }

.route-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.62fr) minmax(340px, .82fr);
  min-height: 590px;
  transition: transform .24s ease, opacity .24s ease;
}
.route-stage.is-changing { transform: translateX(-16px); opacity: .28; }
.map-pane { position: relative; min-height: 590px; overflow: hidden; border-right: 8px solid var(--orange); background: #dce4dd; }
#map { width: 100%; height: 100%; min-height: 590px; z-index: 1; }
.map-message { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; padding: 32px; color: var(--navy); background: #edf0e8; font-weight: 750; text-align: center; }
.map-label, .slide-count {
  position: absolute;
  z-index: 500;
  top: 20px;
  padding: 10px 13px;
  box-shadow: 0 8px 24px rgba(8,42,85,.17);
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.map-label { left: 20px; display: flex; align-items: center; gap: 9px; color: var(--navy); background: var(--paper); }
.map-label i { width: 9px; height: 9px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 4px rgba(236,99,50,.2); }
.slide-count { right: 20px; color: #fff; background: var(--navy); }
.map-actions { position: absolute; z-index: 500; left: 20px; bottom: 20px; display: flex; gap: 9px; }
.map-actions button, .map-actions a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 15px;
  border: 0;
  border-radius: 0;
  color: #fff;
  background: var(--navy);
  box-shadow: 0 6px 20px rgba(8,42,85,.25);
  font-size: .86rem;
  font-weight: 850;
  text-decoration: none;
}
.map-actions a { background: var(--orange); }
.map-actions button:hover, .map-actions a:hover { filter: brightness(1.08); }
.leaflet-popup-content strong { color: var(--navy); }

.trip-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 28px;
  overflow: hidden;
  position: relative;
  color: #fff;
  background: var(--navy);
}
.trip-panel::after {
  content: "M";
  position: absolute;
  right: -34px;
  bottom: -112px;
  color: rgba(255,255,255,.045);
  font: 700 340px/.8 Georgia, serif;
  transform: rotate(-8deg);
  pointer-events: none;
}
.eyebrow--light { color: #ff9a70; }
.trip-summary, .trip-details { position: relative; z-index: 2; }
.trip-details { display: flex; flex-direction: column; flex: 1; }
.date-lockup { display: grid; grid-template-columns: auto 1fr; align-items: end; gap: 14px; margin: 22px 0 26px; padding-bottom: 22px; border-bottom: 1px solid rgba(255,255,255,.42); }
.date-lockup > strong { color: #fff; font: 700 clamp(5.6rem, 10vw, 8.8rem)/.66 Georgia, serif; letter-spacing: -.08em; }
.date-lockup div { padding-bottom: 1px; }
.date-lockup b, .date-lockup span { display: block; }
.date-lockup b { color: #ff9a70; font-size: 1.85rem; line-height: 1; text-transform: uppercase; }
.date-lockup span { margin-top: 7px; color: #fff; font-size: 1rem; font-weight: 800; letter-spacing: .12em; }
.trip-panel h2 { margin: 0 0 9px; color: #ff9a70; font-size: .8rem; font-weight: 800; letter-spacing: .09em; line-height: 1.3; text-transform: uppercase; }
.trip-panel h3 { margin: 0; color: #fff; font-family: Georgia, serif; font-size: clamp(1.8rem, 3.2vw, 2.85rem); line-height: 1.03; letter-spacing: -.035em; }
.route-description { margin: 16px 0 20px; color: #fff; line-height: 1.55; }
.vote-block {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 2;
  margin-bottom: 20px;
  padding: 15px 0;
  border-top: 1px solid rgba(255,255,255,.42);
  border-bottom: 1px solid rgba(255,255,255,.42);
}
.vote-block small, .vote-block strong { display: block; }
.vote-block small { color: #ffd9ca; font-size: .75rem; font-weight: 850; letter-spacing: .12em; }
.vote-block strong { margin-top: 4px; color: #fff; font-size: 1rem; }
.vote-block button {
  min-height: 46px;
  padding: 0 16px;
  border: 2px solid var(--orange);
  border-radius: 999px;
  color: #fff;
  background: var(--orange);
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.vote-block button.is-voted { color: var(--navy); background: #fff; border-color: #fff; }
.vote-block button:disabled { cursor: not-allowed; opacity: .72; }
.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: auto 0 0;
  padding: 0;
  position: relative;
  z-index: 2;
  border-top: 1px solid rgba(255,255,255,.42);
  border-left: 1px solid rgba(255,255,255,.42);
}
.facts div { min-height: 78px; padding: 13px 12px; border-right: 1px solid rgba(255,255,255,.42); border-bottom: 1px solid rgba(255,255,255,.42); }
.facts dt { color: #ffd9ca; font-size: .75rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.facts dd { margin: 5px 0 0; color: #fff; font-weight: 800; line-height: 1.2; }

.elevation { margin: 0; padding: 24px 28px 18px; color: var(--navy); background: var(--paper); border-top: 1px solid var(--navy); }
.elevation__heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 10px; }
.elevation h3 { margin: 3px 0 0; font-family: Georgia, serif; font-size: 1.7rem; }
#elevation-range { color: var(--muted); font-weight: 750; }
#elevation-chart { display: block; width: 100%; height: 190px; }

.archive { margin-top: 70px; }
.archive__heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding-bottom: 18px; border-bottom: 4px solid var(--navy); }
.archive h2 { margin: 4px 0 0; color: var(--navy); font-family: Georgia, serif; font-size: clamp(2rem, 4vw, 3rem); line-height: 1; }
#archive-count { color: var(--muted); font-size: .92rem; }
.archive-item { display: grid; grid-template-columns: 74px 1fr auto; align-items: center; gap: 20px; padding: 22px 0; border-bottom: 1px solid var(--line); }
.archive-item__number { color: var(--orange); font: 700 1.8rem/1 Georgia, serif; }
.archive-item time { display: block; color: var(--orange-deep); font-size: .8rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.archive-item h3 { margin: 4px 0 3px; color: var(--navy); font-family: Georgia, serif; font-size: 1.3rem; }
.archive-item p { margin: 0; color: var(--muted); }
.archive-item a { min-height: 42px; display: inline-flex; align-items: center; padding: 0 13px; border: 1px solid var(--navy); color: var(--navy); font-weight: 800; text-decoration: none; }
.archive-empty { padding: 24px 0; color: var(--muted); border-bottom: 1px solid var(--line); }

.site-footer { color: #fff; background: var(--navy); border-top: 7px solid var(--orange); }
.footer-grid { min-height: 168px; display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: clamp(28px, 5vw, 70px); }
.footer-grid > div:first-child strong, .footer-grid > div:first-child span { display: block; }
.footer-grid > div:first-child strong { font-family: Georgia, serif; font-size: 1.3rem; }
.footer-grid > div:first-child span { margin-top: 4px; color: #d9e4ef; }
.footer-brand, .sponsor { display: grid; justify-items: start; gap: 8px; }
.footer-brand small, .sponsor small { color: #ffd2c0; font-size: .75rem; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
.footer-brand img { width: 200px; padding: 8px 10px; background: #fff; }
.sponsor img { width: min(300px, 30vw); max-height: 48px; object-fit: contain; object-position: left center; }
noscript { display: block; padding: 16px; color: var(--navy); background: #ffe1d4; text-align: center; }

.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: var(--navy); }
.auth-shell { width: min(520px, 100%); }
.back-link { display: inline-block; margin-bottom: 18px; color: #fff; font-weight: 750; text-decoration: none; }
.auth-card { padding: clamp(26px, 6vw, 48px); background: var(--paper); box-shadow: 12px 12px 0 var(--orange); }
.auth-card > img { width: 230px; margin-bottom: 32px; }
.auth-card h1 { margin: 5px 0 12px; color: var(--navy); font-family: Georgia, serif; font-size: 3rem; line-height: 1; }
.auth-card p { color: var(--muted); }
.auth-card form { display: grid; gap: 16px; margin-top: 25px; }
.auth-card label { display: grid; gap: 6px; color: var(--navy); font-weight: 750; }
.auth-card input { min-height: 48px; width: 100%; padding: 0 13px; border: 1px solid #9badba; border-radius: 0; color: var(--ink); background: #fff; }
.auth-card button { min-height: 50px; border: 0; color: #fff; background: var(--orange); font-weight: 850; }
.form-message { min-height: 1.45em; margin: 12px 0 0; color: var(--danger); font-weight: 700; }
.form-message.is-success { color: var(--success); }

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #ffb394;
  outline-offset: 2px;
}
[hidden] { display: none !important; }

@media (max-width: 960px) {
  .masthead__inner { grid-template-columns: auto 1fr auto; }
  .issue { display: none; }
  .account-nav { grid-column: 1 / -1; justify-self: end; margin-bottom: 12px; }
  .masthead__inner { row-gap: 12px; padding-top: 20px; }
  main.page-shell { padding-top: 24px; }
  .route-stage { grid-template-columns: 1fr; }
  .map-pane { min-height: 510px; border-right: 0; border-bottom: 8px solid var(--orange); }
  #map { min-height: 510px; }
  .trip-panel { min-height: 560px; }
  .footer-grid { grid-template-columns: 1fr 1fr; padding-block: 28px; }
  .footer-grid > div:first-child { grid-column: 1 / -1; }
}

@media (max-width: 960px) {
  .page-shell { width: min(100% - 20px, 1220px); }
  .masthead .shell { width: calc(100% - 28px); }
  .masthead__inner { min-height: 0; grid-template-columns: minmax(0,1fr) 110px; gap: 12px; padding-block: 18px 10px; }
  .masthead__inner::before { width: 52px; height: 4px; }
  .title-block .eyebrow { font-size: .75rem; letter-spacing: .08em; }
  .title-block h1 { font-size: clamp(1.5rem, 6.2vw, 2rem); line-height: 1; letter-spacing: -.045em; }
  .title-block h1 span { margin-left: 0; }
  .brand { width: 110px; }
  .account-nav { grid-column: 1 / -1; justify-self: stretch; justify-content: flex-end; max-width: none; margin: 0; gap: 8px; }
  .account-nav a, .account-nav button { font-size: .875rem; min-height: 44px; padding-inline: 14px; }
  .account-nav a { flex: 1; }
  main.page-shell { padding-block: 14px 40px; }
  .route-picker { grid-template-columns: 44px minmax(0,1fr) 44px; }
  .route-nav { min-height: 70px; }
  .route-options { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; }
  .route-option { display: block; flex: 0 0 100%; padding: 10px 12px; scroll-snap-align: start; }
  .route-option small, .route-option span { font-size: .8125rem; }
  .route-option strong { font-family: inherit; font-size: .9375rem; }
  .route-stage { display: flex; flex-direction: column; min-height: 0; }
  .trip-panel { display: contents; }
  .trip-panel::after { display: none; }
  .trip-summary { order: 0; display: grid; grid-template-columns: 4rem minmax(0,1fr); column-gap: 16px; row-gap: 6px; padding: 18px 16px; color: #fff; background: var(--navy); }
  .trip-summary > .eyebrow { grid-column: 2; font-size: .75rem; letter-spacing: .06em; }
  .trip-summary .date-lockup { grid-column: 1; grid-row: 1 / span 3; display: flex; flex-direction: column; align-items: center; align-self: start; gap: 8px; margin: 0; padding: 8px 0; border: 1px solid rgba(255,255,255,.35); }
  .trip-summary .date-lockup > strong { font-size: 2.8rem; line-height: 1; letter-spacing: -.06em; }
  .trip-summary .date-lockup div { text-align: center; }
  .trip-summary .date-lockup b { font-size: .875rem; }
  .trip-summary .date-lockup span { margin-top: 4px; font-size: .75rem; letter-spacing: .04em; }
  .trip-summary h2 { grid-column: 2; margin: 0; font-size: .8125rem; letter-spacing: .02em; }
  .trip-summary h3 { grid-column: 2; font-size: 1.4rem; line-height: 1.15; overflow-wrap: anywhere; }
  .map-pane { order: 1; min-height: 0; border-bottom-width: 4px; }
  #map { min-height: 0; height: clamp(280px, 48svh, 440px); }
  .map-label { left: 10px; top: 10px; max-width: calc(100% - 92px); padding: 8px 10px; }
  .map-label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .map-label i { flex-shrink: 0; }
  .slide-count { top: 10px; right: 10px; padding: 8px; }
  .leaflet-top.leaflet-left { top: 46px; }
  .leaflet-control-zoom a { width: 44px; height: 44px; line-height: 44px; }
  .map-actions { position: static; display: grid; grid-template-columns: 1fr 1fr; padding: 10px; background: var(--paper); }
  .map-actions button, .map-actions a { min-height: 48px; padding-inline: 8px; justify-content: center; box-shadow: none; font-size: .875rem; }
  .trip-details { order: 2; display: flex; padding: 16px; color: #fff; background: var(--navy); }
  .route-description { margin: 0 0 16px; font-size: 1rem; }
  .facts dt { font-size: .8125rem; letter-spacing: .03em; }
  .facts dd { overflow-wrap: anywhere; }
  .vote-block { grid-template-columns: 1fr; }
  .vote-block button { width: 100%; font-size: .875rem; }
  .elevation { padding: 22px 16px 14px; }
  .archive { margin-top: 50px; }
  .archive__heading { align-items: flex-start; flex-direction: column; }
  .archive-item { grid-template-columns: 52px 1fr; gap: 14px; }
  .archive-item a { grid-column: 2; justify-self: start; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-grid > div:first-child { grid-column: auto; }
  .sponsor img { width: min(300px, 78vw); }
  .auth-page { padding: 20px; min-height: 100svh; }
  .auth-card { padding: 24px; box-shadow: 6px 6px 0 var(--orange); }
  .auth-card > img { width: 180px; margin-bottom: 20px; }
  .auth-card h1 { font-size: 2.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .route-stage { transition: none; }
}
