/* ============================================================
   /doing-business-in-bulgaria - "Bulgaria in Numbers"
   Built on the site tokens only (--bg, --bg-black, --green, --line, ...),
   so it follows the navy and dark themes without overrides. In navy,
   --green is the brand gold.
   Map colours are fixed hex: one red-yellow-green scale, validated against
   both theme surfaces - see RYG in scripts/bulgaria/build.js.
   ============================================================ */

.bgf-stamp {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font-size: 0.8rem; color: var(--gray); margin-top: -0.75rem;
}
.bgf-dot {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: var(--green); box-shadow: 0 0 0 4px var(--green-dim);
}

.bgf { background: var(--bg); padding: 2.5rem 0 5rem; }

.bgf-toc {
  position: sticky; top: 72px; z-index: 5;
  display: flex; gap: 0.4rem; flex-wrap: wrap;
  padding: 0.75rem 0; margin-bottom: 1rem;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.bgf-toc a {
  font-family: var(--font-head); font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; text-decoration: none;
  color: var(--gray); padding: 0.4rem 0.8rem; border-radius: 50px;
  border: 1px solid transparent; transition: color .2s, border-color .2s;
}
.bgf-toc a:hover, .bgf-toc a:focus-visible { color: var(--white); border-color: var(--green-border); }

.bgf-section { padding: 3rem 0 0.5rem; scroll-margin-top: 130px; }
.bgf-eyebrow {
  font-family: var(--font-head); font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--green);
  margin-bottom: 0.6rem;
}
.bgf-section h2 {
  font-family: var(--font-head); font-size: clamp(1.35rem, 2.5vw, 1.85rem);
  font-weight: 800; color: var(--white); line-height: 1.2; letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
}
.bgf-intro { color: var(--gray); line-height: 1.7; max-width: 760px; margin: 0 0 1.5rem; }
.bgf-intro a, .bgf-method a { color: var(--green); text-decoration: none; }
.bgf-intro a:hover, .bgf-method a:hover { text-decoration: underline; }

/* ---- stat cards ---- */
.bgf-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.bgf-card {
  display: flex; flex-direction: column; gap: 0.35rem;
  padding: 1.25rem 1.25rem 1.1rem; border-radius: 14px;
  background: rgba(255, 255, 255, 0.025); border: 1px solid var(--line);
  transition: border-color .2s, background .2s;
}
.bgf-card:hover { border-color: var(--green-border); background: rgba(255, 255, 255, 0.04); }
.bgf-label { font-size: 0.8rem; color: var(--gray); }
.bgf-value {
  font-family: var(--font-head); font-weight: 700; color: var(--white);
  font-size: clamp(1.6rem, 3vw, 2.1rem); line-height: 1.1; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.bgf-note { font-size: 0.8rem; color: var(--gray); line-height: 1.5; margin: 0; }
.bgf-meta {
  display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap;
  margin-top: auto; padding-top: 0.75rem; border-top: 1px solid var(--line);
  font-size: 0.72rem; color: var(--gray);
}
.bgf-chip {
  font-family: var(--font-head); font-size: 0.62rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.2rem 0.5rem; border-radius: 4px;
  border: 1px solid var(--line); color: var(--gray);
}
/* Official / final / checked: settled figures. Provisional / estimate: may be revised. */
.bgf-chip--published, .bgf-chip--final, .bgf-chip--checked { color: var(--green); border-color: var(--green-border); }
.bgf-chip--provisional, .bgf-chip--estimated { color: var(--white); border-color: rgba(255, 255, 255, 0.28); border-style: dashed; }
.bgf-src { font-size: 0.72rem; color: var(--gray); text-decoration: none; }
.bgf-src:hover { color: var(--green); }

/* ---- map ---- */
.bgm { margin-top: 0.5rem; }
.bgm-toolbar { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.bgm-tab {
  font-family: var(--font-head); font-size: 0.78rem; font-weight: 600;
  padding: 0.55rem 1rem; border-radius: 50px; cursor: pointer;
  background: transparent; color: var(--gray); border: 1px solid var(--line);
  transition: color .2s, border-color .2s, background .2s;
}
.bgm-tab:hover { color: var(--white); border-color: var(--green-border); }
.bgm-tab[aria-pressed="true"] { color: var(--bg-black); background: var(--green); border-color: var(--green); }
.bgm-tab:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

.bgm-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1rem; align-items: start; }
.bgm-figure {
  position: relative; margin: 0; padding: 1.25rem;
  border: 1px solid var(--line); border-radius: 14px; background: var(--bg-black);
}
.bgm-caption { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.75rem; margin-bottom: 0.75rem; }
.bgm-cap-title { font-family: var(--font-head); color: var(--white); font-size: 1rem; }
.bgm-cap-meta { font-size: 0.75rem; color: var(--gray); }
.bgm-cap-meta a { color: var(--gray); text-decoration: none; }
.bgm-cap-meta a:hover { color: var(--green); }
.bgm-cap-blurb { flex-basis: 100%; font-size: 0.78rem; color: var(--gray); }

.bgm-svg { display: block; width: 100%; height: auto; }
.bgm-d {
  /* 1px surface-coloured gap between districts */
  stroke: var(--bg-black); stroke-width: 1.2; stroke-linejoin: round;
  cursor: pointer; transition: fill .35s ease, opacity .2s;
  outline: none;
}
.bgm-svg:hover .bgm-d { opacity: 0.82; }
.bgm-svg .bgm-d:hover, .bgm-d.is-active { opacity: 1; }
/* Outlines are separate overlay shapes that ignore the pointer: the district
   paths never move in the DOM, so a click can't be lost mid-press. */
.bgm-hover, .bgm-sel { fill: none; pointer-events: none; stroke-linejoin: round; }
.bgm-hover { stroke: var(--white); stroke-width: 1.4; opacity: 0.7; }
.bgm-sel { stroke: var(--white); stroke-width: 2.2; }
/* The capital label must never catch a click meant for the district under it. */
.bgm-capital { pointer-events: none; user-select: none; -webkit-user-select: none; }
.bgm-capital circle { fill: var(--white); stroke: var(--bg-black); stroke-width: 2; }
.bgm-capital text {
  font-family: var(--font-head); font-size: 13px; font-weight: 700; fill: var(--white);
  paint-order: stroke; stroke: var(--bg-black); stroke-width: 3px; letter-spacing: 0.04em;
}

.bgm-legend {
  list-style: none; margin: 0.9rem 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; font-size: 0.75rem; color: var(--gray);
}
.bgm-legend li { display: inline-flex; align-items: center; gap: 0.4rem; }
.bgm-swatch { width: 14px; height: 10px; border-radius: 3px; flex: none; }
.bgm-attrib { margin: 0.75rem 0 0; font-size: 0.66rem; color: var(--gray-dim); }

.bgm-tip {
  position: absolute; pointer-events: none; z-index: 3;
  padding: 0.45rem 0.65rem; border-radius: 8px; white-space: nowrap;
  background: var(--bg); border: 1px solid var(--green-border);
  font-size: 0.78rem; color: var(--white); box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.7);
}
.bgm-tip span { color: var(--gray); margin-left: 0.5rem; font-variant-numeric: tabular-nums; }

