@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("../fonts/Inter-400.ttf") format("truetype");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: block;
  src: url("../fonts/Inter-500.ttf") format("truetype");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: block;
  src: url("../fonts/Inter-600.ttf") format("truetype");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 700;
  font-display: block;
  src: url("../fonts/Inter-700.ttf") format("truetype");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 800;
  font-display: block;
  src: url("../fonts/Inter-800.ttf") format("truetype");
}

:root {
  --navy: #0f2340;
  --red: #e3242b;
  --yellow: #f6c21c;
  --cream: #f6f1e8;
  --paper: #fffdf8;
  --ink: #0f2340;
  --muted: #5a6573;
  --line: #e4ddd1;
  --soft: #f3eee4;
  --shadow: 0 14px 40px rgba(15, 35, 64, 0.16);
  --shadow-soft: 0 8px 24px rgba(15, 35, 64, 0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  height: 100dvh;
  background: var(--cream);
  color: var(--ink);
  font-family: Inter, Helvetica, Arial, sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
}

body {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
input, select, textarea { max-width: 100%; }
:root { --sap-header-h: 72px; }

img { display: block; max-width: 100%; }

a { color: inherit; }

/* Header: larger logo on the left; 3-row stats right-aligned next to Towns / badge.
   Height is auto so it can grow; map/page fill the rest via flex (see body). */
.site-header {
  position: relative;
  z-index: 20;
  flex: 0 0 auto;
  height: auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  padding: env(safe-area-inset-top, 0px) 0 0;
  background: #ffffff;
  border-bottom: 1px solid rgba(15, 35, 64, 0.08);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
  min-width: 0;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 2px 22px;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.site-stats {
  flex: 0 1 auto;
  min-width: 0;
  margin: 0 0 0 auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 0;
  text-align: right;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.15;
  color: var(--navy);
  overflow-wrap: anywhere;
}
.site-stats:empty { display: none; }
.st-row { display: block; min-width: 0; }
.st-row b { font-weight: 800; }
.st-traffic { font-size: 13px; font-weight: 600; }
.st-pins { font-size: 12px; }
.st-since, .st-empty {
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  min-width: 0;
  flex: 0 0 auto;
}

.brand img {
  height: 56px;
  width: auto;
  max-width: 260px;
  object-fit: contain;
}

/* Logo + “N people exploring now” stack in the header. On the map page the bar is
   slightly transparent so the map shows through faintly behind it. */
.header-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 0;
}
.header-row:has(.header-presence) {
  align-items: flex-start;
}
.header-presence {
  margin: 0;
  height: 12px;
  font-size: 11px;
  font-weight: 500;
  line-height: 12px;
  color: var(--muted);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-presence[hidden] { display: none !important; }
.header-presence::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 5px;
  margin-bottom: 1px;
  border-radius: 50%;
  background: #2f9e44;
  vertical-align: middle;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 0 0 auto;
  overflow: visible;
  padding: 0 2px;
}

.example-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--yellow);
  color: var(--navy);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  white-space: nowrap;
  transform-origin: center;
  animation: sap-beta-pulse 2s ease-in-out infinite;
}
.example-pill .site-version {
  margin-left: 0.35em;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  text-transform: none;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 1px;
}
.example-pill .site-version::before {
  content: "· ";
  text-decoration: none;
}
@keyframes sap-beta-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(246, 194, 28, 0); }
  50% { transform: scale(1.06); box-shadow: 0 0 0 4px rgba(246, 194, 28, 0.35), 0 0 14px 2px rgba(246, 194, 28, 0.55); }
}
@media (prefers-reduced-motion: reduce) {
  .example-pill,
  .map-invite-link { animation: none; box-shadow: none; transform: none; }
}

.header-loc {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
}

