:root {
  --bg: #f7f2ea;
  --panel: #fffaf2;
  --ink: #1f2933;
  --muted: #667085;
  --line: #d8c8b0;
  --accent: #8b3f24;
  --accent-soft: #ead4c7;
  --sea: #376b7c;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Georgia, 'Times New Roman', serif;
  background: var(--bg);
  color: var(--ink);
}
.app-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(120deg, #2d4550, #8b3f24);
  color: white;
}
.app-header h1 { margin: 0; font-size: 2rem; letter-spacing: .04em; }
.app-header p { margin: .25rem 0 0; opacity: .9; }
/* #searchInput {
  width: 100%;
  padding: .75rem .9rem;
  border-radius: 999px;
  border: 1px solid var(--line);
} */
.app-shell {
  display: grid;
  grid-template-columns: 360px 1fr;
  min-height: calc(100vh - 90px);
}
.nav-workspace {
  border-right: 1px solid var(--line);
  background: #efe3d1;
  padding: 1rem;
  overflow-y: auto;
}
.tabs, .view-switch { display: grid; gap: .35rem; margin-bottom: .75rem; }
/* .nav-workspace {
  border-right: 1px solid var(--line);
  background: #efe3d1;
  padding: 1rem;
  overflow-y: auto;

  display: flex;
  flex-direction: column;
  gap: 1rem;
} */

/* .search-box {
  margin: 0;
  padding: 0;
  width: 100%;
} */

.tabs,
.view-switch {
  display: grid;
  gap: .35rem;
  margin-bottom: 0;
}
.tabs { 
  grid-template-columns: repeat(2, 1fr);  
  margin-top: 12px;
}
.view-switch { grid-template-columns: repeat(2, 1fr); }
button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: .7rem;
  padding: .55rem .65rem;
  font-family: inherit;
}
button.active { background: var(--accent); color: white; border-color: var(--accent); }
.nav-group {
  margin: .8rem 0;
  padding: .75rem;
  background: rgba(255,250,242,.75);
  border: 1px solid var(--line);
  border-radius: .8rem;
}
.nav-group h3 { margin: 0 0 .5rem; font-size: 1rem; color: var(--accent); }
.nav-item {
  display: block;
  width: 100%;
  text-align: left;
  margin: .28rem 0;
  border: 0;
  border-radius: .5rem;
  background: transparent;
  padding: .45rem .5rem;
}
.nav-item:hover { background: var(--accent-soft); }
.history-heading { margin: 0 0 .25rem; font-size: 1rem; }
.history-title { display: block; width: 100%; font-family: inherit; }
.history-years { margin: 0 .5rem; color: var(--muted); font-size: .9rem; }
.history-theme-group-heading { margin: 1.5rem 0 .5rem; padding-top: .75rem; border-top: 1px solid var(--line); }
.chart-canvas {
  position: relative;
  height: 520px;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background:
    radial-gradient(circle at 62% 38%, rgba(55,107,124,.15), transparent 18%),
    radial-gradient(circle at 45% 58%, rgba(55,107,124,.12), transparent 22%),
    linear-gradient(160deg, #fbf6ed, #e6d8c4);
  overflow: hidden;
}
.marker {
  position: absolute;
  transform: translate(-50%, -50%);
  border: 2px solid white;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  background: var(--sea);
  color: white;
  min-width: 1.4rem;
  height: 1.4rem;
  border-radius: 999px;
  font-size: .72rem;
  display: grid;
  place-items: center;
}
.marker:hover::after {
  content: attr(data-label);
  position: absolute;
  left: 1.4rem;
  top: -0.3rem;
  white-space: nowrap;
  background: #1f2933;
  padding: .25rem .45rem;
  border-radius: .35rem;
  z-index: 5;
}
.route-step {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: .5rem 0;
}
.route-step::before { content: '↓'; color: var(--accent); }
.route-step:first-child::before { content: '•'; }
.content-panel { padding: 1.5rem; overflow-y: auto; min-width: 0; }
.hero {
  min-height: 260px;
  border-radius: 1rem;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  border: 1px solid var(--line);
}
.hero-title {
  width: 100%;
  padding: 1.25rem;
  color: white;
  background: linear-gradient(transparent, rgba(0,0,0,.78));
}
.hero-title h2 { margin: 0; font-size: 2.2rem; }
.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .75rem;
  margin: 1rem 0;
}
.meta-card, .section-card, .welcome-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1rem;
}
.meta-card strong { color: var(--accent); display: block; margin-bottom: .25rem; }
.section-card { margin-top: 1rem; line-height: 1.55; }
.place-overview { line-height: 1.55; }
.pill-list { display: flex; flex-wrap: wrap; gap: .45rem; }
.pill { background: var(--accent-soft); border-radius: 999px; padding: .35rem .6rem; }
.pill-link {
  border: 0;
  transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.pill-link:hover { background: var(--accent); color: white; }
.pill-link:focus-visible {
  outline: 2px solid var(--sea);
  outline-offset: 2px;
  background: var(--accent);
  color: white;
}
.highlight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .65rem;
  align-items: start;
  grid-auto-rows: auto;
}
.highlight-item {
  border: 1px solid var(--line);
  border-radius: .65rem;
  padding: .7rem .8rem;
  background: rgba(255,250,242,.7);
  align-self: start;
  height: auto;
  min-height: 0;
}
.highlight-item p { margin: .35rem 0 0; }
.highlight-explore {
  display: inline-block;
  margin-top: .65rem;
  color: var(--accent);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: .15em;
}
.highlight-explore:hover { color: var(--sea); }
.highlight-explore:focus-visible {
  outline: 2px solid var(--sea);
  outline-offset: 3px;
  border-radius: 2px;
}
.section-card[id] { scroll-margin-top: 7rem; }
.section-card[id]:focus {
  outline: 2px solid var(--sea);
  outline-offset: 2px;
}
.related-button { margin: .25rem; }
@media (max-width: 960px) {
  .highlight-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .highlight-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 800px) {
  .app-header { flex-direction: column; align-items: stretch; }
  #searchInput { width: 100%; max-width: none; }
  .app-shell { grid-template-columns: 1fr; }
  .nav-workspace { border-right: 0; border-bottom: 1px solid var(--line); }
}

