/* Voyage layout extension. Loaded after styles.css and mobile-app.css. */
:root {
  --voyage-width: 1800px;
  --voyage-gutter: 24px;
  --voyage-brand-width: min(33vw, 420px);
  --voyage-header-space: calc(var(--voyage-brand-width) * .5625 + 80px);
}

.app-shell,
.app-topbar,
.app-tabs,
.app-footer {
  width: min(var(--voyage-width), calc(100% - var(--voyage-gutter) * 2));
  max-width: var(--voyage-width);
  margin-inline: auto;
}

.app-topbar {
  gap: clamp(14px, 2.2vw, 38px);
  min-height: 0;
  padding: 12px 0;
}

.app-brand {
  flex: 0 0 var(--voyage-brand-width);
  width: var(--voyage-brand-width);
  max-width: 420px;
}

.app-brand img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

.app-heading h1 {
  font-size: clamp(18px, 2.1vw, 32px);
  line-height: 1.4;
}

.app-heading p {
  margin-top: 7px;
  font-size: clamp(12px, 1.2vw, 17px);
  letter-spacing: .025em;
}

.app-calc-button.button {
  min-height: 48px;
  padding: 12px 18px;
  border-radius: 13px;
  font-size: 14px;
}

.app-tabs {
  gap: 8px;
  padding: 0 0 12px;
}

.app-tab {
  min-height: 48px;
  font-size: 14px;
}

.app-main {
  padding: 28px 0 40px;
}

.app-panel .section-heading {
  margin-bottom: 24px;
}

.app-panel .section-heading h2 {
  font-size: clamp(25px, 2.7vw, 40px);
}

.app-panel .section-heading p:not(.eyebrow) {
  max-width: 76ch;
  font-size: 15px;
}

.app-footer {
  padding: 16px 0 calc(24px + env(safe-area-inset-bottom, 0px));
}

/* The overview is a four-card departure board. */
#overview > .section-heading,
#overview > .overview-shortcuts,
#overview > .overview-extra {
  display: none;
}

#overview .overview-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(12px, 1.5vw, 26px);
  min-height: max(280px, calc(100svh - var(--voyage-header-space) - 90px));
  margin: 0;
  align-items: stretch;
}

#overview .metric-card {
  min-width: 0;
  min-height: 0;
  padding: clamp(20px, 2.4vw, 42px);
  border-radius: 24px;
}

#overview .metric-label {
  font-size: clamp(13px, 1.25vw, 19px);
}

#overview .metric-main {
  margin: 20px 0;
  font-size: clamp(68px, 7.9vw, 142px);
  line-height: 1.05;
}

#overview .metric-main span {
  font-size: .22em;
}

#overview .metric-detail {
  font-size: clamp(12px, 1.1vw, 17px);
  line-height: 1.8;
  overflow-wrap: anywhere;
}

/* Route choices sit directly beside the map's travel context. */
.explore-workspace {
  display: grid;
  min-width: 0;
  gap: 22px;
  margin-bottom: 28px;
}

.explore-workspace > *,
.route-card,
.itinerary-days > * {
  min-width: 0;
}

.explore-workspace .island-map-panel {
  margin: 0;
  overflow: hidden;
}

#island-map {
  position: relative;
  isolation: isolate;
  z-index: 0;
  width: 100%;
  max-width: none;
  height: min(65vh, 640px);
  min-height: 340px;
  margin-top: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--ink-900);
}

#island-map img {
  max-width: none;
}

.route-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.route-picker label {
  display: flex;
  min-width: 0;
  min-height: 54px;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--paper-muted);
  background: var(--ink-900);
  font-size: 14px;
  line-height: 1.6;
  font-weight: 700;
  cursor: pointer;
}

.route-picker label:has(input:checked) {
  border-color: var(--lagoon);
  color: var(--paper);
  background: rgba(33, 201, 198, .12);
  box-shadow: inset 0 -3px 0 var(--lagoon-strong);
}

.route-picker input[type="checkbox"] {
  flex: 0 0 auto;
  width: 19px;
  height: 19px;
  margin: 0;
  accent-color: var(--lagoon-strong);
}

.route-picker label:focus-within {
  outline: 3px solid var(--sand);
  outline-offset: 3px;
}

.route-card {
  padding: clamp(18px, 2vw, 28px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
}

.route-card h3,
.route-card .route-title,
.route-card .title {
  margin: 0 0 8px;
  color: var(--paper);
  font-size: clamp(18px, 1.5vw, 23px);
  line-height: 1.5;
  font-weight: 900;
}

.route-card .route-subtitle,
.route-card .subtitle {
  margin: 0 0 16px;
  color: var(--paper-muted);
  font-size: 14px;
  line-height: 1.8;
}

.route-card .route-stops,
.route-card .stops {
  margin: 14px 0 18px;
  color: var(--lagoon);
  font-size: 14px;
  line-height: 1.9;
  overflow-wrap: anywhere;
}

.route-card ol.route-stops,
.route-card ul.route-stops,
.route-card ol.stops,
.route-card ul.stops {
  padding-left: 1.3em;
}

.route-select button,
button.route-select {
  min-height: 46px;
  padding: 10px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--lagoon);
  background: var(--ink-900);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
  cursor: pointer;
}

