:root {
  color-scheme: light;
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: var(--color-canvas, #f4efe5); }
body {
  min-height: 100vh;
  margin: 0;
  padding: 82px clamp(16px, 5vw, 80px) 26px;
  color: var(--atlas-ink);
  font-family: var(--font-family);
  background: var(--color-canvas, #f4efe5);
}
body.theme-atlas {
  --color-ink: #302a28;
  --color-muted: #726763;
  --color-line: #ded4c6;
  --color-highlight: #e9c08f;
  --color-surface: #fffdf8;
  --atlas-ink: var(--color-ink);
  --atlas-muted: #625752;
  --atlas-faint: #625752;
  --atlas-line: rgba(119, 73, 54, .22);
  --atlas-sun: var(--color-accent-strong, #774936);
  --atlas-panel: var(--color-surface-raised, #fffaf2);
  --atlas-panel-hover: #f4e9dc;
  --atlas-timeline: rgba(169, 103, 72, .28);
}
button, a { font: inherit; }
button:focus-visible, a:focus-visible { outline: var(--focus-ring, 2px solid #a96748); outline-offset: 4px; }
.skip-link { position: absolute; z-index: 1000; top: 8px; left: 8px; padding: 10px 14px; transform: translateY(-160%); color: #302a28; background: var(--color-highlight, #e9c08f); border-radius: 8px; }
.skip-link:focus { transform: translateY(0); }
.atlas-header { max-width: 1280px; margin: 0 auto 24px; }
.back-link { display: inline-flex; gap: 9px; align-items: center; margin-bottom: 22px; color: var(--atlas-muted); text-decoration: none; font: 500 .8rem/1.4 var(--font-family); }
.back-link:hover { color: var(--color-accent-strong, #774936); }
.eyebrow { margin: 0 0 10px; color: var(--atlas-sun); font: 500 .65rem/1.4 var(--font-family); letter-spacing: .18em; text-transform: uppercase; }
.atlas-header h1 { max-width: 1100px; margin: 0; font-size: clamp(2.2rem, 4.1vw, 3.8rem); font-weight: 400; letter-spacing: -.045em; line-height: 1.12; }
.atlas-header h1 em { color: var(--color-accent-strong, #774936); font-style: normal; }
.atlas-intro { max-width: 570px; margin: 14px 0 0; color: var(--atlas-muted); font-size: clamp(.95rem, 1.5vw, 1.08rem); line-height: 1.8; }
.atlas-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(310px, .8fr); gap: clamp(18px, 3vw, 42px); align-items: start; max-width: 1440px; margin: 0 auto; }
.map-column, .memory-column { min-width: 0; }
.map-heading-row { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 14px; }
.map-heading-row h2, .section-heading h2 { margin: 0; font-size: clamp(1.35rem, 2.4vw, 1.8rem); font-weight: 400; letter-spacing: -.035em; }
.map-controls-row { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.atlas-location-picker { display: grid; flex: 1 1 260px; gap: 5px; max-width: 360px; color: var(--atlas-muted); font: .68rem/1.4 var(--font-family); }
.atlas-location-picker select { width: 100%; min-height: 44px; padding: 7px 42px 7px 13px; appearance: none; -webkit-appearance: none; border: 1px solid var(--atlas-line); border-radius: var(--radius-control, 999px); color: var(--atlas-ink); background: var(--atlas-panel); font: .78rem/1.4 var(--font-family); }
.atlas-location-picker select:focus-visible { outline: var(--focus-ring, 2px solid #a96748); outline-offset: 3px; }
.map-hint { margin: 0 0 4px; color: var(--atlas-muted); font: .68rem/1.5 var(--font-family); }
.map-toolbar { display: flex; flex: 0 1 auto; align-items: center; justify-content: flex-end; gap: 12px; }
.atlas-overview-button { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 5px 12px; border: 1px solid var(--atlas-line); border-radius: var(--radius-control, 999px); color: var(--atlas-ink); background: rgba(255,253,248,.72); cursor: pointer; font: .65rem/1.3 var(--font-family); }
.atlas-overview-button[hidden] { display: none; }
.atlas-overview-button:hover { border-color: rgba(119,73,54,.36); color: var(--color-accent-strong, #774936); background: #fffdf8; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { display: inline-block; width: 1.1em; height: 1.1em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.18em; }
.atlas-map { width: 100%; height: min(68vh, 760px); min-height: 480px; overflow: hidden; border: 1px solid rgba(119,73,54,.18); border-radius: var(--radius-panel, 20px); background: #dce6e3; box-shadow: var(--shadow-soft, 0 24px 70px rgba(67,46,34,.12)); }
.atlas-map .leaflet-container { font: inherit; background: #dce6e3; }
.atlas-map .leaflet-container .leaflet-popup-close-button { font-family: var(--font-family); }
.atlas-map .leaflet-control-zoom a { color: var(--color-accent-strong, #774936); background: rgba(255,253,248,.96); border-color: rgba(119,73,54,.2); }
.atlas-map .leaflet-control-zoom a { display: grid; width: 36px; height: 36px; place-items: center; text-decoration: none; }
.atlas-map .leaflet-control-zoom a:hover { color: #fffaf2; background: var(--color-accent-strong, #774936); }
.map-disclaimer { margin: 10px 0 0; color: var(--atlas-muted); font: .69rem/1.6 var(--font-family); }
.memory-column { display: grid; gap: 18px; }
.atlas-viewer, .memory-index { overflow: hidden; border: 1px solid var(--atlas-line); border-radius: var(--radius-card, 14px); background: var(--atlas-panel); box-shadow: var(--shadow-float, 0 8px 28px rgba(67,46,34,.08)); }
.atlas-viewer { min-height: 0; }
.atlas-viewer-empty { display: grid; min-height: 188px; align-content: center; justify-items: center; gap: 9px; margin: 0; padding: 28px; color: var(--atlas-muted); text-align: center; font-size: .95rem; line-height: 1.6; }
.atlas-viewer-empty .icon { width: 24px; height: 24px; color: var(--atlas-sun); stroke-width: 1.6; }
.atlas-viewer-empty span { display: block; }
.atlas-viewer-empty small { max-width: 31ch; color: var(--atlas-muted); font-size: .75rem; line-height: 1.6; }
.atlas-photo { position: relative; width: min(100%, 390px, 48vh); margin: 0 auto; background: #e9dfd3; }
.atlas-photo-expand { position: absolute; z-index: 2; top: 12px; right: 12px; display: grid; width: 40px; height: 40px; place-items: center; border: 1px solid rgba(255,255,255,.6); border-radius: 50%; color: #fff7ed; background: rgba(17,25,39,.72); cursor: zoom-in; }
.atlas-photo-expand:hover { color: var(--atlas-sun); background: rgba(17,25,39,.92); }
.atlas-photo::after { position: absolute; inset: 45% 0 0; content: ""; background: linear-gradient(transparent, rgba(10, 15, 25, .62)); pointer-events: none; }
.atlas-photo figcaption { position: absolute; z-index: 1; right: 18px; bottom: 15px; color: #fff7ed; font: .7rem/1.4 var(--font-family); letter-spacing: .08em; }
.atlas-memory-copy { padding: 19px 22px 20px; }
.atlas-place-label { margin: 0 0 8px; color: var(--color-accent-strong, #774936); font: .65rem/1.4 var(--font-family); letter-spacing: .09em; }
.atlas-memory-copy h2 { margin: 0; font-size: 1.28rem; font-weight: 400; letter-spacing: -.03em; line-height: 1.3; }
.atlas-memory-copy > p:not(.atlas-place-label) { margin: 9px 0 0; color: var(--atlas-muted); font-size: .84rem; line-height: 1.65; }
.atlas-album-link { display: inline-flex; gap: 7px; align-items: center; margin-top: 12px; color: var(--color-accent-strong, #774936); font: .68rem/1.4 var(--font-family); text-decoration: none; }
.atlas-album-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.atlas-navigation { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--atlas-line); color: var(--atlas-faint); font: .67rem/1.4 var(--font-family); }
.atlas-navigation button { min-height: 44px; padding: 5px 7px; border: 0; border-radius: 8px; color: var(--atlas-ink); background: transparent; cursor: pointer; }
.atlas-navigation button:hover:not(:disabled) { color: var(--color-accent-strong, #774936); background: var(--atlas-panel-hover); }
.atlas-navigation button:disabled { color: rgba(114,103,99,.48); cursor: default; }
.memory-index { padding: 20px 20px 12px; }
.section-heading { margin-bottom: 14px; }
.section-heading h2 { font-size: 1.15rem; }
.atlas-memory-list { position: relative; display: flex; align-items: stretch; gap: 0; width: 100%; max-height: 220px; margin: 0; padding: 20px 4px 8px 0; overflow-x: auto; overflow-y: hidden; list-style: none; scroll-snap-type: x proximity; scrollbar-color: rgba(119,73,54,.3) transparent; scrollbar-width: thin; }
.atlas-memory-list > li { position: relative; flex: 0 0 204px; min-width: 0; padding: 20px 9px 0; scroll-snap-align: center; }
.atlas-memory-list > li::before, .atlas-memory-list > li::after { position: absolute; top: 5px; content: ""; }
.atlas-memory-list > li::before { z-index: 1; left: 17px; width: 12px; height: 12px; border: 2px solid var(--atlas-panel); border-radius: 50%; background: rgba(169,103,72,.42); box-shadow: 0 0 0 1px rgba(119,73,54,.28); }
.atlas-memory-list > li::after { z-index: 0; top: 10px; left: 17px; width: 100%; height: 1px; background: var(--atlas-timeline); }
.atlas-memory-list > li:last-child::after { display: none; }
.atlas-memory-list > li.is-active::before { background: var(--color-accent-strong, #774936); box-shadow: 0 0 0 4px rgba(169,103,72,.12), 0 0 10px rgba(169,103,72,.35); }
.atlas-memory-link, .atlas-memory-fallback { position: relative; z-index: 1; display: grid; width: 100%; min-height: 106px; align-content: start; gap: 6px; padding: 11px 12px; border: 1px solid transparent; border-radius: 11px; color: var(--atlas-ink); text-align: left; background: var(--atlas-panel); scroll-snap-align: center; transition: background-color 160ms ease, border-color 160ms ease; }
.atlas-memory-link { cursor: pointer; }
.atlas-memory-fallback { grid-template-columns: 46px 1fr; align-items: center; gap: 12px; text-decoration: none; }
.atlas-memory-fallback:hover, .atlas-memory-fallback:focus-visible { border-color: rgba(119,73,54,.24); background: var(--atlas-panel-hover); }
.atlas-memory-fallback .atlas-memory-thumbnail { width: 46px; border-radius: 7px; background: #e9dfd3; }
.atlas-memory-fallback span { display: grid; gap: 4px; }
.atlas-memory-fallback time { color: var(--atlas-muted); font: .62rem/1.4 var(--font-family); letter-spacing: .04em; }
.atlas-memory-fallback strong { font-size: .85rem; font-weight: 400; line-height: 1.4; }
.atlas-memory-link:hover, .atlas-memory-link[aria-current="true"], .atlas-memory-fallback:hover, .atlas-memory-fallback:focus-visible { border-color: rgba(119,73,54,.5); background: #f0e1d3; }
.atlas-memory-link[aria-current="true"] strong { color: #5f3828; font-weight: 600; }
.atlas-memory-link span, .atlas-memory-link small { color: var(--atlas-muted); font: .62rem/1.4 var(--font-family); letter-spacing: .04em; }
.atlas-memory-link strong { font-size: .85rem; font-weight: 400; line-height: 1.4; }
.atlas-memory-link small { color: var(--color-accent-strong, #774936); }
.atlas-footer { max-width: 1440px; margin: 42px auto 0; padding-top: 15px; border-top: 1px solid var(--atlas-line); color: var(--atlas-faint); text-align: center; font: .64rem/1.5 var(--font-family); letter-spacing: .15em; }
.atlas-viewer:focus { outline: 2px solid var(--atlas-sun); outline-offset: 4px; }
.atlas-marker { border: 0; background: transparent; }
.atlas-marker > span { position: relative; display: grid; width: 42px; height: 48px; place-items: start center; filter: drop-shadow(0 3px 5px rgba(61,42,31,.28)); }
.atlas-marker-pin { width: 42px; height: 48px; color: var(--color-accent-strong, #774936); stroke-width: 1.8; }
.atlas-marker-count { position: absolute; top: 7px; left: 50%; display: grid; width: 19px; height: 19px; place-items: center; border-radius: 50%; color: #36272a; background: #fff2df; font: 600 .6rem/1 var(--font-family); transform: translateX(-50%); }
.atlas-marker--active > span { filter: drop-shadow(0 0 7px rgba(169,103,72,.42)) drop-shadow(0 3px 5px rgba(61,42,31,.28)); transform: translateY(-4px) scale(1.12); }
.atlas-marker--active .atlas-marker-pin { color: #a96748; stroke-width: 2.2; }
.atlas-cluster { border: 0; background: transparent; }
.atlas-cluster > span { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid rgba(119,73,54,.5); border-radius: 50%; color: #302a28; background: #e9c08f; box-shadow: 0 3px 9px rgba(61,42,31,.2); font: 600 .72rem/1 var(--font-family); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.atlas-cluster:focus-visible { outline: 2px solid var(--color-accent-strong, #774936); outline-offset: 3px; border-radius: 50%; }
.atlas-marker:focus-visible { outline: 2px solid var(--color-accent-strong, #774936); outline-offset: 4px; border-radius: 50%; }
.leaflet-marker-icon.atlas-marker { overflow: visible; }
.leaflet-marker-icon.atlas-marker:focus { outline: 2px solid var(--color-accent-strong, #774936); outline-offset: 2px; border-radius: 50%; }

@media (max-width: 1000px) {
  body { padding-right: clamp(16px, 4vw, 40px); padding-left: clamp(16px, 4vw, 40px); }
  .atlas-layout { grid-template-columns: minmax(0, 1fr); }
  .atlas-map { height: min(62vh, 680px); min-height: 430px; }
  .memory-column { grid-template-columns: minmax(0, 1fr) minmax(0, .85fr); align-items: start; }
  .atlas-photo { width: min(100%, 390px, 48vh); }
}
@media (max-width: 640px) {
  body { padding: 18px 14px 22px; }
  body.theme-atlas { padding-top: max(72px, calc(env(safe-area-inset-top) + 64px)); }
  .atlas-header { margin-bottom: 25px; }
  .back-link { margin-bottom: 18px; }
  .atlas-header h1 { font-size: clamp(2rem, 8.5vw, 2.8rem); }
  .atlas-intro { margin-top: 12px; font-size: .9rem; }
  .map-heading-row { align-items: center; margin-bottom: 10px; }
  .map-controls-row { align-items: stretch; gap: 8px; }
  .atlas-location-picker { flex-basis: 100%; max-width: none; }
  .map-toolbar { width: 100%; justify-content: flex-end; }
  .map-hint { display: none; }
  .atlas-overview-button { min-height: 40px; }
  .atlas-map { height: min(64vw, 260px); min-height: 220px; border-radius: 16px; }
  .atlas-map .leaflet-top.leaflet-left { top: auto; bottom: 10px; }
  .atlas-map .leaflet-top.leaflet-left .leaflet-control { margin-bottom: 0; }
  .memory-column { grid-template-columns: minmax(0, 1fr); }
  .atlas-viewer { min-height: 0; }
  .atlas-viewer-empty { min-height: 144px; padding: 22px 18px; }
  .atlas-photo { width: min(100%, 390px, 54vh); }
  .memory-index { padding: 18px 14px 10px; }
  .atlas-memory-list { max-height: 220px; }
  .atlas-memory-list > li { flex-basis: 182px; }
  .atlas-footer { margin-top: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
