/* Place page (place.html). Palette and typography come from base.css. */
body { color: var(--fg); min-height: 100svh; }

.back, .lb-btn, .slider-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; min-width: 44px; padding: 0 1.1rem;
  background: rgba(21, 26, 24, .72); color: var(--paper); border: 1px solid rgba(246, 244, 238, .28);
  font: inherit; font-size: .75rem; letter-spacing: .2em; text-transform: uppercase; text-decoration: none; cursor: pointer;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.back:hover, .lb-btn:hover, .slider-btn:hover { border-color: var(--river-light); }
/* below the menu bar, and part of the page: it scrolls away with the header instead of covering the text */
.back { position: absolute; top: 76px; left: var(--gutter); z-index: 20; border-radius: 999px; background: rgba(21, 26, 24, .8); border-color: rgba(246, 244, 238, .16); }

/* every place has the same layout: a low dark header, a slider of all its photos, then the text */
.place-head {
  /* the top padding leaves room for the menu bar and the back button above the title */
  box-sizing: border-box; min-height: 196px; padding: 136px var(--gutter) 16px;
  display: flex; flex-direction: column; justify-content: flex-end; background: var(--deep);
}
.place-head .eyebrow { margin-bottom: .5rem; }
.place-head h1 { font-family: var(--serif); font-weight: 400; line-height: 1; letter-spacing: -.01em; font-size: clamp(1.8rem, 8vw, 2.2rem); overflow-wrap: break-word; }
@media (min-width: 769px) {
  .place-head { min-height: 216px; padding: 136px var(--gutter) 18px; }
  .place-head h1 { font-size: clamp(2.2rem, 3.6vw, 2.7rem); }
}

/* a place with a hero photo: the photo fills the header (cropped, never a frame), the title sits on a dark gradient at the bottom */
.place-head { position: relative; overflow: hidden; }
.place-head-text { position: relative; z-index: 2; pointer-events: none; }
.place-hero, .hero-open { position: absolute; inset: 0; }
.place-hero[hidden], .hero-open[hidden] { display: none; }
.place-hero img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: var(--pos-m, 50% 50%); }
.hero-open { z-index: 1; padding: 0; border: 0; background: linear-gradient(to top, rgba(21, 26, 24, .88) 0%, rgba(21, 26, 24, .35) 45%, rgba(21, 26, 24, .25) 100%); cursor: zoom-in; }
.place-head.has-hero { min-height: clamp(300px, 58svh, 520px); padding-bottom: clamp(22px, 4svh, 40px); }
.place-head.has-hero h1 { font-size: clamp(2.2rem, 10vw, 3rem); text-shadow: 0 1px 14px rgba(21, 26, 24, .55); }
.hero-page .place-hero { view-transition-name: place-hero; }
@media (min-width: 769px) {
  .place-hero img { object-position: var(--pos, 50% 50%); }
  .place-head.has-hero { min-height: clamp(420px, 68svh, 680px); }
  .place-head.has-hero h1 { font-size: clamp(3rem, 5.4vw, 4.6rem); }
}

/* the slider: one row of photos at a fixed height, each in its own proportions (no crop, no frame). A photo smaller than the row
   is shown at its own size, centred in the row, and is never enlarged: the img has width and height auto and only a maximum.
   Snapping to the start edge and a maximum width a little under the screen width leave the next photo showing at the right edge. */