.header-nav {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  text-decoration: none;
}
.header-nav:hover, .header-nav:focus {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ========== MAP ========== */
body.map-page, body.app-map {
  background: #1a1a1a;
  overflow: hidden;
  overflow-x: hidden;
  max-width: 100%;
  touch-action: manipulation;
  overscroll-behavior: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto 1fr;
}
body.map-page > .site-header,
body.app-map > .site-header {
  grid-row: 1;
  grid-column: 1;
  z-index: 20;
  background: rgba(255, 255, 255, 0.88);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
body.map-page > .map-invite,
body.app-map > .map-invite {
  grid-row: 2;
  grid-column: 1;
  z-index: 20;
}
body.map-page > .map-stage,
body.app-map > .map-stage {
  grid-row: 1 / -1;
  grid-column: 1;
  z-index: 0;
  min-height: 0;
}
body.map-page > .visually-hidden,
body.app-map > .visually-hidden {
  grid-row: 1;
  grid-column: 1;
}

.map-stage {
  position: relative;
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  overflow: hidden;
  background:
    url("../assets/neighborhood-satellite.jpg") center / cover no-repeat;
}

.search-bar {
  position: absolute;
  top: calc(var(--sap-map-underlap, 0px) + 18px);
  left: 50%;
  transform: translateX(-50%);
  width: min(520px, calc(100% - 80px));
  height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: rgba(255, 253, 248, 0.96);
  border: 1px solid rgba(15, 35, 64, 0.1);
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 8;
}

.search-bar svg { flex: 0 0 auto; color: var(--navy); }

.search-bar span {
  font-size: 14px;
  font-weight: 500;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.zoom-controls {
  position: absolute;
  right: 18px;
  top: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 10px;
  background: rgba(255, 253, 248, 0.96);
  box-shadow: var(--shadow-soft);
  z-index: 8;
}

.zoom-controls span {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 500;
  color: var(--navy);
  line-height: 1;
}

.zoom-controls span + span { border-top: 1px solid var(--line); }

/* Compact attribution: a round “i” until tapped. Lifted above bottom cards. */
#map .maplibregl-ctrl-bottom-right {
  bottom: calc(var(--sap-bottom-clear, 10px) + env(safe-area-inset-bottom, 0px));
  right: 8px;
  z-index: 5;
}
#map .maplibregl-ctrl-attrib {
  max-width: min(280px, calc(100vw - 24px));
}
#map .maplibregl-ctrl-attrib:not(.maplibregl-compact-show) .maplibregl-ctrl-attrib-inner {
  display: none !important;
}
#map .maplibregl-ctrl-attrib.maplibregl-compact:not(.maplibregl-compact-show) {
  width: 24px;
  height: 24px;
  min-width: 24px;
  padding: 0;
  overflow: hidden;
  border-radius: 12px;
}

.attribution {
  position: absolute;
  left: 10px;
  bottom: 8px;
  z-index: 5;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  letter-spacing: 0.01em;
}

/* Parcel highlight for the example house (checkered-patio lot) */
.parcel {
  position: absolute;
  left: 56.4%;
  top: 39.8%;
  width: 8.6%;
  height: 13.2%;
  border: 3px solid var(--yellow);
  border-radius: 3px;
  background: rgba(246, 194, 28, 0.28);
  box-shadow: 0 0 0 1px rgba(15, 35, 64, 0.35), 0 8px 20px rgba(15, 35, 64, 0.25);
  z-index: 4;
}

.map-pin {
  position: absolute;
  left: 60.7%;
  top: 45.6%;
  width: 34px;
  height: 58px;
  transform: translate(-50%, -100%);
  z-index: 6;
  filter: drop-shadow(0 6px 8px rgba(15, 35, 64, 0.45));
}

.map-pin-mini {
  position: absolute;
  width: 20px;
  height: 34px;
  transform: translate(-50%, -100%);
  z-index: 3;
  filter: drop-shadow(0 3px 4px rgba(15, 35, 64, 0.4));
  opacity: 0.92;
}

/* Nearby example pins, just to make the map feel lived-in */
.pin-a { left: 28%; top: 48%; }
.pin-b { left: 41%; top: 62%; }
.pin-c { left: 74%; top: 33%; }
.pin-d { left: 19%; top: 30%; }

.popup {
  position: absolute;
  left: 24.5%;
  top: 40%;
  width: 340px;
  background: var(--paper);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(15, 35, 64, 0.28);
  padding: 20px 20px 18px;
  z-index: 7;
}

.popup::after {
  content: "";
  position: absolute;
  right: -10px;
  top: 78px;
  width: 20px;
  height: 20px;
  background: var(--paper);
  transform: rotate(45deg);
  box-shadow: 6px -6px 12px rgba(15, 35, 64, 0.06);
}