.route-select button:hover,
button.route-select:hover {
  border-color: var(--lagoon);
  background: var(--ink-800);
}

.app-panel .explore-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: 22px;
}

.app-panel .explore-card {
  display: block;
  min-width: 0;
  min-height: 0;
  padding: 0 0 22px;
  overflow: hidden;
  border-radius: 18px;
  background: var(--ink-850);
}

.explore-card .spot-image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  margin: 0 0 18px;
  object-fit: cover;
  background: var(--ink-800);
}

.explore-card .spot-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.app-panel .explore-card h3 {
  margin: 0 22px 7px;
  font-size: clamp(20px, 1.6vw, 26px);
  line-height: 1.5;
  letter-spacing: -.025em;
}

.explore-card .spot-subtitle {
  margin: 0 22px 16px;
  color: var(--paper-muted);
  font-size: 14px;
  line-height: 1.8;
}

.explore-card .spot-detail {
  margin: 16px 22px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.explore-card .spot-detail summary {
  padding: 12px 0;
  color: var(--lagoon);
  font-size: 14px;
}

.explore-card .spot-detail p,
.explore-card .spot-detail ul {
  margin: 0 0 14px;
  color: var(--paper-muted);
  font-size: 14px;
  line-height: 1.9;
  overflow-wrap: anywhere;
}

.explore-card .spot-detail ul {
  padding-left: 1.25em;
}

.explore-card .navigation-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  margin: 0 22px;
  padding: 9px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--lagoon);
  background: var(--ink-900);
  font-size: 14px;
  line-height: 1.5;
  font-weight: 700;
  text-decoration: none;
}

.explore-card .navigation-link:hover {
  border-color: var(--lagoon);
  background: var(--ink-800);
}

/* Three days share a timeline rhythm, with route options allowed to grow. */
.itinerary-days {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: 22px;
  margin: 22px 0 28px;
}

.day-card {
  padding: clamp(20px, 2vw, 32px);
  border: 1px solid var(--line);
  border-top: 4px solid var(--lagoon-strong);
  border-radius: 18px;
  background: var(--ink-850);
}

.day-card:nth-child(2) {
  border-top-color: var(--sunset);
}

.day-card:nth-child(3) {
  border-top-color: var(--sand);
}

.day-card .day-title {
  margin: 0 0 8px;
  color: var(--paper);
  font-size: clamp(22px, 2vw, 30px);
  font-weight: 900;
  line-height: 1.5;
}

.day-card .day-meta {
  margin: 0 0 20px;
  color: var(--paper-muted);
  font-size: 13px;
  line-height: 1.8;
}

.day-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.day-timeline li {
  display: grid;
  grid-template-columns: 4.2em minmax(0, 1fr);
  gap: 14px;
  padding: 17px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.8;
}

.day-timeline time {
  color: var(--lagoon);
  font-size: 13px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.day-timeline li > div {
  min-width: 0;
  overflow-wrap: anywhere;
}

.day-timeline strong {
  display: block;
  margin-bottom: 4px;
  color: var(--paper);
  font-size: 15px;
  line-height: 1.6;
}

.day-timeline p,
.day-timeline small {
  color: var(--paper-muted);
  font-size: 13px;
  line-height: 1.8;
}

.day-card .route-picker {
  grid-template-columns: minmax(0, 1fr);
  margin-bottom: 0;
}

.route-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0;
}

.route-presets button {
  flex: 1 1 170px;
  min-height: 48px;
  padding: 10px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  color: var(--lagoon);
  background: var(--ink-900);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.65;
  cursor: pointer;
}

.route-presets button:hover,
.route-presets button[aria-pressed="true"] {
  border-color: var(--lagoon);
  color: var(--ink-950);
  background: var(--lagoon);
}

/* Late return services remain a table so times can be compared directly. */
.return-trains {
  min-width: 0;
  max-width: 100%;
  margin: 24px 0;
  padding: clamp(18px, 2vw, 30px);
  overflow-x: auto;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--ink-850);
  scrollbar-color: var(--ink-600) var(--ink-900);
}

.return-trains h3 {
  margin-bottom: 8px;
  font-size: clamp(20px, 1.8vw, 28px);
}

.return-trains > p {
  margin-bottom: 18px;
  color: var(--paper-muted);
  font-size: 14px;
  line-height: 1.8;
}

.return-table {
  width: 100%;
  min-width: 610px;
  margin-top: 18px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 15px;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
}