.bgm-panel {
  padding: 1.25rem; border: 1px solid var(--line); border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
}
.bgm-panel-eyebrow {
  font-family: var(--font-head); font-size: 0.65rem; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--green);
}
.bgm-panel-name { font-family: var(--font-head); font-size: 1.5rem; font-weight: 800; color: var(--white); margin: 0.35rem 0 0.75rem; }
.bgm-panel-value { font-family: var(--font-head); font-size: 2.2rem; font-weight: 700; color: var(--white); line-height: 1; font-variant-numeric: tabular-nums; }
.bgm-panel-sub { font-size: 0.75rem; color: var(--gray); margin: 0.4rem 0 1rem; }
.bgm-panel-list { margin: 0; border-top: 1px solid var(--line); }
.bgm-panel-list div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.55rem 0; border-bottom: 1px solid var(--line); }
.bgm-panel-list dt { font-size: 0.8rem; color: var(--gray); }
.bgm-panel-list dt span { display: block; font-size: 0.68rem; color: var(--gray-dim); }
.bgm-panel-list dd { margin: 0; font-size: 0.85rem; color: var(--white); font-variant-numeric: tabular-nums; text-align: right; }
.bgm-panel-hint { font-size: 0.72rem; color: var(--gray-dim); margin: 0.9rem 0 0; }

/* ---- full table (every value, also the no-JS / screen-reader view) ---- */
.bgf-table-wrap { margin-top: 1.25rem; overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
.bgf-table { width: 100%; min-width: 620px; border-collapse: collapse; font-size: 0.85rem; }
.bgf-table caption { caption-side: bottom; text-align: left; padding: 0.75rem 1rem; font-size: 0.72rem; color: var(--gray-dim); }
.bgf-table th, .bgf-table td { padding: 0.6rem 1rem; border-bottom: 1px solid var(--line); text-align: right; }
.bgf-table thead th {
  font-family: var(--font-head); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--gray); vertical-align: bottom; background: rgba(255, 255, 255, 0.02);
}
.bgf-table thead th span { display: block; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--gray-dim); }
.bgf-table th:first-child { text-align: left; }
.bgf-table tbody th { font-weight: 600; color: var(--white); }
.bgf-table td { color: var(--gray); font-variant-numeric: tabular-nums; }
.bgf-table tbody tr.is-active th, .bgf-table tbody tr.is-active td { background: var(--green-dim); color: var(--white); }
.bgf-table tbody tr:last-child th, .bgf-table tbody tr:last-child td { border-bottom: 0; }

.bgf-method {
  padding: 1.25rem 1.5rem; border: 1px solid var(--line); border-left: 3px solid var(--green);
  border-radius: 4px 14px 14px 4px; background: rgba(255, 255, 255, 0.02); max-width: 860px;
}
.bgf-method p { color: var(--gray); line-height: 1.7; margin: 0 0 0.9rem; font-size: 0.92rem; }
.bgf-method strong { color: var(--white); }
.bgf-disclaimer { font-size: 0.8rem !important; color: var(--gray-dim) !important; margin-bottom: 0 !important; }

@media (max-width: 900px) {
  .bgm-body { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .bgf-toc { top: 64px; }
  .bgf-grid { grid-template-columns: 1fr 1fr; gap: 0.6rem; }
  .bgf-card { padding: 1rem; }
  .bgf-value { font-size: 1.35rem; }
  .bgm-figure { padding: 0.75rem; }
}
@media (max-width: 380px) {
  .bgf-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .bgm-d, .bgf-card, .bgm-tab { transition: none; }
}