.popup-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.popup h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--navy);
}

.popup .city {
  margin-top: 2px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}

.popup-stat {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 18px;
  padding: 10px 12px;
  background: var(--soft);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
}

.popup-stat strong { font-weight: 800; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  cursor: default;
  font-family: inherit;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.btn-primary {
  width: 100%;
  height: 48px;
  border-radius: 12px;
  background: var(--red);
  color: #fff;
  font-size: 16px;
  box-shadow: 0 8px 18px rgba(227, 36, 43, 0.28);
}

.btn-share {
  height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  background: var(--navy);
  color: #fff;
  font-size: 14px;
}

.btn-support {
  width: 100%;
  height: 42px;
  border-radius: 10px;
  background: var(--navy);
  color: #fff;
  font-size: 14px;
}

.btn-ghost {
  height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  background: transparent;
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
  border: 1px solid var(--line);
}

/* ========== PIN FORM ========== */
body.form-page, body.memory-page { background: var(--cream); }

.page {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  overflow: auto;
  padding: 22px 28px 20px;
}

.page-grid {
  height: 100%;
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 24px;
  max-width: 1180px;
  margin: 0 auto;
}

.context-panel {
  background: var(--paper);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(15, 35, 64, 0.06);
}

.house-photo {
  height: 250px;
  flex: 1 1 auto;
  min-height: 250px;
  background:
    url("../assets/house-close.jpg") 70% 40% / 170% auto no-repeat;
}

.context-body { padding: 18px 18px 20px; }

.context-body .kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.context-body h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.context-body .city {
  margin-top: 2px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}

.context-copy {
  margin-top: 14px;
  font-size: 14px;
  line-height: 1.5;
  color: #3a4553;
}

.form-card {
  background: var(--paper);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(15, 35, 64, 0.06);
  padding: 22px 26px 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.form-card h1, .form-card h2 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}

.form-lead {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field { margin-bottom: 12px; }

.field label, .field .label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 6px;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="number"],
.field textarea {
  width: 100%;
  border: 1px solid #d9d3c8;
  background: #fff;
  border-radius: 10px;
  padding: 0 12px;
  height: 42px;
  font-family: inherit;
  font-size: 14px;
  color: var(--navy);
  outline: none;
}

.field textarea {
  height: 86px;
  padding: 10px 12px;
  resize: none;
  line-height: 1.45;
}

.years {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
}

.years .dash {
  color: var(--muted);
  font-weight: 600;
  padding-top: 20px;
}

.photo-drop {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 64px;
  padding: 0 14px;
  border: 1.5px dashed #cfc8bb;
  border-radius: 10px;
  background: #fbfaf6;
  color: var(--muted);
  font-size: 13px;
}

.photo-drop strong { color: var(--navy); font-weight: 600; }

.optin {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 4px 0 14px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink);
  cursor: default;
}

.optin input[type="checkbox"] {
  margin-top: 2px;
  width: 16px;
  height: 16px;
  accent-color: var(--navy);
  flex: 0 0 auto;
}

.legal, .confirm-note {
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
  margin-top: 10px;
}

.confirm-note { margin-top: 8px; }

/* ========== MEMORY PAGE ========== */
.memory-grid {
  height: 100%;
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.25fr 0.95fr;
  gap: 22px;
}

.panel {
  background: var(--paper);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(15, 35, 64, 0.06);
}

