/* Everything Tailwind cannot reach: the webfonts, the MapLibre widgets, and
   the handful of rules that must apply before the browser build has compiled
   anything. Layout, spacing and colour live in utility classes on the markup.

   The palette is read off the project's own false-colour composite rather
   than chosen from a swatch: karst is Biak's raised coral, canopy the standing
   forest, scar the burn, ember the SWIR response, sea Cenderawasih Bay.

   Karst is a cool grey-green, deliberately not the warm cream that every
   other page of this kind reaches for. Weathered coral under canopy light is
   grey; a latte background would be a swatch choice wearing the island's
   name. The hairline rule is cooled to match, or it reads warm against it. */
:root {
  --karst: #e7e9e4;
  --paper: #f4f6f3;
  --ink: #17201f;
  --ink-soft: #5c6460;
  --canopy: #2f5d53;
  --scar: #a3341f;
  --ember: #c96a2e;
  --sea: #7fa9b8;
  --rule: #d2d6cf;
}

/* Self-hosted so a reader in Biak fetches two files from this origin instead
   of handing a font CDN a request per page view. Latin subsets, SIL OFL 1.1 —
   see assets/FONTS-LICENSE.txt. Source Serif 4 is one variable file covering
   both weights. */
@font-face {
  font-family: "Source Serif 4";
  src: url("sourceserif4-400-600.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans Condensed";
  src: url("plexcondensed-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans Condensed";
  src: url("plexcondensed-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* Applied before Tailwind's browser build finishes compiling, so the page
   never flashes Times on white. */
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--karst);
  color: var(--ink);
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 16px;
  line-height: 1.55;
}
.chrome, nav, table, .tnum {
  font-family: "IBM Plex Sans Condensed", system-ui, sans-serif;
}
.tnum { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }

/* ---------- the map and its in-frame furniture ---------- */
#maparea { position: relative; }
#map { position: absolute; inset: 0; background: #dfe7ee; }
#mappanel {
  position: absolute;
  top: .5rem;
  left: .5rem;
  z-index: 2;
  width: 21rem;
  /* Leaves the right-hand control stack reachable. At 360 px an open panel
     at calc(100% - 1rem) covered the zoom, fullscreen and geolocate buttons,
     so opening the layer list cost the reader the map controls. */
  max-width: calc(100% - 3.5rem);
  max-height: calc(100% - 1rem);
  overflow: auto;
  background: rgba(247, 245, 240, .95);
  backdrop-filter: blur(3px);
  border: 1px solid var(--rule);
  box-shadow: 0 1px 10px rgba(23, 32, 31, .18);
  font-family: "IBM Plex Sans Condensed", system-ui, sans-serif;
  font-size: .82rem;
  line-height: 1.4;
}
#mappanel > summary {
  cursor: pointer;
  padding: .4rem .6rem;
  background: var(--canopy);
  color: var(--paper);
  font-weight: 600;
  letter-spacing: .01em;
  list-style: none;
}
#mappanel > summary::-webkit-details-marker { display: none; }
#mappanel > summary::after { content: " ▾"; float: right; }
#mappanel[open] > summary::after { content: " ▴"; }
#mappanel .pad { padding: .55rem .6rem .7rem; }
/* Sentence-case headings, so no tracking: wide letter spacing breaks the
   word shapes a reader scans by, and only earns its place on short
   all-caps labels, which these are not. */
#mappanel h2 {
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--ink-soft);
  margin: .75rem 0 .3rem;
  border-bottom: 1px solid var(--rule);
  padding-bottom: .15rem;
}
#mappanel h2:first-child { margin-top: 0; }
#mappanel label { display: block; padding: .1rem 0; cursor: pointer; }
#mappanel input[type="checkbox"],
#mappanel input[type="radio"] { accent-color: var(--canopy); margin-right: .3rem; }
#mappanel select,
#mappanel input[type="range"] { width: 100%; font: inherit; }
#mappanel select {
  border: 1px solid var(--rule);
  background: #fff;
  padding: .15rem .25rem;
  margin: .15rem 0;
}
#mappanel button {
  font: inherit;
  border: 1px solid var(--rule);
  background: #fff;
  padding: .15rem .5rem;
  cursor: pointer;
}
#mappanel button:hover { background: var(--karst); }
#legend ul { margin: 0; padding: 0; list-style: none; }
#legend li { display: flex; align-items: baseline; gap: .4rem;
  padding: .15rem 0; line-height: 1.35; }
