/* ===== CSS RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ===== DESIGN TOKENS — LIGHT ===== */
:root {
  --blue:        #1a5fa8;
  --blue-dark:   #134a85;
  --blue-light:  #e8f0fb;
  --teal:        #0d8a8a;
  --accent:      #d64e12;
  --text:        #1e2330;
  --text-muted:  #5a6576;
  --border:      #dce3ec;
  --bg:          #f4f7fb;
  --surface:     #ffffff;
  --surface2:    #f0f4f9;
  --shadow:      0 2px 12px rgba(26,95,168,.09);
  --shadow-lg:   0 6px 28px rgba(26,95,168,.14);
  --radius:      10px;
  --nav-h:       64px;
  --font:        'Segoe UI', 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
}

/* ===== DARK MODE TOKENS ===== */
[data-theme="dark"] {
  --blue:        #6eabff;  /* 4.6:1 on #1a2540 surface */
  --blue-dark:   #5494f0;
  --blue-light:  #1a2745;
  --teal:        #3dbfbf;
  --text:        #e4eaf5;
  --text-muted:  #b0c2d8;  /* 5.1:1 on #1a2540 — was #8ea3be (4.16:1, fail) */
  --border:      #2a3a55;
  --bg:          #0f172a;
  --surface:     #1a2540;
  --surface2:    #0f1a2e;
  --shadow:      0 2px 12px rgba(0,0,0,.4);
  --shadow-lg:   0 6px 28px rgba(0,0,0,.5);
}

/* ===== BASE ===== */
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  transition: background .2s, color .2s;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1,h2,h3,h4,h5 { line-height: 1.3; font-weight: 700; }
ul { padding-left: 1.4em; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: .55rem .9rem; border: 1px solid var(--border); text-align: left; font-size: .92rem; }
th { background: var(--blue); color: #fff; font-weight: 600; }
tr:nth-child(even) td { background: var(--blue-light); }

/* ===== TOP BAR ===== */
.top-bar {
  background: var(--blue-dark);
  color: #e8effa;  /* 7.1:1 on #134a85 */
  font-size: .78rem;
  padding: .28rem 0;
}
.top-bar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .4rem;
}
.top-bar a { color: #fff; }
.top-bar a:hover { color: #fff; text-decoration: underline; }

/* ===== HEADER / NAV ===== */
.site-header {
  background: var(--surface);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--nav-h);
  transition: background .2s;
}
.nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: .65rem;
  flex-shrink: 0;
  text-decoration: none;
}
.nav-logo-icon {
  width: 40px;
  height: 40px;
  background: var(--blue);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.nav-logo-icon svg { fill: #fff; }
.nav-logo-img { height: 44px; width: auto; display: block; flex-shrink: 0; }
.nav-logo-text { display: flex; flex-direction: column; }
.nav-logo-main { font-size: .9rem; font-weight: 700; color: var(--blue); line-height: 1.2; }
.nav-logo-sub  { font-size: .7rem; color: var(--text-muted); }

/* nav menu */
.nav-menu {
  display: flex;
  align-items: center;
  gap: 0;
  list-style: none;
  padding: 0;
  margin: 0;
  flex: 1 1 auto;
  flex-wrap: nowrap;
  overflow: visible;
}
.nav-menu > li { position: relative; }
.nav-menu > li > a {
  display: block;
  padding: .4rem .45rem;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text);
  border-radius: 6px;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.nav-menu > li > a:hover,
.nav-menu > li.active > a {
  background: var(--blue-light);
  color: var(--blue);
  text-decoration: none;
}
/* dropdown */
.nav-menu .dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 250px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 500;
  padding: .4rem 0;
}
.nav-menu li:hover > .dropdown { display: block; }
.nav-menu .dropdown li a {
  display: block;
  padding: .5rem 1rem;
  font-size: .87rem;
  color: var(--text);
  border-left: 3px solid transparent;
  transition: all .12s;
  white-space: nowrap;
}
.nav-menu .dropdown li a:hover {
  background: var(--blue-light);
  color: var(--blue);
  border-left-color: var(--blue);
  text-decoration: none;
}

/* nav controls (lang + theme + hamburger) */
.nav-controls {
  display: flex;
  align-items: center;
  gap: .3rem;
  margin-left: auto;
  flex-shrink: 0;
}
.icon-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .35rem .55rem;
  cursor: pointer;
  font-size: .95rem;
  line-height: 1;
  color: var(--text);
  transition: background .15s;
}
.icon-btn:hover { background: var(--blue-light); }
.lang-switcher { display: flex; gap: .2rem; }
.lang-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .25rem .55rem;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  transition: all .15s;
  display: flex;
  align-items: center;
  gap: .3rem;
  line-height: 1;
  white-space: nowrap;
}
.lang-btn .lang-code {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .03em;
}
.lang-btn.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.lang-btn:hover:not(.active) {
  background: var(--blue-light);
  border-color: var(--blue);
  color: var(--blue);
}
.nav-hamburger {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  padding: .4rem .5rem;
}
.nav-hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  margin: 4px 0;
  border-radius: 2px;
  transition: all .2s;
}