.memory-main {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.memory-hero {
  height: 210px;
  flex: 1 1 auto;
  min-height: 210px;
  background:
    url("../assets/house-close.jpg") 70% 40% / 165% auto no-repeat;
  position: relative;
}

.memory-hero .addr-overlay {
  position: absolute;
  left: 16px;
  bottom: 14px;
  background: rgba(255, 253, 248, 0.94);
  border-radius: 10px;
  padding: 8px 12px 9px;
  box-shadow: 0 4px 14px rgba(15, 35, 64, 0.15);
}

.memory-hero .addr-overlay .kicker {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.memory-hero .addr-overlay h1 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.memory-hero .addr-overlay .city {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.memory-body { padding: 16px 20px 14px; flex: 1; display: flex; flex-direction: column; }

.person {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #dbe4f0;
  color: var(--navy);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -0.02em;
  flex: 0 0 auto;
}

.avatar.s { width: 32px; height: 32px; font-size: 11px; }
.avatar.a { background: #dbe4f0; }
.avatar.b { background: #f3e2c6; }
.avatar.c { background: #d8eadc; }
.avatar.d { background: #edd9e4; }

.person .name {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.person .meta {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.quote {
  font-size: 15px;
  line-height: 1.5;
  color: #243044;
  padding: 12px 14px;
  background: var(--soft);
  border-radius: 12px;
  border-left: 3px solid var(--yellow);
}

.others { margin-top: 16px; }

.others h3 {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}

.other-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
}

.other-row .name { font-size: 13px; font-weight: 600; }
.other-row .meta { font-size: 12px; color: var(--muted); margin-left: auto; }

.memory-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.side-card { padding: 14px 16px 16px; }

.side-card h3 {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}

.share-row {
  display: grid;
  grid-template-columns: 148px 1fr;
  gap: 12px;
  align-items: start;
}

.share-card {
  width: 148px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(15, 35, 64, 0.1);
}

.share-card .photo {
  height: 96px;
  background:
    url("../assets/house-close.jpg") 70% 40% / 200% auto no-repeat;
}

.share-card .copy { padding: 8px 8px 9px; }

.share-card .line {
  height: 3px;
  background: var(--yellow);
  margin-bottom: 6px;
  width: 36px;
  border-radius: 2px;
}

.share-card .title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--navy);
}

.share-card .addr {
  margin-top: 3px;
  font-size: 9px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.3;
}

.share-card .years {
  display: block;
  margin-top: 3px;
  font-size: 9px;
  font-weight: 600;
  color: var(--navy);
}

.share-card .brand-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
}

.share-card .brand-row img { height: 16px; width: auto; }

.share-card .brand-row span {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--navy);
  line-height: 1;
  white-space: nowrap;
}

.share-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}

.share-actions p {
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

.tip-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}

.tip {
  height: 36px;
  border-radius: 8px;
  border: 1px solid #d9d3c8;
  background: #fff;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
}

.tip.selected {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.custom-amt {
  display: flex;
  align-items: center;
  height: 38px;
  border: 1px solid #d9d3c8;
  border-radius: 8px;
  background: #fff;
  margin-bottom: 6px;
  overflow: hidden;
}

.custom-amt .prefix {
  padding: 0 0 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.custom-amt input {
  border: none;
  outline: none;
  width: 100%;
  height: 100%;
  padding: 0 10px 0 6px;
  font-family: inherit;
  font-size: 13px;
  color: var(--navy);
  background: transparent;
}

.custom-amt input::placeholder { color: #8a93a0; }

.tip-note {
  font-size: 11px;
  color: var(--muted);
  margin: 6px 0 8px;
}

.remax-card {
  padding: 14px 16px 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f7f4ee 100%);
}

.remax-card .brand-name {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--navy);
  margin-bottom: 4px;
}

.remax-card p {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin-bottom: 10px;
}

.report-wrap {
  text-align: right;
  padding: 0 2px;
}

.report-wrap a {
  font-size: 11px;
  font-weight: 600;
  color: #7a8490;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Slim map invite: one compact line under the header, never over search or controls. */
.map-invite {
  flex: 0 0 auto;
  margin: 0;
  padding: 3px 8px;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--navy);
  background: #fffdf8;
  border-bottom: 1px solid rgba(15, 35, 64, 0.08);
  max-width: 100%;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: visible;
}
.map-invite-link {
  display: inline-block;
  margin: 0;
  padding: 2px 8px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  color: var(--red);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  white-space: nowrap;
  border-radius: 999px;
  transform-origin: center;
  animation: sap-beta-pulse 2s ease-in-out infinite;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(227, 36, 43, 0.18);
}
.map-invite { touch-action: manipulation; }

/* Dismissible hint after a Pin a home / invite tap. Sits under search, clear of Find me. */
.sap-pin-hint {
  position: relative;
  top: auto;
  left: auto;
  transform: none;
  width: 100%;
  margin: 4px 0 0;
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 4px;
  box-sizing: border-box;
  padding: 8px 6px 8px 12px;
  background: rgba(255, 253, 248, 0.94);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(15, 35, 64, 0.12);
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(15, 35, 64, 0.14);
  color: var(--navy);
}
.sap-pin-hint[hidden] { display: none !important; }
.sap-pin-hint-text {
  margin: 0;
  flex: 1 1 auto;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
}
.sap-pin-hint-close {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--navy);
  font-size: 24px;
  line-height: 1;
  font-weight: 400;
  cursor: pointer;
}
.sap-pin-hint-close:hover, .sap-pin-hint-close:focus { background: rgba(15, 35, 64, 0.08); }
@media (max-width: 760px) {
  .sap-pin-hint-text { font-size: 12px; }
}

/* First-visit invite card: compact, no overlay, map stays usable. */
.join-card {
  position: absolute;
  z-index: 7;
  box-sizing: border-box;
  width: 360px;
  max-width: calc(100% - 32px);
  max-height: 40vh;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  padding: 16px 44px 14px 16px;
  overflow: auto;
  background: rgba(255, 253, 248, 0.82);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(15, 35, 64, 0.12);
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(15, 35, 64, 0.16);
  color: var(--navy);
}
.join-card[hidden] { display: none !important; }
.join-card-close {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--navy);
  font-size: 28px;
  line-height: 1;
  font-weight: 400;
  cursor: pointer;
}
.join-card-close:hover, .join-card-close:focus { background: rgba(15, 35, 64, 0.08); }
.join-card-copy {
  margin: 0 0 12px;
  padding-right: 4px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
}
.join-card-tip {
  margin: -4px 0 12px;
  padding-right: 4px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--muted);
}
.join-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.join-card-actions .btn { margin: 0; width: auto; flex: 1 1 auto; min-height: 40px; }
body.join-open .intro-card { visibility: hidden; }

@media (max-width: 900px) {
  .header-loc { display: none; }
  .example-pill {
    height: 24px;
    font-size: 10px;
    letter-spacing: -0.02em;
    padding: 0 8px;
  }
  .example-pill .site-version { font-size: 9px; }
}

/* Mobile memory page */
@media (max-width: 500px) {
  body { overflow: auto; }

  .site-header {
    height: auto;
    padding: env(safe-area-inset-top, 0px) 0 0;
  }

  .header-row {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "brand nav"
      "stats stats";
    align-items: center;
    column-gap: 8px;
    row-gap: 0;
    padding: 2px 12px;
  }
  .header-brand { grid-area: brand; }
  .brand { grid-area: auto; }
  .header-right { grid-area: nav; gap: 8px; flex-shrink: 0; justify-self: end; align-self: start; }
  .header-presence {
    font-size: 10px;
    height: 11px;
    line-height: 11px;
    margin-top: 0;
  }
  .site-stats {
    grid-area: stats;
    margin: 0;
    align-items: flex-end;
    text-align: right;
    padding: 0;
    font-size: 11px;
    line-height: 1.05;
    gap: 0;
  }
  .st-traffic { font-size: 11px; }
  .st-pins { font-size: 10px; }
  .st-since, .st-empty { font-size: 9px; line-height: 1.05; }

  /* Logo size unchanged; height savings come from padding and line-heights only. */
  .brand img { height: 48px; max-width: 210px; }

  .header-loc { display: none; }

  .example-pill {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    height: auto;
    min-height: 22px;
    max-width: 7.6rem;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    text-transform: uppercase;
    text-align: center;
    padding: 2px 6px;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .example-pill .site-version {
    display: block;
    margin: 0;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1.1;
    text-transform: none;
  }
  .example-pill .site-version::before { content: none; }
  @keyframes sap-beta-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(246, 194, 28, 0); }
    50% { transform: scale(1.04); box-shadow: 0 0 0 3px rgba(246, 194, 28, 0.35), 0 0 10px 1px rgba(246, 194, 28, 0.5); }
  }

  .map-invite {
    padding: 2px 6px;
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
  }
  .map-invite-link {
    font-size: 12px;
    padding: 1px 6px;
  }
  @media (prefers-reduced-motion: reduce) {
    .map-invite-link { animation: none; box-shadow: none; transform: none; }
  }

  .join-card {
    left: max(10px, env(safe-area-inset-left, 0px));
    right: max(10px, env(safe-area-inset-right, 0px));
    bottom: max(12px, env(safe-area-inset-bottom, 0px));
    transform: none;
    width: auto;
    max-width: none;
    max-height: 40vh;
    max-height: 40dvh;
    padding: 14px 48px 12px 14px;
    border-radius: 16px;
  }
  .join-card-copy { font-size: 14px; }

  .page {
    height: auto;
    min-height: 0;
    padding: 8px 8px 12px;
  }

  .memory-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: auto;
  }

  .memory-hero { height: 132px; flex: 0 0 auto; min-height: 0; }

  .memory-hero .addr-overlay { padding: 6px 10px 7px; left: 10px; bottom: 10px; }
  .memory-hero .addr-overlay h1 { font-size: 15px; }

  .memory-body { padding: 12px 12px 10px; }

  .person { margin-bottom: 6px; gap: 10px; }
  .avatar { width: 36px; height: 36px; }
  .person .name { font-size: 14px; }
  .quote { font-size: 13px; padding: 8px 10px; }
  .others { margin-top: 8px; }
  .others h3 { margin-bottom: 4px; }
  .other-row { padding: 5px 0; }

  .share-row {
    grid-template-columns: 110px 1fr;
    gap: 8px;
  }

  .share-card { width: 110px; }
  .share-card .photo { height: 70px; }
  .share-card .copy { padding: 6px 7px 7px; }
  .share-card .title { font-size: 11px; }

  .tip-grid { grid-template-columns: repeat(5, 1fr); gap: 4px; }
  .tip { height: 30px; font-size: 11px; }

  .side-card { padding: 10px 10px 10px; }
  .side-card h3 { margin-bottom: 8px; }
  .remax-card p { font-size: 14px; margin-bottom: 8px; }
  .custom-amt { height: 34px; margin-bottom: 4px; }
  .tip-note { margin: 4px 0 6px; }
}