#legend li + li { border-top: 1px solid rgba(47, 62, 57, .5); }
.sw { display: inline-block; width: .7rem; height: .7rem; flex: 0 0 auto; }
.sw.dot { border-radius: 50%; border: 1px solid #5a1408; }
.sw.ring { border: 2px solid #5b3fa8; border-radius: 50%; background: none; }
.sw.pin { border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--scar); }
#imagery-note, #scene-note { display: block; color: var(--ink-soft); margin-top: .3rem; }
.unavailable { color: #7a1010 !important; }

/* MapLibre's own widgets, brought into the page's palette. */
.maplibregl-ctrl-group { border-radius: 0 !important; border: 1px solid var(--rule); }
.maplibregl-ctrl-group button { border-radius: 0 !important; }
.maplibregl-ctrl-scale {
  border-color: var(--ink) !important;
  background: rgba(247, 245, 240, .85) !important;
  font-family: "IBM Plex Sans Condensed", system-ui, sans-serif;
  font-size: .78rem;
}
/* MapLibre's attribution line keeps its conventional size: it is a credit,
   not body copy, and enlarging it takes map away from the reader. */
.maplibregl-ctrl-attrib { font-size: .7rem; }
.maplibregl-popup-content {
  border-radius: 0;
  border: 1px solid var(--rule);
  padding: .55rem .7rem;
  font-family: "IBM Plex Sans Condensed", system-ui, sans-serif;
  font-size: .8rem;
  line-height: 1.4;
  max-width: 19rem;
}
.maplibregl-popup-content strong { font-size: .86rem; }
.maplibregl-popup-content em { color: var(--ink-soft); font-style: normal; display: block; margin-top: .35rem; }
.popup-photo {
  display: block;
  width: 100%;
  height: auto;
  margin: .35rem 0 .2rem;
  border: 1px solid var(--rule);
}

/* ---------- charts drawn as inline SVG ---------- */
#timeline, #drought, #veg, #fig-interval { width: 100%; height: auto; display: block; }

/* The brief is rendered from Markdown at runtime, so its tags carry no
   classes and have to be styled by element. */
#brief table { border-collapse: collapse; font-size: .8rem; margin: .4rem 0; width: 100%; }
#brief th, #brief td { border: 1px solid var(--rule); padding: .15rem .35rem; text-align: left; }
#brief th { background: var(--karst); font-weight: 600; }
#brief blockquote {
  margin: .4rem 0;
  padding: .25rem .7rem;
  border-left: 3px solid var(--rule);
  color: var(--ink-soft);
}
#brief ul { margin: .25rem 0; padding-left: 1.1rem; }
#brief h2 { font-size: 1.05rem; margin: .8rem 0 .2rem; }
#brief h3 { font-size: .95rem; margin: .6rem 0 .2rem; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- components the prose pages are written in ----------
   Plain CSS, not Tailwind utilities, for two reasons: these are repeated
   components rather than one-off layout, and the error banner in particular
   has to stay visible when the Tailwind browser build does not load. A page
   that fails to say a data file is missing is worse than an unstyled page. */
#data-errors { margin: 0; padding: .5rem 1rem 0; list-style: none; }
#data-errors li {
  background: #fbeae6;
  border: 1px solid #d9a899;
  color: #7a1f10;
  padding: .35rem .7rem;
  margin-bottom: .25rem;
  font-size: .85rem;
}
#data-errors:empty { display: none; }

