/*
 * Shared visual language for every atlas map.
 * The map should feel like a folio opened from Bilbo's study.
 */

:root {
  --atlas-walnut-950: #1d120c;
  --atlas-walnut-900: #281911;
  --atlas-walnut-800: #3a261a;
  --atlas-walnut-700: #503522;
  --atlas-parchment-100: #f5ebd0;
  --atlas-parchment-200: #eadbb5;
  --atlas-parchment-300: #d9c494;
  --atlas-parchment-500: #b99b62;
  --atlas-ink: #352418;
  --atlas-ink-soft: #674d32;
  --atlas-gold: #b68a42;
  --atlas-gold-light: #d8b76e;
  --atlas-oxblood: #71352e;
  --atlas-oxblood-deep: #51221f;
  --atlas-forest: #425c3a;
  --atlas-shadow: rgba(24, 14, 8, 0.42);
  --atlas-paper-texture: url("../assets/map_parchment.png");
}

/* Sidebar folio --------------------------------------------------------- */

.sidebar {
  box-sizing: border-box;
  color: var(--atlas-ink);
  border: 1px solid rgba(182, 138, 66, 0.86);
  border-radius: 9px;
  background: var(--atlas-walnut-900);
  box-shadow:
    0 18px 46px var(--atlas-shadow),
    0 0 0 1px rgba(255, 235, 187, 0.14);
  transition: width 260ms cubic-bezier(0.22, 0.72, 0.24, 1);
}

.sidebar-content {
  color: var(--atlas-ink);
  background:
    linear-gradient(rgba(255, 249, 229, 0.78), rgba(201, 174, 118, 0.28)),
    var(--atlas-paper-texture) center / cover;
  box-shadow: inset 14px 0 24px rgba(61, 39, 20, 0.08);
  scrollbar-color: var(--atlas-gold) rgba(71, 43, 25, 0.12);
  scrollbar-width: thin;
}

.sidebar-content::-webkit-scrollbar {
  width: 10px;
}

.sidebar-content::-webkit-scrollbar-track {
  background: rgba(71, 43, 25, 0.1);
}

.sidebar-content::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: var(--atlas-gold);
  background-clip: padding-box;
}

.sidebar-pane {
  padding: 10px 20px 26px;
}

.sidebar-header {
  box-sizing: border-box;
  height: auto;
  min-height: 52px;
  margin: -10px -20px 18px;
  padding: 11px 54px 10px 20px;
  border-bottom: 1px solid var(--atlas-gold);
  color: var(--atlas-parchment-100);
  background:
    linear-gradient(90deg, rgba(255, 235, 186, 0.04), transparent 30%),
    linear-gradient(100deg, var(--atlas-walnut-950), var(--atlas-walnut-700));
  box-shadow:
    0 5px 14px rgba(38, 21, 11, 0.22),
    inset 0 -1px rgba(255, 239, 199, 0.08);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: 0.035em;
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.48);
}

.sidebar-close {
  top: 0;
  right: 0;
  display: grid;
  width: 48px;
  height: 52px;
  place-items: center;
  color: var(--atlas-parchment-200);
  transition: color 140ms ease, background-color 140ms ease, translate 100ms ease;
}

.sidebar-close:hover,
.sidebar-close:focus-visible {
  color: #fff4d6;
  background: rgba(216, 183, 110, 0.13);
}

.sidebar-close:active {
  translate: -2px 0;
}

.sidebar-tabs {
  border-right: 1px solid rgba(182, 138, 66, 0.74);
  background:
    radial-gradient(circle at 50% 5%, rgba(238, 206, 136, 0.1), transparent 24%),
    linear-gradient(90deg, var(--atlas-walnut-950), var(--atlas-walnut-800));
  box-shadow: inset -7px 0 12px rgba(0, 0, 0, 0.2);
}

.sidebar-tabs > li,
.sidebar-tabs > ul > li {
  color: var(--atlas-parchment-300);
  background: transparent;
  transition: color 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}

