/* =============================================================================
   UNESCO Design System — Skosmos 3.x Theme
   Based on bunesco8 style guide (Bootstrap 5.3)
   Reference: https://www.unesco.org/themes/custom/bunesco8/style-guide/
   ============================================================================= */

/* Google Inter — UNESCO's standard typeface */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ---------------------------------------------------------------------------
   1. UNESCO Design Tokens
   --------------------------------------------------------------------------- */
:root {
  /* Primary blues */
  --unesco-primary:        #0077D4;
  --unesco-blue2:          #115A9E;
  --unesco-blue3:          #0E4280;
  --unesco-primary-light:  #B2D6F2;
  --unesco-primary-bg:     #CCE4F6;

  /* Grayscale */
  --unesco-black:          #212121;
  --unesco-gray5:          #4C5054;
  --unesco-gray4:          #7F888F;
  --unesco-gray3:          #B1BABE;
  --unesco-gray2:          #D5DADD;
  --unesco-gray1:          #F1F4F6;
  --unesco-white:          #FFFFFF;

  /* Accent / dataviz */
  --unesco-green:          #4FB293;
  --unesco-green-light:    #A6DDCB;
  --unesco-teal:           #2D9BB1;
  --unesco-teal-light:     #A1D7E1;
  --unesco-purple:         #4B6AD9;
  --unesco-purple-light:   #C2CBEC;
  --unesco-red:            #D6664F;
  --unesco-red-light:      #ECBEB5;
  --unesco-amber:          #E4A429;
  --unesco-amber-light:    #EECF93;

  /* Semantic */
  --unesco-danger:         #D8552C;
  --unesco-success:        #4FB293;
  --unesco-warning:        #E4A429;
  --unesco-info:           #2D9BB1;

  /* Bootstrap overrides */
  --bs-primary:            #0077D4;
  --bs-primary-rgb:        0, 119, 212;
  --bs-link-color:         #0077D4;
  --bs-link-hover-color:   #115A9E;
  --bs-body-font-family:   'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --bs-body-color:         #212121;

  /* Override Skosmos's default link color (#1B709D) so .vocab-home a,
     .concept a etc. inherit UNESCO classic blue instead of the muted
     teal that doesn't match the design system. */
  --medium-color: #0077D4;

  /* Override Skosmos's dark-navy active-tab and search-button background
     (#0D284E) with the UNESCO design system blue (#115A9E = --unesco-blue2).
     Skosmos exposes these as named tokens so we don't need per-selector
     overrides. */
  --sidebar-tab-active-bg: #115A9E;
  --search-button-bg:      #115A9E;
}

/* ---------------------------------------------------------------------------
   2. Base Typography
   --------------------------------------------------------------------------- */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
               'Helvetica Neue', Arial, sans-serif;
  color: var(--unesco-black);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6,
#concept-heading h1,
.concept-heading {
  font-family: 'Inter', sans-serif !important;
  font-weight: 700;
  color: var(--unesco-black);
}

a {
  color: var(--unesco-primary);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover {
  color: var(--unesco-blue2);
  text-decoration: underline;
}

/* ---------------------------------------------------------------------------
   3. Top Bar — clean UNESCO identity strip (logo + service name only)
   --------------------------------------------------------------------------- */
#topbar {
  background-color: var(--unesco-primary) !important;
  border-bottom: none !important;
  padding: 1.25rem 2rem !important;
  min-height: auto !important;
  align-items: center !important;
}

/* Inject UNESCO logo into topbar via ::before */
#topbar::before {
  content: '';
  display: inline-block;
  width: 262px;
  height: 56px;
  background-image: url('../images/logos/UNESCO_logo_hor_white.svg');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center left;
  margin-right: 1.25rem;
  flex-shrink: 0;
  align-self: center;
}

/* Hide search toggle and global search bar —
   the header bar already provides search */
#topbar #global-search-toggle,
#global-search-bar {
  display: none !important;
}

/* Hide home/vocabularies link from topbar — home is via logo click */
#topbar-nav #navi1 {
  display: none !important;
}