.place-slider { --row-h: 300px; background: #212825; padding-top: 12px; }
.place-slider[hidden] { display: none; }
@media (min-width: 769px) { .place-slider { --row-h: 440px; } }
.slider-track {
  position: relative; display: flex; gap: 12px; height: var(--row-h);
  overflow-x: auto; overflow-y: hidden; padding: 0 var(--gutter); scroll-padding-inline: var(--gutter);
  scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none;
}
.slider-track::-webkit-scrollbar { display: none; }
.slider-track:focus-visible { outline-offset: -3px; }
.slide { flex: none; display: flex; align-items: center; margin: 0; scroll-snap-align: start; position: relative; }
.slide-caption { position: absolute; bottom: 8px; left: 0; max-width: 100%; padding: .3rem .6rem; color: var(--paper); background: #212825; font-size: .8rem; pointer-events: none; }
/* "Archive" / year label on old photos (places.js archive) */
.slide-tag { position: absolute; top: 8px; left: 8px; padding: 3px 7px; background: rgba(21, 26, 24, .82); color: var(--paper); font-size: .62rem; letter-spacing: .18em; text-transform: uppercase; line-height: 1.3; pointer-events: none; }
/* its name matches the card photo on the home page so the browser can fly one into the other */
body:not(.hero-page) .slide:first-child .slide-open { view-transition-name: place-hero; }
.slide-open { display: block; margin: 0; padding: 0; border: 0; background: none; line-height: 0; cursor: zoom-in; }
.slide-open > div { display: block; }
.slide-open img { display: block; width: auto; height: auto; max-height: var(--row-h); max-width: calc(100vw - var(--gutter) - 48px); }
.slider-bar { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-height: 44px; padding: 10px var(--gutter) 14px; }
.slider-bar[hidden] { display: none; }
.slider-count { margin: 0; min-width: 4.5em; text-align: center; font-size: .8rem; letter-spacing: .2em; color: var(--fg-muted); }
.slider-btn { font-size: 1.2rem; letter-spacing: 0; }
.slider-btn:disabled { opacity: .35; cursor: default; }
.slider-btn:disabled:hover { border-color: rgba(246, 244, 238, .28); }
.slider-btn[hidden] { display: none; }
/* on phones the photos are swiped: no arrows, only the counter */
@media (max-width: 768px) { .slider-btn { display: none; } .slider-count { min-width: 0; } }

.place-body {
  padding: clamp(36px, 6svh, 64px) var(--gutter) clamp(48px, 9svh, 100px);
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 2rem;
  grid-template-areas: "facts" "text" "map";
}
@media (min-width: 900px) {
  .place-body { grid-template-columns: minmax(0, 65ch) minmax(300px, 1fr); column-gap: clamp(40px, 6vw, 96px); row-gap: 1.6rem; grid-template-areas: "text facts" "text map" "text ."; align-items: start; }
  .place-map-wrap { max-width: 520px; }
}
/* distance and the link to the map */
.place-facts { grid-area: facts; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem 1.6rem; padding-bottom: 1.2rem; border-bottom: 1px solid var(--rule); }
.place-facts[hidden] { display: none; }
.place-facts dl { display: flex; flex-wrap: wrap; gap: .8rem 2rem; }
.place-facts dl > div[hidden] { display: none; }
.place-facts dt { font-size: .75rem; letter-spacing: .2em; text-transform: uppercase; color: var(--acc); }
.place-facts dd { margin: .2rem 0 0; font-family: var(--serif); font-size: 1.7rem; line-height: 1.1; }
.facts-link { display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; padding: 0 1.1rem; border: 1px solid var(--acc); color: var(--fg); font-size: .75rem; letter-spacing: .2em; text-transform: uppercase; text-decoration: none; }
.facts-link:hover { background: var(--acc); color: var(--paper); }
.facts-link[hidden] { display: none; }
/* mini map: the tiles are softened the same way as on the map page */
.place-map-wrap { grid-area: map; }
.place-map-wrap[hidden] { display: none; }
.place-map { height: 260px; background: var(--mist); border: 1px solid var(--rule); }
@media (min-width: 900px) { .place-map { height: 340px; } }
.place-map .leaflet-tile-pane { filter: grayscale(.45) sepia(.12) saturate(.85) brightness(.97); }
.place-map .pin span { display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--sand); border: 3px solid var(--deep); box-shadow: 0 0 0 1px var(--sand), 0 2px 8px rgba(21, 26, 24, .45); }
/* under the hero and the slider: the text in a readable measure, then "Also worth seeing" */
.place-text { grid-area: text; max-width: 65ch; font-size: 1.05rem; }
.detail-long { color: var(--fg-soft); }
.detail-long p + p { margin-top: 1em; }
.detail-note { margin-top: 1.4rem; padding-left: 1rem; border-left: 1px solid var(--acc); color: var(--fg-muted); font-size: .92rem; }
.detail-note:empty { display: none; }
.place-tn { margin-top: 2.4rem; }
.place-tn[hidden] { display: none; }
.place-tn h2 { font-family: var(--sans); font-size: .75rem; font-weight: 400; letter-spacing: .2em; text-transform: uppercase; line-height: 1.4; color: var(--acc); margin-bottom: .9rem; }
.detail-see { margin-top: 2.4rem; padding-top: 1.4rem; border-top: 1px solid var(--rule); }
.detail-see[hidden] { display: none; }
.detail-see h2 { font-family: var(--sans); font-size: .75rem; font-weight: 400; letter-spacing: .2em; text-transform: uppercase; line-height: 1.4; color: var(--acc); margin-bottom: .9rem; }
.detail-see ul { list-style: none; }
.detail-see li { color: var(--fg-soft); font-size: .95rem; padding: .35rem 0 .35rem 1rem; position: relative; }
.detail-see a { display: inline-block; padding: .7rem 0; margin: -.7rem 0; color: inherit; text-decoration: underline; text-decoration-color: var(--acc); text-underline-offset: .2em; }
.detail-see a:hover { color: var(--acc); }
.detail-see li::before { content: ""; position: absolute; left: 0; top: 1.05em; width: 6px; height: 1px; background: var(--acc); }

/* previous / next place */
.place-pager { display: grid; grid-template-columns: 1fr 1fr; background: var(--deep); color: var(--paper); border-top: 1px solid rgba(246, 244, 238, .16); }
.place-pager[hidden] { display: none; }
.pager-link { display: block; min-height: 44px; padding: clamp(36px, 8svh, 90px) var(--gutter); color: inherit; text-decoration: none; }
.pager-link + .pager-link { border-left: 1px solid rgba(246, 244, 238, .16); text-align: right; }
.pager-link .pl { display: block; font-size: .75rem; letter-spacing: .2em; text-transform: uppercase; color: var(--sand); margin-bottom: .8rem; }
.pager-link .pn { display: block; font-family: var(--serif); font-size: clamp(1.8rem, 4vw, 3.4rem); line-height: 1; transition: color .3s ease; overflow-wrap: anywhere; }
.pager-link:hover .pn { color: var(--sand); }

/* full-screen photo viewer */
/* above the main menu (z-index 60), which would otherwise cover the Close button */
#lightbox { position: fixed; inset: 0; z-index: 70; background: rgba(21, 26, 24, .97); display: flex; align-items: center; justify-content: center; }
#lightbox[hidden] { display: none; }
#lb-img { max-width: calc(100vw - 2 * 72px); max-height: calc(100svh - 120px); object-fit: contain; }
.lb-btn { position: absolute; z-index: 1; font-size: 1.2rem; letter-spacing: 0; }
.lb-btn .esc { color: rgba(246, 244, 238, .66); margin-left: .6rem; }
.lb-close { top: 16px; right: var(--gutter); font-size: .75rem; letter-spacing: .2em; }
.lb-prev { left: 14px; top: 50%; margin-top: -22px; }
.lb-next { right: 14px; top: 50%; margin-top: -22px; }
.lb-btn[hidden] { display: none; }
.lb-count { position: absolute; bottom: 20px; left: 0; right: 0; text-align: center; font-size: .8rem; letter-spacing: .2em; color: rgba(246, 244, 238, .66); }
/* under the photo: the photo credit (author, license, source) from places.js; hidden when the photo has none */
.lb-meta { position: absolute; left: var(--gutter); right: var(--gutter); bottom: 48px; text-align: center; }
.lb-credit { margin-top: .2rem; font-size: .72rem; line-height: 1.4; color: rgba(246, 244, 238, .6); }
.lb-credit[hidden] { display: none; }
.lb-credit a { color: inherit; text-decoration: underline; text-decoration-color: rgba(246, 244, 238, .35); text-underline-offset: .2em; }
.lb-credit a:hover { color: var(--sand); }
#lightbox.has-meta #lb-img { max-height: calc(100svh - 230px); }

::view-transition-group(place-hero) { animation-duration: .7s; animation-timing-function: cubic-bezier(.2, .7, .2, 1); }
/* no View Transitions support: plain fade */
@supports not (view-transition-name: none) { body { animation: pagein .5s ease; } }
@keyframes pagein { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 768px) {
  #lb-img { max-width: 100vw; max-height: calc(100svh - 150px); }
  .lb-meta { bottom: 66px; }
  #lightbox.has-meta #lb-img { max-height: calc(100svh - 270px); }
  .lb-prev { left: 8px; top: auto; bottom: 14px; margin: 0; }
  .lb-next { right: 8px; top: auto; bottom: 14px; margin: 0; }
  .place-pager { grid-template-columns: 1fr; }
  .pager-link + .pager-link { border-left: 0; border-top: 1px solid rgba(246, 244, 238, .16); text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  .slider-track { scroll-behavior: auto; }
  body { animation: none !important; }
}

@media (max-width: 420px) { .back { padding: 0 .8rem; letter-spacing: .12em; } }
/* narrow screens: the back link shows only its arrow so it does not run into the menu; the label stays for screen readers */
@media (max-width: 480px) {
  .back { padding: 0; letter-spacing: 0; font-size: 1.1rem; }
  .back-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
