/* ============================================================
   Woodin Creek Wayfinder — trailhead-sign aesthetic.
   Cream paper, deep forest ink, chunky type. Built for phones
   held in one hand, outdoors, in a hurry.
   ============================================================ */

:root {
  --paper: #edf6f2;           /* sea glass */
  --paper-deep: #e7efda;      /* map ground — parkland mint */
  --ink: #0f3038;             /* deep petrol */
  --forest: #0d7a70;          /* teal — primary UI color */
  --forest-bright: #14b8a6;
  --amber: #c95836;           /* terracotta — action color */
  --gold: #5eead4;            /* light aqua — masthead accent */
  --magenta: #a83f2b;         /* deep rust — gradient partner for terracotta */
  --cream-card: #ffffff;
  --street: #f7f3e8;          /* streets read as light ribbons on the mint ground */
  --street-edge: #d6d0bd;
  --grass: #abd784;
  --dot-blue: #1a73e8;
  --radius: 14px;
  --shadow: 0 2px 4px rgba(13, 90, 84, 0.10), 0 10px 26px rgba(13, 90, 84, 0.12);
  --font: 'Bricolage Grotesque', 'Avenir Next', 'Segoe UI', sans-serif;
}

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

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  /* cartographer's grid: faint map lines under soft teal & coral washes */
  background:
    radial-gradient(900px 420px at 85% -5%, rgba(20, 184, 166, 0.13), transparent 60%),
    radial-gradient(700px 380px at -10% 30%, rgba(255, 90, 60, 0.09), transparent 60%),
    radial-gradient(600px 320px at 110% 85%, rgba(56, 189, 248, 0.10), transparent 60%),
    repeating-linear-gradient(0deg, rgba(13, 122, 112, 0.05) 0 1px, transparent 1px 26px),
    repeating-linear-gradient(90deg, rgba(13, 122, 112, 0.05) 0 1px, transparent 1px 26px),
    var(--paper);
  color: var(--ink);
  line-height: 1.45;
  min-height: 100dvh;
}

/* ---------- Masthead ---------- */

.masthead {
  background: linear-gradient(135deg, #05343a 0%, #0d7a70 55%, #12b3a0 100%);
  color: #f0fbf8;
  padding: max(14px, env(safe-area-inset-top)) 18px 16px;
  border-bottom: 4px solid var(--amber);
}

.masthead-inner {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.compass { width: 44px; height: 44px; flex: none; color: var(--gold); }
.compass svg { width: 100%; height: 100%; animation: settle 1.2s cubic-bezier(.2,1.6,.4,1) both; }

@keyframes settle {
  0% { transform: rotate(-70deg); }
  100% { transform: rotate(0deg); }
}

.masthead h1 {
  font-size: clamp(20px, 5.4vw, 27px);
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.05;
}
.masthead h1 span { color: var(--gold); }
.tagline {
  font-size: 12.5px;
  opacity: 0.75;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 3px;
}

/* ---------- Layout ---------- */

main { max-width: 760px; margin: 0 auto; padding: 18px 14px 8px; }
section + section { margin-top: 22px; }

h2 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--forest);
  margin-bottom: 10px;
}

/* ---------- Finder ---------- */

.finder-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--forest);
  margin-bottom: 8px;
}

.finder-row { display: flex; gap: 10px; }

#apt-input {
  flex: 1;
  min-width: 0;
  font-family: var(--font);
  font-size: 22px;
  font-weight: 600;
  padding: 14px 16px;
  border: 3px solid var(--forest);
  border-radius: var(--radius);
  background: var(--cream-card);
  color: var(--ink);
  text-transform: uppercase;
  box-shadow: var(--shadow);
}
#apt-input::placeholder { color: #a49a80; font-weight: 400; text-transform: none; }
#apt-input:focus { outline: 3px solid var(--amber); outline-offset: 2px; }

.go-btn {
  font-family: var(--font);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 0 22px;
  border: none;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--amber), var(--magenta));
  color: #fff;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.1s ease;
}
.go-btn:active { transform: scale(0.95); }