/* Show and style interface language links in topbar */
#topbar-nav .nav-item.language {
  display: list-item !important;
}
#topbar-nav .nav-item.language a {
  color: rgba(255,255,255,0.8) !important;
  font-size: 0.82rem !important;
  font-weight: 400;
  text-transform: capitalize;
}
#topbar-nav .nav-item.language a:hover {
  color: #fff !important;
}
#topbar-nav .nav-item.language.active a {
  color: #fff !important;
  font-weight: 600;
}

/* Style remaining nav (About, Feedback) */
#topbar-nav {
  align-items: center;
}
#topbar-nav a {
  color: rgba(255,255,255,0.8) !important;
  font-size: 0.82rem !important;
  font-weight: 400;
  text-decoration: none !important;
  transition: color 0.15s ease;
}
#topbar-nav a:hover {
  color: #fff !important;
}
#topbar-nav .fa-solid,
#topbar-nav i {
  font-size: 0.78rem;
  opacity: 0.7;
}

/* ---------------------------------------------------------------------------
   4. Header Bar — UNESCO primary blue with service title
   --------------------------------------------------------------------------- */
#headerbar {
  background-color: var(--unesco-primary) !important;
  padding-top: 0.75rem !important;
  padding-bottom: 0.75rem !important;
}

/* ---- Landing page: #skosmos-logo in #headerbar ---- */
#skosmos-logo {
  background-image: none !important;
  width: auto !important;
  height: auto !important;
  min-height: 0 !important;
}

/* Inject service name (the h1 is hardcoded "Skosmos") */
#skosmos-logo::after {
  content: 'Vocabularies';
  display: block;
  font-size: 1.3rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* ---- Vocabulary pages: #skosmos-logo-top in topbar ---- */
/* skosmos.css sets background-image to the Skosmos SVG wordmark — nuke it */
#skosmos-logo-top {
  background-image: none !important;
  background: none !important;
  width: auto !important;
  height: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  display: flex !important;
  align-items: center;
  text-decoration: none !important;
}

/* Un-hide the h2 and override text-indent: -100% from skosmos.css */
#skosmos-logo-top h2,
#skosmos-logo-top #service-name {
  clip: unset !important;
  clip-path: none !important;
  width: auto !important;
  height: auto !important;
  overflow: visible !important;
  position: static !important;
  white-space: nowrap !important;
  margin: 0 !important;
  padding: 0 !important;
  text-indent: 0 !important;
  font-size: 1rem !important;
  font-weight: 600 !important;
  color: #fff !important;
  letter-spacing: 0.01em;
  line-height: 56px !important;
}

#headerbar a,
#headerbar .nav-link,
#vocab-title a {
  color: #fff !important;
  text-decoration: none;
}

/* All dropdown menus — ensure dark text on white background */
.dropdown-menu {
  background-color: #fff !important;
  border: 1px solid var(--unesco-gray2) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}
.dropdown-menu a,
.dropdown-menu .dropdown-item,
.dropdown-menu li,
#language-list a,
#language-list .dropdown-item {
  color: #212121 !important;
  opacity: 1 !important;
  background-color: transparent;
}
.dropdown-menu .dropdown-item:hover,
.dropdown-menu .dropdown-item:focus {
  color: #212121 !important;
  background-color: var(--unesco-gray1) !important;
}
.dropdown-menu .dropdown-item.active,
.dropdown-menu .dropdown-item:active {
  color: #fff !important;
  background-color: var(--unesco-primary) !important;
}

/* Vocab title on vocabulary pages — Inter font, no serif */
#vocab-title a {
  font-family: 'Inter', sans-serif !important;
  font-weight: 600;
  font-size: 1.1rem;
}

/* Merge topbar + headerbar into single visual block */
#headerbar {
  padding-top: 0.5rem !important;
  padding-bottom: 0.75rem !important;
}

/* ---------------------------------------------------------------------------
   5. Global Search
   --------------------------------------------------------------------------- */
#global-search-bar {
  background-color: var(--unesco-gray1);
  border-bottom: 1px solid var(--unesco-gray2);
}

#global-search-bar h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--unesco-black);
}

/* ---------------------------------------------------------------------------
   6. Landing Page
   --------------------------------------------------------------------------- */

