:root {
  color-scheme: light;
  --blue: #536eaa;
  --blue-dark: #3e568d;
  --blue-soft: #e6ebf7;
  --rose: #f6cecd;
  --rose-dark: #eeb4b3;
  --paper: #f5f2ef;
  --surface: #fffdfb;
  --ink: #26314a;
  --muted: #6c7482;
  --line: #ded9d4;
  --shadow: 0 14px 34px rgb(40 48 72 / 17%);
  font-family: "Avenir Next", Avenir, "Segoe UI", system-ui, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: #e7e4e1;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 8%, rgb(255 255 255 / 82%), transparent 30rem),
    #e7e4e1;
}

button,
a {
  font: inherit;
}

button:focus-visible,
a:focus-visible,
.map-viewport:focus-visible {
  outline: 3px solid rgb(246 206 205 / 82%);
  outline-offset: 3px;
}

.app-frame {
  display: flex;
  width: min(100%, 480px);
  min-height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  flex-direction: column;
  background: var(--paper);
  box-shadow: 0 0 60px rgb(39 45 66 / 15%);
}

.app-bar {
  z-index: 50;
  display: flex;
  min-height: calc(58px + env(safe-area-inset-top));
  align-items: center;
  justify-content: space-between;
  padding: max(11px, env(safe-area-inset-top)) 16px 10px;
  background: var(--blue);
  box-shadow: 0 3px 14px rgb(47 63 102 / 18%);
  color: white;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.035em;
}

.brand-mark {
  width: 12px;
  height: 18px;
  border: 2px solid currentColor;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  padding: 9px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  place-items: center;
}

.icon-button--light {
  color: white;
}

.icon-button:hover {
  background: rgb(255 255 255 / 13%);
}

.icon-button svg,
.map-control svg,
.sheet-close svg,
.sheet-arrow svg,
.bottom-nav svg,
.detail-header svg {
  width: 100%;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.map-shell {
  position: relative;
  min-height: 0;
  flex: 1;
}

.map-viewport,
.droid-map {
  position: absolute;
  inset: 0;
}

.map-viewport {
  overflow: hidden;
  background: #eceae6;
}

.droid-map {
  opacity: 0;
  transition: opacity 300ms ease;
}

.map-viewport.is-ready .droid-map {
  opacity: 1;
}

.maplibregl-map {
  font: inherit;
}

.maplibregl-canvas {
  cursor: grab;
}

.maplibregl-canvas:active {
  cursor: grabbing;
}

.maplibregl-ctrl-logo {
  transform: scale(0.82);
  transform-origin: bottom left;
}

.maplibregl-ctrl-attrib {
  color: #444b56;
  font-size: 9px;
}

.maplibregl-ctrl-attrib a {
  color: inherit;
}

.maplibregl-ctrl-bottom-right {
  transition: bottom 260ms ease;
}

.map-shell:has(.building-sheet.is-open) .maplibregl-ctrl-bottom-right {
  bottom: 124px;
}

.map-badge {
  position: absolute;
  z-index: 5;
  top: 14px;
  left: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border: 1px solid rgb(255 255 255 / 82%);
  border-radius: 99px;
  background: rgb(255 253 251 / 89%);
  box-shadow: 0 4px 12px rgb(40 45 59 / 10%);
  color: #5f6673;
  font-size: 0.63rem;
  font-weight: 750;
  letter-spacing: 0.035em;
  backdrop-filter: blur(8px);
}

.map-badge span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 3px rgb(83 110 170 / 14%);
}

.map-controls {
  position: absolute;
  z-index: 10;
  top: 52px;
  right: 12px;
  display: grid;
  gap: 7px;
}

.map-control {
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 82%);
  border-radius: 13px;
  background: rgb(255 253 251 / 94%);
  box-shadow: 0 5px 14px rgb(40 45 59 / 12%);
  color: var(--blue-dark);
  font-size: 1.35rem;
  font-weight: 600;
  cursor: pointer;
  place-items: center;
  backdrop-filter: blur(8px);
}

.map-control:hover {
  background: var(--blue-soft);
}

.map-control--locate {
  margin-top: 3px;
  padding: 10px;
}