.sidebar-tabs > li > a,
.sidebar-tabs > ul > li > a {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  line-height: 1;
}

.sidebar-tabs .material-icons,
.sidebar-tabs .material-symbols-outlined {
  top: 0;
  font-size: 22px;
}

.sidebar-tabs > li:hover,
.sidebar-tabs > ul > li:hover {
  color: #fff1ca;
  background: rgba(216, 183, 110, 0.12);
}

.sidebar-tabs > li.active,
.sidebar-tabs > ul > li.active {
  color: #fff3d2;
  background: linear-gradient(90deg, var(--atlas-oxblood-deep), var(--atlas-oxblood));
  box-shadow:
    inset 3px 0 var(--atlas-gold-light),
    inset 0 0 18px rgba(255, 220, 145, 0.08);
}

.sidebar-pane h2,
.sidebar-pane h3 {
  color: var(--atlas-ink-soft);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 600;
}

.sidebar-pane h2 {
  margin: 22px 0 8px;
  padding: 0 0 6px;
  border-bottom: 1px solid rgba(91, 59, 28, 0.26);
  font-size: 1.35rem;
  line-height: 1.15;
}

.sidebar-pane h2:first-of-type {
  margin-top: 8px;
}

.sidebar-pane label {
  min-height: 42px;
  box-sizing: border-box;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--atlas-ink);
  background: transparent;
  line-height: 1.35;
  transition:
    color 130ms ease,
    border-color 130ms ease,
    background-color 130ms ease,
    translate 100ms ease;
}

.sidebar-pane label:hover {
  border-color: rgba(121, 84, 39, 0.24);
  background: rgba(103, 70, 34, 0.08);
}

.sidebar-pane label:active {
  translate: 1px 1px;
}

.sidebar-pane label:has(input[id^="all"]) {
  border-color: rgba(113, 53, 46, 0.22);
  background: rgba(113, 53, 46, 0.07);
  font-weight: 700;
}

.sidebar-pane input[type="checkbox"] {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 0 10px 0 0;
  accent-color: var(--atlas-oxblood);
  cursor: pointer;
}

.sidebar-pane button,
.story-launch-card__button {
  border: 1px solid var(--atlas-gold);
  color: var(--atlas-parchment-100);
  background: linear-gradient(var(--atlas-walnut-700), var(--atlas-walnut-900));
  box-shadow:
    0 4px 9px rgba(43, 25, 13, 0.2),
    inset 0 1px rgba(255, 235, 190, 0.12);
  transition: color 130ms ease, background 130ms ease, translate 90ms ease, box-shadow 130ms ease;
}

.sidebar-pane button:hover,
.sidebar-pane button:focus-visible,
.story-launch-card__button:hover,
.story-launch-card__button:focus-visible {
  color: #fff6dc;
  background: linear-gradient(#65452c, var(--atlas-walnut-800));
  box-shadow:
    0 5px 12px rgba(43, 25, 13, 0.27),
    inset 0 1px rgba(255, 235, 190, 0.18);
}

.sidebar-pane button:active,
.story-launch-card__button:active {
  translate: 0 1px;
  box-shadow: inset 0 2px 5px rgba(20, 10, 5, 0.32);
}

/* Atlas frontispiece --------------------------------------------------- */

.atlas-frontispiece-tab {
  border-bottom: 1px solid rgba(216, 183, 110, 0.2);
}

.atlas-frontispiece-pane .sidebar-header:focus,
.atlas-featured-places-pane .sidebar-header:focus,
.atlas-index-pane .sidebar-header:focus {
  outline: none;
}

.atlas-frontispiece {
  padding: 2px 0 0;
}

.atlas-frontispiece__eyebrow,
.atlas-pane-eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 8px;
  color: var(--atlas-oxblood);
  font-family: "Ringbearer", "Cormorant Garamond", Georgia, serif;
  font-size: 12px;
  line-height: 1.25;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

.atlas-frontispiece__eyebrow::after,
.atlas-pane-eyebrow::after {
  width: 42px;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, var(--atlas-gold), transparent);
}