.finder-hint { font-size: 13px; color: #55705f; margin-top: 9px; }
.finder-hint-location { margin-top: 4px; color: var(--amber); font-weight: 600; }

/* ---------- Result card ---------- */

.result-card {
  margin-top: 14px;
  background: var(--cream-card);
  border: 3px solid var(--forest);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  display: flex;
  gap: 14px;
  align-items: center;
  animation: pop-in 0.35s cubic-bezier(.2,1.4,.4,1) both;
}

@keyframes pop-in {
  0% { transform: translateY(8px) scale(0.97); opacity: 0; }
  100% { transform: none; opacity: 1; }
}

.badge {
  flex: none;
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 38px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.25);
  border: 3px solid rgba(0,0,0,0.14);
}

.badge-multi { font-size: 20px; letter-spacing: 0.03em; }

.result-body { min-width: 0; }
.result-name { font-size: 21px; font-weight: 800; line-height: 1.15; }
.result-floor {
  display: inline-block;
  margin-top: 4px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--forest);
  background: rgba(13, 122, 112, 0.10);
  padding: 2px 9px;
  border-radius: 99px;
}
.result-addr { font-size: 13px; color: #6d6650; margin-top: 5px; }
.result-dist { font-size: 13.5px; font-weight: 600; color: var(--amber); margin-top: 4px; }

/* ---------- Notices ---------- */

.notice {
  margin-top: 14px;
  padding: 13px 15px;
  border-radius: var(--radius);
  border: 2px dashed var(--amber);
  background: rgba(201, 88, 54, 0.07);
  font-size: 15px;
  font-weight: 600;
}

/* ---------- Map ---------- */

.map-frame {
  position: relative;
  border: 3px solid var(--forest);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--paper-deep);
  box-shadow: var(--shadow);
}

#map { display: block; width: 100%; height: auto; touch-action: manipulation; }

.map-caption {
  font-size: 12px;
  color: #8a8168;
  text-align: center;
  margin-top: 7px;
  letter-spacing: 0.04em;
}

