@view-transition { navigation: auto; }

:root {
  --bg: #f6f1e7; --fg: #2a241c; --muted: #6f6556; --line: #ddd2bf; --card: #fffaf0; --accent: #8a4b1f; --accent-fg: #fff;
  --serif: "Fraunces", Georgia, serif; --sans: "Inter", system-ui, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #16130f; --fg: #eee5d6; --muted: #a59a88; --line: #3a332a; --card: #211d17; --accent: #e3a066; --accent-fg: #1a140d; }
}

* { box-sizing: border-box; }
html, body { overflow-x: clip; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 400 15px/1.5 var(--sans); }
a { color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
button, select, input { font: inherit; color: inherit; }

/* header */
.hero { padding: clamp(28px, 6vw, 72px) 16px 16px; max-width: 1100px; margin: auto; text-align: center; }
.eyebrow { margin: 0; color: var(--muted); letter-spacing: .14em; text-transform: uppercase; font-size: 12px; }
.hero h1 { font: 600 clamp(38px, 7vw, 76px)/1 var(--serif); margin: .15em 0 .45em; letter-spacing: -.02em; }
.search { position: relative; max-width: 680px; margin: auto; }
.search input { width: 100%; padding: 16px 130px 16px 20px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font-size: 17px; outline: none; transition: box-shadow .2s, border-color .2s; }
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }
.search output { position: absolute; right: 20px; top: 50%; translate: 0 -50%; color: var(--muted); font-size: 13px; pointer-events: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 14px; }
.chip { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 4px 12px; font-size: 13px; cursor: pointer; text-transform: capitalize; transition: background .15s, color .15s; }
.chip:hover { background: var(--card); }
.chip.on { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }

