/* Where's the Owl: styled with the Nike design system tokens (DESIGN-nike.md).
   Fonts: Inter stands in for Helvetica Now, Bebas Neue for Futura ND. */

:root {
  --ink: #111111;
  --on-primary: #ffffff;
  --canvas: #ffffff;
  --soft-cloud: #f5f5f5;
  --charcoal: #39393b;
  --mute: #707072;
  --stone: #9e9ea0;
  --hairline: #cacacb;
  --hairline-soft: #e5e5e5;
  --sale: #d30005;
  --success: #007d48;

  /* severity: monochrome escalation, red reserved for contact */
  --sev-seen: var(--stone);
  --sev-swooped: var(--ink);
  --sev-struck: var(--sale);

  --font-display: "Bebas Neue", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-ui: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;

  --r-md: 24px;
  --r-lg: 30px;
  --r-full: 9999px;

  --sidebar-w: 400px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; color: inherit; }

/* ---------- utility bar + nav ---------- */
.utility-bar {
  flex: none;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 48px;
  background: var(--soft-cloud);
  font-size: 12px;
  font-weight: 500;
}
.utility-bar .dot { color: var(--stone); }

.primary-nav {
  flex: none;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 48px;
  background: var(--canvas);
  box-shadow: inset 0 -1px 0 var(--hairline-soft);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-name {
  font-family: var(--font-display);
  font-size: 28px;
  line-height: 0.9;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}
.brand-sub {
  font-size: 12px;
  font-weight: 500;
  color: var(--mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  padding: 0 32px;
  border: 0;
  border-radius: var(--r-lg);
  font-size: 16px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease;
}
.btn:active { transform: scale(0.96); opacity: 0.6; }
.btn:disabled { opacity: 0.4; cursor: default; transform: none; }
.btn-primary { background: var(--ink); color: var(--on-primary); }
.btn-secondary { background: var(--soft-cloud); color: var(--ink); }
.btn-sm { height: 40px; padding: 0 20px; font-size: 14px; }

.icon-btn {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: var(--r-full);
  background: var(--soft-cloud);
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* ---------- layout ---------- */
.layout {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
}
.sidebar {
  flex: none;
  width: var(--sidebar-w);
  overflow-y: auto;
  background: var(--canvas);
  border-right: 1px solid var(--hairline);
}
.map-wrap { position: relative; flex: 1; min-width: 0; }
#map { position: absolute; inset: 0; background: var(--soft-cloud); }

/* ---------- campaign tile ---------- */
.campaign-tile {
  background: var(--ink);
  color: var(--on-primary);
  padding: 30px 24px 24px;
}
.display {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 72px;
  line-height: 0.9;
  letter-spacing: -0.005em;
  text-transform: uppercase;
}
.campaign-sub {
  margin: 18px 0 24px;
  font-size: 14px;
  color: var(--stone);
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid #39393b;
  padding-top: 18px;
}
.stats > div { display: flex; flex-direction: column; }
.stat-num {
  font-family: var(--font-display);
  font-size: 48px;
  line-height: 0.9;
}
.stat-label { font-size: 12px; font-weight: 500; color: var(--stone); margin-top: 4px; }

/* ---------- sections ---------- */
.section { padding: 24px 24px 0; }
.heading-md {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.75;
}
.heading-lg { margin: 0; font-size: 24px; font-weight: 500; line-height: 1.2; }
.count { color: var(--mute); font-weight: 500; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  background: var(--canvas);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}
.chip.active,
.chip:has(input:checked) {
  background: var(--ink);
  color: var(--on-primary);
  border-color: var(--ink);
}
.chip:has(input:checked) .swatch { box-shadow: 0 0 0 2px var(--ink), 0 0 0 3px var(--on-primary); }
.chip:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 2px; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }

.swatch {
  flex: none;
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: var(--r-full);
}
.sev-seen { background: var(--sev-seen); }
.sev-swooped { background: var(--sev-swooped); }
.sev-struck { background: var(--sev-struck); }

.legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin: 18px 0 0;
  padding: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--charcoal);
}
.legend li { display: inline-flex; align-items: center; gap: 8px; }

/* ---------- report list ---------- */
.report-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--hairline); }
.report-list li { border-bottom: 1px solid var(--hairline); }
.report-list button {
  width: 100%;
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 4px 12px;
  align-items: baseline;
  padding: 18px 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}
.report-list .swatch { align-self: center; }
.report-title { font-weight: 500; }
.report-time { font-size: 14px; font-weight: 500; color: var(--mute); white-space: nowrap; }
.report-note {
  grid-column: 2 / 4;
  font-size: 14px;
  color: var(--charcoal);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}
.empty { font-size: 14px; color: var(--mute); margin: 0; padding: 18px 0; border-top: 1px solid var(--hairline); }

/* ---------- faq rows ---------- */
.faq-row { border-bottom: 1px solid var(--hairline); }
.faq-row:first-of-type { border-top: 1px solid var(--hairline); }
.faq-row summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 0;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
}
.faq-row summary::-webkit-details-marker { display: none; }
.faq-row summary::after {
  content: "";
  width: 8px;
  height: 8px;
  margin-right: 4px;
  border-right: 1.75px solid var(--ink);
  border-bottom: 1.75px solid var(--ink);
  transform: rotate(45deg) translateY(-3px);
  transition: transform 0.15s ease;
}
.faq-row[open] summary::after { transform: rotate(-135deg) translateY(-3px); }
.faq-row p { margin: 0 0 18px; font-size: 14px; color: var(--charcoal); }