.sidebar-pane .atlas-frontispiece__title,
.sidebar-pane .atlas-pane-title {
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--atlas-ink);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1.85rem, 4vw, 2.35rem);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.018em;
}

.atlas-frontispiece__copy,
.atlas-pane-copy {
  margin: 13px 0 18px;
  color: var(--atlas-ink-soft);
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 12px;
  line-height: 1.65;
}

.atlas-chapter-list {
  display: grid;
  gap: 11px;
}

.sidebar-pane button.atlas-chapter-card {
  display: grid;
  width: 100%;
  min-height: 88px;
  grid-template-columns: 46px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 12px;
  padding: 12px 11px;
  border: 1px solid rgba(160, 112, 47, 0.66);
  border-radius: 9px;
  color: var(--atlas-ink);
  background:
    linear-gradient(105deg, rgba(255, 251, 233, 0.78), rgba(219, 196, 147, 0.46)),
    var(--atlas-paper-texture) center / cover;
  box-shadow:
    0 7px 17px rgba(52, 31, 15, 0.13),
    inset 0 0 0 1px rgba(255, 249, 226, 0.42);
  font: inherit;
  text-align: left;
}

.sidebar-pane button.atlas-chapter-card:hover,
.sidebar-pane button.atlas-chapter-card:focus-visible {
  border-color: var(--atlas-gold-light);
  color: var(--atlas-parchment-100);
  background:
    radial-gradient(circle at 11% 22%, rgba(255, 220, 157, 0.12), transparent 23%),
    linear-gradient(112deg, var(--atlas-oxblood), var(--atlas-oxblood-deep));
  box-shadow:
    0 9px 20px rgba(52, 25, 18, 0.22),
    inset 0 0 0 1px rgba(255, 232, 182, 0.1);
  translate: 2px 0;
}

.atlas-chapter-card__medallion {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--atlas-gold-light);
  border-radius: 50%;
  color: var(--atlas-parchment-100);
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 230, 178, 0.17), transparent 28%),
    var(--atlas-walnut-800);
  box-shadow:
    0 3px 8px rgba(43, 25, 13, 0.22),
    inset 0 0 0 2px rgba(77, 45, 25, 0.74);
}

.atlas-chapter-card__medallion .material-icons {
  font-size: 21px;
}

.atlas-chapter-card__copy {
  display: grid;
  gap: 3px;
}

.atlas-chapter-card__copy strong {
  color: currentColor;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 21px;
  font-weight: 700;
  line-height: 1;
}

.atlas-chapter-card__copy > span {
  color: var(--atlas-ink-soft);
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 10px;
  line-height: 1.5;
  transition: color 130ms ease;
}

.atlas-chapter-card:hover .atlas-chapter-card__copy > span,
.atlas-chapter-card:focus-visible .atlas-chapter-card__copy > span {
  color: var(--atlas-parchment-200);
}

.atlas-chapter-card__chevron {
  color: var(--atlas-gold);
  font-size: 21px;
  transition: color 130ms ease, translate 130ms ease;
}

.atlas-chapter-card:hover .atlas-chapter-card__chevron,
.atlas-chapter-card:focus-visible .atlas-chapter-card__chevron {
  color: var(--atlas-gold-light);
  translate: 3px 0;
}

.atlas-frontispiece__return-note {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 16px 4px 0;
  color: var(--atlas-ink-soft);
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 9px;
  font-style: italic;
  line-height: 1.5;
}

.atlas-frontispiece__return-note .material-icons {
  color: var(--atlas-gold);
  font-size: 16px;
}

.atlas-place-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 17px;
}

.sidebar-pane button.atlas-place-card {
  display: flex;
  min-height: 60px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid rgba(160, 112, 47, 0.48);
  border-radius: 7px;
  color: var(--atlas-ink);
  background: rgba(255, 248, 224, 0.36);
  box-shadow: inset 0 0 0 1px rgba(255, 252, 235, 0.26);
  text-align: left;
}