.map-controls {
  position: absolute;
  bottom: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.map-btn {
  font-family: var(--font);
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--forest);
  background: var(--cream-card);
  border: 2px solid var(--forest);
  border-radius: 99px;
  padding: 8px 14px;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.map-btn:active { transform: scale(0.95); }
.map-btn svg { width: 17px; height: 17px; }
.map-btn.active { background: var(--forest); color: var(--paper); }

/* Pulse the location button until it's been turned on */
#locate-btn:not(.active) { animation: locate-nudge 2.4s ease-in-out infinite; }
@keyframes locate-nudge {
  0%, 100% { box-shadow: var(--shadow); }
  50% { box-shadow: 0 0 0 7px rgba(201, 88, 54, 0.28), var(--shadow); }
}

.dist-hint {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  color: var(--amber);
  background: rgba(201, 88, 54, 0.08);
  border: 1.5px dashed var(--amber);
  border-radius: 99px;
  padding: 4px 12px;
  cursor: pointer;
  margin-top: 3px;
}
.dist-hint:active { transform: scale(0.97); }

.geo-status {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  font-size: 13px;
  font-weight: 600;
  background: rgba(6, 42, 48, 0.88);
  color: var(--paper);
  padding: 8px 12px;
  border-radius: 10px;
  backdrop-filter: blur(3px);
}

/* SVG innards (classes used by app.js) */

.street { fill: var(--street); stroke: var(--street-edge); stroke-width: 1; }
.street-label {
  font-family: var(--font);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.18em;
  fill: #94a08a;
}
.grass { fill: var(--grass); opacity: 0.55; }
.tree { fill: #7fa05a; opacity: 0.85; }
.roundabout { fill: var(--street); stroke: var(--street-edge); }
.roundabout-core { fill: var(--grass); }

.bldg {
  stroke: rgba(33, 48, 31, 0.35);
  stroke-width: 1.2;
  cursor: pointer;
  transition: opacity 0.3s ease, filter 0.3s ease;
}
.bldg-letter {
  font-family: var(--font);
  font-weight: 800;
  fill: #fff;
  paint-order: stroke;
  stroke: rgba(33, 48, 31, 0.45);
  stroke-width: 1.1;
  pointer-events: none;
}
.bldg-name {
  font-family: var(--font);
  font-weight: 700;
  font-size: 7px;
  letter-spacing: 0.1em;
  fill: rgba(33, 48, 31, 0.78);
  pointer-events: none;
}
.bldg-sublabel {
  font-family: var(--font);
  font-weight: 700;
  font-size: 5.5px;
  letter-spacing: 0.12em;
  fill: rgba(33, 48, 31, 0.6);
  pointer-events: none;
}

g.dimmed .bldg { opacity: 0.25; }
g.dimmed .bldg-letter, g.dimmed .bldg-name, g.dimmed .bldg-sublabel { opacity: 0.2; }

g.target .bldg {
  stroke: var(--ink);
  stroke-width: 2.4;
  filter: drop-shadow(0 0 6px rgba(201, 88, 54, 0.9));
  animation: target-pulse 1.6s ease-in-out infinite;
}

@keyframes target-pulse {
  0%, 100% { filter: drop-shadow(0 0 3px rgba(201, 88, 54, 0.95)); }
  50% { filter: drop-shadow(0 0 10px rgba(201, 88, 54, 0.5)); }
}

.walk-line {
  fill: none;
  stroke: var(--dot-blue);
  stroke-width: 2.6;
  stroke-dasharray: 1 7;
  stroke-linecap: round;
  animation: march 1.2s linear infinite;
}
@keyframes march { to { stroke-dashoffset: -8; } }

.user-accuracy { fill: rgba(26, 115, 232, 0.14); stroke: rgba(26, 115, 232, 0.35); stroke-width: 1; }
.user-dot { fill: var(--dot-blue); stroke: #fff; stroke-width: 2.5; }
.user-halo {
  fill: none;
  stroke: var(--dot-blue);
  stroke-width: 2;
  animation: halo 2s ease-out infinite;
  transform-origin: center;
}
@keyframes halo {
  0% { opacity: 0.8; }
  100% { opacity: 0; }
}

/* ---------- Legend ---------- */

.legend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.legend-chip {
  font-family: var(--font);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  background: var(--cream-card);
  border: 2px solid rgba(33, 48, 31, 0.16);
  border-radius: 12px;
  cursor: pointer;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
  text-align: left;
  transition: border-color 0.15s ease, transform 0.1s ease;
}
.legend-chip:active { transform: scale(0.96); }
.legend-chip.selected { border-color: var(--amber); background: rgba(201, 88, 54, 0.07); }

.chip-letter {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 17px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.25);
}

/* ---------- Businesses ---------- */

.biz-sub { font-size: 13px; color: #6d6650; margin: -4px 0 10px; }

.biz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 8px;
}

.biz-chip {
  font-family: var(--font);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  background: var(--cream-card);
  border: 2px solid rgba(33, 48, 31, 0.16);
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  color: var(--ink);
  transition: border-color 0.15s ease, transform 0.1s ease;
}
.biz-chip:active { transform: scale(0.97); }
.biz-chip:hover { border-color: var(--amber); }

.biz-icon { font-size: 20px; flex: none; }
.biz-text { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.biz-name { font-size: 14px; font-weight: 700; line-height: 1.2; }
.biz-cat { font-size: 11.5px; color: #8a8168; }
.biz-letter { width: 26px; height: 26px; font-size: 14px; border-radius: 7px; }

/* ---------- Sponsors ---------- */

.sponsor-sub { font-size: 13px; color: #6d6650; margin: -4px 0 10px; }

/* Sponsor banner sits between the finder and the map — premium slot. */
.sponsor-grid { display: grid; gap: 8px; }

.sponsor-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--cream-card);
  border: 2px solid rgba(15, 48, 56, 0.14);
  border-left: 6px solid var(--amber);
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: var(--shadow);
}
.sponsor-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--amber);
  border: 1.5px solid var(--amber);
  border-radius: 99px;
  padding: 1px 8px;
  margin-bottom: 4px;
}
.sponsor-name { font-size: 15.5px; font-weight: 800; }
.sponsor-blurb { font-size: 13px; color: #55705f; margin-top: 2px; }
.sponsor-phone { font-size: 13px; font-weight: 700; color: var(--forest); margin-top: 4px; }

.sponsor-contact { font-size: 12px; color: #6f8478; margin-top: 7px; text-align: center; }

/* ---------- Footer ---------- */

.site-foot {
  margin-top: 30px;
  padding: 18px 14px calc(20px + env(safe-area-inset-bottom));
  text-align: center;
  font-size: 12px;
  color: #8a8168;
  border-top: 2px solid rgba(33, 48, 31, 0.1);
}

@media (min-width: 700px) {
  .finder-row { max-width: 520px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
