/* Palawan Watch — shared design tokens + brand component.
   Single source of truth: pages link this BEFORE their inline styles
   and must not redeclare anything defined here. */

:root {
  /* Earthy, hopeful palette: forest meets sea */
  --bone:        #f4f1e8;
  --bone-deep:   #ece7d8;
  --sand:        #e3dcc6;
  --moss:        #6b8f5e;
  --moss-deep:   #4a6b40;
  --forest:      #1f3a2e;
  --forest-ink:  #14271e;
  --teal:        #2f7d7a;
  --teal-bright: #3fa8a0;
  --ocean:       #1d5e6b;
  --clay:        #c2724a;   /* warm accent: sunrise over the strait */
  --bark:        #3a3327;

  --display: "Fraunces", Georgia, serif;
  --body:    "Spline Sans", system-ui, sans-serif;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* Detection-kind colours. Map pins, the legend swatches and the JS that
     builds markers all read these — a kind's colour is defined once here.
     JS reads them via getComputedStyle(document.documentElement). */
  --pin-fire:   #ff7a4d;
  --pin-defor:  #ffd166;
  --pin-mining: #e6e6e6;
  --pin-flood:  #4dc3ff;

  /* Minimum comfortable touch target (WCAG 2.5.5 target size AAA is 44px). */
  --tap-min: 44px;
}

/* Header brand: Island Iris mark + wordmark, links home. */
.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; }
.brand .mark { width: 30px; height: 30px; display: block; flex-shrink: 0; }
.brand .name {
  font-family: var(--display); font-weight: 600; font-size: 1.1rem;
  letter-spacing: -0.01em; color: var(--forest);
}

/* Visually hidden, still read by screen readers. */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Skip link: first tabbable element on every page. Off-screen until focused,
   so a keyboard user can jump the header and map controls instead of tabbing
   through them on every visit. Pages mark their main region id="main". */
.skip-link {
  position: absolute; top: 0; left: 0; z-index: 200;
  transform: translateY(-120%);
  padding: 0.75rem 1.1rem; border-radius: 0 0 12px 0;
  font-family: var(--body); font-weight: 600; font-size: 0.95rem;
  background: var(--forest); color: var(--bone); text-decoration: none;
  transition: transform 0.2s var(--ease);
}
.skip-link:focus { transform: translateY(0); outline: 2px solid var(--teal-bright); outline-offset: 2px; }

/* Baseline keyboard focus ring. Individual components may restyle it, but
   nothing should remove it: every interactive element stays visible when
   tabbed to, even if a page forgets its own :focus-visible rule. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--teal-bright);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Shared pill control (site chips, filter chips). One implementation, sized
   to the minimum tap target so thumbs land on it. */
.pw-chip {
  font-family: var(--body); font-size: 0.9rem; font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--tap-min); padding: 0.55rem 1.1rem;
  border-radius: 999px; border: 1.5px solid rgba(74,107,64,0.25);
  background: rgba(255,255,255,0.5); color: var(--forest-ink);
  cursor: pointer; transition: border-color 0.25s var(--ease), background 0.25s var(--ease);
}
.pw-chip:hover { border-color: var(--teal); }
.pw-chip.active { background: var(--clay); border-color: var(--clay); color: #fff; }

/* Touch targets.
   Scoped to coarse pointers (fingers) rather than applied globally: with a
   mouse the compact 28-32px controls are easy to hit and the dense map UI is
   part of the design, but a thumb needs ~44px (WCAG 2.5.5). These set
   min-height/min-width only — pages style padding and colour, so the two
   never fight, and this file loads after leaflet.css so the map controls
   here win. */
@media (pointer: coarse) {
  .pw-chip,
  .chip,
  .site-chip,
  .map-toggle button,
  .consent input[type="checkbox"] {
    min-height: var(--tap-min);
    min-width: var(--tap-min);
  }
  /* The checkbox is square and small by nature; the wrapping label is the
     real target, so give the box a comfortable size without a 44px void. */
  .consent input[type="checkbox"] {
    min-width: 24px; min-height: 24px; width: 24px; height: 24px;
  }
  /* Leaflet's own zoom buttons. It ships 26px, then 30px under its own
     `.leaflet-touch .leaflet-bar a` rule — which outranks a bare
     `.leaflet-bar a`, so match that two-class specificity to win. */
  .leaflet-touch .leaflet-bar a,
  .leaflet-touch .leaflet-control-zoom a,
  .leaflet-bar a {
    width: var(--tap-min);
    height: var(--tap-min);
    line-height: var(--tap-min);
  }
}