.sidebar-pane button.atlas-place-card:hover,
.sidebar-pane button.atlas-place-card:focus-visible,
.sidebar-pane button.atlas-place-card.is-active {
  border-color: var(--atlas-gold-light);
  color: var(--atlas-parchment-100);
  background: linear-gradient(110deg, var(--atlas-oxblood), var(--atlas-oxblood-deep));
  translate: 0 -1px;
}

.atlas-place-card > span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.atlas-place-card strong {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.05;
}

.atlas-place-card small {
  overflow: hidden;
  color: var(--atlas-ink-soft);
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 8px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.atlas-place-card:hover small,
.atlas-place-card:focus-visible small,
.atlas-place-card.is-active small {
  color: var(--atlas-parchment-200);
}

.atlas-place-card > .material-icons {
  flex: 0 0 auto;
  color: var(--atlas-gold);
  font-size: 17px;
}

.atlas-pane-actions {
  display: grid;
  gap: 8px;
}

.sidebar-pane button.atlas-pane-link {
  width: 100%;
  padding: 10px 12px;
  border-radius: 6px;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 10px;
  line-height: 1.45;
}

.sidebar-pane button.atlas-pane-link:not(.atlas-pane-link--primary) {
  border-color: rgba(112, 75, 37, 0.34);
  color: var(--atlas-ink-soft);
  background: rgba(255, 248, 224, 0.22);
  box-shadow: none;
}

.sidebar-pane button.atlas-pane-link:not(.atlas-pane-link--primary):hover,
.sidebar-pane button.atlas-pane-link:not(.atlas-pane-link--primary):focus-visible {
  border-color: var(--atlas-gold);
  color: var(--atlas-ink);
  background: rgba(182, 138, 66, 0.13);
}

.atlas-index-group {
  margin: 17px 0 0;
}

.sidebar-pane .atlas-index-group h3 {
  margin: 0 0 7px;
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(91, 59, 28, 0.24);
  color: var(--atlas-oxblood);
  font-size: 17px;
  line-height: 1.15;
}

.sidebar-pane button.atlas-index-link {
  display: grid;
  width: 100%;
  min-height: 43px;
  grid-template-columns: 24px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 9px;
  margin: 0 0 5px;
  padding: 7px 9px;
  border-color: transparent;
  border-radius: 6px;
  color: var(--atlas-ink);
  background: transparent;
  box-shadow: none;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 10px;
  text-align: left;
}

.sidebar-pane button.atlas-index-link:hover,
.sidebar-pane button.atlas-index-link:focus-visible {
  border-color: rgba(182, 138, 66, 0.58);
  color: var(--atlas-parchment-100);
  background: linear-gradient(105deg, var(--atlas-walnut-700), var(--atlas-walnut-900));
  translate: 2px 0;
}

.atlas-index-link .material-icons,
.atlas-index-link .material-symbols-outlined {
  color: var(--atlas-gold);
  font-size: 19px;
}

.atlas-index-link > :last-child {
  justify-self: end;
  transition: translate 120ms ease;
}

.atlas-index-link:hover > :last-child,
.atlas-index-link:focus-visible > :last-child {
  translate: 2px 0;
}

.atlas-index-pane > section > .atlas-pane-link {
  margin-top: 13px;
}

/* A quiet reading-surface treatment while the folio is open. */
#map::after {
  position: absolute;
  z-index: 250;
  inset: 0;
  content: "";
  pointer-events: none;
  background: rgba(42, 26, 15, 0.18);
  opacity: 0;
  transition: opacity 220ms ease;
}

.atlas-sidebar-open #map::after {
  opacity: 1;
}

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

.leaflet-bar {
  border: 1px solid var(--atlas-gold);
  border-radius: 7px;
  box-shadow: 0 8px 20px rgba(30, 17, 9, 0.3);
  overflow: hidden;
}