.return-table th,
.return-table td {
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.return-table th {
  color: var(--paper-muted);
  background: var(--ink-900);
  font-size: 12px;
  font-weight: 700;
}

.return-table tbody tr:last-child td {
  border-bottom: 0;
}

.return-table .is-fastest {
  color: var(--paper);
  background: rgba(33, 201, 198, .13);
  font-weight: 900;
}

.return-table .is-fastest td:first-child {
  color: var(--lagoon);
  box-shadow: inset 4px 0 0 var(--lagoon-strong);
}

.fastest-label {
  display: inline-flex;
  align-items: center;
  margin-left: 9px;
  padding: 4px 9px;
  border-radius: 999px;
  color: var(--ink-950);
  background: var(--sunset-soft);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.5;
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .app-panel .explore-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .itinerary-days {
    grid-template-columns: minmax(0, 1fr);
  }

  .day-card .route-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .route-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #overview .metric-card {
    padding: 22px 16px;
  }

  #overview .metric-main {
    font-size: clamp(54px, 7.4vw, 90px);
  }
}

@media (max-width: 759px) {
  :root {
    --voyage-gutter: 16px;
    --voyage-header-space: calc(33vw * .5625 + 132px);
  }

  html {
    scroll-padding-top: var(--voyage-header-space);
  }

  .app-topbar {
    gap: 10px;
    padding: 9px 0;
  }

  .app-brand {
    flex-basis: 33vw;
    width: 33vw;
  }

  .app-heading h1 {
    font-size: clamp(12px, 3.4vw, 18px);
    line-height: 1.55;
    overflow-wrap: anywhere;
  }

  .app-heading p {
    margin-top: 3px;
    font-size: 10px;
    line-height: 1.6;
    letter-spacing: 0;
  }

  .app-calc-button.button {
    min-height: 44px;
    padding: 8px 9px;
    border-radius: 11px;
    font-size: 11px;
  }

  .app-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    padding-bottom: 11px;
  }

  .app-tab {
    min-height: 44px;
    padding: 10px 3px;
    font-size: 12px;
  }

  .app-main {
    padding-top: 18px;
    padding-bottom: 28px;
  }

  .app-panel.section {
    scroll-margin-top: var(--voyage-header-space);
  }

  .app-panel .section-heading h2 {
    font-size: 26px;
  }

  .app-panel .section-heading p:not(.eyebrow) {
    font-size: 14px;
  }

  #overview .overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 12px;
    min-height: max(390px, calc(100svh - var(--voyage-header-space) - 42px));
  }

  #overview .metric-card {
    padding: clamp(16px, 4.7vw, 28px);
    border-radius: 19px;
  }

  #overview .metric-label {
    font-size: 13px;
    letter-spacing: .05em;
  }

  #overview .metric-main {
    margin: 14px 0;
    font-size: clamp(52px, 14vw, 88px);
  }

  #overview .metric-main span {
    font-size: .23em;
  }

  #overview .metric-detail {
    font-size: 11px;
    line-height: 1.85;
  }

  .app-panel .explore-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }

  .explore-workspace {
    gap: 18px;
    margin-bottom: 22px;
  }

  .explore-workspace .island-map-panel {
    padding: 16px;
  }

  #island-map {
    min-height: 330px;
    margin-top: 14px;
    border-radius: 12px;
  }

  .route-picker {
    gap: 8px;
    margin: 14px 0;
  }

  .route-picker label {
    gap: 8px;
    min-height: 54px;
    padding: 10px;
    font-size: 12px;
  }

  .app-panel .explore-card h3 {
    margin-inline: 18px;
    font-size: 23px;
  }

  .explore-card .spot-subtitle,
  .explore-card .spot-detail,
  .explore-card .navigation-link {
    margin-inline: 18px;
  }

  .itinerary-days {
    gap: 18px;
  }

  .day-card {
    padding: 20px 18px;
  }

  .day-card .day-title {
    font-size: 25px;
  }

  .day-card .route-picker {
    grid-template-columns: minmax(0, 1fr);
  }

  .day-timeline li {
    grid-template-columns: 4em minmax(0, 1fr);
    gap: 12px;
  }

  .route-presets {
    gap: 8px;
  }

  .route-presets button {
    flex-basis: calc(50% - 8px);
    padding-inline: 8px;
    font-size: 12px;
  }

  .return-trains {
    padding: 18px 14px;
  }

  .return-table th,
  .return-table td {
    padding: 13px 12px;
  }

  .return-table {
    font-size: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .route-picker label,
  .route-select button,
  .route-presets button {
    transition: none;
  }
}

@media print {
  .app-shell,
  .app-topbar,
  .app-tabs,
  .app-footer {
    width: 100%;
    max-width: none;
  }

  .app-main {
    padding: 0;
  }

  #overview .overview-grid {
    min-height: 0;
  }

  .itinerary-days,
  .app-panel .explore-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .day-card,
  .explore-card,
  .route-card {
    break-inside: avoid;
  }

  .return-trains {
    overflow: visible;
  }

  .return-table {
    min-width: 0;
    font-size: 10pt;
  }
}
