/* The Presidential Range — shared styles */

:root {
  --granite: #1f2a33;
  --granite-soft: #3a4853;
  --ink: #1d2328;
  --muted: #5b6770;
  --paper: #f7f5f1;
  --card: #ffffff;
  --line: #e3ded5;
  --accent: #b5532a;      /* autumn maple */
  --accent-dark: #8f3f1e;
  --sky: #dfe9ef;
  --max: 72rem;
  --text: 42rem;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--accent-dark); }
a:hover { color: var(--accent); }

h1, h2, h3 {
  font-family: var(--serif);
  line-height: 1.2;
  color: var(--granite);
}
h2 { font-size: 1.9rem; margin: 2.75rem 0 0.75rem; }
h3 { font-size: 1.3rem; margin: 1.75rem 0 0.5rem; }

/* ---------- Header / nav ---------- */

.site-header {
  background: var(--granite);
  color: #fff;
}
.site-header .inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.9rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
}
.site-title {
  font-family: var(--serif);
  font-size: 1.25rem;
  color: #fff;
  text-decoration: none;
  letter-spacing: 0.01em;
}
.site-title:hover { color: #f3d9c9; }
.site-nav { position: relative; }
.nav-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.4rem;
}
.nav-menu > li { position: relative; }
.site-nav a,
.sub-toggle,
.nav-toggle {
  display: block;
  color: #d9e1e6;
  text-decoration: none;
  font: inherit;
  font-size: 0.97rem;
  background: none;
  border: 0;
  padding: 0.4rem 0.65rem;
  border-radius: 6px;
  cursor: pointer;
}
.site-nav a:hover, .sub-toggle:hover, .nav-toggle:hover,
.site-nav a:focus-visible, .sub-toggle:focus-visible, .nav-toggle:focus-visible { color: #fff; background: rgba(255, 255, 255, 0.1); }
.site-nav a:focus-visible, .sub-toggle:focus-visible, .nav-toggle:focus-visible { outline: 2px solid #f3d9c9; outline-offset: 1px; }
.site-nav a[aria-current="page"], .has-sub.current > .sub-toggle { color: #fff; box-shadow: inset 0 -2px 0 #e7a47f; }
.sub-toggle::after {
  content: "";
  display: inline-block;
  margin-left: 0.4rem;
  border: 4px solid transparent;
  border-top-color: currentColor;
  border-bottom: 0;
  vertical-align: 0.15em;
}
.sub {
  list-style: none;
  margin: 0;
  padding: 0.35rem;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 1000;
  min-width: 13rem;
  background: var(--granite);
  border: 1px solid #3c4a55;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
  display: none;
}
.sub a { padding: 0.5rem 0.75rem; }
/* Open on hover/focus (works without JavaScript) and when toggled. */
.has-sub:hover > .sub, .has-sub:focus-within > .sub, .has-sub.open > .sub { display: block; }
.js-nav .has-sub:focus-within:not(.open) > .sub { display: none; }
.js-nav .has-sub:hover > .sub { display: block; }
.nav-toggle { border: 1px solid #5b6a75; display: none; }

@media (max-width: 720px) {
  .site-header .inner { flex-wrap: wrap; }
  .site-nav { width: auto; }
  .js-nav .site-nav { position: static; }
  .js-nav .nav-toggle { display: block; }
  .js-nav .nav-menu { display: none; }
  .js-nav .nav-menu.open {
    display: block;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 1000;
    background: var(--granite);
    padding: 0.5rem 1rem 1rem;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
  }
  .site-header { position: relative; }
  .nav-menu > li { margin: 0.1rem 0; }
  /* On phones the groups are shown expanded under their headings. */
  .sub, .js-nav .has-sub:hover > .sub, .js-nav .has-sub:focus-within:not(.open) > .sub {
    display: block;
    position: static;
    box-shadow: none;
    border: 0;
    padding: 0 0 0.25rem 0.75rem;
    min-width: 0;
    background: none;
  }
  .sub-toggle { pointer-events: none; color: #9fb0bb; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; padding-bottom: 0.1rem; }
  .sub-toggle::after { display: none; }
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  min-height: 72vh;
  display: flex;
  align-items: flex-end;
  background-color: var(--granite);
  background-size: cover;
  background-position: center;
  color: #fff;
}
.hero.short { min-height: 52vh; }
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(10, 16, 20, 0.78) 0%, rgba(10, 16, 20, 0.25) 45%, rgba(10, 16, 20, 0) 70%);
}
.hero .inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 2.5rem 1.25rem;
}
.hero h1 {
  color: #fff;
  font-size: clamp(2.4rem, 6vw, 4.25rem);
  margin: 0 0 0.4rem;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}
.hero p {
  margin: 0;
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  max-width: 38rem;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.4);
}
.hero .credit {
  position: absolute;
  right: 0.75rem;
  bottom: 0.5rem;
  z-index: 1;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.8);
  text-shadow: none;
}
.hero .credit a { color: inherit; }