.leaflet-bar a,
.leaflet-bar a:hover,
.leaflet-bar a:focus {
  border-bottom-color: rgba(216, 183, 110, 0.36);
  color: var(--atlas-parchment-100);
  background: linear-gradient(var(--atlas-walnut-700), var(--atlas-walnut-900));
  font-family: "Libre Baskerville", Georgia, serif;
  text-shadow: 0 1px rgba(0, 0, 0, 0.54);
  transition: color 120ms ease, background 120ms ease, translate 90ms ease;
}

.leaflet-bar a:hover,
.leaflet-bar a:focus-visible {
  color: #fff5d6;
  background: linear-gradient(#67462d, var(--atlas-walnut-800));
}

.leaflet-bar a:active {
  translate: 0 1px;
  background: var(--atlas-walnut-950);
}

.leaflet-bar a.leaflet-disabled {
  color: rgba(234, 219, 181, 0.38);
  background: #332219;
}

.leaflet-control-attribution {
  border: 1px solid rgba(182, 138, 66, 0.45);
  border-width: 1px 0 0 1px;
  color: var(--atlas-ink-soft);
  background: rgba(239, 224, 187, 0.88);
  font-family: "Libre Baskerville", Georgia, serif;
}

.leaflet-control-attribution a {
  color: var(--atlas-oxblood);
}

/* Wax-seal marker clusters --------------------------------------------- */

.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large,
.leaflet-oldie .marker-cluster-small,
.leaflet-oldie .marker-cluster-medium,
.leaflet-oldie .marker-cluster-large {
  box-sizing: border-box;
  border: 2px solid var(--atlas-gold-light);
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 221, 166, 0.18), transparent 24%),
    var(--atlas-oxblood-deep);
  box-shadow:
    0 4px 10px rgba(35, 18, 11, 0.4),
    0 0 0 2px rgba(70, 38, 24, 0.62),
    inset 0 0 0 1px rgba(255, 227, 171, 0.11);
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div,
.leaflet-oldie .marker-cluster-small div,
.leaflet-oldie .marker-cluster-medium div,
.leaflet-oldie .marker-cluster-large div {
  width: 30px;
  height: 30px;
  margin: 3px;
  border: 1px solid rgba(233, 199, 124, 0.48);
  border-radius: 50%;
  color: var(--atlas-parchment-100);
  background:
    radial-gradient(circle at 38% 30%, #98564b, var(--atlas-oxblood) 48%, var(--atlas-oxblood-deep));
  font: 600 15px/30px "Cormorant Garamond", Georgia, serif;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.72);
}

.marker-cluster span {
  line-height: 30px;
}

/* Illustrated marker medallions --------------------------------------- */

.leaflet-marker-icon.atlas-marker-icon {
  box-sizing: border-box;
  padding: 3px;
  border: 2px solid var(--atlas-gold-light);
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 30%, var(--atlas-parchment-100), var(--atlas-parchment-300));
  box-shadow:
    0 4px 9px rgba(35, 20, 11, 0.38),
    0 0 0 2px rgba(75, 46, 25, 0.72),
    inset 0 0 0 1px rgba(255, 248, 221, 0.62);
  object-fit: contain;
  transition: opacity 150ms ease, filter 150ms ease, box-shadow 150ms ease;
}

.leaflet-marker-icon.atlas-marker-icon--hover {
  filter: sepia(0.16) brightness(1.04);
}

.leaflet-marker-icon.atlas-marker-icon--hover-bounce {
  animation: none !important;
}

/* Parchment popups and cartographic tooltips --------------------------- */

.leaflet-popup-content-wrapper {
  border: 0;
  border-radius: 0;
  color: var(--atlas-ink);
  background: var(--atlas-paper-texture) center / 100% 100% no-repeat;
  box-shadow: none;
  font-family: "Libre Baskerville", Georgia, serif;
}

.leaflet-popup-tip {
  border: 0;
  background: var(--atlas-paper-texture) center / 600% 600% no-repeat;
  box-shadow: none;
}

.campsite-popup-shell .leaflet-popup-content-wrapper,
.lore-popup-shell .leaflet-popup-content-wrapper {
  border: 0;
  background: var(--atlas-paper-texture) center / 100% 100% no-repeat;
  box-shadow: none;
}