/* Parcel-card memories list (map popup and phone sheet), styled like comments. */
.pop-memories { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.pop-memories > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--navy); padding: 4px 0; user-select: none; }
.pop-memories > summary::-webkit-details-marker { display: none; }
.pop-memories > summary::after { content: ""; margin-left: auto; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .15s; margin-right: 4px; }
.pop-memories[open] > summary::after { transform: rotate(-135deg); }
.pm-list { list-style: none; margin: 0; padding: 0; }
.pm-item { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; line-height: 1.4; }
.pm-item:last-child { border-bottom: 0; }
.pm-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px; font-size: 12px; color: var(--muted); }
.pm-name { color: var(--ink); font-weight: 700; }
.pm-text { margin-top: 3px; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.pm-photo { display: block; margin-top: 6px; }
.pm-photo img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; }
.pm-links { margin-top: 5px; font-size: 12px; font-weight: 600; }
.pm-links a { color: var(--navy); text-decoration: none; }
.pm-links a:hover, .pm-links a:focus-visible { text-decoration: underline; }
.pm-more { margin-top: 6px; border: 0; background: none; color: var(--navy); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; padding: 4px 0; }
.pm-extra[hidden], .pm-more-wrap[hidden] { display: none; }
@media (max-width: 760px) {
  .parcel-sheet .pop-memories { margin-top: 8px; padding-top: 6px; }
}

