/* =========================================================================
   Tutok — Map styles
   Stylized city map: land, roads, blocks, water, park, pins, user dot, route.
   Layout positions are set inline by js/map.js using % coordinates.
   ========================================================================= */

.map {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--map-land);
  box-shadow: var(--sh-1);
  isolation: isolate;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.map--tall { aspect-ratio: 3 / 4; }
.map--wide { aspect-ratio: 16 / 10; }
.map--full { aspect-ratio: auto; height: 100%; border-radius: 0; }

/* The SVG city fills the map */
.map__city { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* Subtle top vignette for depth + legibility of overlays */
.map::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(20,18,31,.10) 0%, transparent 22%),
    radial-gradient(120% 80% at 50% 120%, rgba(20,18,31,.10), transparent 60%);
  z-index: 5;
}

/* ---- Map primitive fills (used inside the SVG via class) ---- */
.map-land { fill: var(--map-land); }
.map-block { fill: var(--map-block); }
.map-road { stroke: var(--map-road); stroke-linecap: round; }
.map-road--minor { stroke: var(--map-road); opacity: .8; }
.map-water { fill: var(--map-water); }
.map-park { fill: var(--map-park); }

/* =========================================================================
   Tutor pin (teardrop with avatar/emoji)
   ========================================================================= */
.map__pin {
  position: absolute;
  transform: translate(-50%, -100%);
  z-index: 12;
  width: 40px;
  height: 50px;
  filter: drop-shadow(0 6px 10px rgba(20,18,31,.28));
  transition: transform var(--dur) var(--ease);
  cursor: default;
}
.map__pin-drop {
  position: absolute;
  inset: 0;
  background: var(--grad-brand);
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.55);
}
.map__pin-inner {
  position: absolute;
  top: 4px; left: 4px;
  width: 32px; height: 32px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface);
  display: grid;
  place-items: center;
  font-size: 1rem;
  z-index: 1;
}
.map__pin-inner img { width: 100%; height: 100%; object-fit: cover; }
.map__pin--moving { z-index: 14; transition: none; }
.map__pin--me-target { width: 34px; height: 42px; }

/* Small pin variant for crowd of tutors */
.map__pin--sm { width: 30px; height: 38px; }
.map__pin--sm .map__pin-inner { top: 3px; left: 3px; width: 24px; height: 24px; font-size: .8rem; }

/* =========================================================================
   User location dot (pulsing)
   ========================================================================= */
.map__me {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 11;
  width: 22px; height: 22px;
}
.map__me-dot {
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 3px #fff, 0 4px 10px rgba(91,91,245,.5);
  z-index: 2;
}
.map__me-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--brand);
  opacity: .35;
  animation: mePulse 2.4s var(--ease-io) infinite;
}
@keyframes mePulse {
  0% { transform: scale(.6); opacity: .5; }
  70% { transform: scale(2.6); opacity: 0; }
  100% { transform: scale(2.6); opacity: 0; }
}

/* =========================================================================
   Route (dashed brand path) — rendered as SVG path
   ========================================================================= */
.map__route {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  z-index: 8;
  pointer-events: none;
  overflow: visible;
}
.map__route-path {
  fill: none;
  stroke: var(--brand);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 2 11;
  opacity: .9;
  filter: drop-shadow(0 2px 4px rgba(91,91,245,.4));
}
.map__route-path--bg {
  fill: none;
  stroke: #fff;
  stroke-width: 7;
  stroke-linecap: round;
  opacity: .65;
}
.map__route-dash { animation: routeFlow 1s linear infinite; }
@keyframes routeFlow { to { stroke-dashoffset: -13; } }

/* Origin marker (pickup/destination little ring) */
.map__dot {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--ink), 0 3px 8px rgba(20,18,31,.3);
  z-index: 10;
}
.map__dot--start { box-shadow: 0 0 0 3px var(--success), 0 3px 8px rgba(18,184,134,.4); }

/* =========================================================================
   Reduced motion: no pulsing / flow
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
  .map__me-ring { animation: none; opacity: 0; }
  .map__route-dash { animation: none; }
  .map__pin, .map__pin--moving { transition: none; }
}
