:root {
  color-scheme: light;
  --paper: #f3f0e8;
  --paper-high: #fbf9f4;
  --paper-low: #e8e3d8;
  --ink: #1b2a25;
  --muted: #61716b;
  --line: rgba(27, 42, 37, 0.16);
  --line-strong: rgba(27, 42, 37, 0.28);
  --pine: #163f35;
  --pine-soft: #2f6754;
  --sage: #829476;
  --terra: #cb6438;
  --ocean: #83aaba;
  --white: #fffdf8;
  --shadow: 0 14px 42px rgba(27, 42, 37, 0.13);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.app-shell {
  display: grid;
  width: 100%;
  height: 100dvh;
  grid-template-columns: minmax(430px, 500px) 1fr;
}

.sidebar {
  position: relative;
  z-index: 5;
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--line-strong);
  background:
    radial-gradient(circle at 85% 5%, rgba(203, 100, 56, 0.055), transparent 30%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.2), transparent 42%),
    var(--paper);
  box-shadow: 10px 0 32px rgba(27, 42, 37, 0.08);
}

.atlas-rail {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  display: flex;
  width: 74px;
  height: 142px;
  align-items: center;
  flex-direction: column;
  padding-top: 20px;
  background: var(--pine);
  color: var(--white);
}

.compass-rose {
  position: relative;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: #d8dfd1;
  font-size: 29px;
  line-height: 1;
}

.compass-rose::after {
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  transform: rotate(45deg);
  content: "";
}

.atlas-monogram {
  margin-top: 14px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 21px;
  letter-spacing: 0.06em;
}

.sidebar-header {
  flex: 0 0 auto;
  min-height: 142px;
  padding: 26px 24px 19px 98px;
  border-bottom: 1px solid var(--line);
}

.brand-row,
.header-meta,
.detail-actions,
.map-actions,
.filter-row,
.section-heading,
.timeline-title-row {
  display: flex;
  align-items: center;
}

.brand-row {
  justify-content: space-between;
  gap: 14px;
}

.brand-mark {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--terra);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 30px;
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1;
}

.trip-badge {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.62);
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.trip-badge::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--terra);
  content: "";
}

.header-meta {
  position: relative;
  justify-content: space-between;
  gap: 10px;
  margin-top: 23px;
  color: var(--muted);
  font-size: 11px;
}

.header-meta::before,
.header-meta::after {
  height: 1px;
  flex: 1;
  background: repeating-linear-gradient(90deg, var(--line-strong) 0 2px, transparent 2px 5px);
  content: "";
}

.header-meta span {
  white-space: nowrap;
}

.header-meta strong {
  color: var(--pine);
  font-weight: 850;
}

.sidebar-scroll {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(27, 42, 37, 0.22) transparent;
}

.detail-panel {
  padding: 26px 30px 24px;
  border-bottom: 1px solid var(--line);
}