.castle-entry,
.section-card {
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

.hero-header {
    display: flex;
    justify-content: center;
    align-items: center;

    padding: 20px;
    background: #f5f1e8;
}

.hero-image {
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 8;
  height: auto;
  object-fit: cover;
  display: block;
  border-radius: 12px;
}

.search-box {
  margin: 0 0 1.25rem 0;
  padding: 0;
  width: 100%;
}

#searchInput {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  padding: .75rem .9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: inherit;
  font-size: 1rem;
  appearance: none;
  -webkit-appearance: none;
}

.welcome-card {
  max-width: 1200px;
  margin: 0 auto;
}
.welcome-image {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  margin-bottom: 1.5rem;
  border-radius: 12px;
}
.home-introduction,
.home-section {
  max-width: 92ch;
  line-height: 1.65;
}
.home-introduction {
  font-size: 1.05rem;
}
.home-sections {
  margin: 1.5rem 0;
}
.home-section + .home-section {
  margin-top: 1.35rem;
}
.home-section h3 {
  margin-bottom: 0.35rem;
}
.home-section p {
  margin-top: 0.45rem;
}

.accordion-header {
  width: 100%;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  font-weight: 700;
  text-align: left;
  padding: 0.55rem 0.4rem;
  cursor: pointer;
}

.accordion-header:hover {
  background: rgba(255, 255, 255, 0.08);
}

.accordion-arrow {
  display: inline-block;
  width: 1rem;
}

.group-count {
  opacity: 0.65;
  font-size: 0.85em;
}

#navPanel .accordion-group > .accordion-content {
  display: none;
  padding-left: 1.25rem;
}

#navPanel .accordion-group.open > .accordion-content {
  display: block;
}

.image-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.gallery-item {
  margin: 0;
}

.gallery-item img {
  width: 100%;
  height: 260px;
  object-fit: contain;
  display: block;
  border-radius: 10px;
}

.gallery-item figcaption {
  margin-top: 0.4rem;
  font-size: 0.9rem;
  line-height: 1.35;
}

.gallery-item small {
  color: #666;
}

@media (max-width: 700px) {
  .image-gallery {
    grid-template-columns: 1fr;
  }

  .gallery-item img {
    height: 220px;
  }
}

.hero-credit {
  margin-top: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: #666;
  text-align: center;
}

.image-source-link {
  text-decoration: none;
  margin-left: 0.3rem;
  font-weight: bold;
}

.image-source-link:hover {
  text-decoration: underline;
}