.map-status {
  position: absolute;
  z-index: 40;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 12px;
  padding: 30px;
  background: rgb(245 242 239 / 92%);
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  backdrop-filter: blur(6px);
}

.map-status.is-error {
  color: #8a4646;
}

.map-status.is-error strong {
  color: var(--ink);
  font-size: 1.1rem;
}

.loader {
  width: 34px;
  height: 34px;
  border: 3px solid var(--blue-soft);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.map-marker {
  width: var(--marker-width);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--blue-dark);
  cursor: pointer;
  filter: saturate(0.92);
}

.marker-visual {
  position: relative;
  display: block;
  width: 100%;
  transition: filter 180ms ease, transform 180ms ease;
  transform-origin: 50% 88%;
}

.map-marker img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 8px 7px rgb(32 36 49 / 24%));
  pointer-events: none;
  user-select: none;
}

.marker-label {
  position: absolute;
  z-index: 2;
  top: -9px;
  left: 50%;
  max-width: 145px;
  padding: 5px 8px;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 90%);
  border-radius: 8px;
  background: rgb(255 253 251 / 94%);
  box-shadow: 0 4px 12px rgb(39 46 63 / 14%);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
  transform: translateX(-50%);
  transition: color 160ms ease, background 160ms ease;
}

.marker-pin {
  position: absolute;
  bottom: -4px;
  left: 50%;
  width: 12px;
  height: 12px;
  border: 3px solid white;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 2px 7px rgb(32 36 49 / 30%);
  transform: translateX(-50%);
}

.map-marker:hover .marker-visual,
.map-marker.is-selected .marker-visual {
  filter: saturate(1.08) brightness(1.03);
  transform: scale(1.08) translateY(-3px);
}

.map-marker.is-selected {
  z-index: 1000 !important;
}

.map-marker.is-selected .marker-label {
  border-color: var(--blue);
  background: var(--blue);
  color: white;
}

.map-marker.is-selected .marker-pin {
  box-shadow: 0 0 0 6px rgb(83 110 170 / 22%), 0 3px 8px rgb(32 36 49 / 30%);
}

.building-sheet {
  position: absolute;
  z-index: 30;
  right: 12px;
  bottom: 12px;
  left: 12px;
  overflow: visible;
  border: 1px solid rgb(255 255 255 / 65%);
  border-radius: 19px;
  background: var(--rose);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(calc(100% + 28px));
  transition: opacity 230ms ease, transform 280ms cubic-bezier(.2, .75, .25, 1);
}

.building-sheet.is-open {
  opacity: 1;
  transform: translateY(0);
}

.sheet-link {
  display: grid;
  min-height: 112px;
  grid-template-columns: 92px 1fr 28px;
  align-items: center;
  gap: 13px;
  padding: 10px 34px 10px 10px;
  border-radius: inherit;
  color: inherit;
  text-decoration: none;
}

.sheet-link:hover {
  background: rgb(255 255 255 / 16%);
}

.sheet-image {
  display: grid;
  width: 92px;
  height: 92px;
  overflow: hidden;
  border-radius: 13px;
  background: rgb(255 253 251 / 66%);
  place-items: center;
}

.sheet-image img {
  width: 92%;
  height: 92%;
  object-fit: contain;
  filter: drop-shadow(0 5px 5px rgb(38 43 56 / 18%));
}

.sheet-copy {
  display: block;
  min-width: 0;
}

.sheet-copy small,
.sheet-copy strong,
.sheet-copy > span {
  display: block;
}

.sheet-copy small {
  margin-bottom: 4px;
  overflow: hidden;
  color: #72585f;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.045em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.sheet-copy strong {
  color: var(--blue-dark);
  font-size: 1.03rem;
  line-height: 1.2;
}

.sheet-copy > span {
  margin-top: 5px;
  color: #665f6b;
  font-size: 0.72rem;
  font-weight: 650;
}

.sheet-arrow {
  display: grid;
  width: 28px;
  height: 28px;
  color: var(--blue-dark);
  place-items: center;
}

.sheet-arrow svg {
  width: 22px;
}