.footer { padding: 30px 24px; }
.footer p { margin: 0; font-size: 12px; font-weight: 500; color: var(--mute); }

/* ---------- report sheet ---------- */
.sheet {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  z-index: 1100;
  overflow-y: auto;
  background: var(--canvas);
  border-right: 1px solid var(--hairline);
  padding: 24px;
}
.sheet[hidden] { display: none; }
.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.field { margin: 0 0 24px; padding: 0; border: 0; min-width: 0; }
.label {
  display: block;
  padding: 0;
  margin-bottom: 8px;
  font-size: 16px;
  font-weight: 500;
}
.optional { color: var(--mute); font-weight: 400; }
.loc-status { margin: 0 0 12px; font-size: 14px; color: var(--charcoal); }
.loc-status.set { color: var(--success); font-weight: 500; }

.input {
  width: 100%;
  min-height: 48px;
  padding: 12px 20px;
  border: 2px solid transparent;
  border-radius: var(--r-md);
  background: var(--soft-cloud);
  font-size: 16px;
  resize: vertical;
}
.input:focus {
  outline: none;
  background: var(--canvas);
  border-color: var(--ink);
  box-shadow: 0 0 0 6px var(--soft-cloud);
}
.counter { margin-top: 4px; text-align: right; font-size: 12px; font-weight: 500; color: var(--mute); }

.form-error { margin: 0 0 18px; font-size: 14px; font-weight: 500; color: var(--sale); }
.actions { display: flex; gap: 12px; flex-wrap: wrap; }
.actions .btn-primary { flex: 1; }
.fine-print { margin: 18px 0 0; font-size: 12px; font-weight: 500; color: var(--mute); }

/* ---------- map chrome ---------- */
.place-banner {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  padding: 12px 24px;
  border-radius: var(--r-lg);
  background: var(--ink);
  color: var(--on-primary);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
}
.map-wrap.placing #map { cursor: crosshair; }

.leaflet-container { font-family: var(--font-ui); }
.leaflet-bar,
.leaflet-control-layers {
  border: 1px solid var(--hairline) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}
.leaflet-bar a { color: var(--ink); width: 40px !important; height: 40px !important; line-height: 40px !important; }
.leaflet-bar a:first-child,
.leaflet-bar a:last-child { border-radius: 0 !important; }
.leaflet-control-layers-expanded { padding: 12px 18px; font-size: 14px; font-weight: 500; }

.leaflet-popup-content-wrapper {
  border-radius: 0;
  border: 1px solid var(--hairline);
  box-shadow: none;
}
.leaflet-popup-tip { box-shadow: none; border: 1px solid var(--hairline); }
.leaflet-popup-content { margin: 18px; font-size: 14px; line-height: 1.5; min-width: 200px; }
.pop-title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 500; }
.pop-time { color: var(--mute); font-weight: 500; margin-top: 4px; }
.pop-note { margin-top: 8px; color: var(--charcoal); overflow-wrap: anywhere; white-space: pre-wrap; }

.owl-marker {
  position: relative;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: var(--r-full);
  border: 2px solid var(--on-primary);
}
.owl-marker svg { width: 20px; height: 20px; }
.owl-marker.old { opacity: 0.5; }
.owl-marker.fresh::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: var(--r-full);
  border: 2px solid currentColor;
  animation: ping 1.8s ease-out infinite;
}
@keyframes ping {
  from { transform: scale(1); opacity: 0.8; }
  to { transform: scale(2.2); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .owl-marker.fresh::after { animation: none; }
  .btn { transition: none; }
}

.pending-marker {
  width: 36px;
  height: 36px;
  border-radius: var(--r-full);
  background: var(--canvas);
  border: 3px solid var(--ink);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1;
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  z-index: 3000;
  padding: 12px 24px;
  border-radius: var(--r-lg);
  background: var(--ink);
  color: var(--on-primary);
  font-size: 14px;
  font-weight: 500;
}

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .utility-bar, .primary-nav { padding: 0 24px; }
}

@media (max-width: 800px) {
  body { height: auto; display: block; }
  .utility-bar { justify-content: center; }
  .primary-nav { position: sticky; top: 0; z-index: 1500; padding: 0 18px; }
  .primary-nav .btn { height: 40px; padding: 0 18px; font-size: 14px; }
  .brand-sub { display: none; }
  .layout { flex-direction: column; }
  .map-wrap { order: -1; flex: none; height: 58vh; min-height: 320px; }
  .sidebar { width: 100%; overflow: visible; border-right: 0; }
  .display { font-size: 56px; }

  .sheet {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-height: 62vh;
    z-index: 2000;
    border-right: 0;
    border-top: 1px solid var(--hairline);
    padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  }
  .sheet-head { margin-bottom: 18px; }
  .place-banner { top: 12px; font-size: 13px; padding: 10px 18px; }
}