/* Hide the default Skosmos frontpage-logo behavior */
.frontpage-logo #skosmos-logo {
  background: none !important;
}

/* Hide the default vocabulary list — we have only one vocab,
   the hero section provides the direct link */
#vocabulary-list {
  display: none !important;
}

/* Make landing page full-width when vocab list is hidden */
.landing #landing-start-slot {
  display: none !important;
}
.landing #landing-end-slot {
  flex: 0 0 100% !important;
  max-width: 100% !important;
}

/* ---- Hero section ---- */
.unesco-hero {
  background: linear-gradient(135deg, var(--unesco-gray1) 0%, #e8eef4 100%);
  border-radius: 8px;
  padding: 2.5rem 2rem 2rem;
  text-align: center;
  margin-bottom: 0.5rem;
}

.unesco-hero-title {
  color: var(--unesco-black) !important;
  font-size: 1.6rem !important;
  font-weight: 700 !important;
  margin: 0.75rem 0 1rem;
}

.unesco-hero-lead {
  color: var(--unesco-gray5);
  font-size: 1.05rem;
  line-height: 1.65;
  max-width: 640px;
  margin: 0 auto 1.5rem;
}

.unesco-hero-cta {
  margin-bottom: 2rem;
}

.unesco-hero-btn {
  font-size: 1rem !important;
  font-weight: 600 !important;
  padding: 0.65rem 1.75rem !important;
  border-radius: 6px !important;
  letter-spacing: 0.01em;
  box-shadow: 0 2px 8px rgba(0, 119, 212, 0.25);
  transition: all 0.2s ease !important;
}
.unesco-hero-btn:hover {
  box-shadow: 0 4px 16px rgba(0, 119, 212, 0.35);
  transform: translateY(-1px);
}

.unesco-hero-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.unesco-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
}

.unesco-stat-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--unesco-primary);
  line-height: 1.2;
}

.unesco-stat-label {
  font-size: 0.78rem;
  color: var(--unesco-gray4);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.15rem;
}

/* ---- Sidebar cards ---- */
.unesco-card {
  background-color: var(--unesco-gray1);
  border-radius: 6px;
  padding: 1.25rem;
}

.unesco-card-highlight {
  background-color: var(--unesco-primary-bg, #CCE4F6);
  border-left: 3px solid var(--unesco-primary);
}

.unesco-card-title {
  font-size: 0.95rem !important;
  font-weight: 600 !important;
  color: var(--unesco-black) !important;
  margin-bottom: 0.65rem !important;
}

.unesco-card-text {
  font-size: 0.875rem;
  color: var(--unesco-gray5);
  line-height: 1.6;
  margin-bottom: 0.5rem;
}

.unesco-card-list {
  font-size: 0.875rem;
  color: var(--unesco-gray5);
  line-height: 1.7;
  padding-left: 1.1rem;
  margin-bottom: 0;
}

.unesco-card-code {
  display: block;
  font-size: 0.8rem;
  background: var(--unesco-white, #fff);
  padding: 0.35rem 0.6rem;
  border-radius: 4px;
  border: 1px solid var(--unesco-gray2);
  color: var(--unesco-gray5);
}

.unesco-card-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--unesco-primary) !important;
  text-decoration: none !important;
}
.unesco-card-link:hover {
  text-decoration: underline !important;
  color: var(--unesco-blue2) !important;
}

.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }

/* Vocabulary list (hidden, but style in case it's shown) */
#vocabulary-list .list-group-item a:hover {
  color: var(--unesco-blue2);
  text-decoration: underline;
}

/* Hide slot placeholder messages */
.slot-placeholder {
  display: none !important;
}

/* ---------------------------------------------------------------------------
   7. Sidebar & Navigation
   --------------------------------------------------------------------------- */
.sidebar-header,
.tab-content-header {
  background-color: var(--unesco-gray1);
  border-color: var(--unesco-gray2);
}