/* filters */
.filters { max-width: 1400px; margin: 8px auto 0; padding: 0 16px; }
.timeline { border-top: 1px solid var(--line); padding-top: 12px; }
.tl-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.hist { display: flex; gap: 3px; align-items: flex-end; height: 74px; margin-top: 6px; overflow-x: auto; scrollbar-width: none; }
.bar { flex: 1 1 0; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; border: 0; background: none; padding: 0; cursor: pointer; }
.bar i { display: block; height: calc(var(--h) * 52px + 2px); background: color-mix(in srgb, var(--accent) 45%, var(--line)); border-radius: 3px 3px 0 0; transition: height .35s cubic-bezier(.2, .8, .2, 1), background .2s; }
.bar span { font-size: 10px; color: var(--muted); margin-top: 3px; }
.bar:hover i { background: color-mix(in srgb, var(--accent) 75%, var(--line)); }
.bar.on i { background: var(--accent); }
.bar.zero { opacity: .35; }
@media (max-width: 700px) { .bar.odd span { visibility: hidden; } }
.range { position: relative; height: 22px; margin-top: 4px; }
.range::before, .range::after { content: ""; position: absolute; top: 9px; height: 4px; border-radius: 2px; }
.range::before { left: 0; right: 0; background: var(--line); }
.range::after { left: var(--a, 0%); right: calc(100% - var(--b, 100%)); background: var(--accent); }
.range input { position: absolute; inset: 0; width: 100%; margin: 0; background: none; pointer-events: none; appearance: none; z-index: 1; }
.range input::-webkit-slider-thumb { appearance: none; pointer-events: auto; width: 20px; height: 20px; border-radius: 50%; background: var(--card); border: 2px solid var(--accent); cursor: grab; box-shadow: 0 1px 4px rgb(0 0 0 / .25); }
.range input::-moz-range-thumb { pointer-events: auto; width: 16px; height: 16px; border-radius: 50%; background: var(--card); border: 2px solid var(--accent); cursor: grab; }
.range input:focus-visible::-webkit-slider-thumb { outline: 3px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.years { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-top: 8px; font-size: 13px; color: var(--muted); }
.years input { width: 5.5em; margin-left: 6px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.years small { font-size: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.row select { margin-left: 6px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); max-width: 46vw; }
.toggle { display: flex; gap: 6px; align-items: center; cursor: pointer; }
.toggle input { accent-color: var(--accent); }
.link { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 3px; }

/* justified grid: flex-grow proportional to aspect ratio keeps each row the same height */
.grid { display: flex; flex-wrap: wrap; gap: 6px; padding: 16px; max-width: 1400px; margin: auto; --row: clamp(140px, 22vw, 240px); }
.grid::after { content: ""; flex-grow: 999999; }
.tile { position: relative; min-width: 0; flex: calc(var(--ar) * 100) 1 calc(var(--ar) * var(--row)); aspect-ratio: var(--ar); max-height: calc(var(--row) * 1.6); overflow: hidden; border-radius: 6px; background: var(--col); text-decoration: none; content-visibility: auto; contain-intrinsic-size: auto var(--row); }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: scale .5s cubic-bezier(.2, .8, .2, 1), filter .4s; }
.tile:hover img, .tile:focus-visible img { scale: 1.05; }
.tile:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.cap { position: absolute; inset: auto 0 0; padding: 28px 10px 8px; color: #fff; background: linear-gradient(transparent, rgb(0 0 0 / .75)); opacity: 0; translate: 0 8px; transition: opacity .25s, translate .25s; display: flex; flex-direction: column; font-size: 13px; line-height: 1.3; }
.cap b { font-weight: 500; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cap small { opacity: .8; }
.tile:hover .cap, .tile:focus-visible .cap { opacity: 1; translate: 0; }
@media (hover: none) { .cap { opacity: 1; translate: 0; padding-top: 22px; } .cap small { display: none; } }
.badge { position: absolute; top: 8px; right: 8px; background: rgb(0 0 0 / .6); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 999px; backdrop-filter: blur(4px); }
.empty { text-align: center; color: var(--muted); padding: 60px 16px; }

@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .tile { animation: rise linear both; animation-timeline: view(); animation-range: entry 0% entry 60%; }
    @keyframes rise { from { opacity: 0; translate: 0 24px; scale: .97; } }
  }
}

/* photo page */
.bar.brand, .brand { text-decoration: none; }
header.bar { position: sticky; top: 0; z-index: 2; padding: 14px 16px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); height: auto; display: block; }
header.bar .brand { font: 600 17px var(--serif); }
.photo { max-width: 1400px; margin: auto; padding: 24px 16px 60px; display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 32px; align-items: start; }
@media (max-width: 860px) { .photo { grid-template-columns: minmax(0, 1fr); } }
.photo figure { margin: 0; position: sticky; top: 72px; }
@media (max-width: 860px) { .photo figure { position: static; } }
.photo figure img { width: 100%; height: auto; display: block; border-radius: 8px; background: var(--col); box-shadow: 0 20px 50px -20px rgb(0 0 0 / .45); cursor: zoom-in; }
.info h1 { font: 600 clamp(26px, 3.4vw, 40px)/1.12 var(--serif); margin: 0 0 12px; letter-spacing: -.01em; }
.desc { font-size: 16px; }
.info dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 20px 0; padding: 16px 0; border-block: 1px solid var(--line); }
.info dt { color: var(--muted); font-size: 13px; }
.info dd { margin: 0; }
.actions, .pn { display: flex; flex-wrap: wrap; gap: 10px; }
.pn { justify-content: space-between; margin-top: 18px; }
.btn { display: inline-block; padding: 9px 16px; border-radius: 999px; background: var(--accent); color: var(--accent-fg); text-decoration: none; font-size: 14px; font-weight: 500; transition: filter .15s; }
.btn:hover { filter: brightness(1.08); }
.btn.ghost, .pn .btn { background: transparent; color: var(--fg); border: 1px solid var(--line); }
.info h2 { font: 600 16px var(--serif); margin: 28px 0 10px; }
.strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
.strip a { flex: none; scroll-snap-align: start; border-radius: 6px; overflow: hidden; outline-offset: 2px; }
.strip img { height: 96px; width: auto; display: block; transition: scale .3s; }
.strip a:hover img { scale: 1.06; }
.strip a[aria-current] { outline: 3px solid var(--accent); }

.viewer { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgb(10 8 6 / .96); overflow: auto; display: grid; }
.viewer:not([open]) { display: none; }
.viewer::backdrop { background: transparent; }
.viewer img { max-width: 100vw; max-height: 100vh; margin: auto; cursor: zoom-in; }
.viewer.one img { max-width: none; max-height: none; width: 200%; cursor: zoom-out; }
.viewer .close { position: fixed; top: 12px; right: 16px; z-index: 1; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgb(255 255 255 / .15); color: #fff; font-size: 26px; cursor: pointer; }
.viewer[open] { animation: fade .25s; }
@keyframes fade { from { opacity: 0; } }

.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 40px 16px; border-top: 1px solid var(--line); margin-top: 40px; }

