/* ---------- 3. location: the map alone, edge to edge, no headline ---------- */

/* The map is one drawing, 1440 by 900, north up, one pixel to about 4.85 metres.
   Every position below is in the drawing's own pixels, so each place sits where it is on the ground.
   js/map.js scales the drawing to the window (--k).
   One rule holds for every name and card: neither it nor its soft edge may lie over NH 66. */

/* still */

.map { overflow: hidden; height: calc(900px * var(--k, 1)); background: var(--page); }
.map__plane { position: relative; width: 1440px; height: 900px; transform-origin: 0 0; transform: scale(var(--k, 1)); }
.map__art, .map__cards { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
.map__art svg { width: 100%; height: 100%; }

/* Every real street, stream and river of the area, faint: assets/map-streets.svg, drawn from
   OpenStreetMap data. */
.map__streets { position: absolute; left: 0; top: 0; width: 100%; height: 100%; max-width: none; }
/* NH 66 in tan under the ink line; the proposed highway dotted; the route to the plot in ink. */
.map__road { fill: none; stroke: var(--tan); stroke-width: 9; stroke-linecap: round; opacity: 0.7; }
.map__proposed { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 2 10; }
.map__route { fill: none; stroke: var(--ink); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
/* The drawing fades into the page at its top and bottom edges. */
.map__fade { position: absolute; left: 0; right: 0; top: 0; height: 110px; background: linear-gradient(to bottom, var(--page) 0%, transparent 100%); }
.map__art::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 70px; background: linear-gradient(to top, var(--page) 0%, transparent 100%); pointer-events: none; }

/* The other places: a small black pin, its point on the place. */
.spot {
  position: absolute;
  width: 20px;
  height: 25px;
  margin: -25px 0 0 -10px;
  transform-origin: 50% 100%;
  filter: drop-shadow(0 1px 2px rgba(23, 16, 15, 0.3));
}
.spot svg { display: block; width: 100%; height: 100%; overflow: visible; }
.spot__body { fill: var(--pin-black); stroke: var(--page); stroke-width: 2; paint-order: stroke; }
.spot__eye { fill: var(--page); }
.spot--jn { left: 253px; top: 133px; }
.spot--ul { left: 625px; top: 361px; }
.spot--tower { left: 800px; top: 347px; }
.spot--park { left: 823px; top: 378px; }
.spot--mall { left: 754px; top: 503px; }
/* Royal Drive and Galaxy Celeste Riviera stand side by side on NH 66, about 30 m apart: one pin, two names. */
.spot--near { left: 847px; top: 696px; }

/* THE GRAND 10: a red pin, its point on the plot's exact position. */
.pin {
  position: absolute;
  left: 889px;
  top: 675px;
  width: 40px;
  height: 54px;
  margin: -54px 0 0 -20px;
  transform-origin: 50% 100%;
  filter: drop-shadow(0 3px 5px rgba(58, 16, 18, 0.3));
}
.pin svg { display: block; width: 100%; height: 100%; overflow: visible; }
.pin__body { fill: var(--pin-red); stroke: var(--page); stroke-width: 2.5; paint-order: stroke; }
.pin__dot { fill: var(--pin-red-dot); }
/* The ring that spreads from the pin's point when the line arrives. */
.pin::after { content: ''; position: absolute; left: 50%; bottom: -8px; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; border: 2px solid var(--pin-red); opacity: 0; }

/* A place's name on the map. It clears the streets behind it with a soft edge, not a hard box. */
.tag { position: absolute; padding: 6px 12px; border-radius: 10px; background: var(--page); box-shadow: 0 0 10px 5px var(--page); font-size: 15px; font-weight: 600; white-space: nowrap; }
.tag--city { left: 22px; top: 298px; }
/* A small arrow: the city lies off the map's west edge. */
.tag--city::before { content: ''; display: inline-block; width: 7px; height: 7px; margin: 0 8px 1px 2px; border-left: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: rotate(45deg); }
.tag--jn { right: 1226px; top: 102px; }
.tag--ul { left: 640px; top: 335px; padding: 4px 10px; font-size: 13px; }
/* Royal Drive and the Galaxy tower share one pin: their names stand left of it, one under the other. */
.tag--drive { right: 630px; top: 682px; padding: 4px 10px; font-size: 13px; box-shadow: 0 0 8px 4px var(--page); }
.tag--galaxy { right: 630px; top: 710px; padding: 4px 10px; font-size: 13px; box-shadow: 0 0 8px 4px var(--page); }
/* A road's name rides on the road, turned to its direction (--turn). */
.tag--road {
  padding: 4px 12px;
  border-radius: var(--round-pill);
  background: var(--ink);
  box-shadow: none;
  color: var(--page);
  font-size: 13px;
  letter-spacing: 0.02em;
  transform: rotate(var(--turn));
  transform-origin: 0 50%;
}
.tag--bypass { left: 298px; top: 141px; --turn: 20deg; }
.tag--nh { left: 604px; top: 392px; --turn: 27deg; }
/* Three names shown on the map only on a phone, where each place's card sits at the foot of the screen. */
.tag--phone { display: none; }
.tag--river { left: 1094px; top: 530px; padding: 0; background: none; box-shadow: none; font-size: 12px; font-weight: 500; letter-spacing: 0.1em; color: var(--quiet-sm); transform: rotate(-48deg); transform-origin: 0 50%; }

/* A place's card: its name, and a small picture where there is one. Each sits beside its own pin:
   the mall's to the left, the tower's above, Cyberpark's to the right. */
.place { position: absolute; width: 230px; padding: 12px 14px; border-radius: 14px; background: var(--page); box-shadow: 0 0 14px 8px var(--page); display: flex; flex-direction: column; gap: 4px; }
.place h3 { font-family: var(--head); font-size: 20px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.place__meta { font-size: 14px; font-weight: 500; }
.place__note { font-size: 13px; line-height: 1.4; color: var(--quiet-sm); }
.place__pic { display: block; object-fit: cover; border-radius: 10px; }
.place--mall { right: 736px; top: 480px; box-shadow: 0 0 8px 4px var(--page); width: auto; align-items: flex-end; gap: 6px; }
.place--mall .place__pic { width: 140px; height: 96px; }
.place--tower { left: 672px; bottom: 584px; width: auto; flex-direction: row; align-items: flex-end; gap: 10px; }
.place--tower .place__pic { width: 96px; height: 124px; }
.place__words { display: flex; flex-direction: column; gap: 3px; width: 122px; }
.place--park { left: 846px; top: 352px; width: auto; }
.place--green { right: 20px; bottom: 296px; width: 240px; text-align: right; }
.place--green h3 { font-size: 17px; }
.place--home { left: 832px; top: 534px; width: 250px; }
.place--home h3 { font-size: 30px; font-weight: 700; letter-spacing: -0.035em; line-height: 1; }

/* The credit OpenStreetMap's licence asks for, small, in the map's lower left corner. */
.map__credit { position: absolute; left: 24px; top: 806px; font-size: 11px; line-height: 1.3; color: var(--quiet-sm); text-shadow: 0 0 6px var(--page), 0 0 6px var(--page), 0 0 6px var(--page); }

/* Standing still on a narrow screen: the drawing is scaled to the width, and the cards are set
   under it in a grid, so nothing is too small to read. */
@media (max-width: 1023px) {
  html:not(.motion) .map { height: auto; }
  html:not(.motion) .map__plane { width: 100%; height: auto; transform: none; }
  /* The drawing keeps its shape and is scaled down; the margin takes back the space the scaling leaves. */
  html:not(.motion) .map__art { position: relative; width: 1440px; height: 900px; transform-origin: 0 0; transform: scale(var(--k, 1)); margin-bottom: calc(900px * (var(--k, 1) - 1)); }
  html:not(.motion) .map__cards { position: static; height: auto; padding: 24px var(--gutter) 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
  html:not(.motion) .place, html:not(.motion) .map__credit { position: static; width: auto; max-width: none; text-align: left; }
  html:not(.motion) .place { border: 1px solid var(--rule); box-shadow: none; }
  html:not(.motion) .map__credit { grid-column: 1 / -1; }
}

/* moving */

/* Held for two and a half screens of scroll while the route draws itself. js/map.js centres the
   drawing up and down (--my) and fades it in as it arrives (--enter). */
.motion .hold--map { height: 350vh; }
.motion .map { height: 100vh; }
.motion .map__plane { position: absolute; left: var(--mx, 0px); top: var(--my, 0px); opacity: var(--enter, 1); }

/* Each pin, name and card waits unseen and comes in when the line reaches its place (.on). */
.motion [data-place] { opacity: 0; transition: opacity 0.45s ease, transform 0.45s ease; }
.motion .place[data-place], .motion .tag[data-place] { transform: translateY(10px); }
.motion .spot[data-place] { transform: translateY(-12px) scale(0.3); }
.motion .tag--road[data-place] { transform: rotate(var(--turn)) translateY(10px); }
.motion [data-place].on { opacity: 1; }
.motion .place[data-place].on, .motion .tag[data-place].on { transform: none; }
.motion .spot[data-place].on { transform: none; }
.motion .tag--road[data-place].on { transform: rotate(var(--turn)); }

/* When the line arrives, the red pin drops in from above with a small overshoot and its ring
   spreads once; THE GRAND 10's name comes with it. */
.motion .pin, .motion .place--home { opacity: 0; transition: opacity 0.5s ease, transform 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.3); }
.motion .pin { transform: translateY(-28px) scale(0.2); }
.motion .place--home { transform: translateY(10px); }
.motion .arrived .pin, .motion .arrived .place--home { opacity: 1; transform: none; }
.motion .arrived .pin::after { animation: pin-ring 1.2s ease-out 0.35s 1 both; }
@keyframes pin-ring {
  from { opacity: 0.8; transform: scale(1); }
  to { opacity: 0; transform: scale(3.6); }
}

/* moving, on a phone */

/* About 490 px of the drawing fills the width, so its names stay readable, and the view travels
   down NH 66 with the line (js/map.js moves the drawing with --mx and --my). The pins and names
   stay on the map. Each place's card sits at the foot of the screen, one at a time (.now). */
.motion.phone .hold--map { height: 420vh; }
.motion.phone .map__plane { position: absolute; left: 0; top: 0; width: 100%; height: 100%; transform: none; }
.motion.phone .map__art { position: absolute; left: 0; top: 0; width: 1440px; height: 900px; transform-origin: 0 0; transform: translate3d(var(--mx, 0px), var(--my, 0px), 0) scale(var(--k, 1)); will-change: transform; }
.motion.phone .map__cards { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; }
.motion.phone .tag { font-size: 16px; }
.motion.phone .tag--road, .motion.phone .tag--ul, .motion.phone .tag--galaxy, .motion.phone .tag--drive { font-size: 15px; }
.motion.phone .tag--river { font-size: 14px; }
.motion.phone .tag--phone { display: block; font-size: 15px; padding: 4px 10px; }
.motion.phone .tag--phone-tower { left: 792px; top: 288px; }
.motion.phone .tag--phone-park { left: 838px; top: 360px; }
.motion.phone .tag--phone-mall { right: 704px; top: 480px; }
.motion.phone .tag--drive { right: 636px; top: 676px; }
.motion.phone .tag--galaxy { right: 636px; top: 706px; }
.motion.phone .place[data-place] {
  left: 14px;
  right: 14px;
  top: auto;
  bottom: 84px;
  width: auto;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 18px;
  text-align: left;
  background: var(--page);
  box-shadow: 0 16px 36px -18px rgba(58, 16, 18, 0.5), 0 0 0 1px var(--rule);
  opacity: 0;
  transform: translateY(14px);
}
.motion.phone .place[data-place].now { opacity: 1; transform: none; }
.motion.phone .place .place__pic { order: -1; flex: none; border-radius: 12px; }
.motion.phone .place--mall .place__pic { width: 120px; height: 82px; }
.motion.phone .place--tower .place__pic { width: 70px; height: 90px; }
.motion.phone .place h3 { font-family: var(--head); font-size: 20px; letter-spacing: -0.02em; }
.motion.phone .place__words { width: auto; }
.motion.phone .place--green[data-place] { flex-direction: column; align-items: flex-start; gap: 4px; }
.motion.phone .place--green h3 { font-size: 17px; }
/* THE GRAND 10's name stays on the map, above its pin, and moves with the map. */
.motion.phone .place--home,
.motion.phone .arrived .place--home {
  left: 0;
  top: 0;
  transform-origin: 0 0;
  transform: translate3d(calc(var(--mx, 0px) + 832px * var(--k, 1)), calc(var(--my, 0px) + 534px * var(--k, 1)), 0) scale(var(--k, 1));
  transition: opacity 0.5s ease;
}
/* The credit sits at the foot, to the left of the WhatsApp pill, on two short lines. */
.motion.phone .map__credit { left: 16px; top: auto; bottom: 22px; max-width: calc(100% - 216px); font-size: 10px; line-height: 1.25; }