/* Tab navigation */
.nav-tabs .nav-link {
  color: var(--unesco-gray5);
  font-weight: 500;
  border-radius: 0;
}
.nav-tabs .nav-link:hover {
  color: var(--unesco-primary);
  border-color: transparent;
}
.nav-tabs .nav-link.active {
  color: var(--unesco-blue2);
  font-weight: 600;
  border-bottom: 2px solid var(--unesco-blue2);
}

/* Hierarchy & alphabetical nav */
.sidebar .nav-link.active,
.sidebar .list-group-item.active,
.active-concept {
  background-color: var(--unesco-blue2) !important;
  border-color: var(--unesco-blue2) !important;
  color: #fff !important;
}

/* Tree view / hierarchy */
.concept-hierarchy .jstree-anchor:hover,
.concept-hierarchy a:hover {
  color: var(--unesco-primary);
}

/* ---------------------------------------------------------------------------
   8. Buttons
   --------------------------------------------------------------------------- */
.btn-primary {
  background-color: var(--unesco-blue2);
  border-color: var(--unesco-blue2);
  font-weight: 500;
  border-radius: 4px;
  transition: all 0.15s ease;
}
.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--unesco-blue3);
  border-color: var(--unesco-blue3);
}
.btn-primary:active {
  background-color: var(--unesco-blue3);
  border-color: var(--unesco-blue3);
}

.btn-outline-primary {
  color: var(--unesco-primary);
  border-color: var(--unesco-primary);
  font-weight: 500;
  border-radius: 4px;
}
.btn-outline-primary:hover {
  background-color: var(--unesco-primary);
  color: #fff;
}

.btn-secondary {
  background-color: var(--unesco-gray4);
  border-color: var(--unesco-gray4);
}

/* ---------------------------------------------------------------------------
   9. Search
   --------------------------------------------------------------------------- */
.search-form .form-control,
#search-field,
input[type="search"] {
  border-color: var(--unesco-gray2);
  border-radius: 4px;
  font-size: 0.95rem;
}
.search-form .form-control:focus,
#search-field:focus,
input[type="search"]:focus {
  border-color: var(--unesco-primary);
  box-shadow: 0 0 0 0.2rem rgba(0, 119, 212, 0.2);
}

/* ---------------------------------------------------------------------------
   9b. About Page — white background like UNESCO.org
   --------------------------------------------------------------------------- */
.unesco-about {
  background-color: #fff;
  padding: 1.5rem;
  border-radius: 6px;
}

/* Main content area — white background */
#main-content,
.main-content-section {
  background-color: #fff;
}

/* ---------------------------------------------------------------------------
   10. Concept Pages
   --------------------------------------------------------------------------- */
.concept-property .prop-label {
  color: var(--unesco-gray5);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Breadcrumbs */
.breadcrumb-item a {
  color: var(--unesco-primary);
}
.breadcrumb-item.active {
  color: var(--unesco-gray4);
}

/* Badges */
.badge.bg-primary,
.badge.bg-info {
  background-color: var(--unesco-primary) !important;
}

/* Property values — normal weight links */
.concept-property a,
.property-value a,
#sidebar .list-group-item a {
  color: var(--unesco-primary);
  font-weight: 400 !important;
}

/* UNESDOC link next to preferred term */
.unesco-unesdoc-link {
  display: inline-block;
  margin-left: 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--unesco-primary) !important;
  text-decoration: none !important;
  vertical-align: middle;
}
.unesco-unesdoc-link:hover {
  text-decoration: underline !important;
}

/* Vocabulary description heading — force design system dark color [#4] */
#vocab-info h1,
#vocab-info h2,
.concept-scheme h1,
.concept-scheme h2,
.vocab-info-header {
  color: #212121 !important;
}

/* Download format links — UNESCO primary blue [#5] */
#vocab-download-links a,
#download-links a {
  color: #0077D4 !important;
}

