/* /neighborhood and /amenities: the location story, map and amenities.
 * Plain CSS, no framework.
 * Story state comes from assets/js/location.js as custom properties:
 *   --morph 0..1, --intro, --details, --hero-edge, --hero-drift, --photo-drift. */

.location-page {
  --location-navy: var(--ink);
  background: var(--location-navy);
  color: #fff;
}

/* ── Header over the photograph ── */
.site-header.location-header {
  position: fixed;
  inset: 0 0 auto;
  width: 100%;
  z-index: 40;
  color: #fff;
  background: linear-gradient(180deg, rgba(11,16,40, 0.6), transparent) no-repeat;
  border-bottom-color: transparent;
  transition: background-color 0.3s, color 0.3s;
}
.site-header.location-header .btn-tour { background: #fff; color: var(--ink); }
.site-header.location-header .btn-tour:hover { background: var(--mist); }
.site-header.location-header.on-light-surface { background: var(--paper); color: var(--ink); border-bottom-color: var(--line); }
.site-header.location-header.on-light-surface .btn-tour { background: var(--ink); color: #fff; }

/* ── The journey: four screens of scroll behind one sticky stage ── */
.location-journey {
  height: 400svh;
  position: relative;
  --morph: 0;
  --intro: 1;
  --details: 0;
}
.location-stage {
  position: sticky;
  top: 0;
  height: 100svh;
  overflow: hidden;
}
.location-scenes,
.location-scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.location-scene { will-change: clip-path; }
.location-scene img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.78);
  transform: translate3d(0, var(--photo-drift, 0%), 0) scale(1.12);
  will-change: transform;
}

