/*
 * EAF Country Regulations map: additions to styles.css / themes.css.
 * Only new elements are styled here; the page itself reuses the existing
 * member-map, member-card and country-information components.
 * Load after themes.css.
 */

:root {
  --eaf-reg-marker-verified-bg: var(--navy);
  --eaf-reg-marker-verified-fg: var(--gold);
  --eaf-reg-marker-verified-ring: var(--white);
  --eaf-reg-marker-partial-bg: var(--white);
  --eaf-reg-marker-partial-fg: var(--navy);
  --eaf-reg-marker-partial-ring: var(--navy);
  --eaf-reg-marker-awaiting-bg: rgba(255, 255, 255, 0.92);
  --eaf-reg-marker-awaiting-fg: #7a8aa3;
  --eaf-reg-marker-awaiting-ring: #8fa0b8;
  --eaf-reg-marker-hover-bg: var(--blue);
  --eaf-reg-marker-hover-fg: var(--white);
  --eaf-reg-contributor: #a9c8ea;
  --eaf-reg-progress-track: rgba(0, 43, 111, 0.12);
  --eaf-reg-progress-verified: var(--navy);
  --eaf-reg-progress-partial: var(--gold-deep);
  --eaf-reg-group-text: var(--navy);
  --eaf-reg-group-icon: var(--gold-deep);
  --eaf-reg-empty: #8292aa;
  --eaf-reg-example: var(--blue);
  --eaf-reg-example-bg: #eaf1fb;
  --eaf-reg-status-verified: #2f6b4f;
  --eaf-reg-status-partial: #9a6700;
  --eaf-reg-status-awaiting: #6b7a90;
}

/* ---------- Map ---------- */

.regulations-map-section .europe-map-card .map-country.is-contributor {
  fill: var(--eaf-reg-contributor);
}

.regulations-map-section .europe-map-card .map-country.is-member.is-highlighted {
  fill: var(--eaf-map-hover, #4f87cc);
}

.regulations-marker {
  cursor: pointer;
}

.regulations-marker circle {
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 2px 3px rgba(0, 27, 77, 0.28));
  transition: fill 160ms ease, stroke 160ms ease;
}

.regulations-marker text {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
  font-style: italic;
  font-weight: 700;
  pointer-events: none;
  user-select: none;
}

.regulations-marker.is-verified circle { fill: var(--eaf-reg-marker-verified-bg); stroke: var(--eaf-reg-marker-verified-ring); }
.regulations-marker.is-verified text { fill: var(--eaf-reg-marker-verified-fg); }
.regulations-marker.is-partial circle,
.regulations-marker.is-contributed circle { fill: var(--eaf-reg-marker-partial-bg); stroke: var(--eaf-reg-marker-partial-ring); }
.regulations-marker.is-partial text,
.regulations-marker.is-contributed text { fill: var(--eaf-reg-marker-partial-fg); }
.regulations-marker.is-awaiting circle { fill: var(--eaf-reg-marker-awaiting-bg); stroke: var(--eaf-reg-marker-awaiting-ring); stroke-dasharray: 3 2; }
.regulations-marker.is-awaiting text { fill: var(--eaf-reg-marker-awaiting-fg); }
.regulations-marker:hover circle { fill: var(--eaf-reg-marker-hover-bg); stroke: var(--eaf-reg-marker-verified-ring); stroke-dasharray: none; }
.regulations-marker:hover text { fill: var(--eaf-reg-marker-hover-fg); }

/* ---------- Legend & progress ---------- */

.regulations-legend .regulations-marker-key {
  display: grid;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin: 0 2px;
  place-items: center;
  border: 1.5px solid;
  border-radius: 50%;
  font: italic 700 12px/1 Georgia, "Times New Roman", serif;
}

.regulations-marker-key.is-verified { color: var(--eaf-reg-marker-verified-fg); background: var(--eaf-reg-marker-verified-bg); border-color: var(--eaf-reg-marker-verified-bg); }
.regulations-marker-key.is-partial { color: var(--eaf-reg-marker-partial-fg); background: var(--eaf-reg-marker-partial-bg); border-color: var(--eaf-reg-marker-partial-ring); }
.regulations-marker-key.is-awaiting { color: var(--eaf-reg-marker-awaiting-fg); background: var(--eaf-reg-marker-awaiting-bg); border-color: var(--eaf-reg-marker-awaiting-ring); border-style: dashed; }

.regulations-progress {
  margin-top: 26px;
}

.regulations-progress-bar {
  display: flex;
  height: 8px;
  overflow: hidden;
  background: var(--eaf-reg-progress-track);
  border-radius: 999px;
}

.regulations-progress-bar span {
  display: block;
  width: 0;
  height: 100%;
  transition: width 400ms ease;
}