/* ---- Photo galleries (Google-style strip, home grid, lightbox) ---- */
.photo-strip-wrap { margin: 12px 0 4px; min-width: 0; max-width: 100%; }
.photo-strip-count { font-size: 16px; font-weight: 700; color: var(--navy); margin: 0 0 8px; line-height: 1.3; }
.photo-strip {
  display: flex; gap: 8px; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
  padding-bottom: 4px; margin: 0 -2px; max-width: 100%;
}
.photo-strip-item {
  flex: 0 0 96px; width: 96px; height: 96px; aspect-ratio: 1 / 1;
  padding: 0; border: 0; border-radius: 10px; overflow: hidden;
  background: var(--soft, #eef1f6); cursor: pointer; scroll-snap-align: start;
  position: relative;
}
.photo-strip-item img {
  display: block; width: 96px; height: 96px; object-fit: cover;
  aspect-ratio: 1 / 1;
}
.sap-pop .photo-strip-wrap { margin-top: 12px; }
.parcel-sheet .photo-strip-item,
.parcel-sheet .photo-strip-item img { flex-basis: 88px; width: 88px; height: 88px; }

.photo-gallery { margin: 14px 0 18px; min-width: 0; max-width: 100%; }
.photo-gallery-count { font-size: 16px; font-weight: 700; color: var(--navy); margin: 0 0 10px; }
.photo-gallery-grid {
  display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 8px; min-width: 0;
}
.photo-gallery-hero,
.photo-gallery-thumb {
  display: block; padding: 0; border: 0; border-radius: 12px; overflow: hidden;
  background: var(--soft, #eef1f6); cursor: pointer; position: relative;
  width: 100%;
}
.photo-gallery-hero { aspect-ratio: 4 / 3; }
.photo-gallery-thumbs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; min-width: 0; align-content: start; }
.photo-gallery-thumb { aspect-ratio: 1 / 1; }
.photo-gallery-hero img,
.photo-gallery-thumb img {
  display: block; width: 100%; height: 100%; object-fit: cover;
}
.photo-gallery-more {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(15, 35, 64, 0.45); color: #fff; font-size: 18px; font-weight: 800;
}
.pin-photo { cursor: pointer; }
@media (max-width: 640px) {
  .photo-gallery-grid { grid-template-columns: 1fr; }
  .photo-gallery-thumbs {
    display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch; gap: 8px;
  }
  .photo-gallery-thumb { flex: 0 0 112px; width: 112px; height: 112px; aspect-ratio: 1 / 1; }
  .photo-gallery-hero { aspect-ratio: 4 / 3; }
}

.town-photos { min-width: 0; }
.town-photo-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px; min-width: 0;
}
.town-photo { display: block; min-width: 0; text-decoration: none; color: inherit; }
.town-photo-frame {
  display: block; aspect-ratio: 1 / 1; border-radius: 12px; overflow: hidden;
  background: var(--soft, #eef1f6);
}
.town-photo-frame img { display: block; width: 100%; height: 100%; object-fit: cover; }
.town-photo-addr {
  display: block; margin-top: 6px; font-size: 16px; font-weight: 600; color: var(--navy);
  line-height: 1.3; overflow-wrap: anywhere; word-break: break-word;
}
@media (max-width: 430px) {
  .town-photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
}

.sap-lightbox {
  position: fixed; inset: 0; z-index: 80; background: rgba(10, 16, 28, 0.94);
  display: flex; flex-direction: column; color: #fff;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}
.sap-lightbox[hidden] { display: none; }
body.sap-lb-open { overflow: hidden; }
body.map-page.sap-lb-open #map { pointer-events: none; }
.sap-lb-close {
  position: absolute; top: max(8px, env(safe-area-inset-top, 8px)); right: max(8px, env(safe-area-inset-right, 8px));
  width: 48px; height: 48px; border: 0; border-radius: 24px;
  background: rgba(255,255,255,0.16); color: #fff; font-size: 36px; line-height: 1;
  cursor: pointer; z-index: 2;
}
.sap-lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 48px; height: 48px; border: 0; border-radius: 24px;
  background: rgba(255,255,255,0.16); color: #fff; font-size: 36px; line-height: 1;
  cursor: pointer; z-index: 2;
}
.sap-lb-prev { left: max(8px, env(safe-area-inset-left, 8px)); }
.sap-lb-next { right: max(8px, env(safe-area-inset-right, 8px)); }
.sap-lb-stage {
  flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center;
  padding: 56px 16px 8px; touch-action: none;
}
.sap-lb-frame {
  max-width: 100%; max-height: 100%; touch-action: none; overscroll-behavior: contain;
}
.sap-lb-img {
  display: block; max-width: min(100%, 100vw); max-height: 70dvh;
  width: auto; height: auto; object-fit: contain;
  transform-origin: center center; user-select: none; -webkit-user-drag: none;
}
.sap-lb-caption {
  flex: 0 0 auto; padding: 12px 20px calc(16px + env(safe-area-inset-bottom, 0));
  font-size: 16px; line-height: 1.4; max-width: 100%; box-sizing: border-box;
}
.sap-lb-count { font-size: 16px; opacity: 0.8; margin-bottom: 4px; }
.sap-lb-meta { font-weight: 700; overflow-wrap: anywhere; }
.sap-lb-name { margin-top: 2px; overflow-wrap: anywhere; }
.sap-lb-memory {
  display: inline-block; margin-top: 8px; color: #fff; font-size: 16px; font-weight: 700;
  text-decoration: underline;
}
@media (max-width: 430px) {
  .sap-lb-img { max-height: 62dvh; }
  .sap-lb-caption { padding-left: 16px; padding-right: 16px; }
}

/* ---- spot photos ---- */
.photo-strip-n { font-weight: 600; color: #51607a; }
.spot-photo-modal { position: fixed; inset: 0; z-index: 4000; background: rgba(15, 35, 64, 0.45); display: flex; align-items: flex-end; justify-content: center; }
.spot-photo-modal[hidden] { display: none; }
@media (min-width: 761px) { .spot-photo-modal { align-items: center; } }
.spot-photo-card { position: relative; background: #fff; width: 100%; max-width: 460px; max-height: 92vh; overflow-y: auto; border-radius: 16px 16px 0 0; padding: 20px 18px calc(18px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 30px rgba(0,0,0,.25); }
@media (min-width: 761px) { .spot-photo-card { border-radius: 16px; padding: 24px; } }
.spot-photo-card h2 { margin: 0 44px 4px 0; font-size: 20px; color: var(--navy, #0f2340); }
.spot-photo-place { margin: 0 0 14px; color: #51607a; font-size: 14px; }
.spot-photo-close { position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: #eef1f6; color: #0f2340; font-size: 26px; line-height: 40px; cursor: pointer; }
.spot-photo-close:hover, .spot-photo-close:focus-visible { background: #dfe5ee; }
.spot-photo-pick { display: inline-flex; align-items: center; justify-content: center; width: 100%; cursor: pointer; margin-bottom: 10px; }
.spot-photo-previews { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 10px; }
.spot-photo-prev { position: relative; width: 72px; height: 72px; }
.spot-photo-prev img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; display: block; }
.spot-photo-rm { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: #0f2340; color: #fff; font-size: 16px; line-height: 24px; cursor: pointer; }
.spot-photo-label { display: block; font-weight: 600; font-size: 14px; margin: 8px 0 4px; }
.spot-photo-form textarea, .spot-photo-form input[type=text] { width: 100%; box-sizing: border-box; font: inherit; font-size: 16px; padding: 8px 10px; border: 1px solid #c9d1de; border-radius: 8px; }
.spot-photo-count { text-align: right; font-size: 12px; }
.spot-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.spot-photo-note { font-size: 12.5px; color: #51607a; margin: 10px 0; line-height: 1.4; }
.spot-photo-msg { font-size: 14px; margin: 8px 0; padding: 8px 10px; border-radius: 8px; background: #eef6ee; color: #1d5b2a; }
.spot-photo-msg.err { background: #fdeeee; color: #8a1c1c; }
.spot-photo-actions { display: flex; gap: 10px; }
.spot-photo-actions .btn { flex: 1; }
body.spot-photo-open { overflow: hidden; }
.sap-lb-report { margin-top: 6px; background: transparent; border: 1px solid rgba(255,255,255,.5); color: #fff; border-radius: 999px; padding: 4px 12px; font-size: 13px; cursor: pointer; }
.sap-lb-report[hidden] { display: none; }
.sap-lb-report:disabled { opacity: .75; cursor: default; }

.spot-photo-hint { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 3500; background: #0f2340; color: #fff; border-radius: 999px; padding: 10px 8px 10px 18px; display: flex; align-items: center; gap: 8px; font-size: 15px; box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: calc(100vw - 32px); }
.spot-photo-hint[hidden] { display: none; }
.spot-photo-hint-x { width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(255,255,255,.18); color: #fff; font-size: 20px; line-height: 32px; cursor: pointer; }