/* ---------- Layout ---------- */

main { display: block; }

.section {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1rem 1.25rem 2rem;
}
.prose { max-width: var(--text); }
.prose p { margin: 0 0 1.1rem; }

.lead {
  font-family: var(--serif);
  font-size: 1.3rem;
  line-height: 1.55;
  color: var(--granite-soft);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}
@media (min-width: 56rem) {
  .split { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
}

/* ---------- Figures ---------- */

figure { margin: 2rem 0; }
figure img { border-radius: 6px; width: 100%; }
figcaption {
  font-size: 0.875rem;
  color: var(--muted);
  margin-top: 0.5rem;
  line-height: 1.5;
}
figcaption .credit { display: block; font-size: 0.8rem; }
figcaption a { color: var(--muted); }

/* ---------- Fact box ---------- */

.facts {
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
}
.facts h2 { font-size: 1.3rem; margin: 0 0 0.75rem; }
.facts dl { margin: 0; }
.facts dt {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-top: 0.85rem;
}
.facts dt:first-child { margin-top: 0; }
.facts dd { margin: 0.1rem 0 0; font-weight: 600; }

/* ---------- Cards ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1.25rem 1.35rem;
  display: flex;
  flex-direction: column;
}
.card h3 { margin: 0 0 0.4rem; }
.card p { margin: 0; color: var(--muted); font-size: 0.97rem; }
.card .more { margin-top: auto; padding-top: 0.9rem; font-weight: 600; }
.card a.stretch { text-decoration: none; color: inherit; }
.card.link:hover { border-color: var(--accent); }
.card .soon {
  margin-top: auto;
  padding-top: 0.9rem;
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
}

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.97rem;
}
th, td {
  text-align: left;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: #faf8f4;
}
tr:last-child td { border-bottom: none; }

/* ---------- Timeline ---------- */

.timeline {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  border-left: 3px solid var(--line);
}
.timeline li {
  position: relative;
  padding: 0 0 1.1rem 1.4rem;
}
.timeline li::before {
  content: "";
  position: absolute;
  left: -0.5rem;
  top: 0.45rem;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: var(--accent);
}
.timeline .year {
  font-family: var(--serif);
  font-weight: 700;
  color: var(--granite);
  margin-right: 0.4rem;
}

/* ---------- Callouts ---------- */

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.stat {
  background: var(--granite);
  color: #fff;
  border-radius: 6px;
  padding: 1.1rem 1.25rem;
}
.stat .num {
  display: block;
  font-family: var(--serif);
  font-size: 2rem;
  line-height: 1.1;
}
.stat .label { font-size: 0.88rem; color: #c9d3d9; }

.notice {
  background: #fff6ec;
  border: 1px solid #efcfae;
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}
.notice p:last-child { margin-bottom: 0; }

/* ---------- Footer ---------- */

.site-footer {
  margin-top: 3rem;
  background: var(--granite);
  color: #c9d3d9;
  font-size: 0.9rem;
}
.site-footer .inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.75rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 2rem;
}
.site-footer a { color: #fff; }
.site-footer p { margin: 0; }

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

/* ---------- Mini weather station ---------- */

.station {
  background: var(--granite);
  color: #fff;
  border-radius: 8px;
  padding: 1.25rem 1.5rem 1.1rem;
  margin: 1.5rem 0;
}
.station h2 {
  color: #fff;
  font-size: 1.35rem;
  margin: 0 0 0.15rem;
}
.station .sub {
  margin: 0 0 1rem;
  color: #c9d3d9;
  font-size: 0.9rem;
}
.station .readings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 0.75rem;
  margin: 0;
}
.station .reading {
  background: rgba(255, 255, 255, 0.07);
  border-radius: 6px;
  padding: 0.7rem 0.9rem;
}
.station dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #c9d3d9;
}
.station dd {
  margin: 0.15rem 0 0;
  font-family: var(--serif);
  font-size: 1.5rem;
  line-height: 1.2;
}
.station .reading.wide { grid-column: 1 / -1; }
.station .reading.wide dd { font-size: 1.2rem; }
.station .updated {
  margin: 0.9rem 0 0;
  font-size: 0.85rem;
  color: #c9d3d9;
}
.station a { color: #fff; }
.station.loading dd { opacity: 0.4; }
.station.failed .readings { display: none; }

/* ---------- Map ---------- */

.range-map {
  height: 70vh;
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 1rem;
  background: #e8e4dc;
}
.map-note { color: var(--muted); margin: 0.5rem 0 0; }
.map-fallback { padding: 1.5rem; }
.map-key {
  display: inline-block;
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  margin-right: 0.4rem;
  vertical-align: -0.05rem;
  border: 2px solid;
}
.map-key.peak { background: #b5532a; border-color: #7a2f12; }
.map-key.hut { background: #3f7cac; border-color: #1f3f5b; }
.map-key.access { background: #5f8f3e; border-color: #2c4a1e; }
.leaflet-popup-content { font-family: var(--sans); font-size: 0.95rem; line-height: 1.45; }
.leaflet-control-layers { font-family: var(--sans); }

/* ---------- Then and now ---------- */

.then-now {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1.25rem;
}
.then-now figure { margin: 0; }
.then-now img { aspect-ratio: 4 / 3; object-fit: cover; }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0;
}
.photo-grid figure { margin: 0; }

/* ---------- 24-hour charts ---------- */

.chart-block {
  position: relative;
  background: #fbfaf7;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.25rem 1.25rem 1rem;
  margin: 1.5rem 0;
}
.chart-block h2 { margin: 0 0 0.25rem; font-size: 1.35rem; }
.chart-block .sub { margin: 0 0 1rem; color: var(--muted); font-size: 0.9rem; }
.chart { margin: 0 0 1rem; }
.chart-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  margin-bottom: 0.25rem;
}
.chart-title { font-weight: 600; font-size: 0.95rem; color: var(--ink); }
.chart-legend { display: flex; gap: 1rem; font-size: 0.85rem; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.chart-svg { width: 100%; min-height: 60px; }
.chart-svg svg { display: block; overflow: visible; }
.chart-tick { font: 12px var(--sans); fill: var(--muted); }
.chart-ref { font: 11px var(--sans); fill: var(--muted); }
.chart-direct { font: 600 12px var(--sans); fill: var(--ink); }
.chart-empty { color: var(--muted); font-size: 0.9rem; }
.sw { display: inline-block; flex: none; }
.sw.line { width: 16px; height: 2px; border-radius: 1px; }
.sw.dot { width: 8px; height: 8px; border-radius: 50%; }
.chart-tooltip .sw { width: 8px; height: 8px; border-radius: 50%; margin-right: 0.4rem; }
.sw.temp { background: #b5532a; }
.sw.wind { background: #2a78d6; }
.sw.gust { background: #eb6834; }
.chart-tooltip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  padding: 0.5rem 0.7rem;
  font-size: 0.85rem;
  line-height: 1.5;
  min-width: 11rem;
}
.chart-tooltip strong, .chart-tooltip span { display: flex; align-items: center; }
.chart-status { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.85rem; }
.chart-table summary { cursor: pointer; color: var(--accent-dark); font-size: 0.9rem; }
.chart-table table { margin-top: 0.75rem; font-size: 0.9rem; }
.chart-block.loading .chart-svg { opacity: 0.4; }
.chart-block.failed .chart, .chart-block.failed .chart-table { display: none; }

/* ---------- My Hikes gallery ---------- */

.hike-meta {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-dark);
  margin-top: -0.5rem;
}
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 1.25rem;
  margin-top: 1.25rem;
}
.gallery figure { margin: 0; }
.gallery img {
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: opacity 0.15s;
}
.gallery a:hover img { opacity: 0.88; }

/* ---------- Live data blocks ---------- */

.live-block {
  background: #fbfaf7;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.25rem 1.25rem 1rem;
  margin: 1.5rem 0;
}
.live-block h2 { margin: 0 0 0.35rem; font-size: 1.35rem; }
.live-block h3 { margin: 0 0 0.35rem; }
.live-block .sub { margin: 0 0 1rem; color: var(--muted); font-size: 0.9rem; }
.live-headline { font-family: var(--serif); font-size: 1.2rem; margin: 0 0 0.75rem; color: var(--granite); }
.live-status { margin: 0.6rem 0 0; color: var(--muted); font-size: 0.85rem; }
.live-links { margin: 0.25rem 0 0; font-size: 0.9rem; }
.live-block.loading .table-wrap, .live-block.loading .forecast-grid, .live-block.loading .river-readings { opacity: 0.5; }
.live-block.failed .table-wrap, .live-block.failed .forecast-grid, .live-block.failed .river-readings, .live-block.failed .live-headline { display: none; }
.live-block th .elev, .live-block td .elev { display: block; font-size: 0.78rem; font-weight: 400; color: var(--muted); text-transform: none; letter-spacing: 0; }
.live-block tbody th { text-align: left; font-size: 0.95rem; color: var(--ink); text-transform: none; letter-spacing: 0; background: none; }
.live-block td.num { font-variant-numeric: tabular-nums; font-weight: 600; }
.live-block .summit-row { background: #fff6ec; }

.forecast-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.75rem;
}
.fc-period {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.7rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.fc-period.night { background: #f1f0ec; }
.fc-name { font-weight: 600; font-size: 0.9rem; }
.fc-temp { font-family: var(--serif); font-size: 1.3rem; color: var(--granite); }
.fc-short { font-size: 0.9rem; }
.fc-wind { font-size: 0.8rem; color: var(--muted); }

.satellite img { width: 100%; max-width: 600px; border-radius: 6px; }
.satellite figcaption { margin-top: 0.5rem; }

.river-readings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.75rem;
  margin: 0;
}
.river-readings div { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 0.6rem 0.85rem; }
.river-readings dt { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.river-readings dd { margin: 0.15rem 0 0; font-weight: 600; }

/* ---------- Seasons and Traverse ---------- */

.season-jump { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.season-jump a {
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  text-decoration: none;
  font-size: 0.95rem;
}
.season-jump a:hover { border-color: var(--accent); }
.season { scroll-margin-top: 1rem; }
.chart-block.traverse .chart-svg { min-height: 300px; }
.sw.hut-key { width: 10px; height: 10px; border-radius: 2px; background: #2a78d6; }
.traverse-tooltip strong, .traverse-tooltip span { display: block; }

/* Full-width panoramas on My Hikes */
.pano { display: grid; gap: 1.25rem; margin-top: 1.25rem; }
.pano figure { margin: 0; }
.pano img { width: 100%; border-radius: 6px; }

/* Scrolling panorama viewer */
.pano-viewer { margin: 1.25rem 0 0; }
.pano-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 8px;
  background: #dfe6ea;
  cursor: grab;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.pano-scroll:active { cursor: grabbing; }
.pano-scroll:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.pano-scroll img {
  display: block;
  height: clamp(260px, 55vh, 560px);
  width: auto;
  max-width: none;
  border-radius: 0;
}
.pano-hint { font-weight: 600; color: var(--accent-dark); margin-right: 0.35rem; }

/* Booking buttons */
.hut-links { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; margin-top: 1rem; }
.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  padding: 0.55rem 1rem;
  border-radius: 6px;
}
.btn:hover, .btn:focus-visible { background: var(--accent-dark); color: #fff; }

/* ---------- Weather alert banner ---------- */
.alert-banner { background: #fff1d6; border-bottom: 3px solid #d98a00; color: #3a2a00; }
.alert-banner.severe { background: #fde3e1; border-bottom-color: #c62828; color: #3d0f0c; }
.alert-banner .inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.7rem 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
.alert-icon { font-size: 1.4rem; line-height: 1.2; }
.alert-text { flex: 1; font-size: 0.95rem; }
.alert-label { font-weight: 600; margin-right: 0.35rem; }
.alert-text ul { display: inline; margin: 0; padding: 0; list-style: none; }
.alert-text li { display: inline; }
.alert-text li + li::before { content: " · "; }
.alert-more { font-weight: 600; color: inherit; white-space: nowrap; }
.alert-close {
  background: none;
  border: 0;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: inherit;
  padding: 0 0.25rem;
}

/* ---------- Daylight box ---------- */
.sun-box .river-readings { grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); }
