/* ep_report.css — the EP report's OWN grammar. The tile, species-table and heading vocabulary is reused
   verbatim from report_shared.css (which the page links alongside this file, and the PDF inlines both), so
   what lives here is only what an inside-vs-outside report needs and a place report does not: the identity
   strip, the Inside : Outside contrast tiles, the class key, and the compare strip.

   Class colours (interior/on_boundary/final_approach) are NOT in this file — they come from IK_THEME$ep_class in R and
   are passed inline, so the palette has exactly one home. Nothing here encodes a class by colour alone:
   every class also carries its word, which is what makes the page survive printing and colour-blindness. */

.ik-epr-ov { padding-top: 0.35rem; }

/* ── Identity strip: what this EP IS, before any metric ───────────────────────────────────────── */
.ik-epr-ident {
  display: flex; flex-wrap: wrap; gap: 0.4rem 1.6rem; align-items: baseline;
  padding: 0.55rem 0.75rem; margin: 0.2rem 0 0.9rem;
  border: 1px solid var(--bs-border-color, #dee2e6); border-radius: 0.5rem;
  background: var(--bs-tertiary-bg, #f8f9fa);
}
.ik-epr-ident-cell { display: flex; align-items: baseline; gap: 0.35rem; }
.ik-epr-k {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--bs-secondary-color, #6c757d);
}
.ik-epr-v { font-size: 0.92rem; font-weight: 700; }

/* ── Tile rows ─────────────────────────────────────────────────────────────────────────────────
   A wider column floor than the Place report's: these tiles carry two labelled value rows plus a ratio
   line, so squeezing five into an A4 width clips them. This wraps to four and stays legible in print.
   Compound selector deliberately — report_shared.css is loaded AFTER this file (both here and inlined into
   the PDF), so a single-class rule would lose the cascade to its .ik-rpt-tiles default. The floor is in PX,
   not rem: the report stylesheet sets html{font-size:12.5px}, so a rem floor silently shrinks by a fifth on
   paper and lets an extra column squeeze in — exactly where there is least room.
   auto-FIT with a per-tile max-width, which is the combination that handles both ends. auto-fit collapses
   the tracks it does not use, so three tiles share the row instead of huddling into three narrow columns on
   the left (auto-fill's failure — it keeps the empty tracks, so a short row uses a fraction of the width).
   The max-width then stops the one case auto-fit gets wrong: a section holding a SINGLE tile, which would
   otherwise stretch it across a 24-inch monitor. It is set high enough (and in px, for the same reason as
   the floor) to bite ONLY on those sparse rows — a row of four or five still fills the width, because a cap
   that constrained a full row would just reintroduce the wasted-space problem it exists to prevent. */
.ik-rpt-tiles.ik-epr-tiles { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.ik-rpt-tiles.ik-epr-tiles > * { max-width: 460px; }

/* ── Inside : Outside contrast tiles ──────────────────────────────────────────────────────────── */
.ik-epr-io-row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 0.5rem; margin-top: 0.25rem; padding-left: 0.4rem; border-left: 3px solid transparent;
}
.ik-epr-io-lab {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--bs-secondary-color, #6c757d);
}
/* "Outside" is a POOLED arm, not a class a device carries, so its label says what it is made of on the
   line beneath — smaller and lighter than the label, because it is a gloss and not a second heading. */
.ik-epr-io-sub {
  display: block; text-transform: none; letter-spacing: 0; font-size: 0.66rem;
  opacity: 0.8; margin-top: 0.05rem;
}
.ik-epr-io-v { font-size: 1.1rem; font-weight: 700; line-height: 1.2; }
.ik-epr-io-v.ik-epr-io-na { font-size: 0.95rem; font-weight: 400; color: var(--bs-secondary-color, #adb5bd); }
.ik-epr-io-ratio {
  margin-top: 0.4rem; padding-top: 0.35rem; font-size: 0.78rem;
  border-top: 1px dashed var(--bs-border-color, #dee2e6);
}
.ik-epr-io-ratio .ik-epr-io-rv { font-weight: 700; }
.ik-epr-io-ratio.good .ik-epr-io-rv { color: var(--ik-good, #2e7d32); }
.ik-epr-io-ratio.bad  .ik-epr-io-rv { color: var(--ik-bad, #c62828); }
.ik-epr-io-ratio.neutral .ik-epr-io-rv,
.ik-epr-io-ratio.na .ik-epr-io-rv { color: var(--bs-secondary-color, #6c757d); }
.ik-epr-io-why { font-size: 0.7rem; color: var(--bs-secondary-color, #adb5bd); margin-top: 0.15rem; line-height: 1.3; }
/* The effort caveat rides the same slot as `why` but is a DIFFERENT claim — the ratio IS computable and
   was computed on an arm barely being checked — so it must not read as the muted grey of "there was
   nothing to measure". It takes --ik-accent, which is what .ik-epr-recon already uses for "read this
   before you read the number above it". NOT the overdue red: red is a servicing verdict on a trap, and
   this discounts a rate rather than condemning one. It also must not take the on_boundary amber, which
   on this page means a POSITION — the collision the coverage-arm palette note records at length. */
.ik-epr-io-thin { color: var(--ik-accent, #cf6819); opacity: 0.95; }

/* ── The three-class key + the "on-boundary is excluded" sentence ─────────────────────────────── */
.ik-epr-class-key {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 1rem;
  font-size: 0.76rem; color: var(--bs-secondary-color, #6c757d); margin: 0.6rem 0 0.2rem;
}
.ik-epr-key-item { display: inline-flex; align-items: center; gap: 0.35rem; }
.ik-epr-swatch { width: 0.75rem; height: 0.75rem; border-radius: 0.2rem; display: inline-block; flex: 0 0 auto; }
.ik-epr-key-note { flex: 1 1 22rem; min-width: 16rem; line-height: 1.35; }

/* ── Species tables: a class-coloured underline under each class column header ───────────────────
   THE SELECTOR IS THE CLASS VALUE, and so is the custom property: ep_report.R builds the th class as
   sprintf("ik-epr-th--%s", <class>) and ik_theme_css_vars emits --ik-ep-<key> from names(IK_THEME$ep_class).
   So both halves have to track the class vocabulary, and neither fails loudly when they don't — a stale
   selector simply matches nothing and a stale var falls through to its literal fallback, which is why these
   sat dead through the internal/edge/external -> interior/on_boundary rename (Jul 2026) and the
   approach -> final_approach one after it, still painting the right colours by accident of the fallbacks.
   If a class is renamed again, rename it here too. */
.ik-epr-th--interior       { border-bottom: 3px solid var(--ik-ep-interior, #2e9e3f) !important; }
.ik-epr-th--on_boundary    { border-bottom: 3px solid var(--ik-ep-on_boundary, #f0a020) !important; }
.ik-epr-th--final_approach { border-bottom: 3px solid var(--ik-ep-final_approach, #9aa0a6) !important; }
.ik-epr-th--periphery      { border-bottom: 3px solid var(--ik-ep-periphery, #9aa0a6) !important; }
.ik-epr-th--ratio          { border-bottom: 3px solid var(--bs-border-color, #dee2e6) !important; }

/* ── Coverage reconciliation: why two honest trap counts differ ────────────────────────────────── */
.ik-epr-recon {
  font-size: 0.76rem; color: var(--bs-secondary-color, #6c757d);
  margin: 0.5rem 0 0.2rem; line-height: 1.4;   /* full line width — see .ik-rpt-ov-foot */
}
.ik-epr-recon .fa, .ik-epr-recon svg { color: var(--ik-accent, #cf6819); margin-right: 0.3rem; }

/* ("How this EP compares" uses the shared .ik-rpt-rowlink / .ik-rpt-rowself / .ik-rpt-strip-wrap classes in
   report_shared.css — the same pattern as the Place report's protected-areas strip.) */
/* ── Devices tab local controls + the map frame ────────────────────────────────────────────────── */
.ik-epr-devctl { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1rem; margin: 0.2rem 0 0.7rem; }
.ik-epr-devctl .shiny-input-container { margin-bottom: 0; }
.ik-epr-map { border: 1px solid var(--bs-border-color, #dee2e6); border-radius: 0.5rem; overflow: hidden; }

/* `.ik-epr-mapctl` lived here — the "Show the approaches" checkbox above the map. The checkbox retired
   Aug 2026 (the leaflet layer control already offers the same four layers individually, and a master
   switch that ALSO removed the table underneath was not a display option), so the rules went with it. */

/* A trend figure that closes a server-built section but renders outside its container (the Trap network
   tab's cadence figure). It gets the gap a `.ik-rpt-ov-h` block would have given it, so the plot frame
   starts a beat after the prose above rather than butting onto it. */
.ik-epr .ik-epr-figblock { margin-top: 1.5rem; }

/* The Method appendix takes the SHARED `.ik-rpt-method*` grammar in report_shared.css — both reports
   carry the same appendix and a reader moves between them, so it is one set of rules rather than two that
   drift. Only the class-swatch bullets are local to this page. */
.ik-rpt-method .ik-epr-recon .fa, .ik-rpt-method .ik-epr-recon svg { color: inherit; }

/* ── Empty / prompt states ─────────────────────────────────────────────────────────────────────── */
.ik-epr-empty {
  padding: 1.4rem 1rem; text-align: center; color: var(--bs-secondary-color, #6c757d);
  border: 1px dashed var(--bs-border-color, #dee2e6); border-radius: 0.5rem; margin: 0.6rem 0;
}

@media (max-width: 575.98px) {
  .ik-epr-ident { gap: 0.35rem 1rem; }
  .ik-epr-io-v { font-size: 1rem; }
}

/* Print: the PDF inlines this file. Keep a section from being orphaned from its heading. */
@media print {
  .ik-epr-ident, .ik-epr-class-key, .ik-epr-recon { break-inside: avoid; }
}

/* ── Servicing-by-proximity table ──────────────────────────────────────────────────────────────
   Eight columns (five status states plus the totals) is wider than the species tables, so it runs
   tighter: the canonical status WORDS are fixed vocabulary and must not be abbreviated to fit. */
.ik-rpt-sptable.ik-epr-svc { font-size: 0.8rem; }
.ik-rpt-sptable.ik-epr-svc .ik-rpt-th,
.ik-rpt-sptable.ik-epr-svc .ik-rpt-tc { padding-left: 0.3rem; padding-right: 0.3rem; }
.ik-rpt-sptable.ik-epr-svc .ik-rpt-tc { font-weight: 600; }

/* ── The approaches: neighbour-ring table ───────────────────────────────────────────────────────
   Two row KINDS in one table: the ring total, and the places inside it. The place rows (.ik-epr-zonerow —
   the class name predates the place model) are indented and lightened so the hierarchy is visible without
   a second table or an expander — a ring holds two or three places here, and hiding them behind a click
   would cost more than it saves. */
.ik-rpt-sptable.ik-epr-rings { font-size: 0.82rem; }
.ik-epr-ringrow > td { border-top: 1px solid var(--bs-border-color, #dee2e6); }

/* THE SEAM IN THE SERVICING TABLE, where the UNIT changes. Everything above this row counts TRAPS as at
   the period end; everything below counts NIGHTS across the whole of it. Run together they read as one
   ladder of comparable rows, and a reader adds a trap count to a night count without noticing the join —
   so the rule is doing real work, not decoration. Heavier than the ring rule above it (which separates
   like from like) and paired with the sub-head naming each block's clock. */
.ik-epr-nightrule > td { border-top: 2px solid var(--bs-border-color, #dee2e6);
  padding-top: 0.45rem !important; }
.ik-epr-zonerow > td { color: var(--bs-secondary-color, #6c757d); font-weight: 400; }
.ik-epr-zonecell { padding-left: 1.4rem !important; }
.ik-epr-zonecell::before { content: "↳"; opacity: 0.5; margin-right: 0.35rem; }
/* The thin-ring flag rides ON the ring name, in the same muted ink as the greyed rate it explains. */
.ik-epr-thin { font-size: 0.72rem; font-weight: 400; color: var(--bs-secondary-color, #6c757d); }

/* BREAK BETWEEN FACTS, NEVER INSIDE ONE. A place row joins locality · lines · group · marker in a single
   cell, and left alone it broke wherever the column ran out — usually mid-name ("Ngāti Awa (Ōhope" /
   "Farm)"), sometimes between a count and its noun. Each fact is now unbreakable, so the cell still uses a
   second line when it needs one but every line holds whole facts. The cell itself must stay wrappable for
   that to work, hence the explicit `normal` — .ik-rpt-tsp elsewhere leans on nowrap. */
.ik-epr-zonecell { white-space: normal; }
.ik-epr-zonecell .ik-epr-thin, .ik-epr-nb { white-space: nowrap; }

/* Trend panels in the PDF: one image each, stacked with a little air, never split mid-panel. */
.ik-report-trend-panel { margin-bottom: 6px; break-inside: avoid; }

/* The period-comparison value ("was 0.69×") — context beside the headline number, never competing with
   it: smaller, muted, and always to its right. */
.ik-epr-was { font-size: 0.68rem; font-weight: 400; color: var(--bs-secondary-color, #adb5bd); margin-left: 0.35rem; }
.ik-epr-io-ratio .ik-epr-was { margin-left: 0.4rem; }

/* ── Approaches table: ring rows disclose their places ───────────────────────────────────────────────── */
/* The caret is the only affordance a table row can carry without looking like a link, and rotating it is
   the one convention a reader does not have to learn. `ik-epr-hidden` rather than an inline style so the
   PDF (which renders every ring open and ships no JS) simply never sees the class. */
.ik-epr-ringrow-x { cursor: pointer; }
.ik-epr-ringrow-x:hover { background: var(--bs-tertiary-bg, rgba(0, 0, 0, 0.035)); }
.ik-epr-ringrow-x:focus-visible { outline: 2px solid var(--ik-accent, #cf6819); outline-offset: -2px; }
.ik-epr-caret {
  display: inline-block; margin-right: 0.35rem; font-size: 0.7rem; line-height: 1;
  color: var(--bs-secondary-color, #6c757d); transition: transform 0.12s ease;
}
.ik-epr-caret.open { transform: rotate(90deg); }
.ik-epr-hidden { display: none; }
/* The rule between the ratio's arm and the wider approaches. A group header, not a row of data — it
   carries no figures, so it must not read as one: no borders on the cells, and the label sits left. */
.ik-epr-grouprow > td {
  padding-top: 0.55rem; font-size: 0.76rem;
  color: var(--bs-secondary-color, #6c757d);
  border-bottom: 1px solid var(--bs-border-color, #dee2e6);
}
.ik-epr-grouprow:first-child > td { padding-top: 0.15rem; }