.campsite-popup-shell .leaflet-popup-tip,
.lore-popup-shell .leaflet-popup-tip {
  border: 0;
  background: var(--atlas-paper-texture) center / 600% 600% no-repeat;
  box-shadow: none;
}

.campsite-popup__frame,
.lore-popup__frame {
  border: 0;
  border-radius: 0;
  color: var(--atlas-ink);
  background: transparent;
  box-shadow: none;
}

.campsite-popup__title,
.lore-popup__title,
.leaflet-popup-content h1,
.leaflet-popup-content h2,
.leaflet-popup-content h3 {
  color: var(--atlas-ink);
  font-family: "Cormorant Garamond", Georgia, serif;
}

.leaflet-container a.lore-popup__link {
  padding: 8px 15px 9px;
  border: 1px solid var(--atlas-gold);
  border-radius: 5px;
  color: var(--atlas-parchment-100);
  background: linear-gradient(var(--atlas-oxblood), var(--atlas-oxblood-deep));
  box-shadow: inset 0 1px rgba(255, 231, 184, 0.13);
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.035em;
  text-decoration: none;
  transition:
    color 130ms ease,
    border-color 130ms ease,
    background 130ms ease,
    box-shadow 130ms ease,
    translate 90ms ease;
}

.leaflet-container a.lore-popup__link::after {
  content: "›";
  display: inline-block;
  margin-left: 0.42em;
  font-size: 1.18em;
  line-height: 0;
  transition: translate 100ms ease;
}

.leaflet-container a.lore-popup__link:hover,
.leaflet-container a.lore-popup__link:focus-visible {
  border-color: var(--atlas-gold-light);
  color: #fff6de;
  background: linear-gradient(#895047, var(--atlas-oxblood));
  box-shadow:
    inset 0 1px rgba(255, 237, 196, 0.18),
    0 0 0 1px rgba(216, 183, 110, 0.16),
    0 4px 10px rgba(55, 27, 18, 0.24);
  translate: 0 -1px;
}

.leaflet-container a.lore-popup__link:hover::after,
.leaflet-container a.lore-popup__link:focus-visible::after {
  translate: 2px 0;
}

.leaflet-container a.lore-popup__link:focus-visible {
  outline: 2px solid var(--atlas-gold-light);
  outline-offset: 3px;
}

.leaflet-container a.lore-popup__link:active {
  box-shadow: inset 0 2px 5px rgba(34, 15, 11, 0.34);
  translate: 0 1px;
}

.leaflet-container a.leaflet-popup-close-button {
  width: 30px;
  height: 30px;
  color: var(--atlas-ink-soft);
  font: 700 22px/28px Georgia, serif;
  transition: color 120ms ease, rotate 120ms ease;
}

.leaflet-container a.leaflet-popup-close-button:hover,
.leaflet-container a.leaflet-popup-close-button:focus-visible {
  color: var(--atlas-oxblood);
  rotate: 4deg;
}

.leaflet-tooltip,
.polygon-label {
  padding: 5px 9px;
  border: 1px solid var(--atlas-gold);
  border-radius: 5px;
  color: var(--atlas-ink);
  background:
    linear-gradient(rgba(255, 249, 229, 0.94), rgba(222, 200, 153, 0.86)),
    var(--atlas-paper-texture) center / cover;
  box-shadow: 0 5px 12px rgba(31, 17, 9, 0.24);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 17px;
  font-weight: 600;
}

/* Keep the navigation in the same walnut-and-gold family. */
.atlas-map-nav__link,
.atlas-map-nav__toggle {
  border-color: rgba(216, 183, 110, 0.68);
  color: var(--atlas-parchment-100);
  background: rgba(40, 25, 17, 0.93);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.34),
    inset 0 1px rgba(255, 236, 193, 0.08);
  transition: color 130ms ease, background-color 130ms ease, translate 90ms ease;
}