.card, #panel, #timeline-wrap, #drought-wrap, #veg-wrap {
  border: 1px solid var(--rule);
  background: var(--paper);
  padding: .6rem .8rem .8rem;
  margin: 1rem 0;
}
#panel h2, #timeline-wrap h2, #drought-wrap h2, #veg-wrap h2 {
  margin-top: .2rem;
}

/* Boxed asides: the observation gap on both pages it appears on, the
   coverage-lag note, and anything flagged. */
#gap, .lag {
  border: 1px solid var(--rule);
  background: rgba(127, 169, 184, .15);
  padding: .5rem .75rem;
  font-size: .86rem;
  line-height: 1.45;
}
.warn {
  border: 1px solid #d9a899;
  background: #fbeae6;
  padding: .4rem .7rem;
}
.error { color: #7a1f10; font-size: .86rem; margin: .3rem 0; }
.error:empty { display: none; }
.muted { color: var(--ink-soft); font-size: .82rem; }
.pagenote { color: var(--ink-soft); font-size: .82rem; margin-top: 1.2rem; }
.block { display: block; }

main table {
  border-collapse: collapse;
  font-family: "IBM Plex Sans Condensed", system-ui, sans-serif;
  font-size: .84rem;
  margin: .5rem 0 1rem;
  width: 100%;
}
main th, main td {
  border: 1px solid var(--rule);
  padding: .2rem .45rem;
  text-align: left;
  vertical-align: top;
}
main th { background: var(--karst); font-weight: 600; }
main h3 { font-family: "IBM Plex Sans Condensed", system-ui, sans-serif;
  font-size: .98rem; margin: 1rem 0 .2rem; }
main a { color: inherit; text-decoration: underline;
  text-decoration-color: var(--rule); text-underline-offset: 2px; }
main a:hover { text-decoration-color: var(--ember); }
code { font-size: .9em; background: rgba(23, 32, 31, .06); padding: 0 .2em; }

/* ---------- dark surfaces ----------
   The map is the light thing on this page and the instruments around it are
   dark, which is the AICC arrangement the brief started from and the reason
   the figures stop competing with the map for attention. Every pairing below
   was checked rather than eyeballed: nightink on night is 13.6:1, nightsoft
   on night 6.6:1, flame on night 5.3:1. scar is too dark to sit on night at
   all, which is what flame exists for. */
:root {
  --night: #16201d;
  --night-line: #2f3e39;
  --night-ink: #e7e9e4;
  --night-soft: #9aa69f;
  --flame: #e2714a;
}

.rail { color: var(--night-ink); }
.rail-card {
  background: var(--night);
  border: 1px solid var(--night-line);
  padding: .5rem .75rem;
}
.rail-stack { padding: 0; }
.rail-row { padding: .5rem .75rem; border-bottom: 1px solid var(--night-line); }
.rail-row:last-child { border-bottom: 0; }
.rail .tile-k { color: var(--night-soft); }
.rail a { color: var(--night-ink); text-decoration-color: var(--night-line); }
.rail a:hover { text-decoration-color: var(--flame); }
.rail #gap { background: var(--night); border-color: var(--night-line);
  color: var(--night-ink); font-size: .84rem; }
.rail #figures-error { color: var(--flame); }
.pnote { color: var(--night-soft); font-size: .8rem; }
body > *:not(.rail) .pnote, .pad .pnote { color: var(--night-soft); }

/* The map panel is the same instrument surface as the rail. */
#mappanel {
  background: rgba(22, 32, 29, .94);
  border-color: var(--night-line);
  color: var(--night-ink);
}
#mappanel h2 { color: var(--night-soft); border-bottom-color: var(--night-line); }
#mappanel select, #mappanel button, #mappanel input[type="date"] {
  background: #1f2b27;
  color: var(--night-ink);
  border: 1px solid var(--night-line);
}
#mappanel button:hover { background: var(--night-line); }
#mappanel input[type="checkbox"], #mappanel input[type="radio"],
#mappanel input[type="range"] { accent-color: var(--flame); }
#mappanel .muted { color: var(--night-soft); }
#imagery-note, #scene-note, #det-count { color: var(--night-soft); }
/* nested under the detection layer it filters */
#layers #detfilter { margin: .1rem 0 .45rem 1.35rem; padding-left: .55rem;
  border-left: 2px solid var(--night-line); }