.maritime-context-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: -0.15rem 0 0.65rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.maritime-context-link:hover {
  text-decoration: underline;
}

.maritime-context-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 0.15rem;
}

.nautical-options-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--sea);
  font-weight: 700;
  cursor: pointer;
}

.nautical-options-list {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.65rem;
}

.nautical-options-list[hidden] { display: none; }

.nautical-option-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 0.55rem;
  padding: 0.48rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  background: rgba(255, 250, 242, 0.7);
  color: var(--ink);
  text-align: left;
}

.nautical-option-link.recommended {
  border-color: var(--accent);
  background: rgba(239, 123, 82, 0.12);
}

.nautical-option-link strong { color: var(--accent); font-size: 0.78rem; }
.nautical-option-link:hover { border-color: var(--sea); }
.nautical-option-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.nautical-operational-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: -0.1rem 0 0.75rem;
}

.nautical-operational-links a {
  display: inline-flex;
  gap: 0.3rem;
  align-items: center;
  color: var(--sea);
  font-size: 0.86rem;
  font-weight: 700;
}

.nautical-operational-links a:hover { color: var(--accent); }
.nautical-operational-links a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.nautical-link-role {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
}


/* Expeditions */

.expedition-hero img {
  width: 100%;
  border-radius: 12px;
}

.route-table {
  width: 100%;
  border-collapse: collapse;
}

.route-table th,
.route-table td {
  padding: 0.5rem;
  border-bottom: 1px solid #ddd;
}
.route-table th {
  background: #1f2933;
  color: #fff;
  font-weight: 600;
  text-align: left;
}
.stop-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.stop-card {
  padding: 0.75rem 1rem;
  border: 1px solid #ccc;
  border-radius: 10px;
  background: white;
  cursor: pointer;
}

.stop-card small {
  display: block;
  opacity: 0.7;
}

.route-table-wrap {
  overflow-x: auto;
  margin-top: 1rem;
}

.route-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.route-table th,
.route-table td {
  border-bottom: 1px solid rgba(255,255,255,0.15);
  padding: 0.6rem;
  vertical-align: top;
  text-align: left;
}

.route-table th {
  position: sticky;
  top: 0;
  background: #1f2933;
  z-index: 1;
}

.route-table tfoot td {
  border-top: 2px solid rgba(255,255,255,0.25);
  font-weight: 500;
}

.field {
  display: flex;
  gap: 0.4rem;
  align-items: baseline;
}

.compact-route-table th,
.compact-route-table td {
  white-space: nowrap;
}

.route-note-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1.1rem;
}

.route-note-panel.hidden {
  display: none;
}

.route-note-panel {
  margin-top: 1rem;
}

.route-note-card {
  border: 1px solid #ddd;
  border-radius: 0.75rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.55);
  position: relative;
}

.route-note-card h3 {
  margin-top: 0;
}

.route-note-card h4 {
  margin-bottom: 0.25rem;
}

.route-note-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  border: none;
  background: transparent;
  font-size: 1.4rem;
  cursor: pointer;
}

.monuments-section {
  margin: 1.5rem 0;
}

.monument-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.monument-card {
  border: 1px solid #ddd;
  border-radius: 0.75rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.65);
}

.monument-card h4 {
  margin: 0 0 0.35rem;
}

.monument-kind {
  font-weight: 600;
  margin: 0;
}

.monument-period {
  font-size: 0.9rem;
  opacity: 0.75;
  margin-top: 0.25rem;
}

.route-detail-row.hidden {
  display: none;
}

.route-detail-row td {
  background: rgba(0, 0, 0, 0.03);
  padding: 0;
}

.route-detail-content {
  padding: 1rem;
}
.nav-options {
  margin: 0.75rem 0;
  padding: 0.65rem 0.75rem;
  background: rgba(255,250,242,.75);
  border: 1px solid var(--line);
  border-radius: 0.8rem;
}

.nav-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
}

.nav-checkbox input {
  width: 1rem;
  height: 1rem;
}