.atlas-map-nav__link:hover,
.atlas-map-nav__link:focus-visible,
.atlas-map-nav__toggle:hover,
.atlas-map-nav__toggle:focus-visible {
  color: #fff5d8;
  background: rgba(79, 52, 33, 0.97);
}

.atlas-map-nav__link:active,
.atlas-map-nav__toggle:active {
  translate: 0 1px;
}

.atlas-map-nav__link--current {
  border-color: var(--atlas-gold-light);
  background: rgba(113, 53, 46, 0.95);
}

/* Atlas sound settings -------------------------------------------------- */

.atlas-sounds-card {
  margin: 18px 0 0;
  padding: 17px;
  border: 1px solid rgba(182, 138, 66, 0.58);
  border-radius: 7px;
  background: rgba(255, 248, 224, 0.28);
  box-shadow:
    inset 0 0 0 1px rgba(255, 249, 230, 0.38),
    0 8px 20px rgba(58, 36, 19, 0.08);
}

.atlas-sounds-card__eyebrow,
.atlas-project-card__eyebrow {
  margin: 0 0 11px;
  color: var(--atlas-oxblood);
  font-family: "Ringbearer", "Cormorant Garamond", Georgia, serif;
  font-size: 12px;
  line-height: 1.2;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

.atlas-project-card {
  box-sizing: border-box;
  margin: 18px 0 0;
  padding: 16px 17px 15px;
  border: 1px solid rgba(103, 77, 50, 0.3);
  border-radius: 6px;
  background: rgba(255, 248, 224, 0.28);
  box-shadow:
    inset 0 0 0 1px rgba(255, 249, 230, 0.38),
    0 8px 20px rgba(58, 36, 19, 0.08);
}

.atlas-project-card__link {
  display: block;
  color: var(--atlas-ink);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 21px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration-color: rgba(113, 53, 46, 0.42);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: color 130ms ease, text-decoration-color 130ms ease;
}

.atlas-project-card__link:hover,
.atlas-project-card__link:focus-visible {
  color: var(--atlas-oxblood);
  text-decoration-color: var(--atlas-gold);
}

.atlas-project-card__link:focus-visible {
  outline: 2px solid var(--atlas-gold);
  outline-offset: 4px;
  border-radius: 2px;
}

.atlas-project-card__copy {
  margin: 10px 0 0;
  color: var(--atlas-ink-soft);
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 10px;
  font-style: italic;
  line-height: 1.55;
}

.sidebar-pane label.atlas-sounds-toggle {
  display: flex;
  min-height: 0;
  align-items: center;
  gap: 16px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
}

.sidebar-pane label.atlas-sounds-toggle:hover,
.sidebar-pane label.atlas-sounds-toggle:focus-within {
  color: inherit;
  background: transparent;
  box-shadow: none;
  translate: 0;
}

.atlas-sounds-toggle__copy {
  display: grid;
  min-width: 0;
  flex: 1 1 auto;
  gap: 4px;
}

.atlas-sounds-toggle__title {
  color: var(--atlas-ink);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 23px;
  font-weight: 700;
  line-height: 1.05;
}

.atlas-sounds-toggle__description {
  color: var(--atlas-ink-soft);
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 11px;
  line-height: 1.55;
}

.atlas-sounds-toggle__input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.atlas-sounds-toggle__track {
  position: relative;
  box-sizing: border-box;
  width: 52px;
  height: 29px;
  flex: 0 0 52px;
  border: 1px solid var(--atlas-gold);
  border-radius: 999px;
  background: rgba(80, 53, 34, 0.28);
  box-shadow: inset 0 2px 5px rgba(42, 24, 13, 0.22);
  transition:
    border-color 140ms ease,
    background-color 140ms ease,
    box-shadow 140ms ease;
}

.atlas-sounds-toggle__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  box-sizing: border-box;
  width: 21px;
  height: 21px;
  border: 1px solid rgba(255, 239, 195, 0.62);
  border-radius: 50%;
  background: linear-gradient(var(--atlas-gold-light), var(--atlas-gold));
  box-shadow: 0 2px 5px rgba(46, 25, 13, 0.3);
  transition: translate 150ms cubic-bezier(0.22, 0.72, 0.24, 1);
}