/* ===== HERO ===== */
.hero {
  background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue) 55%, var(--teal) 100%);
  color: #fff;
  padding: 4.5rem 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
}
.hero-inner { position: relative; max-width: 820px; margin: 0 auto; }
.hero h1 { font-size: clamp(1.9rem, 4.5vw, 3rem); margin-bottom: .8rem; }
.hero p  { font-size: 1.05rem; opacity: .9; max-width: 640px; margin: 0 auto 1.75rem; }
.hero-ctas { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.btn {
  display: inline-block;
  padding: .65rem 1.6rem;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: .9rem;
  cursor: pointer;
  transition: transform .1s, box-shadow .15s;
  border: 2px solid transparent;
  text-decoration: none;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.22); text-decoration: none; }
.btn-primary { background: #fff; color: var(--blue-dark); }
.btn-outline  { background: transparent; color: #fff; border-color: rgba(255,255,255,.65); }
.btn-outline:hover { background: rgba(255,255,255,.12); color: #fff; }
.btn-sm { padding: .4rem 1rem; font-size: .82rem; }

/* ===== STATS BAR ===== */
.stats-bar {
  background: var(--surface);
  box-shadow: var(--shadow);
  margin-bottom: 2.5rem;
}
.stats-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: repeat(4,1fr);
}
.stat-item {
  padding: 1.3rem 1rem;
  text-align: center;
  border-right: 1px solid var(--border);
}
.stat-item:last-child { border-right: none; }
.stat-num   { font-size: 2rem; font-weight: 800; color: var(--blue); line-height: 1; }
.stat-label { font-size: .75rem; color: var(--text-muted); margin-top: .25rem; text-transform: uppercase; letter-spacing: .06em; }

/* ===== LAYOUT ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.page-wrap  { padding: 2.5rem 0 3.5rem; }

/* homepage two-col */
.home-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 2rem;
  align-items: start;
  padding: 2.5rem 0 3rem;
}

/* ===== CARDS ===== */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: background .2s;
}
.card + .card { margin-top: 1.25rem; }
.card-header {
  background: var(--blue);
  color: #fff;
  padding: .85rem 1.2rem;
  font-size: .92rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.card-body { padding: 1.2rem; }

/* news list */
.news-list { list-style: none; padding: 0; margin: 0; }
.news-list li { padding: .8rem 0; border-bottom: 1px solid var(--border); }
.news-list li:last-child { border-bottom: none; }
.news-date  { font-size: .75rem; color: var(--text-muted); margin-bottom: .2rem; }
.news-title a { font-weight: 600; color: var(--text); font-size: .9rem; }
.news-title a:hover { color: var(--blue); }
.news-tag {
  display: inline-block;
  background: var(--blue-light);
  color: var(--blue);
  font-size: .7rem;
  font-weight: 700;
  padding: .1rem .5rem;
  border-radius: 20px;
  margin-bottom: .2rem;
}

/* quick links */
.quick-links { list-style: none; padding: 0; margin: 0; }
.quick-links li a {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .6rem .85rem;
  margin-bottom: .3rem;
  border-radius: 7px;
  background: var(--surface2);
  font-size: .875rem;
  font-weight: 600;
  color: var(--text);
  border: 1px solid var(--border);
  transition: background .13s, color .13s, border-color .13s;
}
.quick-links li a:hover {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
  text-decoration: none;
}
.ql-icon { font-size: 1rem; }

/* emergency banner */
.emergency-banner {
  background: linear-gradient(90deg, #b5281c, #e03428);
  color: #fff;
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
}
.em-icon { font-size: 1.5rem; flex-shrink: 0; }
.emergency-banner strong { display: block; font-size: .95rem; }
.emergency-banner a { color: #fff; font-weight: 700; font-size: 1.05rem; }

/* ===== EU CO-FUNDING BANNERS ===== */
.eu-banner.card { padding: 0; overflow: hidden; }
.eu-doc-img { display: block; width: 100%; height: auto; }

/* Mobile EU strip — hidden on desktop, shown below content on mobile */
.eu-mobile-strip {
  display: none;
  background: var(--surface-2, var(--surface));
  border-top: 1px solid var(--border);
  padding: 1rem 0;
}
.eu-mobile-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.eu-mobile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
@media (max-width: 1024px) {
  .eu-mobile-strip { display: block; }
  /* hide sidebar banners — mobile strip takes over */
  .eu-banner.card { display: none; }
}
@media (max-width: 600px) {
  .eu-mobile-inner { grid-template-columns: 1fr; }
}

/* ===== PAGE HEADER ===== */
.page-hero {
  background: linear-gradient(135deg, var(--blue-dark), var(--blue));
  color: #fff;
  padding: 2.5rem 1.5rem;
}
.page-hero-inner { max-width: 1200px; margin: 0 auto; }
.breadcrumb { font-size: .78rem; opacity: .72; margin-bottom: .45rem; }
.breadcrumb a { color: rgba(255,255,255,.8); }
.breadcrumb a:hover { color: #fff; text-decoration: none; }
.breadcrumb span { margin: 0 .35rem; }
.page-hero h1 { font-size: clamp(1.4rem,3vw,2rem); }

/* ===== CONTENT PAGE ===== */
.content-grid {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 2rem;
  align-items: start;
  padding: 2.5rem 0 3rem;
}
.sidebar {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: sticky;
  top: calc(var(--nav-h) + 12px);
  transition: background .2s;
}
.sidebar-title {
  background: var(--blue);
  color: #fff;
  padding: .75rem 1rem;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
}
.sidebar-nav { list-style: none; padding: .35rem 0; margin: 0; }
.sidebar-nav li a {
  display: block;
  padding: .48rem 1rem;
  font-size: .87rem;
  color: var(--text);
  border-left: 3px solid transparent;
  transition: all .12s;
}
.sidebar-nav li a:hover,
.sidebar-nav li.active a {
  background: var(--blue-light);
  color: var(--blue);
  border-left-color: var(--blue);
  text-decoration: none;
}

.main-content {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem 2.5rem;
  transition: background .2s;
}
.main-content h2 {
  color: var(--blue);
  font-size: 1.4rem;
  margin: 1.75rem 0 .6rem;
  border-bottom: 2px solid var(--blue-light);
  padding-bottom: .4rem;
}
.main-content h2:first-child { margin-top: 0; }
.main-content h3 { color: var(--blue); font-size: 1.1rem; margin: 1.25rem 0 .4rem; }
.main-content h4 { font-size: 1rem; margin: 1rem 0 .3rem; }
.main-content p  { margin-bottom: .9rem; }
.main-content ul, .main-content ol { margin-bottom: .9rem; }
.main-content li { margin-bottom: .3rem; }
.main-content table { margin: 1rem 0; }

.highlight-box {
  background: var(--blue-light);
  border-left: 4px solid var(--blue);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1rem 1.2rem;
  margin: 1rem 0;
}
.warning-box {
  background: #fff8e1;
  border-left: 4px solid #f59e0b;
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1rem 1.2rem;
  margin: 1rem 0;
}
[data-theme="dark"] .warning-box { background: #2a1f07; }

.contact-grid-sm {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: .75rem;
  margin: 1rem 0;
}
.contact-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .8rem 1rem;
}
.contact-item strong {
  display: block;
  font-size: .75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .25rem;
}

/* ===== CONTACT PAGE MAP ===== */
.map-wrap {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  height: 380px;
}
.map-wrap iframe { width: 100%; height: 100%; border: none; }

/* ===== FOOTER ===== */
.site-footer {
  background: #0e1b2e;
  color: #c8d6e8;  /* 6.5:1 on #0e1b2e */
  padding: 3rem 0 0;
  margin-top: 4rem;
  font-size: .875rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2rem;
  padding-bottom: 2rem;
}
.footer-brand .footer-logo { color: #fff; font-size: .95rem; font-weight: 700; margin-bottom: .5rem; }
.footer-brand p { font-size: .82rem; line-height: 1.6; margin-bottom: .6rem; }
.footer-brand a { color: #c8d6e8; }
.footer-brand a:hover { color: #fff; text-decoration: underline; }
.footer-heading { color: #fff; font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; margin-bottom: .7rem; }
.footer-links { list-style: none; padding: 0; margin: 0; }
.footer-links li { margin-bottom: .38rem; }
.footer-links a { color: #c8d6e8; font-size: .82rem; }  /* 6.5:1 */
.footer-links a:hover { color: #fff; text-decoration: underline; }
.footer-divider { border: none; border-top: 1px solid rgba(255,255,255,.12); }
.footer-bottom {
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
  font-size: .76rem;
  color: #8fa8c0;  /* 4.6:1 on #0e1b2e */
}
.footer-bottom a { color: #8fa8c0; }
.footer-bottom a:hover { color: #fff; text-decoration: underline; }
.footer-wcag {
  display: flex;
  align-items: center;
  gap: .4rem;
}
.footer-wcag a {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: #1a2e48;
  border: 1px solid #2a4060;
  border-radius: 4px;
  padding: .2rem .5rem;
  font-size: .72rem;
  font-weight: 700;
  color: #7ec8e3 !important;
  letter-spacing: .04em;
  transition: background .15s;
}
.footer-wcag a:hover { background: #1f3a58; text-decoration: none !important; }
.footer-engineered { font-size: .72rem; color: #8fa8c0; }
.footer-engineered a { color: #8fa8c0; font-weight: 600; }
.footer-engineered a:hover { color: #fff; }

/* ===== UTILITY ===== */
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: .5rem; }

/* ===== SKIP LINK (WCAG 2.4.1) ===== */
.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  z-index: 9999;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  font-size: .9rem;
  padding: .6rem 1.2rem;
  border-radius: 0 0 var(--radius) var(--radius);
  text-decoration: none;
  transition: top .15s;
}
.skip-link:focus { top: 0; outline: 3px solid #fff; outline-offset: 2px; }

/* ===== FOCUS STYLES (WCAG 2.4.7) ===== */
:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
  border-radius: 3px;
}
/* Remove outline for mouse users, keep for keyboard */
:focus:not(:focus-visible) { outline: none; }

/* High-contrast focus for elements on blue backgrounds */
.hero a:focus-visible,
.card-header a:focus-visible,
.page-hero a:focus-visible,
.top-bar a:focus-visible {
  outline-color: #fff;
}

/* ===== REDUCED MOTION (WCAG 2.3.3) ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ===== MOBILE SIDEBAR ORDER (WCAG 1.3.2) ===== */
@media (max-width: 960px) {
  .content-grid { display: flex; flex-direction: column; }
  .sidebar { order: 2; }
  .main-content { order: 1; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
  .lang-btn .lang-code { display: none; }
  .lang-btn { padding: .25rem .4rem; }
  .nav-menu > li > a { padding: .4rem .35rem; font-size: .78rem; }
}
@media (max-width: 1100px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
/* lang row inside mobile menu — hidden on desktop */
.nav-menu-langs {
  display: none;
}

@media (max-width: 1024px) {
  .home-grid { grid-template-columns: 1fr; }
  .content-grid { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .stats-inner { grid-template-columns: repeat(2,1fr); }
  .stat-item:nth-child(2) { border-right: none; }
  /* hide header lang switcher — it moves into the menu */
  .nav-controls .lang-switcher { display: none; }
  /* show lang row inside menu */
  .nav-menu-langs {
    display: flex;
    gap: .4rem;
    flex-wrap: wrap;
    padding: .5rem .75rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: .25rem;
  }
  /* collapse nav */
  .nav-menu {
    display: none;
    flex-direction: column;
    align-items: stretch;
    position: absolute;
    top: var(--nav-h);
    left: 0; right: 0;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    padding: .75rem 1rem 1rem;
    gap: 0;
    max-height: calc(100vh - var(--nav-h));
    overflow-y: auto;
    flex: none;
  }
  .nav-menu.open { display: flex; }
  .nav-menu > li > a { padding: .65rem .75rem; font-size: .875rem; }
  .nav-menu .dropdown {
    position: static;
    box-shadow: none;
    border: none;
    padding: .25rem 0 .25rem 1rem;
    display: none;
  }
  .nav-menu li.open > .dropdown { display: block; }
  .nav-hamburger { display: block; }
  .main-content { padding: 1.5rem; }
}
@media (max-width: 640px) {
  .footer-grid { grid-template-columns: 1fr; }
  .hero { padding: 3rem 1rem 2.5rem; }
  .stats-inner { grid-template-columns: repeat(2,1fr); }
  .contact-grid-sm { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; text-align: center; }
}