.detail-kicker {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 11px;
  color: var(--pine-soft);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.detail-kicker::before {
  width: 24px;
  height: 2px;
  background: currentColor;
  content: "";
}

.detail-title {
  max-width: 380px;
  margin-bottom: 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(30px, 2.6vw, 39px);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.02;
}

.detail-summary {
  max-width: 410px;
  margin-bottom: 20px;
  color: #52635c;
  font-size: 13px;
  line-height: 1.58;
}

.fact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0 0 20px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.fact {
  min-width: 0;
  padding: 12px 14px 11px 0;
}

.fact:nth-child(odd) {
  border-right: 1px solid var(--line);
}

.fact:nth-child(even) {
  padding-left: 14px;
}

.fact:nth-child(n + 3) {
  border-top: 1px solid var(--line);
}

.fact dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.fact dd {
  margin: 0;
  color: var(--ink);
  font-size: 11px;
  font-weight: 760;
  line-height: 1.35;
}

.mini-heading {
  margin: 18px 0 9px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.experience-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.experience-list li {
  position: relative;
  padding-left: 23px;
  color: #405149;
  font-size: 12px;
  line-height: 1.45;
}

.experience-list li::before {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 14px;
  color: var(--pine-soft);
  content: "↗";
  font-size: 12px;
  font-weight: 800;
}

.detail-actions {
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 20px;
}

.action-link,
.secondary-link,
.choice-button,
.map-button,
.filter-button {
  border: 0;
  cursor: pointer;
  text-decoration: none;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.action-link,
.secondary-link {
  display: inline-flex;
  min-height: 37px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-bottom: 1px solid currentColor;
  color: var(--pine);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.action-link:hover,
.secondary-link:hover {
  color: var(--terra);
}

.source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 15px;
}

.source-links a {
  color: var(--pine);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 12px;
  text-underline-offset: 4px;
}

.choice-panel {
  margin: 0;
  padding: 18px 30px 22px;
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.section-heading {
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
}

.section-heading::before,
.section-heading::after {
  height: 1px;
  flex: 1;
  background: var(--line);
  content: "";
}

.section-heading h3 {
  margin: 0;
  color: var(--muted);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.selected-pill {
  display: none;
}

.choice-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 19px;
  background: rgba(255, 253, 248, 0.5);
}

.choice-button {
  position: relative;
  min-height: 55px;
  padding: 9px 12px 9px 40px;
  background: transparent;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
}

.choice-button + .choice-button {
  border-left: 1px solid var(--line);
}

.choice-button::before {
  position: absolute;
  top: 50%;
  left: 15px;
  width: 16px;
  transform: translateY(-50%);
  color: var(--pine-soft);
  content: "≈";
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 23px;
  font-weight: 500;
}

.choice-button[data-choice="fragas"]::before {
  content: "♧";
  font-size: 20px;
}

.choice-button.is-active {
  background: var(--pine);
  color: white;
}

.choice-button.is-active::before {
  color: #dfe8dc;
}

.choice-copy {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.timeline-panel {
  padding: 20px 30px 38px;
}

.timeline-title-row {
  justify-content: space-between;
  margin-bottom: 14px;
}

.timeline-title-row h3 {
  margin: 0;
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.timeline-title-row span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
}

.timeline-list {
  position: relative;
  display: grid;
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline-list::before {
  position: absolute;
  top: 18px;
  bottom: 18px;
  left: 18px;
  width: 1px;
  background: var(--line-strong);
  content: "";
}

.timeline-button {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 45px;
  grid-template-columns: 38px 1fr auto;
  gap: 11px;
  align-items: center;
  padding: 6px 10px 6px 0;
  border: 1px solid transparent;
  border-left: 3px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.timeline-button:hover {
  background: rgba(255, 253, 248, 0.44);
}

.timeline-button.is-active {
  border-color: var(--line);
  border-left-color: var(--terra);
  background: rgba(255, 253, 248, 0.62);
}

.timeline-number {
  position: relative;
  z-index: 1;
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  justify-self: center;
  border: 2px solid var(--paper);
  border-radius: 50%;
  background: var(--sage);
  color: white;
  font-size: 9px;
  font-weight: 900;
}

.timeline-button.is-active .timeline-number {
  width: 31px;
  height: 31px;
  background: var(--terra);
  font-size: 11px;
}

.timeline-copy {
  min-width: 0;
}

.timeline-copy strong,
.timeline-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-copy strong {
  margin-bottom: 2px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
  font-weight: 600;
}

.timeline-button.is-active .timeline-copy strong,
.timeline-button.is-active .timeline-copy span,
.timeline-button.is-active .timeline-duration {
  color: var(--terra);
}

.timeline-copy span,
.timeline-duration {
  color: var(--muted);
  font-size: 9px;
}

.timeline-duration {
  font-weight: 750;
  white-space: nowrap;
}

.map-wrap {
  position: relative;
  min-width: 0;
  height: 100%;
  background: #dfe8e5;
}

#map {
  position: absolute;
  inset: 0;
}

.map-toolbar {
  position: absolute;
  z-index: 3;
  top: 20px;
  left: 20px;
  right: 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  pointer-events: none;
}

.map-actions,
.filter-row {
  overflow: hidden;
  border: 1px solid rgba(27, 42, 37, 0.13);
  border-radius: 10px;
  background: rgba(255, 253, 248, 0.94);
  box-shadow: 0 9px 28px rgba(27, 42, 37, 0.11);
  backdrop-filter: blur(12px);
  pointer-events: auto;
}

.filter-row {
  margin-left: auto;
}

.map-button,
.filter-button {
  display: inline-flex;
  min-height: 45px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  background: transparent;
  color: var(--ink);
  font-size: 10px;
  font-weight: 850;
}

.map-button + .map-button,
.filter-button + .filter-button {
  border-left: 1px solid var(--line);
}

.map-button svg,
.filter-button svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.map-button:hover,
.filter-button:hover {
  background: rgba(22, 63, 53, 0.07);
}

.filter-button {
  color: var(--muted);
}

.filter-button.is-active {
  background: var(--pine);
  color: white;
}

.map-legend {
  position: absolute;
  z-index: 3;
  right: 18px;
  bottom: 25px;
  width: min(235px, calc(100% - 36px));
  padding: 13px 14px;
  border: 1px solid rgba(27, 42, 37, 0.13);
  border-radius: 9px;
  background: rgba(255, 253, 248, 0.91);
  box-shadow: 0 9px 28px rgba(27, 42, 37, 0.1);
  backdrop-filter: blur(12px);
}

.legend-title {
  margin-bottom: 9px;
  color: var(--ink);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.legend-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 11px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
}

.legend-line {
  width: 25px;
  height: 3px;
  border-radius: 99px;
  background: var(--pine);
}

.legend-line.alt {
  height: 0;
  border-top: 2px dashed var(--terra);
  border-radius: 0;
  background: transparent;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border: 2px solid white;
  border-radius: 50%;
  background: var(--ocean);
  box-shadow: 0 0 0 1px rgba(27, 42, 37, 0.2);
}

.stop-marker,
.poi-marker {
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(27, 42, 37, 0.24);
  transition: transform 150ms ease, opacity 150ms ease, background 150ms ease;
}

.stop-marker {
  width: 30px;
  height: 30px;
  border: 3px solid var(--white);
  border-radius: 50%;
  background: var(--pine-soft);
  color: white;
  font-size: 9px;
  font-weight: 900;
}

.stop-marker:hover,
.stop-marker.is-active {
  z-index: 4;
  transform: scale(1.22);
  background: var(--terra);
}

.stop-marker.is-start,
.stop-marker.is-end {
  border-radius: 8px;
  background: var(--pine);
}

.poi-marker {
  width: 23px;
  height: 23px;
  border: 2px solid var(--white);
  border-radius: 50%;
  background: var(--ocean);
  color: white;
  font-size: 9px;
  font-weight: 900;
}

.poi-marker svg {
  width: 13px;
  height: 13px;
  pointer-events: none;
}

.poi-marker[data-kind="hike"] {
  background: #687d57;
}

.poi-marker[data-kind="water"] {
  background: #4d879f;
}

.poi-marker[data-kind="village"] {
  background: #9b7257;
}

.poi-marker[data-kind="view"] {
  background: #745a82;
}

.poi-marker[data-kind="culture"] {
  background: #ad7049;
}

.poi-marker[data-kind="road"] {
  background: #356b67;
}

.poi-marker[data-kind="choice"] {
  background: var(--terra);
}

.poi-marker.is-muted {
  opacity: 0.2;
}

.maplibregl-popup-content {
  padding: 8px 11px !important;
  border-radius: 7px !important;
  background: var(--pine) !important;
  color: white !important;
  box-shadow: var(--shadow) !important;
  font: 750 10px/1.3 Inter, ui-sans-serif, system-ui, sans-serif !important;
}

.maplibregl-popup-tip {
  border-top-color: var(--pine) !important;
}

.maplibregl-ctrl-bottom-left,
.maplibregl-ctrl-bottom-right {
  opacity: 0.72;
}

.maplibregl-ctrl-group {
  overflow: hidden;
  border: 1px solid rgba(27, 42, 37, 0.13) !important;
  border-radius: 8px !important;
  box-shadow: 0 8px 24px rgba(27, 42, 37, 0.1) !important;
}

.maplibregl-ctrl button {
  background-color: rgba(255, 253, 248, 0.95) !important;
}

.loading-state {
  position: absolute;
  z-index: 7;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--paper);
  transition: opacity 300ms ease, visibility 300ms ease;
}

.loading-state.is-hidden {
  visibility: hidden;
  opacity: 0;
}

.loading-card {
  display: grid;
  justify-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.loading-ring {
  width: 30px;
  height: 30px;
  border: 3px solid var(--paper-low);
  border-top-color: var(--pine);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: minmax(390px, 440px) 1fr;
  }

  .filter-button {
    padding: 0 11px;
  }
}

@media (max-width: 900px) {
  html,
  body {
    overflow: auto;
  }

  .app-shell {
    display: flex;
    height: auto;
    min-height: 100dvh;
    flex-direction: column;
  }

  .map-wrap {
    order: 1;
    height: 54dvh;
    min-height: 400px;
  }

  .sidebar {
    order: 2;
    min-height: 46dvh;
    overflow: visible;
    border-top: 1px solid var(--line-strong);
    border-right: 0;
    box-shadow: 0 -9px 30px rgba(27, 42, 37, 0.1);
  }

  .sidebar-scroll {
    overflow: visible;
  }

  .map-legend {
    display: none;
  }
}

@media (max-width: 600px) {
  .atlas-rail {
    width: 64px;
    height: 130px;
  }

  .compass-rose {
    width: 34px;
    height: 34px;
    font-size: 24px;
  }

  .atlas-monogram {
    margin-top: 12px;
    font-size: 18px;
  }

  .sidebar-header {
    min-height: 130px;
    padding: 22px 16px 17px 82px;
  }

  h1 {
    font-size: 24px;
  }

  .trip-badge {
    display: none;
  }

  .header-meta {
    margin-top: 21px;
    font-size: 9px;
  }

  .header-meta::before,
  .header-meta::after {
    display: none;
  }

  .detail-panel,
  .choice-panel,
  .timeline-panel {
    padding-right: 18px;
    padding-left: 18px;
  }

  .detail-title {
    font-size: 32px;
  }

  .choice-button {
    min-height: 53px;
    padding-left: 34px;
    font-size: 11px;
  }

  .choice-button::before {
    left: 11px;
  }

  .map-toolbar {
    top: 12px;
    left: 12px;
    right: 12px;
    display: grid;
    gap: 8px;
  }

  .map-actions,
  .filter-row {
    width: max-content;
    max-width: 100%;
  }

  .filter-row {
    justify-self: end;
    margin-left: 0;
  }

  .map-button,
  .filter-button {
    min-height: 37px;
    padding: 0 10px;
    font-size: 9px;
  }

  .filter-button {
    width: 38px;
    padding: 0;
  }

  .filter-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

@media (max-width: 420px) {
  .filter-button {
    width: 36px;
  }

  .map-button {
    padding: 0 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