/* Opening plate: the same bottom-to-top hard wipe as the story photos. */
.location-hero-photo {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  clip-path: inset(0 0 var(--hero-edge, 0%) 0);
}
.location-hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--hero-pos, center 50%);
  transform: translateY(var(--hero-drift, 0%)) scale(1.12);
  will-change: transform;
}
.location-hero-photo::after { content: ""; position: absolute; inset: 0; background: #0002; }

/* The stepped navy panel: opening card that morphs into the story card. */
.location-panel {
  position: absolute;
  left: calc(1.3% + var(--morph) * 49.2%);
  right: 1.3%;
  top: calc(56% - var(--morph) * 41%);
  bottom: 2.6%;
  background: var(--location-navy);
  clip-path: polygon(34% 0, 100% 0, 100% 100%, 0 100%, 0 12%, 34% 12%);
  will-change: left, top;
}
.location-opening {
  opacity: var(--intro);
  position: absolute;
  inset: 0;
  padding: 2.4vw;
  pointer-events: none;
}
/* The offset runs from the top of the capitals, not the line box, so every font sits the same. */
.location-opening h1 {
  position: absolute;
  right: 2vw;
  top: 0.42em;
  font-size: clamp(30px, 5.8vw, 108px);
  line-height: 1;
  text-box: trim-start cap alphabetic;
  font-weight: 400;
  letter-spacing: -0.045em;
  margin: 0;
  color: #fff;
}
.location-opening-copy {
  position: absolute;
  bottom: 3%;
  margin: 0;
  font-size: clamp(18px, 1.8vw, 28px);
  line-height: 1.35;
  text-transform: uppercase;
  max-width: 60%;
}
.location-down { display: block; width: 10px; height: 10px; margin-top: -4px; border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; transform: rotate(45deg); }
.location-opening button {
  position: absolute;
  bottom: 5%;
  right: 3%;
  pointer-events: auto;
  background: none;
  border: 1px solid #7d8169;
  border-radius: 50%;
  width: 45px;
  height: 45px;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.location-details {
  position: absolute;
  inset: 0;
  opacity: var(--details);
}
.location-detail {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.45s ease, visibility 0.45s;
}
.location-detail[data-active="true"] { opacity: 1; visibility: visible; }
.location-detail h2 {
  position: absolute;
  top: 2.5%;
  right: 3%;
  font-size: clamp(18px, 1.8vw, 30px);
  font-weight: 400;
  line-height: 1.2;
  text-align: right;
  margin: 0;
  color: #fff;
}
.location-detail svg {
  position: absolute;
  width: 25%;
  height: 35%;
  left: 37.5%;
  top: 25%;
}
.location-detail > p {
  position: absolute;
  left: 3%;
  right: 15%;
  bottom: 22%;
  font-size: clamp(13px, 1.22vw, 20px);
  line-height: 1.32;
  text-transform: uppercase;
  color: #c4c7b4;
  margin: 0;
  max-width: 440px;
}
.location-progress {
  position: absolute;
  left: 3%;
  right: 3%;
  bottom: 17%;
  display: flex;
  gap: 3%;
}
.location-progress button {
  height: 24px;
  position: relative;
  flex: 1;
  border: 0;
  background: none;
  cursor: pointer;
  padding: 0;
}
.location-progress button::before,
.location-progress-fill {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 11px;
  height: 1px;
  background: #5b6140;
}
.location-progress-fill {
  background: #eee;
  transform-origin: left;
  transform: scaleX(0);
  will-change: transform;
}
.location-count {
  position: absolute;
  bottom: 4.5%;
  left: 3%;
  right: 3%;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}
.location-journey[data-expanded="true"] .location-details,
.location-journey[data-expanded="false"] .location-opening,
.location-journey[data-expanded="false"] .location-opening button { pointer-events: none; }
.location-page button:focus-visible,
.location-page a:focus-visible,
.location-page input:focus-visible { outline: 2px solid #a3a693; outline-offset: 5px; }
/* Light surfaces inside the dark story: the focus ring switches to the accent so it keeps 3:1. */
.location-map-card :focus-visible,
.map-interaction-toggle:focus-visible,
.amenities-collection :focus-visible { outline-color: var(--accent); }

/* ── Neighborhood map ── */
.location-map-section {
  height: 100svh;
  min-height: 640px;
  position: relative;
  background: var(--ink);
  padding: 120px 2vw 3vw;
  overflow-anchor: none;
}
.location-map-canvas { position: absolute; inset: 0; z-index: 0; }
.location-map-section[data-interactive="false"] .location-map-canvas { pointer-events: none; }
/* Before "Explore map" the page scrolls through the map, and the pins still answer. */
.location-map-marker { pointer-events: auto; }
/* The same control invites and exits. */
.map-interaction-toggle {
  position: absolute;
  z-index: 4;
  right: 80px;
  top: 90px;
  width: 210px;
  max-width: calc(100% - 44px);
  padding: 18px 22px;
  border: 0;
  text-align: left;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 12px 44px #2f341733;
  cursor: pointer;
  transition: background 0.3s;
  touch-action: manipulation;
}
.map-toggle-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  font-size: 18px;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.map-interaction-toggle:hover { background: var(--mist); }

.location-map-card {
  position: relative;
  z-index: 2;
  background: var(--mist);
  color: var(--ink);
  width: 32%;
  max-width: 480px;
  min-width: 330px;
  max-height: calc(100svh - 150px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding: 32px 28px 24px;
  clip-path: polygon(0 0, 65% 0, 65% 25px, 100% 25px, 100% 100%, 0 100%);
}
.location-map-card h2 {
  font-size: clamp(32px, 3vw, 48px);
  font-weight: 400;
  letter-spacing: -0.04em;
  line-height: 1;
  margin: 0 0 22px;
  color: var(--ink);
}
.location-map-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.location-map-filters button {
  border: 1px solid var(--line);
  padding: 7px 10px;
  font-size: 10px;
  cursor: pointer;
  background: transparent;
  color: var(--ink);
}
.location-map-filters button { display: inline-flex; align-items: center; gap: 7px; }
.location-map-filters button svg { flex: none; }
.location-map-filters button[aria-pressed="true"] { color: #fff; background: var(--ink); border-color: var(--ink); }
.location-map-search { display: block; }
.location-map-search input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #8a8d78;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  padding: 12px 0;
  outline-offset: 3px;
}
.location-place-list { display: grid; }
.location-place-list button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 13px 0;
  font-size: 13px;
  cursor: pointer;
  color: inherit;
}
.location-place-list button > span:first-child { color: var(--muted); min-width: 16px; display: grid; place-items: center; }
.location-place-list button > span:first-child svg { display: block; }
.location-place-list button[aria-pressed="true"] > span:first-child { color: var(--ink); }
.location-place-list button[aria-pressed="true"] { font-weight: 600; }
.location-place-list button:hover { background: #efefe6; }
.location-place { margin-top: 22px; animation: place-reveal 0.45s cubic-bezier(0.4, 0, 0.2, 1); }
.location-place small { font-size: 9px; letter-spacing: 0.1em; color: var(--muted); text-transform: uppercase; }
.location-place h3 { font-size: 18px; font-weight: 400; margin: 12px 0; }
.location-place p { font-size: 13px; line-height: 1.6; margin: 0 0 8px; }
.location-place a { font-size: 12px; display: inline-block; margin: 12px 0; }
.location-place-links { display: flex; flex-wrap: wrap; gap: 0 20px; }
@keyframes place-reveal { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: translateX(0); } }
.location-map-reset {
  background: none;
  border: 0;
  border-bottom: 1px solid #c4c7b4;
  padding: 10px 0;
  font-size: 11px;
  color: var(--ink);
  cursor: pointer;
}
.location-map-note { font-size: 10px; line-height: 1.5; color: var(--muted); margin: 20px 0 0; }
.location-map-marker {
  border: 1px solid #7d8169;
  border-radius: 50%;
  background: #3f4524;
  color: #fff;
  width: 40px;
  height: 40px;
  cursor: pointer;
  font-size: 16px;
  font-family: var(--font);
  padding: 0;
}
.location-map-marker:not(.is-home) { display: grid; place-items: center; }
.location-map-marker:not(.is-home) svg { display: block; }
.location-map-marker.is-home { z-index: 6; border-radius: 0; width: 96px; height: 52px; display: grid; place-items: center; background: var(--ink); }
.location-map-marker.is-home svg { width: 66px; height: auto; display: block; }
.location-map-marker.is-selected { background: #fff; color: var(--ink); outline: 5px solid #ffffff22; z-index: 5; }
.location-map-marker[hidden] { display: none; }
/* MapLibre positions each marker with an inline transform on this element, so
   it must never get a transform or a transform transition of its own (that is
   what made pins trail the map while panning). Hover grows the icon inside. */
.location-map-marker { transition: background-color 0.2s, border-color 0.2s, color 0.2s; }
.location-map-marker svg { transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1); }
.location-map-marker.is-hovered:not(.is-selected) { background: var(--accent); border-color: #fff; z-index: 4; }
.location-map-marker.is-hovered:not(.is-selected):not(.is-home) svg { transform: scale(1.15); }
/* Hover preview card: sits beside its pin. */
.map-peek {
  position: absolute; top: 0; left: 0; z-index: 6; width: 264px; padding: 18px 20px 14px;
  background: #fff; color: var(--ink); box-shadow: 0 18px 40px -18px rgba(7, 11, 32, 0.55);
  opacity: 0; transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.map-peek[data-shown="true"] { opacity: 1; }
.map-peek[hidden] { display: none; }
.map-peek small { font-size: 9px; letter-spacing: 0.1em; color: var(--muted); text-transform: uppercase; }
.map-peek h3 { font-size: 17px; font-weight: 400; line-height: 1.3; margin: 8px 0 6px; }
.map-peek p { font-size: 12.5px; line-height: 1.55; margin: 0; color: var(--muted); }
.map-peek-links { display: flex; flex-wrap: wrap; gap: 0 18px; margin-top: 10px; }
.map-peek-links a { font-size: 12px; padding: 6px 0; border-bottom: 1px solid #e3e4d8; color: var(--ink); }
.map-peek-links a:hover { border-bottom-color: var(--ink); }
@media (hover: none) { .map-peek { display: none; } }
@media (prefers-reduced-motion: reduce) { .map-peek, .location-map-marker, .location-map-marker svg { transition: none; } }
.location-map-section .maplibregl-ctrl-top-right { top: 80px; right: 20px; }
.map-drawer-toggle,
.map-mobile-selection { display: none; }

/* ── Amenities collection ── */
.amenities-collection { background: var(--paper); color: var(--ink); padding: 85px var(--gutter); }
.amenities-accordion article { border-top: 1px solid var(--line); }
.amenities-accordion article:last-child { border-bottom: 1px solid var(--line); }
.amenities-accordion h2 { margin: 0; font-weight: 400; }
.amenities-accordion h2 button {
  display: flex;
  align-items: center;
  text-align: left;
  width: 100%;
  gap: 35px;
  padding: 30px 0;
  border: 0;
  background: none;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: clamp(24px, 3vw, 44px);
  letter-spacing: -0.035em;
  line-height: 1.15;
}
.amenities-accordion h2 button:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
.amenities-accordion i { width: 20px; height: 20px; position: relative; margin-left: auto; flex-shrink: 0; }
.amenities-accordion i::before,
.amenities-accordion i::after {
  content: "";
  position: absolute;
  background: currentColor;
  left: 0;
  top: 9px;
  width: 20px;
  height: 1px;
  transition: transform 0.65s cubic-bezier(0.65, 0, 0.35, 1);
}
.amenities-accordion i::after { transform: rotate(90deg); }
.amenities-accordion [data-open="true"] i::after { transform: rotate(0); }
.amenity-collapse {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  visibility: hidden;
  transition:
    grid-template-rows 0.7s cubic-bezier(0.65, 0, 0.35, 1),
    opacity 0.5s ease,
    visibility 0.7s;
}
.amenity-collapse > div { overflow: hidden; min-height: 0; }
.amenities-accordion [data-open="true"] .amenity-collapse { grid-template-rows: 1fr; opacity: 1; visibility: visible; }
.amenity-content { display: grid; grid-template-columns: 1fr 1.6fr; gap: 8vw; padding: 5px 0 40px 50px; }
.amenity-content p { max-width: 340px; font-size: 17px; color: var(--muted); margin: 0 0 16px; }
.amenity-content ul { list-style: none; padding: 0; margin: 0 0 18px; max-width: 380px; font-size: 14px; color: var(--muted); }
.amenity-content li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.amenity-content .amenity-tour {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0;
  background: none; border: 0; border-bottom: 1px solid var(--ink); color: var(--ink);
  font: inherit; font-size: 13px; cursor: pointer;
}
.amenity-content img { width: 100%; height: auto; aspect-ratio: 1.6; object-fit: cover; }
.amenity-content figure { margin: 0; }
/* Amenity lists: an icon, the amenity and an optional tag. */
.amenity-list { list-style: none; margin: 18px 0 0; padding: 0; border-top: 1px solid var(--line); }
.amenity-list li { display: flex; align-items: center; gap: 14px; min-height: 48px; padding: 8px 0; border-bottom: 1px solid var(--line); line-height: 1.4; }
.amenity-icon { flex: none; width: 22px; height: 22px; color: var(--accent); }
.amenity-tag { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ── Phones ── */
@media (max-width: 700px) {
  .location-panel {
    left: 4%;
    right: 4%;
    top: 78px;
    bottom: auto;
    height: calc(34svh - var(--morph) * 5svh);
    min-height: 250px;
    clip-path: polygon(14% 0, 100% 0, 100% 100%, 0 100%, 0 12%, 14% 12%);
  }
  .location-opening h1 { font-size: 7.6vw; right: 4%; }
  .location-opening-copy { font-size: 15px; left: 5%; top: 47%; bottom: auto; max-width: 85%; }
  .location-detail h2 { font-size: 17px; top: 3%; right: 5%; }
  .location-detail svg { top: 24%; height: 26%; width: 30%; left: 35%; }
  .location-detail > p { font-size: 11px; left: 5%; right: 5%; bottom: 23%; }

  .location-map-section { height: 100svh; min-height: 640px; padding: 0; overflow: hidden; }
  .location-map-canvas { height: 100%; bottom: 0; }
  .map-interaction-toggle { top: 90px; right: 64px; width: 180px; padding: 12px 16px; }
  .map-toggle-title { font-size: 15px; }
  .location-map-card {
    position: absolute;
    z-index: 3;
    bottom: 20px;
    left: 16px;
    width: calc(100% - 32px);
    min-width: 0;
    max-width: none;
    max-height: 62svh;
    padding: 0;
    clip-path: none;
    border-radius: 6px;
    overflow: clip;
    box-shadow: 0 6px 30px #0002;
  }
  .map-drawer-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 18px 20px;
    min-height: 56px;
    border: 0;
    color: var(--ink);
    background: var(--mist);
    font: inherit;
    font-size: 18px;
    cursor: pointer;
  }
  .map-mobile-selection { display: block; margin: 0; padding: 0 20px 18px; font-size: 12px; color: var(--muted); }
  .map-drawer-content {
    display: block;
    max-height: 0;
    padding: 0 20px;
    opacity: 0;
    visibility: hidden;
    overflow: hidden;
    overscroll-behavior: contain;
    transition:
      max-height 0.55s cubic-bezier(0.65, 0, 0.35, 1),
      opacity 0.3s ease,
      visibility 0.55s;
  }
  /* Open, the card is a bottom sheet pinned to the viewport. */
  .location-map-card[data-open="true"] { position: fixed; left: 16px; right: 16px; bottom: 20px; width: auto; z-index: 20; }
  .location-map-card[data-open="true"] .map-drawer-content {
    max-height: calc(62svh - 56px);
    padding-bottom: 24px;
    opacity: 1;
    visibility: visible;
    overflow-y: auto;
  }
  .location-map-card[data-open="true"] .map-mobile-selection { display: none; }
  .location-map-card h2,
  .location-place-list button { min-height: 48px; font-size: 12px; }
  .location-map-filters button { min-height: 40px; }
  .location-map-search input { font-size: 16px; }
  /* The drawer lists the places; the expanded detail block is redundant there. */
  .location-map-card .location-place { display: none; }
  .location-map-section .maplibregl-ctrl-bottom-right { bottom: 0; }

  .amenities-collection { padding: 55px var(--gutter); }
  .amenities-accordion h2 button { gap: 16px; padding: 25px 0; }
  .amenity-content { grid-template-columns: 1fr; padding-left: 0; gap: 25px; }
  .amenity-content p { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .location-detail,
  .amenity-collapse,
  .amenities-accordion i::after,
  .map-interaction-toggle,
  .map-toggle-title,
  .map-drawer-content { transition: none; }
  .location-scene { will-change: auto; }
  .location-scene img,
  .location-hero-photo img { transform: none; will-change: auto; }
  .location-place { animation: none; }
}