.sheet-close {
  position: absolute;
  z-index: 2;
  top: 8px;
  right: 8px;
  display: grid;
  width: 28px;
  height: 28px;
  padding: 7px;
  border: 0;
  border-radius: 50%;
  background: rgb(255 255 255 / 45%);
  color: #665f6b;
  cursor: pointer;
  place-items: center;
}

.bottom-nav {
  z-index: 50;
  display: grid;
  min-height: calc(67px + env(safe-area-inset-bottom));
  grid-template-columns: repeat(5, 1fr);
  padding: 7px 6px max(7px, env(safe-area-inset-bottom));
  background: var(--blue);
  box-shadow: 0 -4px 18px rgb(46 58 92 / 20%);
}

.bottom-nav a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 10px;
  color: rgb(255 255 255 / 76%);
  font-size: 0.57rem;
  font-weight: 650;
  text-decoration: none;
  flex-direction: column;
}

.bottom-nav a:hover,
.bottom-nav a.is-active {
  background: rgb(255 255 255 / 10%);
  color: white;
}

.bottom-nav svg {
  width: 22px;
  height: 22px;
}

.bottom-nav a:first-child svg,
.bottom-nav a:nth-child(2) svg {
  fill: currentColor;
  stroke-width: 1.6;
}

.detail-header {
  display: grid;
  min-height: calc(62px + env(safe-area-inset-top));
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  padding: max(10px, env(safe-area-inset-top)) 10px 8px;
  background: var(--paper);
  color: var(--blue-dark);
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
  overflow-wrap: anywhere;
}

.detail-header .icon-button {
  grid-column: 1;
  text-decoration: none;
}

.detail-header > span {
  grid-column: 2;
}

.detail-content {
  flex: 1;
  background: var(--paper);
}

.detail-loading,
.detail-error {
  display: grid;
  min-height: 70dvh;
  align-content: center;
  justify-items: center;
  padding: 32px;
  color: var(--muted);
  text-align: center;
}

.detail-hero {
  position: relative;
  display: grid;
  min-height: 350px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 65%, rgb(255 255 255 / 82%), transparent 50%),
    linear-gradient(145deg, #dce3f2, #f4d8d7);
  place-items: center;
}

.detail-hero::after {
  position: absolute;
  right: -20%;
  bottom: -45%;
  left: -20%;
  height: 58%;
  border-radius: 50%;
  background: rgb(255 255 255 / 35%);
  content: "";
}

.detail-hero > p {
  position: absolute;
  z-index: 1;
  top: 18px;
  left: 20px;
  margin: 0;
  color: var(--blue-dark);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.detail-hero img {
  z-index: 1;
  width: min(88%, 390px);
  max-height: 315px;
  object-fit: contain;
  filter: drop-shadow(0 14px 12px rgb(38 43 56 / 24%));
}

.detail-copy {
  position: relative;
  z-index: 2;
  margin-top: -20px;
  padding: 30px 24px 42px;
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  background: var(--surface);
}

.detail-eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.detail-copy h1 {
  margin: 0;
  color: var(--blue-dark);
  font-size: 2rem;
  line-height: 1.12;
  letter-spacing: -0.03em;
}

.detail-copy > p:not(.detail-eyebrow) {
  margin: 15px 0 24px;
  color: var(--muted);
  line-height: 1.6;
}

.detail-copy dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0 0 24px;
}

.detail-copy dl div {
  padding: 13px;
  border-radius: 12px;
  background: var(--blue-soft);
}

.detail-copy dt {
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 700;
}

.detail-copy dd {
  margin: 3px 0 0;
  color: var(--blue-dark);
  font-size: 0.9rem;
  font-weight: 800;
}

.primary-link {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border-radius: 14px;
  background: var(--blue);
  box-shadow: 0 8px 20px rgb(63 86 141 / 22%);
  color: white;
  font-weight: 800;
  text-decoration: none;
}

.detail-error h1 {
  margin-bottom: 8px;
  color: var(--blue-dark);
}

.detail-error a {
  color: var(--blue);
  font-weight: 700;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (min-width: 600px) {
  body {
    padding: 24px 0;
  }

  .app-frame {
    min-height: calc(100dvh - 48px);
    height: calc(100dvh - 48px);
    border-radius: 30px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
