:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-soft: #f8faff;
  --text: #152238;
  --muted: #64748b;
  --line: #dce4ef;
  --primary: #2563eb;
  --primary-dark: #1749b5;
  --primary-soft: #eaf1ff;
  --shadow: 0 18px 55px rgba(25, 44, 78, 0.09);
  --radius: 24px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f172a;
  --panel: #172033;
  --panel-soft: #1e293b;
  --text: #e5edf8;
  --muted: #a5b4c8;
  --line: #334155;
  --primary: #60a5fa;
  --primary-dark: #93c5fd;
  --primary-soft: #203656;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.25);
}

html[data-theme="dark"] body { background: var(--bg); }
html[data-theme="dark"] .site-header,
html[data-theme="dark"] .site-footer,
html[data-theme="dark"] .quick-map,
html[data-theme="dark"] .button:not(.button-primary) { background: var(--panel); border-color: var(--line); }
html[data-theme="dark"] .tree-root { background: linear-gradient(135deg, var(--panel), var(--primary-soft)); }
html[data-theme="dark"] .button-primary,
html[data-theme="dark"] .tree-icon,
html[data-theme="dark"] .skip-link { color: var(--bg); }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 7% 3%, rgba(37, 99, 235, 0.12), transparent 29rem),
    linear-gradient(180deg, #f9fbfe 0, var(--bg) 32rem);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
.shell { width: min(1160px, calc(100% - 40px)); margin-inline: auto; }
.skip-link {
  position: fixed;
  z-index: 50;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--text);
  color: #fff;
  text-decoration: none;
  transform: translateY(-160%);
}
.skip-link:focus { transform: none; }

.site-header {
  position: relative;
  z-index: 10;
  border-bottom: 1px solid rgba(220, 228, 239, 0.86);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(16px);
}
.header-inner {
  display: flex;
  min-height: 82px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; }
.brand img { width: 46px; height: 46px; object-fit: contain; }
.brand span { display: grid; gap: 1px; }
.brand strong { font-size: 16px; letter-spacing: -0.025em; }
.brand small { color: var(--muted); font-size: 11px; font-weight: 700; }
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.header-inner nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.header-inner nav a {
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}
.header-inner nav a:hover { background: var(--primary-soft); color: var(--primary); }
.language-control {
  display: inline-flex;
  min-height: 40px;
  padding: 4px 5px 4px 11px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}
.language-control > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  white-space: nowrap;
}
.language-control select {
  min-width: 118px;
  max-width: 168px;
  min-height: 30px;
  padding: 5px 28px 5px 8px;
  border: 0;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--text);
  font: inherit;
  font-size: 11px;
  font-weight: 850;
  cursor: pointer;
}
.language-control select:focus-visible { outline: 3px solid rgba(37, 99, 235, 0.24); outline-offset: 2px; }

.hero { padding-block: 72px 54px; text-align: center; }
.breadcrumbs {
  display: flex;
  margin-bottom: 31px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}