.atlas-sounds-toggle__input:checked + .atlas-sounds-toggle__track {
  border-color: var(--atlas-gold-light);
  background: var(--atlas-oxblood);
  box-shadow:
    inset 0 2px 5px rgba(42, 14, 12, 0.3),
    0 0 0 1px rgba(216, 183, 110, 0.12);
}

.atlas-sounds-toggle__input:checked + .atlas-sounds-toggle__track::after {
  translate: 23px 0;
}

.atlas-sounds-toggle__input:focus-visible + .atlas-sounds-toggle__track {
  outline: 2px solid var(--atlas-gold-light);
  outline-offset: 3px;
}

.atlas-sounds-toggle__input:disabled + .atlas-sounds-toggle__track {
  opacity: 0.52;
  cursor: not-allowed;
}

.atlas-sounds-card__status {
  margin: 13px 0 0;
  padding-top: 11px;
  border-top: 1px solid rgba(103, 77, 50, 0.2);
  color: var(--atlas-ink-soft);
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 10px;
  font-style: italic;
  line-height: 1.55;
}

@media (max-width: 767px) {
  .sidebar {
    border-width: 0 1px 0 0;
    border-radius: 0;
  }

  .sidebar-pane label {
    min-height: 46px;
  }

  .sidebar-tabs > li,
  .sidebar-tabs > ul > li {
    height: 44px;
  }

  .sidebar-tabs,
  .sidebar-tabs > ul {
    width: 44px;
  }

  .sidebar-left .sidebar-content {
    left: 44px;
  }

  .sidebar.collapsed {
    width: 44px;
  }

  .sidebar-pane button.atlas-chapter-card {
    min-height: 82px;
    grid-template-columns: 42px minmax(0, 1fr) 18px;
    gap: 10px;
  }

  .atlas-chapter-card__medallion {
    width: 38px;
    height: 38px;
  }

  .atlas-place-list {
    grid-template-columns: 1fr;
  }

  .sidebar-pane button.atlas-place-card {
    min-height: 52px;
  }
}

/* Keep the chapter rail usable on short mobile landscape viewports. */
@media (orientation: landscape) and (max-height: 520px) and (max-width: 1024px) {
  .sidebar-tabs {
    display: flex;
    flex-direction: column;
    width: 44px;
    overflow: hidden;
  }

  .sidebar-tabs > ul {
    position: static;
    width: 44px;
  }

  .sidebar-tabs > ul:first-child {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scroll-snap-type: y proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar-tabs > ul:first-child::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
  }

  .sidebar-tabs > ul + ul {
    position: static;
    bottom: auto;
    z-index: 2;
    flex: 0 0 auto;
    border-top: 1px solid rgba(216, 183, 110, 0.72);
    background: linear-gradient(90deg, var(--atlas-walnut-950), var(--atlas-walnut-800));
    box-shadow: 0 -10px 16px rgba(8, 4, 2, 0.45);
  }

  .sidebar-tabs > li,
  .sidebar-tabs > ul > li {
    height: 44px;
    min-height: 44px;
    scroll-snap-align: start;
  }

  .sidebar-left .sidebar-content {
    left: 44px;
  }

  .sidebar-right .sidebar-content {
    right: 44px;
  }

  .sidebar.collapsed {
    width: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar,
  #map::after,
  .sidebar-pane label,
  .sidebar-pane button,
  .story-launch-card__button,
  .leaflet-marker-icon.atlas-marker-icon,
  .leaflet-bar a,
  .atlas-map-nav__link,
  .atlas-map-nav__toggle,
  .atlas-sounds-toggle__track,
  .atlas-sounds-toggle__track::after,
  .atlas-chapter-card,
  .atlas-chapter-card__chevron,
  .atlas-place-card,
  .atlas-index-link,
  .atlas-index-link > :last-child {
    transition: none;
  }
}