/* "In other languages" — one term per line, prefLabel bold */
#concept-other-languages .row {
  margin-bottom: 0.25rem !important;
}
#concept-other-languages .concept-other-languages-language {
  flex: 0 0 auto !important;
  width: auto !important;
  min-width: 80px;
}
#concept-other-languages .concept-other-languages-language h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--unesco-gray5);
  margin: 0;
}
#concept-other-languages .col-5 {
  flex: 1 1 0% !important;
  width: auto !important;
  max-width: none !important;
}
#concept-other-languages ul {
  display: block !important;
  padding: 0;
  margin: 0;
  list-style: none;
}
#concept-other-languages li {
  display: block !important;
  line-height: 1.6;
  margin-bottom: 0.15rem;
}
/* Ensure non-preferred terms are on separate lines, not run-together */
#concept-other-languages li span,
#concept-other-languages li em {
  display: block;
}

/* ---------------------------------------------------------------------------
   11. Footer — UNESCO.org light gray footer
   --------------------------------------------------------------------------- */
footer {
  background-color: var(--unesco-gray1) !important;
  color: var(--unesco-black) !important;
  padding: 0 !important;
}

footer .unesco-footer-top {
  border-top: 1px solid var(--unesco-gray2);
  padding: 2.5rem 0 2rem;
}

footer .unesco-footer-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--unesco-black);
  margin-bottom: 0.75rem;
}

footer p {
  color: var(--unesco-black);
  font-size: 0.875rem;
  line-height: 1.6;
}

footer a {
  color: var(--unesco-black) !important;
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.15s ease;
}
footer a:hover {
  color: var(--unesco-primary) !important;
  text-decoration: none;
}

footer ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
footer ul li {
  margin-bottom: 0.35rem;
}

footer .unesco-footer-bottom {
  padding: 1.25rem 0;
  font-size: 0.8rem;
  color: var(--unesco-gray4);
}

footer .unesco-zero-tolerance {
  font-size: 0.8rem;
  color: var(--unesco-gray4);
  margin-bottom: 0.25rem;
}

footer .unesco-scam-link {
  color: var(--unesco-danger) !important;
}

footer .unesco-ext-icon {
  font-size: 0.75rem;
  vertical-align: middle;
  margin-left: 2px;
}

/* Social links in footer */
footer .unesco-social-list li {
  margin-bottom: 0.5rem;
}
footer .unesco-social-list a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}
footer .unesco-social-list svg {
  flex-shrink: 0;
}

/* ---------------------------------------------------------------------------
   12. RTL Support for Arabic
   --------------------------------------------------------------------------- */
html[lang="ar"] {
  direction: rtl;
}
html[lang="ar"] body {
  text-align: right;
}
html[lang="ar"] #topbar::before {
  margin-right: 0;
  margin-left: 1.5rem;
}
html[lang="ar"] .ms-auto {
  margin-left: unset !important;
  margin-right: auto !important;
}
html[lang="ar"] .me-auto {
  margin-right: unset !important;
  margin-left: auto !important;
}
html[lang="ar"] .text-start {
  text-align: right !important;
}
html[lang="ar"] .text-end {
  text-align: left !important;
}
html[lang="ar"] .ps-3, html[lang="ar"] .ps-4 {
  padding-left: 0 !important;
  padding-right: 1rem !important;
}
html[lang="ar"] .pe-3, html[lang="ar"] .pe-4 {
  padding-right: 0 !important;
  padding-left: 1rem !important;
}
html[lang="ar"] .float-start {
  float: right !important;
}
html[lang="ar"] .float-end {
  float: left !important;
}
html[lang="ar"] #topbar .nav-item.language:first-of-type {
  border-left: none;
  border-right: 1px solid rgba(255,255,255,0.25);
  padding-left: 0 !important;
  padding-right: 0.75rem !important;
  margin-left: 0;
  margin-right: 0.5rem;
}
html[lang="ar"] .unesco-filter-sidebar {
  border-left: none;
}
html[lang="ar"] .unesco-filter-option {
  flex-direction: row-reverse;
  justify-content: flex-end;
}
html[lang="ar"] .unesco-filter-badge {
  margin-left: 0;
  margin-right: 0.4rem;
}

/* ---------------------------------------------------------------------------
   13. Miscellaneous
   --------------------------------------------------------------------------- */

/* Smooth focus outlines */
:focus-visible {
  outline: 2px solid var(--unesco-primary);
  outline-offset: 2px;
}