.expedition-nav-header {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.expedition-toggle {
  width: 1.4rem;
  min-width: 1.4rem;
  padding: 0.2rem 0;
  border: 0;
  background: transparent;
  color: var(--accent);
}

.expedition-title-link {
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 0.2rem 0;
  font-weight: 700;
  font-size: 1rem;
  text-align: left;
}

.expedition-title-link:hover {
  text-decoration: underline;
}

.expedition-nav-subtitle {
  margin: 0.2rem 0 0.5rem 1.75rem;
}


/* V2 compact expedition additions */
.expedition-page, .castle-entry { line-height: 1.42; }
.expedition-header { margin-bottom: .75rem; }
.expedition-header h2, .castle-entry h1 { margin-bottom: .25rem; }
.section-card, .expedition-section, .detail-card, .route-section {
  padding: .85rem 1rem;
  margin: .65rem 0;
}
.route-table th, .route-table td { padding: .35rem .5rem; vertical-align: top; }
.route-facts, .compact-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem .75rem;
  padding: .55rem .7rem;
  margin: .6rem 0;
}
.route-facts .field {
  display: inline-flex;
  gap: .25rem;
  align-items: baseline;
  white-space: nowrap;
}
.monument-entry .route-facts .field {
  white-space: normal;
  min-width: 0;
  max-width: 100%;
}
.monument-entry .route-facts .field > span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.compact-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: .6rem;
}
.compact-info-card, .operational-compact {
  border: 1px solid var(--line);
  border-radius: .65rem;
  background: rgba(255,250,242,.7);
  padding: .65rem .75rem;
}
.compact-info-card { display: grid; gap: .25rem; }
.compact-info-card strong { color: var(--accent); }
.compact-info-card small { color: var(--muted); display: block; }
.inline-link-button {
  border: 0;
  padding: .15rem 0;
  background: transparent;
  color: var(--sea);
  text-align: left;
  border-radius: 0;
  text-decoration: underline;
}
.operational-compact p { margin: .25rem 0; }
.operational-compact ul { margin: .35rem 0 .25rem 1.2rem; }
.stop-detail h4 { margin: .75rem 0 .35rem; }
.pill-list { gap: .35rem; }
.related-button { padding: .35rem .5rem; margin: .15rem; }
.v2-dashboard h3 { margin-top: 0; }

/* Expedition VI complete-page prototype */
.expedition-complete-page {
  --v-gap: 0.5rem;
  display: grid;
  gap: var(--v-gap);
  width: 100%;
  max-width: 1280px;
  min-width: 0;
  margin: 0 auto;
}
.expedition-complete-page > * { min-width: 0; }

.compact-hero {
  margin: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: visible;
}

.compact-hero img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 60vh;
  object-fit: contain;
  background: #111;
}

.compact-hero figcaption {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.voyage-panel,
.mission-header {
  background: rgba(255,250,242,.82);
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  padding: 0.65rem 0.8rem;
}

.mission-header h2 { margin: 0.1rem 0 0; font-size: 1.75rem; }
.mission-header .subtitle { margin: 0.2rem 0; font-size: 1.05rem; }
.mission-meta {
  margin: 0.2rem 0;
  font-weight: 700;
  color: var(--accent);
}
.voyage-status {
  margin: 0.15rem 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.mission-summary { margin: 0.2rem 0; max-width: 95ch; }
.panel-kicker,
.eyebrow {
  margin: 0 0 0.15rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent);
  font-size: .72rem;
  font-weight: 800;
}
.panel-heading-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
}
.panel-heading-row h3,
.voyage-panel h3 { margin: 0 0 0.3rem; }
.panel-note { margin: 0; max-width: 55ch; color: var(--muted); font-size: .86rem; }

.voyage-briefing-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 0.9fr);
  gap: var(--v-gap);
}
.highlight-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.4rem;
}
.highlight-card {
  display: grid;
  gap: 0.1rem;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  padding: 0.5rem 0.6rem;
  cursor: pointer;
  min-height: 0;
  grid-template-rows: auto auto auto auto;
  align-content: start;
  align-items: start;
}
.highlight-card:hover { background: var(--accent-soft); }
.highlight-card strong { color: var(--accent); }
.highlight-card small { color: var(--muted); }
.highlight-card span:last-child { font-size: 0.86rem; line-height: 1.3; }
.highlight-card-summary {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}
.highlight-icon { font-size: 1.15rem; }

