/* =============================================================================
   GBIF GAP FINDER — Shared Styles
   =============================================================================
   Clean, warm theme with sage / sand / slate palette.
   Used by: the GBIF Gap Finder app
   ============================================================================= */

/* ---------------------------------------------------------------------------
   FONTS
   Served from www/fonts (SIL Open Font License 1.1, licence files alongside),
   so a page view sends no request to a third-party font service. Fraunces and
   Outfit are variable fonts (one file covers every weight); the browser fetches
   the Latin Extended files only when a page shows a character from that range.
   --------------------------------------------------------------------------- */
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('fonts/fraunces-latin-opsz-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('fonts/fraunces-latin-ext-opsz-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('fonts/outfit-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('fonts/outfit-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 300;
  src: url('fonts/ibm-plex-mono-latin-300-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 300;
  src: url('fonts/ibm-plex-mono-latin-ext-300-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url('fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url('fonts/ibm-plex-mono-latin-ext-400-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url('fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url('fonts/ibm-plex-mono-latin-ext-500-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

/* ---------------------------------------------------------------------------
   CSS VARIABLES
   --------------------------------------------------------------------------- */
:root {
  /* Background */
  --bg-base:    #f6f5f1;
  --bg-card:    #ffffff;
  --bg-subtle:  #efeee8;
  --bg-hover:   #e8e7e1;
  --bg-code:    #f0efea;

  /* Text */
  --text-primary:   #2d2d2d;
  --text-secondary: #6b6b6b;
  --text-muted:     #6a6a6a;

  /* Borders */
  --border:       #e0dfda;
  --border-light: #eae9e4;

  /* Accent colors — colorblind-safe palette (Tol/Wong inspired) */
  --sage:     #2A7F62;
  --sage-light: rgba(42, 127, 98, 0.12);
  --sand:     #CCBB44;
  --sand-light: rgba(204, 187, 68, 0.12);
  --slate:    #4477AA;
  --slate-light: rgba(68, 119, 170, 0.12);
  --coral:    #EE6677;
  --coral-light: rgba(238, 102, 119, 0.12);
  --plum:     #AA3377;
  --plum-light: rgba(170, 51, 119, 0.12);

  /* Darker, AA-passing shades of the same hues, for use as TEXT/badges */
  --sage-ink:  #1d6048;
  --sand-ink:  #6f6210;
  --slate-ink: #2f567f;
  --coral-ink: #b32e44;
  --plum-ink:  #8a2a61;

  /* Semantic */
  --success:  #2A7F62;
  --warning:  #CCBB44;
  --danger:   #EE6677;
  --info:     #4477AA;

  /* Radius */
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;
}

/* ---------------------------------------------------------------------------
   BASE
   --------------------------------------------------------------------------- */
html {
  /* Base size for the whole UI. Everything below is sized in rem, so raising
     this scales fonts AND spacing together for readability while preserving the
     visual hierarchy. 106.25% = 17px; at 18px some content overflows its boxes. */
  font-size: 106.25%;
}

/* Links: a darker blue than Bootstrap's default (#337ab7), which stays below
   4.5:1 contrast on the off-white background. Links inside running text are
   underlined, so they do not rely on colour alone (WCAG 1.4.1). */
a { color: var(--slate-ink); }
a:hover, a:focus { color: var(--text-primary); }
p a, dd a, .info-note a, .metadata-footer a { text-decoration: underline; }

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 400;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  font-size: 1rem;
}

/* ---------------------------------------------------------------------------
   HEADER
   --------------------------------------------------------------------------- */
.main-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 2rem;
  margin: -15px -15px 1.5rem -15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.main-header .form-group {
  margin-bottom: 0;
}

.main-header .selectize-input {
  min-height: 30px !important;
  padding: 4px 10px !important;
  font-size: 1rem !important;
}

.main-title {
  font-family: 'Fraunces', serif;
  font-size: 1.6rem;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
  -webkit-text-fill-color: var(--text-primary);
  background: none;
}

.main-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-top: 0.15rem;
}

.header-stats {
  display: flex;
  gap: 2rem;
  color: var(--text-secondary);
  font-size: 1rem;
}

.header-stat-value {
  font-family: 'IBM Plex Mono', monospace;
  color: var(--sage);
  font-weight: 500;
}

/* ---------------------------------------------------------------------------
   CARDS
   --------------------------------------------------------------------------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.card-title {
  font-family: 'Fraunces', serif;
  font-size: 1.28rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-title .fa, .card-title .fas, .card-title .far {
  color: var(--sage);
  font-size: 1rem;
}

/* ---------------------------------------------------------------------------
   STAT BOXES
   --------------------------------------------------------------------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 992px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 576px) {
  .stat-grid { grid-template-columns: 1fr; }
}

.stat-box {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1.1rem;
  text-align: center;
  transition: box-shadow 0.2s ease;
}

.stat-box:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.stat-value {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1.6rem;
  font-weight: 500;
  line-height: 1.2;
}

.stat-value.sage  { color: var(--sage); }
.stat-value.slate { color: var(--slate); }
.stat-value.sand  { color: var(--sand-ink); }
.stat-value.coral { color: var(--coral-ink); }
.stat-value.plum  { color: var(--plum); }

.stat-label {
  font-size: 0.92rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.4rem;
}

/* Narrower variant for "in GBIF / total" ratios so they don't overflow */
.stat-value.ratio { font-size: 1.3rem; white-space: nowrap; }

.stat-sublabel {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  letter-spacing: 0.02em;
}

/* ---------------------------------------------------------------------------
   GAP METRICS (Overview tab — inside cards)
   --------------------------------------------------------------------------- */
.gap-metric {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1.6rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
}

.gap-detail {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ---------------------------------------------------------------------------
   NAVIGATION PILLS
   --------------------------------------------------------------------------- */
.nav-pills .nav-link {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius);
  padding: 0.6rem 1.1rem;
  margin-right: 0.4rem;
  margin-bottom: 0.4rem;
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.nav-pills .nav-link:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.nav-pills .nav-link.active {
  background: var(--sage);
  border-color: var(--sage);
  color: #fff;
}

/* Sub-tabs (type="tabs") — the Concern tab's threatened / invasive / restricted
   switcher. Made bold and clearly visible with an underline active state, so
   the sub-tabs read as real tabs rather than faint text. */
.nav-tabs {
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.25rem;
}
.nav-tabs > li > a {
  font-size: 1.08rem;
  font-weight: 600;
  padding: 0.65rem 1.25rem;
  color: var(--text-secondary);
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  margin-bottom: -2px;
}
.nav-tabs > li > a:hover {
  color: var(--text-primary);
  background: var(--slate-light);
  border-color: transparent transparent var(--border);
}
.nav-tabs > li.active > a,
.nav-tabs > li.active > a:hover,
.nav-tabs > li.active > a:focus {
  color: var(--coral-ink);
  font-weight: 700;
  background: transparent;
  border: none;
  border-bottom: 3px solid var(--coral);
}

/* ---------------------------------------------------------------------------
   FORMS & INPUTS
   --------------------------------------------------------------------------- */
.filter-section {
  background: var(--bg-subtle);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

.filter-label {
  font-size: 0.92rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.4rem;
}

/* The same caption used as an input's own <label> (filter_label() in app.R):
   keeps the caption weight instead of the label's default bold. */
label.control-label .filter-label { font-weight: 400; }

.form-control,
.selectize-input {
  background: var(--bg-card) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-primary) !important;
  border-radius: var(--radius-sm) !important;
  font-size: 1rem !important;
}

.form-control:focus,
.selectize-input.focus {
  border-color: var(--sage) !important;
  box-shadow: 0 0 0 2px var(--sage-light) !important;
}

.selectize-dropdown {
  background: var(--bg-card) !important;
  border: 1px solid var(--border) !important;
  max-height: 300px !important;
}

.selectize-dropdown-content .option {
  color: var(--text-primary) !important;
}

.selectize-dropdown-content .option.active {
  background: var(--sage-light) !important;
}

/* Slider */
.irs--shiny .irs-bar { background: var(--sage); }
.irs--shiny .irs-handle { border-color: var(--sage); }
.irs--shiny .irs-from,
.irs--shiny .irs-to,
.irs--shiny .irs-single { background: var(--sage); }
.irs--shiny .irs-line { background: var(--border); }

/* ---------------------------------------------------------------------------
   TABLES (DataTables)
   --------------------------------------------------------------------------- */
.dataTables_wrapper { color: var(--text-secondary); }
.dataTable { color: var(--text-primary) !important; }

table.dataTable tbody tr { background: var(--bg-card) !important; }
table.dataTable tbody tr:hover { background: var(--sage-light) !important; }

table.dataTable thead th {
  color: var(--text-secondary) !important;
  border-bottom: 2px solid var(--border) !important;
  background: transparent !important;
  font-size: 0.92rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dataTables_info, .dataTables_length,
.dataTables_filter, .dataTables_paginate {
  color: var(--text-secondary) !important;
  font-size: 1rem;
}

.dataTables_length select,
.dataTables_filter input {
  background: var(--bg-card) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-primary) !important;
  border-radius: var(--radius-sm) !important;
}

.paginate_button {
  color: var(--text-secondary) !important;
  background: transparent !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
}

.paginate_button.current {
  background: var(--sage-light) !important;
  color: var(--sage) !important;
  border-color: var(--sage) !important;
  font-weight: 600;
}

.paginate_button:hover {
  background: var(--bg-hover) !important;
  color: var(--text-primary) !important;
}

/* ---------------------------------------------------------------------------
   MAPS (Leaflet)
   --------------------------------------------------------------------------- */
.leaflet-container {
  border-radius: var(--radius);
  font-size: 1rem;
}

/* Legends, info boxes, popups and tooltips — larger and higher-contrast
   than Leaflet's small defaults, so map keys are actually readable. */
.leaflet-container .legend,
.leaflet-container .info {
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text-primary);
  background: var(--bg-card);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}
.leaflet-container .legend i {
  width: 16px;
  height: 16px;
  margin-right: 7px;
  opacity: 0.95;
  border-radius: 3px;
}
.leaflet-popup-content,
.leaflet-tooltip {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
}

/* ---------------------------------------------------------------------------
   PLOTS (Plotly)
   --------------------------------------------------------------------------- */
.plotly .modebar { background: transparent !important; }
.plotly .modebar-btn path { fill: var(--text-muted) !important; }
.plotly .modebar-btn:hover path { fill: var(--text-primary) !important; }

/* ---------------------------------------------------------------------------
   BADGES
   --------------------------------------------------------------------------- */
.priority-badge {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.priority-high   { background: var(--coral-light); color: var(--coral-ink); }
.priority-medium { background: var(--sand-light);  color: var(--sand-ink); }
.priority-low    { background: var(--sage-light);   color: var(--sage-ink); }

.threat-badge {
  display: inline-block;
  padding: 0.3rem 0.65rem;
  border-radius: 20px;
  font-size: 0.92rem;
  font-weight: 600;
  text-transform: uppercase;
}

.threat-CR { background: var(--coral-light); color: var(--coral-ink); }
.threat-EN { background: var(--sand-light);  color: var(--sand-ink); }
.threat-VU { background: rgba(196,168,130,0.25); color: var(--sand-ink); }
.threat-NT { background: var(--sage-light);  color: var(--sage-ink); }
.threat-LC { background: rgba(107,143,113,0.12); color: var(--text-secondary); }

/* ---------------------------------------------------------------------------
   ACTION TABLE
   --------------------------------------------------------------------------- */
.action-table { width: 100%; }
.action-table td {
  padding: 0.85rem 0.75rem;
  border-bottom: 1px solid var(--border-light);
  font-size: 1rem;
}
.action-table tr:last-child td { border-bottom: none; }

/* ---------------------------------------------------------------------------
   SPECIES CARDS (Explorer)
   --------------------------------------------------------------------------- */
.species-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--sage);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.species-name {
  font-family: 'Fraunces', serif;
  font-size: 1.5rem;
  font-style: italic;
  margin-bottom: 0.35rem;
}

.species-taxonomy {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

/* ---------------------------------------------------------------------------
   SEARCH BOX (Explorer)
   --------------------------------------------------------------------------- */
.search-box {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.search-title {
  font-family: 'Fraunces', serif;
  font-size: 1.3rem;
  margin-bottom: 0.35rem;
  text-align: center;
}

.search-subtitle {
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 1rem;
  font-size: 1rem;
}

/* ---------------------------------------------------------------------------
   BUTTONS
   --------------------------------------------------------------------------- */
.btn-primary, .random-btn {
  background: var(--sage);
  border: none;
  color: white;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1rem;
}

.btn-primary:hover, .random-btn:hover {
  background: #5a7e60;
  box-shadow: 0 2px 8px rgba(107,143,113,0.25);
}

.btn-download {
  background: var(--slate);
  border: none;
  color: white;
  padding: 0.65rem 1.35rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 1.05rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.10);
}

.btn-download .fa,
.btn-download .fas,
.btn-download .far { margin-right: 0.4rem; }

.btn-download:hover {
  background: #4d6a85;
  box-shadow: 0 2px 8px rgba(68, 119, 170, 0.25);
}

/* ---------------------------------------------------------------------------
   INFO NOTE
   --------------------------------------------------------------------------- */
.info-note {
  background: var(--slate-light);
  border-left: 3px solid var(--slate);
  padding: 0.75rem 1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 0.75rem 0;
  font-size: 1rem;
  /* darker than --text-secondary, which falls below 4.5:1 on this tint */
  color: #5a5a5a;
}

.info-note strong { color: var(--text-primary); }

/* ---------------------------------------------------------------------------
   FOOTER
   --------------------------------------------------------------------------- */
.metadata-footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.92rem;
  border-top: 1px solid var(--border-light);
  margin-top: 1rem;
}

/* ---------------------------------------------------------------------------
   UTILITY
   --------------------------------------------------------------------------- */
.text-muted   { color: var(--text-muted) !important; }
.text-primary { color: var(--sage) !important; }
hr { border-color: var(--border-light); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---------------------------------------------------------------------------
   FOCUS VISIBILITY (keyboard accessibility)
   --------------------------------------------------------------------------- */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.btn-primary:focus-visible,
.random-btn:focus-visible,
.btn-download:focus-visible,
.nav-pills .nav-link:focus-visible,
.paginate_button:focus-visible,
.form-control:focus-visible {
  outline: 3px solid var(--slate);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------------------
   EAA ACCESSIBILITY — headings, glossary tooltips, methods panel
   --------------------------------------------------------------------------- */

/* Card titles are <h2> and persona headings <h3>; keep the tight card
   spacing (browsers add a default heading top-margin). */
h1.main-title { margin: 0; }
h2.card-title { margin-top: 0; }

/* Disabled pager links (DataTables) in the muted text colour instead of
   Bootstrap's lighter grey. */
.pagination > .disabled > a,
.pagination > .disabled > a:hover,
.pagination > .disabled > a:focus,
.pagination > .disabled > span { color: var(--text-muted); }

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

/* sr_label() in app.R: an input labelled for screen readers only, because
   visible text or a heading next to it already names it. */
.sr-label label.control-label + br { display: none; }

/* Accessible inline glossary term: dotted underline; reveals a short definition
   on hover AND keyboard focus; screen readers get it via aria-label. */
.gloss {
  border-bottom: 1px dotted var(--slate);
  cursor: help;
  position: relative;
  color: inherit;
}
.gloss:focus-visible { outline: 3px solid var(--slate); outline-offset: 2px; }
.gloss::after {
  content: attr(data-tip);
  position: absolute;
  left: 0; top: 100%;
  margin-top: 4px;
  width: max-content; max-width: 300px;
  background: var(--text-primary); color: #fff;
  padding: 0.5rem 0.7rem; border-radius: var(--radius-sm);
  font-family: 'Outfit', sans-serif;
  font-size: 0.86rem; font-weight: 400; line-height: 1.45;
  text-transform: none; letter-spacing: normal;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.20);
  opacity: 0; visibility: hidden; transition: opacity 0.12s ease;
  z-index: 1000; pointer-events: none;
}
.gloss:hover::after,
.gloss:focus::after,
.gloss:focus-visible::after { opacity: 1; visibility: visible; }

/* Methods & limitations expandable (native <details> — keyboard accessible) */
.methods-details {
  margin-top: 1.25rem;
  border-top: 1px solid var(--border-light);
  padding-top: 0.85rem;
}
.methods-details > summary {
  font-family: 'Fraunces', serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--slate-ink);
  cursor: pointer;
  list-style: none;
  display: flex; align-items: center; gap: 0.4rem;
}
.methods-details > summary::-webkit-details-marker { display: none; }
.methods-details > summary::before {
  content: "\25b6";
  font-size: 0.7rem;
  color: var(--text-muted);
  transition: transform 0.15s ease;
}
.methods-details[open] > summary::before { transform: rotate(90deg); }
.methods-details > summary:focus-visible {
  outline: 3px solid var(--slate);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}
.methods-details h3 {
  font-family: 'Fraunces', serif;
  font-size: 1.02rem;
  margin: 1rem 0 0.4rem;
  color: var(--text-primary);
}
.methods-details p,
.methods-details li { color: var(--text-secondary); line-height: 1.6; }

/* Glossary definition list */
dl.glossary { margin: 0.4rem 0 0; }
dl.glossary dt { font-weight: 600; color: var(--text-primary); margin-top: 0.6rem; }
dl.glossary dd { margin: 0.1rem 0 0; color: var(--text-secondary); line-height: 1.55; }

/* ---------------------------------------------------------------------------
   "MEASUREMENT -> INTERPRETATION -> ACTION" TAB GUIDE
   --------------------------------------------------------------------------- */
.read-guide {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin: 0 0 1.25rem;
}
@media (max-width: 800px) { .read-guide { grid-template-columns: 1fr; } }
.read-guide > div {
  background: var(--bg-subtle);
  border-left: 3px solid var(--slate);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.6rem 0.85rem;
  font-size: 0.98rem;
  line-height: 1.5;
  color: var(--text-secondary);
}
.read-guide > div:nth-child(1) { border-left-color: var(--slate); }
.read-guide > div:nth-child(2) { border-left-color: var(--sand); }
.read-guide > div:nth-child(3) { border-left-color: var(--sage); }
.read-guide .rg-label {
  display: block;
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}