/* Table styling */
table.table th {
  background-color: var(--unesco-gray1);
  color: var(--unesco-gray5);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Cards */
.card {
  border-color: var(--unesco-gray2);
  border-radius: 6px;
}

/* Pagination */
.page-link {
  color: var(--unesco-primary);
}
.page-item.active .page-link {
  background-color: var(--unesco-primary);
  border-color: var(--unesco-primary);
}

/* ---------------------------------------------------------------------------
   14a. Search Filters Sidebar
   --------------------------------------------------------------------------- */

/* Two-column layout: filters left, results right */
.unesco-search-layout {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

/* Filter sidebar — fixed width on desktop */
.unesco-filter-sidebar {
  flex: 0 0 250px;
  min-width: 250px;
  background: var(--unesco-gray1);
  border-radius: 6px;
  padding: 1.25rem;
  position: sticky;
  top: 1rem;
}

/* Results column takes remaining space.
   Skosmos's #search-results has no max-width and its content (long URIs,
   multilingual labels) can blow out wider than the viewport. Constrain
   everything inside the wrapper. */
.unesco-search-results {
  flex: 1 1 0%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
.unesco-search-results,
.unesco-search-results * {
  overflow-wrap: break-word;
  word-break: break-word;
}
.unesco-search-results #search-results {
  max-width: 100%;
}
.unesco-filter-heading {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--unesco-black);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--unesco-gray2);
}

.unesco-filter-section {
  margin-bottom: 1.25rem;
}

.unesco-filter-section:last-child {
  margin-bottom: 0;
}

.unesco-filter-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--unesco-gray5);
  margin-bottom: 0.5rem;
  display: block;
}

/* Type checkboxes */
.unesco-filter-option {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0;
  font-size: 0.85rem;
  color: var(--unesco-black);
  cursor: pointer;
}

.unesco-filter-option input[type="checkbox"],
.unesco-filter-option input[type="radio"] {
  accent-color: var(--unesco-primary);
  margin: 0;
  cursor: pointer;
}

/* Group select dropdown */
.unesco-filter-select {
  width: 100%;
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
  border: 1px solid var(--unesco-gray2);
  border-radius: 4px;
  background: #fff;
  color: var(--unesco-black);
}

.unesco-filter-select:focus {
  border-color: var(--unesco-primary);
  box-shadow: 0 0 0 0.15rem rgba(0, 119, 212, 0.2);
  outline: none;
}

/* Clear filters link */
.unesco-filter-clear {
  display: inline-block;
  font-size: 0.8rem;
  color: var(--unesco-gray4);
  cursor: pointer;
  margin-top: 0.75rem;
  text-decoration: none;
}

.unesco-filter-clear:hover {
  color: var(--unesco-primary);
  text-decoration: underline;
}

/* Active filter count badge */
.unesco-filter-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--unesco-primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  padding: 0 5px;
  margin-left: 0.4rem;
}

/* Mobile toggle button (hidden on desktop) */
.unesco-filter-toggle {
  display: none;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 500;
  background: var(--unesco-gray1);
  border: 1px solid var(--unesco-gray2);
  border-radius: 4px;
  color: var(--unesco-black);
  cursor: pointer;
  margin-bottom: 0.75rem;
  width: 100%;
  justify-content: center;
}

.unesco-filter-toggle .material-icons {
  font-size: 1.1rem;
}

/* ---------------------------------------------------------------------------
   14. Mobile Responsive
   --------------------------------------------------------------------------- */