.regulations-progress-bar .is-verified { background: var(--eaf-reg-progress-verified); }
.regulations-progress-bar .is-partial { background: var(--eaf-reg-progress-partial); }

.member-map-copy .regulations-progress p {
  margin: 8px 0 0;
  color: var(--navy-deep);
  font-size: 12px;
  font-weight: 750;
}

/* ---------- Directory cards ---------- */

.regulations-card-status.is-verified { color: var(--eaf-reg-status-verified); }
.regulations-card-status.is-partial { color: var(--eaf-reg-status-partial); }
.regulations-card-status.is-awaiting { color: var(--eaf-reg-status-awaiting); }

/* ---------- Country window ---------- */

.regulations-updated.is-pending {
  color: #4a5872;
  background: #f1f5fb;
  border-color: #c9d5e6;
}

.regulations-updated.is-pending strong { color: #4a5872; }

.regulations-updated.is-stale {
  background: #fff1ef;
  border-color: #f0a79c;
}

.regulations-updated.is-stale span:last-child {
  color: #b42318;
  font-weight: 850;
}

.regulations-source {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.regulations-source strong { color: var(--navy-deep); }

.regulations-source-verify {
  color: var(--muted);
  font-size: 12px;
}

.regulations-status-pill {
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.regulations-status-pill.is-verified { color: var(--gold); background: var(--navy); }
.regulations-status-pill.is-partial { color: var(--navy-deep); background: var(--gold); }
.regulations-status-pill.is-awaiting { color: #4a5872; background: #e4ebf5; }
.regulations-status-pill.is-contributed { color: var(--navy-deep); background: var(--eaf-reg-contributor); }

.regulations-regions {
  margin: 0 0 12px;
}

.regulations-regions .filter-chip {
  cursor: pointer;
}

.regulations-region-select {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0 0 12px;
}

.regulations-region-select span {
  color: var(--blue);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.regulations-region-select select {
  flex: 1 1 240px;
  min-height: 44px;
  padding: 0 12px;
  color: var(--navy-deep);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
}

.regulations-region-select select:focus-visible {
  border-color: var(--gold-deep);
  outline: 3px solid rgba(255, 210, 63, 0.42);
}

.regulations-region-note {
  margin: 0 0 6px;
  background: #fff7dc;
  border-color: #e6bd3e;
}

.regulations-group-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 20px 0 10px;
  color: var(--eaf-reg-group-text);
  font-family: var(--display);
  font-size: 17px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.regulations-group-title svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--eaf-reg-group-icon);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.regulations-group:first-of-type .regulations-group-title { margin-top: 8px; }

.regulations-dialog .country-information-list > div.is-empty {
  background: transparent;
  border-style: dashed;
}

.regulations-empty {
  color: var(--eaf-reg-empty);
  font-weight: 500;
  font-style: italic;
}

.regulations-example {
  color: var(--eaf-reg-example);
  font-weight: 600;
}

.regulations-example::before {
  content: "Example";
  margin-right: 6px;
  padding: 2px 6px;
  color: var(--eaf-reg-example);
  background: var(--eaf-reg-example-bg);
  border-radius: 4px;
  font-size: 9px;
  font-style: normal;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: 1px;
}

.regulations-new {
  display: none;
  margin-left: 6px;
  padding: 1px 5px;
  color: #b54708;
  background: #fef0c7;
  border-radius: 4px;
  font-size: 9px;
  letter-spacing: 0.06em;
  vertical-align: 1px;
}

body.regulations-show-new .regulations-new { display: inline-block; }

/* ---------- Quick answer ---------- */

.regulations-quick-answer {
  margin: 0 0 14px;
  padding: 14px 16px;
  color: var(--white);
  background: linear-gradient(120deg, var(--navy-deep), var(--blue));
  border-left: 4px solid var(--gold);
  border-radius: 10px;
}

.regulations-quick-answer strong {
  display: block;
  margin-bottom: 4px;
  color: var(--gold);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.regulations-quick-answer p {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.5;
}

/* ---------- Reliability labels ---------- */

.regulations-reliability {
  display: inline-block;
  margin-top: 8px;
  padding: 2px 8px;
  border: 1px solid;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1.6;
  text-transform: uppercase;
  cursor: help;
}

.regulations-reliability.is-statute { color: #2f6b4f; background: #e8f5ee; border-color: #9fcfb5; }
.regulations-reliability.is-interpretation { color: #8a5a00; background: #fff4d6; border-color: #e8c46a; }
.regulations-reliability.is-not-regulated { color: #6941c6; background: #f1ecfd; border-color: #c8b6f4; }
.regulations-reliability.is-unverified { color: #b42318; background: #fff0ee; border-color: #f2b2a9; }
.regulations-reliability.is-federation-rule { color: var(--blue); background: #eaf1fb; border-color: #aac3e6; }
.regulations-reliability.is-for-federation { color: #475467; background: #f2f4f7; border-color: #c4ccd8; border-style: dashed; }

.regulations-labels-help {
  margin: 18px 0 4px;
  padding: 10px 14px;
  background: #f1f5fb;
  border: 1px solid #dce5f2;
  border-radius: 10px;
  font-size: 13px;
}

.regulations-labels-help summary {
  color: var(--blue);
  font-weight: 800;
  cursor: pointer;
}

.regulations-labels-help dl {
  display: grid;
  gap: 8px;
  margin: 10px 0 2px;
}

.regulations-labels-help dl > div {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 10px;
  align-items: start;
}

.regulations-labels-help .regulations-reliability { margin-top: 0; }
.regulations-labels-help dd { margin: 0; color: var(--navy-deep); }

/* On phones the whole window scrolls (header stays pinned), so the longer
   regulations content is not squeezed above the legal notice. */
@media (max-width: 760px) {
  .regulations-dialog {
    display: block;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .regulations-dialog .country-information-body { overflow: visible; }

  .regulations-dialog .country-information-drag {
    position: sticky;
    z-index: 2;
    top: 0;
  }
}

/* ---------- Working-draft bar (preview only) ---------- */

.regulations-demo-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 22px;
  margin-top: 22px;
  padding: 12px 18px;
  color: var(--navy-deep);
  background: rgba(255, 255, 255, 0.8);
  border: 1px dashed var(--gold-deep);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
}

.regulations-demo-bar[hidden] { display: none; }

.regulations-demo-bar strong {
  padding: 4px 10px;
  color: var(--navy-deep);
  background: var(--gold);
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.regulations-demo-bar label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.regulations-demo-bar input { accent-color: var(--navy); }

/* ---------- Theme: institutional ---------- */

html[data-eaf-theme="institutional"] {
  --eaf-reg-marker-verified-bg: #235b85;
  --eaf-reg-marker-partial-ring: #235b85;
  --eaf-reg-marker-partial-fg: #235b85;
  --eaf-reg-marker-hover-bg: #235b85;
  --eaf-reg-progress-verified: #235b85;
  --eaf-reg-group-text: #235b85;
  --eaf-reg-group-icon: #6aa1c8;
}

/* ---------- Theme: camouflage ---------- */

html[data-eaf-theme="camouflage"] {
  --eaf-reg-marker-verified-bg: #24331f;
  --eaf-reg-marker-verified-fg: #f2ca52;
  --eaf-reg-marker-partial-ring: #526b42;
  --eaf-reg-marker-partial-fg: #304426;
  --eaf-reg-marker-awaiting-ring: #899778;
  --eaf-reg-marker-awaiting-fg: #6c7a5f;
  --eaf-reg-marker-hover-bg: #526b42;
  --eaf-reg-contributor: #b9c9a3;
  --eaf-reg-progress-track: rgba(36, 51, 31, 0.14);
  --eaf-reg-progress-verified: #24331f;
  --eaf-reg-group-text: #304426;
  --eaf-reg-group-icon: #9b7d1f;
  --eaf-reg-example: #526b42;
  --eaf-reg-example-bg: #e8ecdf;
}

html[data-eaf-theme="camouflage"] .regulations-updated.is-pending { color: #46563d; background: #e8ecdf; border-color: #cbd2bf; }
html[data-eaf-theme="camouflage"] .regulations-updated.is-pending strong { color: #304426; }
html[data-eaf-theme="camouflage"] .regulations-quick-answer { background: linear-gradient(120deg, #24331f, #526b42); border-left-color: #f2ca52; }
html[data-eaf-theme="camouflage"] .regulations-quick-answer strong { color: #f2ca52; }
html[data-eaf-theme="institutional"] .regulations-quick-answer { background: linear-gradient(120deg, #235b85, #6aa1c8); }

/* ---------- Night mode ---------- */

html[data-eaf-theme-context="public"][data-eaf-night-mode="true"] {
  --eaf-reg-marker-verified-bg: #ffd23f;
  --eaf-reg-marker-verified-fg: #111923;
  --eaf-reg-marker-verified-ring: #111923;
  --eaf-reg-marker-partial-bg: #172330;
  --eaf-reg-marker-partial-fg: #ffd23f;
  --eaf-reg-marker-partial-ring: #ffd23f;
  --eaf-reg-marker-awaiting-bg: #172330;
  --eaf-reg-marker-awaiting-fg: #8fa3b8;
  --eaf-reg-marker-awaiting-ring: #8fa3b8;
  --eaf-reg-marker-hover-bg: #4f87cc;
  --eaf-reg-contributor: #2f557e;
  --eaf-reg-progress-track: rgba(255, 255, 255, 0.12);
  --eaf-reg-progress-verified: #ffd23f;
  --eaf-reg-progress-partial: #b98a12;
  --eaf-reg-group-text: #f0f4f8;
  --eaf-reg-group-icon: #ffd23f;
  --eaf-reg-empty: #8fa3b8;
  --eaf-reg-example: #91bce8;
  --eaf-reg-example-bg: #1e3c59;
  --eaf-reg-status-verified: #a8d4be;
  --eaf-reg-status-partial: #ffd23f;
  --eaf-reg-status-awaiting: #a9b6c4;
}

html[data-eaf-theme-context="public"][data-eaf-night-mode="true"] .member-map-copy .regulations-progress p { color: #c5d0db; }
html[data-eaf-theme-context="public"][data-eaf-night-mode="true"] .regulations-source { color: #a9b6c4; }
html[data-eaf-theme-context="public"][data-eaf-night-mode="true"] .regulations-source strong { color: #f0f4f8; }
html[data-eaf-theme-context="public"][data-eaf-night-mode="true"] .regulations-updated.is-pending { color: #c5d0db; background: #172330; border-color: #40566c; }
html[data-eaf-theme-context="public"][data-eaf-night-mode="true"] .regulations-updated.is-pending strong { color: #91bce8; }
html[data-eaf-theme-context="public"][data-eaf-night-mode="true"] .regulations-region-note { color: #ffe7a3; background: #30250c; border-color: #9d7412; }
html[data-eaf-theme-context="public"][data-eaf-night-mode="true"] .regulations-status-pill.is-awaiting { color: #c5d0db; background: #26384a; }
html[data-eaf-theme-context="public"][data-eaf-night-mode="true"] .regulations-region-select span { color: #91bce8; }
html[data-eaf-theme-context="public"][data-eaf-night-mode="true"] .regulations-quick-answer { background: linear-gradient(120deg, #0c1722, #1e3c59); }
html[data-eaf-theme-context="public"][data-eaf-night-mode="true"] .regulations-reliability { background: transparent; }
html[data-eaf-theme-context="public"][data-eaf-night-mode="true"] .regulations-reliability.is-statute { color: #a8d4be; border-color: #4f7f66; }
html[data-eaf-theme-context="public"][data-eaf-night-mode="true"] .regulations-reliability.is-interpretation { color: #ffd88a; border-color: #8a6a22; }
html[data-eaf-theme-context="public"][data-eaf-night-mode="true"] .regulations-reliability.is-not-regulated { color: #cbb8ff; border-color: #6b55a8; }
html[data-eaf-theme-context="public"][data-eaf-night-mode="true"] .regulations-reliability.is-unverified { color: #ffaba0; border-color: #a5463b; }
html[data-eaf-theme-context="public"][data-eaf-night-mode="true"] .regulations-reliability.is-federation-rule { color: #91bce8; border-color: #40566c; }
html[data-eaf-theme-context="public"][data-eaf-night-mode="true"] .regulations-reliability.is-for-federation { color: #c7d0dc; border-color: #5a6878; }
html[data-eaf-theme-context="public"][data-eaf-night-mode="true"] .regulations-labels-help { background: #172330; border-color: #40566c; }
html[data-eaf-theme-context="public"][data-eaf-night-mode="true"] .regulations-labels-help summary { color: #91bce8; }
html[data-eaf-theme-context="public"][data-eaf-night-mode="true"] .regulations-labels-help dd { color: #d8e1eb; }
html[data-eaf-theme-context="public"][data-eaf-night-mode="true"] .regulations-region-select select { color: #f0f4f8; background: #172330; border-color: #40566c; }
html[data-eaf-theme-context="public"][data-eaf-night-mode="true"] .regulations-demo-bar { color: #f0f4f8; background: rgba(17, 25, 35, 0.85); }
html[data-eaf-theme-context="public"][data-eaf-night-mode="true"] .regulations-dialog .country-information-list > div.is-empty { background: transparent; }

/* ---------- Forced colours ---------- */

@media (forced-colors: active) {
  .regulations-marker circle { stroke: CanvasText; fill: Canvas; }
  .regulations-marker text { fill: CanvasText; }
  .regulations-progress-bar span { background: Highlight; }
}

/* Legal source under each answer: present, but quieter than the answer itself. */
.regulations-answer-source { display: block; margin-top: 6px; font-size: 0.78em; font-weight: 400; line-height: 1.4; color: #5b6573; overflow-wrap: anywhere; }
html[data-eaf-theme-context="public"][data-eaf-night-mode="true"] .regulations-answer-source { color: #9fb0c3; }