/* the indent takes width from the two date boxes; let them shrink instead of
   pushing the panel into a horizontal scroll */
#layers #detfilter .row2 label, #layers #detfilter input[type="date"] { min-width: 0; }
#detfilter .detfilter-k { font-size: .74rem; color: var(--night-soft);
  margin-bottom: .15rem; }
#mappanel .unavailable { color: #f1a08c !important; }
#mappanel .row2 { display: flex; align-items: center; gap: .4rem;
  justify-content: space-between; }
#mappanel .row2 label { display: flex; align-items: center; gap: .25rem;
  flex: 1 1 0; }
#mappanel .row2 input[type="date"] { width: 100%; font: inherit;
  padding: .1rem .2rem; }
#mappanel .btns { display: flex; gap: .3rem; margin: .3rem 0 .2rem; }
#mappanel .btns button { flex: 1 1 0; }

/* legend marks that only exist on the dark panel */
.sw.dot.small { width: .5rem; height: .5rem; align-self: center; }
/* Zero-height marks are centred on the flex line by default, which on a
   two-line legend entry drops them opposite the second line. Pin them to the
   first. */
.sw.rule { height: 0; border-top: 2px solid; width: .9rem;
  align-self: flex-start; margin-top: .5em; }
.sw.ring.recent { border-color: #e2714a; }
.sw.sni { height: 0; width: 1.1rem; align-self: flex-start;
  margin-top: .5em; border-top: 1.5px solid var(--night-ink); }
.sw.sni.kab { border-top-style: dashed; }
.sw.sni.distrik { border-top-style: dotted; }
.sw.sni.desa { border-top-style: dashed; border-top-width: 1px; }

/* ---------- the before-and-after wipe ----------
   Two scenes stacked, the top one clipped by a range input lying over them at
   full width. A range input rather than a drag handler: draggable with a
   mouse, operable from the keyboard, and announced to a screen reader. */
/* Capped so a square 1280 px scene still fits a laptop screen whole during
   a demo; the frame is square, so the width follows. */
.swipe { position: relative; aspect-ratio: 1 / 1; overflow: hidden;
  background: var(--night); max-height: 70vh; margin-inline: auto;
  max-width: calc(70vh); }
.swipe-img { position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; display: block; }
.swipe-line { position: absolute; top: 0; bottom: 0; width: 2px;
  margin-left: -1px; background: var(--paper); pointer-events: none;
  box-shadow: 0 0 0 1px rgba(23, 32, 31, .45); }
.swipe-line::after { content: ""; position: absolute; top: 50%; left: 50%;
  width: 2rem; height: 2rem; margin: -1rem; border-radius: 50%;
  border: 2px solid var(--paper); background: rgba(22, 32, 29, .55);
  box-shadow: 0 0 0 1px rgba(23, 32, 31, .45); }
.swipe-tag { position: absolute; bottom: .5rem; padding: .15rem .45rem;
  background: rgba(22, 32, 29, .8); color: var(--night-ink);
  font-family: "IBM Plex Sans Condensed", system-ui, sans-serif;
  font-size: .8rem; pointer-events: none; }
.swipe-tag-l { left: .5rem; }
.swipe-tag-r { right: .5rem; }
/* The input is the hit area for the whole frame; its own track is invisible. */
.swipe-range { position: absolute; inset: 0; width: 100%; height: 100%;
  margin: 0; opacity: 0; cursor: ew-resize; -webkit-appearance: none;
  appearance: none; background: transparent; }
.swipe-range::-webkit-slider-thumb { -webkit-appearance: none; width: 3rem;
  height: 100%; cursor: ew-resize; }
.swipe-range::-moz-range-thumb { width: 3rem; height: 100%; border: 0;
  background: transparent; cursor: ew-resize; }
.swipe-range:focus-visible { opacity: 1; outline: 2px solid var(--ember);
  outline-offset: -2px; }