@media (max-width: 768px) {
  /* Header: prevent overlapping */
  #topbar {
    padding: 0.4rem 0.75rem !important;
    flex-wrap: wrap;
  }
  #topbar::before {
    width: 160px;
    height: 34px;
  }
  #topbar-nav {
    font-size: 0.72rem;
    flex-wrap: wrap;
    gap: 0.15rem;
  }
  #topbar-nav .nav-item.language {
    font-size: 0.7rem;
  }

  /* Headerbar: more breathing room above the homepage logo (asymmetric:
     pads the top so the logo isn't glued to the screen edge, keeps the
     bottom tight so the search bar doesn't push down). */
  #headerbar {
    padding: 1rem 0.75rem 0.5rem !important;
  }

  /* Search bar: flex-wrap so the lang dropdown + input + submit reflow
     onto multiple rows instead of clipping past the viewport. */
  #search-wrapper {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.25rem;
    max-width: 100% !important;
  }
  #search-vocab {
    flex: 0 1 auto !important;
    max-width: 50% !important;
  }
  #search-field {
    flex: 1 1 100% !important;
    min-width: 0 !important;
    width: auto !important;
  }
  #search-wrapper button[type="submit"],
  #search-wrapper button.btn-outline-secondary:not(.dropdown-toggle) {
    flex: 0 0 auto !important;
  }

  /* Links: prevent overflow beyond edge */
  .property-value,
  #concept-other-languages,
  .main-content-section {
    word-break: break-word;
    overflow-wrap: break-word;
  }
  .property-value a {
    word-break: break-all;
  }

  /* Footer: padding and light gray bg */
  footer .unesco-footer-top {
    padding: 1.5rem 1rem 1rem !important;
  }
  footer .unesco-footer-bottom {
    padding: 1rem !important;
  }

  /* Hero: tighter on mobile */
  .unesco-hero {
    padding: 1.5rem 1rem !important;
  }
  .unesco-hero-title {
    font-size: 1.2rem !important;
  }
  .unesco-hero-lead {
    font-size: 0.9rem;
  }

  /* Contact / Feedback + About pages: prevent one-word-per-line wrapping.
     Skosmos's stock skosmos.css applies `.about .container, .feedback .container
     { padding: 0 8rem }` unconditionally — on a 390px viewport that leaves
     the inner content area ~48px wide, breaking text character-by-character. */
  .feedback .container,
  .feedback #main-container-row,
  .feedback #main-container-row > div,
  .about .container,
  .about #main-container-row,
  .about #main-container-row > div {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    width: 100% !important;
  }
  .unesco-about {
    padding: 1rem !important;
  }
  #main-content,
  .main-content-section {
    word-break: normal !important;
    overflow-wrap: break-word;
  }

  /* Search filters: stack vertically, collapse by default */
  .unesco-search-layout {
    flex-direction: column;
    gap: 0;
  }
  .unesco-filter-sidebar {
    flex: none;
    min-width: 0;
    width: 100%;
    position: static;
    margin-bottom: 0.75rem;
    display: none;
    padding: 1rem;
  }
  .unesco-filter-sidebar.unesco-filter-open {
    display: block;
  }
  .unesco-filter-toggle {
    display: flex;
  }
  .unesco-search-results {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }
}

/* ---------------------------------------------------------------------------
   12. Visited link state — keep the unvisited colour
   --------------------------------------------------------------------------- *
   Browsers render :visited in dark red/purple by default. We never want
   the UNESCO design system colours to flip after the user clicks. Apply
   to anywhere we explicitly set a link colour. */
.vocab-home a:visited,
.concept a:visited,
.vocab-search a:visited,
.global-search a:visited,
.error a:visited,
#vocab-download-links a:visited,
#download-links a:visited,
.unesco-footer-top a:visited,
#sidebar a:visited,
#vocabulary-list a:visited,
.dropdown-menu a:visited {
  color: inherit;
}
#vocab-download-links a,
#download-links a,
#vocab-download-links a:visited,
#download-links a:visited {
  color: #0077D4 !important;
}

/* ---------------------------------------------------------------------------
   13. UNESCO body-style link overrides (force #212121)
   --------------------------------------------------------------------------- *
   Two contexts where the user's design wants links rendered as plain
   dark text rather than as classic blue links:
   - "In other languages" prefLabel switchers on concept and group pages
     (Skosmos applies <a class="preflabel"> for each language link).
   - The About page body content (text + links inside section boxes).
*/
#concept-other-languages a,
#concept-other-languages a:visited,
.row.property a.preflabel,
.row.property a.preflabel:visited,
a.preflabel,
a.preflabel:visited {
  color: #212121 !important;
}

.unesco-about,
.unesco-about p,
.unesco-about li,
.unesco-about a,
.unesco-about a:visited {
  color: #212121 !important;
}