.breadcrumbs a { text-decoration: none; }
.breadcrumbs a:hover { color: var(--primary); }
.eyebrow,
.section-heading > span,
.section-heading > div > span,
.card-heading > div > span {
  color: var(--primary);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.hero h1 {
  max-width: 780px;
  margin: 12px auto 16px;
  font-size: clamp(38px, 6vw, 72px);
  letter-spacing: -0.055em;
  line-height: 0.98;
}
.hero > p {
  max-width: 680px;
  margin: 0 auto;
  color: var(--muted);
  font-size: clamp(16px, 2vw, 19px);
  line-height: 1.65;
}
.hero-actions { display: flex; margin-top: 28px; flex-wrap: wrap; justify-content: center; gap: 10px; }
.button {
  display: inline-flex;
  min-height: 46px;
  padding: 11px 17px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
  text-decoration: none;
  box-shadow: 0 5px 18px rgba(25, 44, 78, 0.05);
}
.button:hover { border-color: #b8c7dd; transform: translateY(-1px); }
.button-primary { border-color: var(--primary); background: var(--primary); color: #fff; }
.button-primary:hover { border-color: var(--primary-dark); background: var(--primary-dark); }

.quick-map {
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}
.section-heading h2 { margin: 6px 0 0; font-size: clamp(24px, 4vw, 34px); letter-spacing: -0.04em; }
.site-tree { margin-top: 29px; }
.tree-root {
  display: flex;
  width: min(330px, 100%);
  min-height: 76px;
  margin-inline: auto;
  padding: 14px 18px;
  align-items: center;
  gap: 13px;
  border: 1px solid rgba(37, 99, 235, 0.28);
  border-radius: 18px;
  background: linear-gradient(135deg, #fff, var(--primary-soft));
  text-decoration: none;
}
.tree-icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border-radius: 13px;
  background: var(--primary);
  color: #fff;
  font-size: 18px;
  font-weight: 950;
}
.tree-root > span:last-child { display: grid; gap: 3px; }
.tree-root strong, .tree-branches strong { font-size: 14px; }
.tree-root small, .tree-branches small { color: var(--muted); font-size: 11px; }
.tree-connector { width: 1px; height: 30px; margin-inline: auto; background: var(--line); }
.tree-branches {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}
.tree-branches::before {
  position: absolute;
  top: -1px;
  right: 10%;
  left: 10%;
  height: 1px;
  background: var(--line);
  content: "";
}
.tree-branches a {
  position: relative;
  display: grid;
  min-height: 104px;
  padding: 21px 14px 14px;
  justify-items: center;
  align-content: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  text-align: center;
  text-decoration: none;
}
.tree-branches a::before { position: absolute; top: -13px; width: 1px; height: 13px; background: var(--line); content: ""; }
.tree-branches a > span {
  display: grid;
  width: 29px;
  height: 29px;
  margin-bottom: 2px;
  place-items: center;
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 13px;
  font-weight: 950;
}
.tree-branches a:hover { border-color: rgba(37, 99, 235, 0.35); box-shadow: 0 12px 25px rgba(37, 99, 235, 0.08); transform: translateY(-2px); }

.directory { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; padding-block: 22px; }
.directory-card {
  scroll-margin-top: 24px;
  padding: 27px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 13px 40px rgba(25, 44, 78, 0.055);
}
.directory-card-featured, .directory-card-wide { grid-column: 1 / -1; }
.card-heading { display: flex; align-items: center; gap: 13px; }
.card-number {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border-radius: 13px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 950;
}
.card-heading > div { display: grid; gap: 3px; }
.card-heading h2 { margin: 0; font-size: 20px; letter-spacing: -0.035em; }
.link-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 23px; }
.link-list a {
  display: flex;
  min-height: 78px;
  padding: 14px 15px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: var(--panel-soft);
  text-decoration: none;
}
.link-list a > span:first-child { display: grid; gap: 4px; }
.link-list strong { font-size: 13px; }
.link-list small { color: var(--muted); font-size: 11px; line-height: 1.45; }
.link-list a > span:last-child { color: var(--primary); font-weight: 900; }
.link-list a:hover { border-color: rgba(37, 99, 235, 0.26); background: var(--primary-soft); }
.link-list-compact { grid-template-columns: 1fr; }
.legal-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin-top: 23px; }
.legal-links a {
  display: flex;
  min-height: 52px;
  padding: 12px 14px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}
.legal-links a span { color: var(--primary); }
.legal-links a:hover { border-color: rgba(37, 99, 235, 0.35); color: var(--primary); }

.languages {
  scroll-margin-top: 24px;
  margin-bottom: 64px;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.section-heading-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 22px; }
.section-heading-row p { max-width: 390px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.language-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-top: 25px; }
.language-grid a {
  display: flex;
  min-width: 0;
  min-height: 44px;
  padding: 9px 11px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel-soft);
  font-size: 12px;
  font-weight: 780;
  text-decoration: none;
}
.language-grid a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.language-grid small { color: var(--muted); font-size: 9px; font-weight: 950; letter-spacing: 0.04em; }
.language-grid a:hover { border-color: rgba(37, 99, 235, 0.35); background: var(--primary-soft); color: var(--primary); }

.site-footer { border-top: 1px solid var(--line); background: rgba(255, 255, 255, 0.8); }
.footer-inner { display: flex; min-height: 112px; align-items: center; justify-content: space-between; gap: 28px; }
.footer-inner > div { display: grid; gap: 4px; }
.footer-inner > div strong { font-size: 14px; }
.footer-inner > div span { color: var(--muted); font-size: 11px; }
.footer-inner nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px 16px; }
.footer-inner nav a { color: var(--muted); font-size: 11px; font-weight: 800; text-decoration: none; }
.footer-inner nav a:hover { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }

a, .tree-branches a, .button { transition: 160ms ease; }
a:focus-visible { outline: 3px solid rgba(37, 99, 235, 0.28); outline-offset: 3px; }

@media (max-width: 900px) {
  .tree-branches { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tree-branches::before, .tree-branches a::before { display: none; }
  .language-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .shell { width: min(100% - 24px, 1160px); }
  .header-inner { min-height: 72px; }
  .header-inner nav { display: none; }
  .language-control > span { display: none; }
  .language-control { padding-left: 5px; }
  .language-control select { min-width: 126px; }
  .hero { padding-block: 54px 42px; }
  .quick-map, .directory-card, .languages { padding: 20px; border-radius: 19px; }
  .tree-branches { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tree-branches::before { display: none; }
  .tree-branches a::before { display: none; }
  .directory { grid-template-columns: 1fr; }
  .directory-card-featured, .directory-card-wide { grid-column: auto; }
  .link-list { grid-template-columns: 1fr; }
  .legal-links { grid-template-columns: 1fr; }
  .section-heading-row { align-items: flex-start; flex-direction: column; }
  .language-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-inner { padding-block: 28px; align-items: flex-start; flex-direction: column; }
  .footer-inner nav { justify-content: flex-start; }
}

[dir="rtl"] .section-heading-row,
[dir="rtl"] .footer-inner { direction: rtl; }

@media (max-width: 420px) {
  .hero-actions { flex-direction: column; }
  .button { width: 100%; }
  .tree-branches, .language-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