.glance-list,
.compact-dl {
  margin: 0;
  display: grid;
  gap: 0.35rem;
}
.glance-list div,
.compact-dl div {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(0,0,0,.06);
  padding-bottom: 0.28rem;
}
.glance-list dt,
.compact-dl dt { font-weight: 800; color: var(--accent); }
.glance-list dd,
.compact-dl dd { margin: 0; }
.character-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.7rem;
}
.character-tags span,
.leg-type {
  border-radius: 999px;
  padding: 0.2rem 0.45rem;
  background: var(--accent-soft);
  font-size: 0.78rem;
  font-weight: 700;
}
.leg-type.optional { background: #fff3cd; }
.leg-type.base { background: #e8f1f4; }

.stats-ribbon {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
  padding: 0.45rem;
}
.stats-ribbon div {
  background: #fff;
  border: 1px solid rgba(0,0,0,.06);
  border-radius: 0.5rem;
  padding: 0.4rem;
  text-align: center;
}
.stats-ribbon strong { display: block; color: var(--accent); font-size: 1.05rem; }
.stats-ribbon span { color: var(--muted); font-size: 0.78rem; }

.journey-timeline {
  display: flex;
  gap: 0.55rem;
  overflow-x: auto;
  padding-bottom: 0.2rem;
}
.journey-step {
  min-width: 150px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 0.75rem;
  padding: 0.6rem;
  position: relative;
}
.journey-step span {
  display: inline-grid;
  place-items: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.75rem;
  margin-bottom: 0.25rem;
}
.journey-step strong,
.journey-step small { display: block; }
.journey-step small { color: var(--muted); }

.planning-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--v-gap);
}
.planning-grid p { margin: 0.35rem 0; }
.planning-introduction { grid-column: 1 / -1; }
.operational-flexibility { max-width: 100ch; }
.time-budget-list {
  display: grid;
  gap: 0.5rem;
}
.time-budget-list div {
  display: grid;
  grid-template-columns: 2rem 1fr;
  column-gap: 0.55rem;
  align-items: center;
  background: #fff;
  border: 1px solid rgba(0,0,0,.06);
  border-radius: 0.65rem;
  padding: 0.55rem;
}
.time-budget-list span { grid-row: span 2; font-size: 1.25rem; }
.time-budget-list small { color: var(--muted); }
.download-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.55rem;
}
.download-card {
  display: grid;
  gap: 0.15rem;
  text-decoration: none;
  color: inherit;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 0.7rem;
}
.download-card:hover { background: var(--accent-soft); }
.download-card span { font-size: 1.2rem; }
.download-card small { color: var(--muted); overflow-wrap: anywhere; }

.route-table-panel,
.route-checks-panel { padding: 0.6rem; min-width: 0; }
.route-leg-index { color: var(--muted); font-weight: 700; }
.route-destination-link small,
.route-main-row td small { display: block; margin-top: 0.15rem; color: var(--muted); }
.route-day-stops {
  max-width: 15rem;
  white-space: normal;
  line-height: 1.3;
}
.route-summary-cell { width: 8rem; min-width: 0; white-space: nowrap !important; }
.compact-route-table th,
.compact-route-table td { white-space: nowrap; padding: 0.28rem 0.4rem; }
.optional-leg { background: rgba(255, 243, 205, 0.25); }

.expedition-theme-panel .theme-note {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(0,0,0,.08);
}
.expedition-theme-panel h4 { margin: 0 0 0.25rem; color: var(--accent); }
.expedition-theme-panel p { margin: 0.25rem 0; }

@media (max-width: 980px) {
  .voyage-briefing-grid,
  .planning-grid { grid-template-columns: 1fr; }
  .stats-ribbon { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 620px) {
  .stats-ribbon { grid-template-columns: repeat(2, 1fr); }
  .glance-list div,
  .compact-dl div { grid-template-columns: 1fr; gap: 0.1rem; }
  .mission-header h2 { font-size: 1.55rem; }
}

/* Expedition VI UI refinement: typed highlight cards and optional-leg controls */
.highlight-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  width: fit-content;
  border-radius: 999px;
  padding: 0.18rem 0.45rem;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  align-self: start;
  justify-self: start;
  white-space: nowrap;
}
.highlight-card.excursion-card .highlight-type-badge { background: #eef6ef; }
.highlight-card.monument-card .highlight-type-badge { background: var(--accent-soft); }

.route-table-tools {
  display: grid;
  justify-items: end;
  gap: 0.25rem;
}
.route-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.6rem;
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--accent);
  white-space: nowrap;
}
.route-toggle input { margin: 0; }

@media (max-width: 720px) {
  .panel-heading-row { align-items: start; flex-direction: column; }
  .route-table-tools { justify-items: start; }
}