::view-transition-old(root), ::view-transition-new(root) { animation-duration: .3s; }
::view-transition-group(*) { animation-duration: .45s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
@media (prefers-reduced-motion: reduce) { ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; } }

@media (max-width: 600px) { .search input { padding-right: 20px; } .search output { position: static; display: block; translate: none; margin-top: 8px; text-align: center; } .eyebrow { font-size: 10px; } }

/* view switch */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--card); }
.seg button { border: 0; background: none; padding: 5px 14px; border-radius: 999px; cursor: pointer; font-size: 13px; color: var(--muted); transition: background .2s, color .2s; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); }
.muted { color: var(--muted); }
.info dd small.muted { margin-left: 6px; font-size: 12px; }

/* map: same paper palette, fonts and accent as the rest of the site */
#mapView { max-width: 1400px; margin: auto; padding: 16px; view-transition-name: content; }
#grid { view-transition-name: content; }
.map { height: min(72vh, 760px); min-height: 380px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); overflow: hidden; }
.map-note { color: var(--muted); font-size: 13px; margin: 10px 2px 0; }
.leaflet-container { font: 400 14px/1.4 var(--sans); background: var(--bg); }
.leaflet-container a { color: var(--accent); }
.leaflet-tile-pane { filter: grayscale(1) sepia(.35) contrast(.88) brightness(1.04); opacity: .9; }
@media (prefers-color-scheme: dark) { .leaflet-tile-pane { filter: grayscale(1) invert(1) sepia(.3) contrast(.82) brightness(.85); opacity: 1; } }
.leaflet-bar { border: 1px solid var(--line) !important; border-radius: 10px !important; overflow: hidden; box-shadow: none !important; }
.leaflet-bar a, .leaflet-bar a:hover { background: var(--card); color: var(--fg); border-color: var(--line); }
.leaflet-bar a:hover { background: var(--bg); }
.leaflet-control-attribution { background: color-mix(in srgb, var(--card) 85%, transparent) !important; color: var(--muted); font-size: 11px; }
.leaflet-control-attribution a { color: var(--muted) !important; }

.pin { display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: var(--accent-fg); border: 2px solid var(--card);
  font: 600 12px var(--sans); box-shadow: 0 4px 14px -4px rgb(0 0 0 / .45); transition: scale .2s cubic-bezier(.2, .8, .2, 1); }
.pin:hover, .pin:focus-visible { scale: 1.12; }
.pin:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.pin-s { background: color-mix(in srgb, var(--accent) 70%, var(--card)); }
.pin-c { background: var(--fg); color: var(--bg); }
.marker-cluster-anim .leaflet-marker-icon, .marker-cluster-anim .leaflet-marker-shadow { transition: transform .3s ease-out, opacity .3s ease-in; }
.pin-a { background: color-mix(in srgb, var(--card) 80%, transparent); color: var(--accent); border: 2px dashed var(--accent); }
@media (prefers-reduced-motion: no-preference) { .pin { animation: pop .35s cubic-bezier(.2, .8, .2, 1) both; } @keyframes pop { from { scale: .4; opacity: 0; } } }

.leaflet-popup-content-wrapper { background: var(--card); color: var(--fg); border-radius: 12px; box-shadow: 0 18px 44px -14px rgb(0 0 0 / .45); }
.leaflet-popup-tip { background: var(--card); }
.leaflet-popup-content { margin: 14px 16px; font: 14px/1.4 var(--sans); }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.mp h3 { font: 600 16px/1.2 var(--serif); margin: 0 18px 4px 0; }
.mp p { margin: 0 0 10px !important; font-size: 12px; }
.mp-thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-bottom: 12px; }
.mp-thumbs a { aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: var(--line); }
.mp-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; transition: scale .3s; }
.mp-thumbs a:hover img { scale: 1.08; }
.mp .btn { border: 0; cursor: pointer; width: 100%; color: var(--accent-fg) !important; }