/* Expedition route checks */
.route-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.55rem;
  margin-top: 0.5rem;
}
.route-check-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 0.65rem;
}
.route-check-card.optional { background: rgba(255, 243, 205, 0.25); }
.route-check-title {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: baseline;
  margin-bottom: 0.4rem;
}
.route-check-title strong { color: var(--accent); }
.route-check-title span {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.route-check-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.route-check-badge {
  border-radius: 999px;
  padding: 0.18rem 0.45rem;
  font-size: 0.74rem;
  font-weight: 800;
  background: #f3f0ea;
  color: var(--text);
}
.route-check-badge.good { background: #eef6ef; color: #315f3a; }
.route-check-badge.watch { background: #eef4f8; color: #31566a; }
.route-check-badge.caution { background: #fff3cd; color: #7a5a00; }
.route-check-badge.neutral { background: #f3f0ea; color: var(--muted); }

.highlight-card.monument-card .highlight-type-badge { background: #eef4f8; }

/* Curated route-bypass prototype */
.route-enable-cell { text-align: center; }
.route-enable-btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 0.45rem;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0.25rem 0.35rem;
}
.route-enable-btn:hover { background: var(--accent-soft); }
.route-variant-select {
  display: block;
  margin-top: 0.2rem;
  max-width: 8rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 0.72rem;
}
.route-variant-select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.route-stay-control {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}
.route-stay-input {
  width: 3.25rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 0.18rem 0.25rem;
}
.route-stay-input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.route-stay-warning {
  display: block;
  margin-top: 0.25rem;
  color: #7a5a00;
  line-height: 1.3;
}
.disabled-leg {
  opacity: 0.48;
  background: rgba(0,0,0,0.035);
}
.disabled-leg .route-destination-link { text-decoration: line-through; }
.bypass-leg {
  background: rgba(232, 241, 244, 0.75);
}
.missing-bypass-leg {
  background: rgba(255, 243, 205, 0.38);
}
.route-plan-banner {
  margin: 0.4rem 0 0.65rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid rgba(122, 90, 0, 0.25);
  border-radius: 0.65rem;
  background: rgba(255, 243, 205, 0.35);
  font-size: 0.9rem;
}
.planning-icons {
  display: inline-flex;
  gap: 0.22rem;
  align-items: center;
  white-space: nowrap;
}
.planning-icons.muted { color: var(--muted); }
.planning-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid rgba(0,0,0,.08);
  cursor: help;
  font-size: 0.92rem;
}/* Route-table width and detail-row behavior */



.route-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

.compact-route-table {
  width: 100%;
  min-width: 0;
}

/* Keep the information button narrow and visible. */
.compact-route-table th:last-child,
.compact-route-table td:last-child {
  width: 2.5rem;
  min-width: 2.5rem;
  padding-left: 0.25rem;
  padding-right: 0.25rem;
  text-align: center;
}

.route-note-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
}

/*
 * Expanded detail content must wrap without determining the width
 * of the parent table.
 */
.compact-route-table .route-detail-row td {
  width: auto;
  max-width: 0;
  white-space: normal !important;
}

.route-detail-content {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* Explanation belongs below the table, not inside its column layout. */
.route-table-footnote {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.route-related-place-link { padding: 0; border: 0; background: none; color: var(--sea); text-align: left; text-decoration: underline; cursor: pointer; }
.nav-subitem { display: block; margin: 0 0 .45rem 1.25rem; padding: .25rem .4rem; border: 0; background: transparent; color: var(--muted); text-align: left; cursor: pointer; }
.catalog-search { display: flex; align-items: center; gap: .6rem; margin: 1rem 0; }
.catalog-search input { max-width: 24rem; padding: .55rem; }
.stop-catalog-list { display: grid; gap: .75rem; }
.stop-catalog-item { padding: .85rem; border: 1px solid var(--line); border-radius: .4rem; background: var(--surface, #fff); }
.stop-catalog-item h2 { margin: 0; font-size: 1.1rem; }
.stop-catalog-item h2 a { color: var(--sea); font: inherit; }
.stop-catalog-item p { margin: .35rem 0; }
.catalog-place-link { margin: .35rem .4rem 0 0; }
.catalog-count { color: var(--muted); }
.route-destination-link:focus-visible,
.route-related-place-link:focus-visible,
.stop-catalog-item a:focus-visible,
.stop-detail a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
