:root {
  color-scheme: light;
  --av-bg: #f4f7fb;
  --av-bg-soft: #eef3f9;
  --av-surface: #ffffff;
  --av-surface-2: #f7f9fc;
  --av-surface-3: #eaf0f8;
  --av-border: #d6e0ec;
  --av-border-strong: #c4d2e2;
  --av-text: #0f1b2d;
  --av-text-muted: #64748b;
  --av-text-soft: #7c8aa3;
  --av-brand: #155eef;
  --av-brand-strong: #0f4fd6;
  --av-brand-soft: rgb(21 94 239 / .10);
  --av-success: #15803d;
  --av-success-soft: rgb(21 128 61 / .12);
  --av-warning: #b45309;
  --av-warning-soft: rgb(180 83 9 / .12);
  --av-danger: #c2410c;
  --av-danger-soft: rgb(194 65 12 / .12);
  --av-shadow-sm: 0 1px 2px rgb(15 27 45 / .04), 0 8px 24px rgb(15 27 45 / .04);
  --av-shadow-md: 0 14px 36px rgb(15 27 45 / .08);
  --bg: var(--av-bg);
  --paper: var(--av-surface);
  --paper-soft: var(--av-surface-3);
  --ink: var(--av-text);
  --muted: var(--av-text-muted);
  --faint: var(--av-text-soft);
  --line: var(--av-border);
  --line-strong: var(--av-border-strong);
  --blue: var(--av-brand);
  --blue-dark: var(--av-brand-strong);
  --teal: var(--av-success);
  --teal-soft: var(--av-success-soft);
  --red: var(--av-danger);
  --amber: var(--av-warning);
  --green: var(--av-success);
  --shadow: var(--av-shadow-md);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, rgb(244 247 251 / .96), rgb(238 243 249 / .98)),
    radial-gradient(circle at 8% 0%, rgb(21 94 239 / .10), transparent 26%),
    radial-gradient(circle at 96% 0%, rgb(21 128 61 / .08), transparent 24%);
  color: var(--ink);
  font-family: "Satoshi", "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

:focus-visible {
  outline: 3px solid rgb(31 111 159 / .35);
  outline-offset: 3px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(180px, 1fr);
  gap: 22px;
  align-items: center;
  min-height: 68px;
  padding: 0 34px;
  border-bottom: 1px solid rgb(216 225 232 / .82);
  background: rgb(255 255 255 / .9);
  backdrop-filter: blur(18px);
}

.site-header > * {
  min-width: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(160deg, #ffffff, #eef3f9);
  color: var(--blue-dark);
  font-weight: 800;
  letter-spacing: 0;
}

.brand strong,
.brand small {
  display: block;
  white-space: nowrap;
}

.brand strong {
  font-size: 15px;
  letter-spacing: 0;
}

.brand small,
.header-meta,
.section-kicker {
  color: var(--muted);
  font-size: 12px;
}

.main-nav {
  display: flex;
  min-width: 0;
  max-width: 100%;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-soft);
  box-shadow: var(--av-shadow-sm);
}

.main-nav a {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
  transition: background .18s ease, color .18s ease;
}

.main-nav a:hover {
  background: var(--paper);
  color: var(--ink);
}

.header-meta {
  justify-self: end;
}

main {
  width: min(1200px, calc(100% - 48px));
  margin: 0 auto;
}

.atlas-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.22fr) minmax(360px, .78fr);
  gap: 24px;
  min-height: calc(100vh - 68px);
  padding: 28px 0 32px;
  align-items: stretch;
}

.atlas-map-panel,
.atlas-copy-panel,
.content-band,
.source-rail {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgb(255 255 255 / .86);
  box-shadow: var(--shadow);
}

.atlas-map-panel {
  display: flex;
  min-height: 620px;
  flex-direction: column;
  overflow: hidden;
}

.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--blue-dark);
  cursor: pointer;
}

.kazakhstan-map {
  display: block;
  width: 100%;
  min-height: 560px;
  flex: 1;
  position: relative;
  background:
    linear-gradient(180deg, #f9fbfd, #eef5f8),
    repeating-linear-gradient(0deg, transparent, transparent 28px, rgb(31 111 159 / .03) 29px);
}

.kazakhstan-map.leaflet-container {
  background:
    linear-gradient(180deg, #f9fbfd, #eef5f8),
    repeating-linear-gradient(0deg, transparent, transparent 28px, rgb(31 111 159 / .03) 29px);
}

.kazakhstan-map .leaflet-control-zoom {
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.kazakhstan-map .leaflet-control-zoom a {
  width: 32px;
  height: 32px;
  border: 0;
  background: rgb(255 255 255 / .92);
  color: var(--blue-dark);
  line-height: 32px;
}

.kazakhstan-map .leaflet-control-zoom a:hover {
  background: var(--paper);
  color: var(--blue);
}

.map-tooltip {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgb(255 255 255 / .96);
  box-shadow: var(--shadow);
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
}

.map-tooltip::before {
  display: none;
}

.atlas-copy-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 34px;
}

.section-kicker {
  margin: 0 0 12px;
  color: var(--blue-dark);
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 780px;
  margin-bottom: 18px;
  font-size: clamp(34px, 4.6vw, 66px);
  line-height: .96;
  letter-spacing: 0;
  overflow-wrap: normal;
  word-break: normal;
}

.atlas-copy-panel > p,
.section-heading > p {
  color: var(--muted);
  font-size: 17px;
}

.hero-lead span {
  display: block;
}

.search-box {
  margin: 30px 0 18px;
}

.search-box label {
  display: block;
  margin-bottom: 8px;
  color: var(--blue-dark);
  font-size: 13px;
  font-weight: 800;
}

.search-box div {
  display: grid;
  grid-template-columns: 1fr auto;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper);
}

.search-box input {
  min-width: 0;
  border: 0;
  padding: 15px 16px;
  background: transparent;
  color: var(--ink);
}

.search-box button {
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--blue);
  color: #ffffff;
  padding: 0 18px;
  font-weight: 800;
  cursor: pointer;
}

.search-status {
  min-height: 22px;
  margin: -6px 0 18px;
  color: var(--muted);
  font-size: 13px;
}

.quick-links,
.check-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-links a,
.source-chip,
.field-chip,
.gate-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-soft);
  color: var(--blue-dark);
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.source-rail {
  margin-top: 24px;
  padding: 18px;
  box-shadow: none;
}

.selection-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.selection-metric {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper-soft);
}

.selection-metric span,
.runtime-meta span,
.platform-meta span,
.runtime-card small,
.platform-card small {
  display: block;
  color: var(--faint);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.selection-metric strong {
  display: block;
  margin-top: 4px;
  font-size: 13px;
}

.source-rail span,
.entity-card small,
.source-card small,
.route-card small {
  color: var(--faint);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.source-rail strong {
  display: block;
  margin: 4px 0 7px;
  font-size: 22px;
}

.source-rail p {
  margin-bottom: 0;
  color: var(--muted);
}

.content-band {
  margin: 24px 0;
  padding: 34px;
}

.section-heading {
  display: grid;
  grid-template-columns: minmax(260px, .58fr) minmax(320px, .42fr);
  gap: 24px;
  align-items: end;
  margin-bottom: 24px;
}

.section-heading.compact {
  display: block;
  max-width: 860px;
}

.section-heading h2 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.04;
}

.route-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.route-card,
.entity-card,
.source-card,
.region-pill,
.situation-flow article,
.runtime-card,
.platform-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.route-card {
  padding: 18px;
}

.route-card code {
  display: block;
  overflow-wrap: anywhere;
  margin-top: 8px;
  color: var(--blue-dark);
  font-size: 13px;
}

.entity-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.entity-card {
  display: flex;
  min-height: 260px;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
}

.entity-card h3,
.source-card h3,
.situation-flow h3 {
  margin-bottom: 6px;
  font-size: 21px;
}

.entity-card p,
.source-card p,
.situation-flow p {
  color: var(--muted);
}

.field-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: auto;
}

.field-chip {
  border-radius: 6px;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 600;
}

.region-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.region-pill {
  cursor: pointer;
  padding: 12px;
  text-align: left;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.region-pill:hover,
.region-pill:focus-visible,
.region-pill.is-selected {
  border-color: rgb(31 111 159 / .34);
  box-shadow: 0 0 0 3px rgb(31 111 159 / .10);
}

.region-pill:active {
  transform: translateY(1px);
}

.region-pill strong,
.region-pill span {
  display: block;
}

.region-pill span {
  color: var(--muted);
  font-size: 12px;
}

.situation-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.situation-flow article {
  padding: 22px;
}

.situation-flow article span {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  margin-bottom: 18px;
  border-radius: 50%;
  background: var(--teal-soft);
  color: var(--teal);
  font-weight: 900;
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.runtime-grid,
.platform-grid {
  display: grid;
  gap: 12px;
}

.runtime-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 16px;
}

.platform-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.runtime-card,
.platform-card {
  display: flex;
  min-height: 220px;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.runtime-card h3,
.platform-card h3 {
  margin-bottom: 0;
  font-size: 20px;
}

.runtime-card p,
.platform-card p,
.runtime-meta code,
.platform-meta span:last-child {
  color: var(--muted);
}

.runtime-meta,
.platform-meta {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.runtime-meta code {
  overflow-wrap: anywhere;
  font-size: 12px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-chip.tone-success {
  border-color: rgb(21 128 61 / .18);
  background: var(--av-success-soft);
  color: var(--av-success);
}

.status-chip.tone-warning {
  border-color: rgb(180 83 9 / .18);
  background: var(--av-warning-soft);
  color: var(--av-warning);
}

.status-chip.tone-muted {
  background: var(--paper-soft);
  color: var(--muted);
}

.source-card {
  padding: 18px;
}

.source-card a {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  color: var(--blue);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-card[data-tier="canonical"] {
  border-top: 4px solid var(--teal);
}

.source-card[data-tier="operational"] {
  border-top: 4px solid var(--blue);
}

.source-card[data-tier="ecosystem"] {
  border-top: 4px solid var(--amber);
}

.platform-card[data-tier="edge_public"] {
  border-top: 4px solid var(--blue);
}

.platform-card[data-tier="control_plane"] {
  border-top: 4px solid var(--amber);
}

.platform-card[data-tier="qazlake"] {
  border-top: 4px solid var(--teal);
}

.gate-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.gate-chip {
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 600;
}

.runtime-error {
  margin: 16px auto 0;
  width: min(1200px, calc(100% - 48px));
  padding: 14px 16px;
  border: 1px solid rgb(194 65 12 / .24);
  border-radius: 12px;
  background: rgb(194 65 12 / .08);
  color: var(--red);
}

.is-hidden {
  display: none !important;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  width: min(1200px, calc(100% - 48px));
  margin: 36px auto 0;
  padding: 22px 0 34px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 1120px) {
  .site-header {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px 20px;
  }

  .main-nav {
    justify-content: flex-start;
    overflow-x: auto;
  }

  .header-meta {
    justify-self: start;
  }

  .atlas-hero,
  .section-heading {
    grid-template-columns: 1fr;
  }

  .atlas-hero {
    min-height: 0;
  }

  .atlas-map-panel {
    min-height: 480px;
  }

  .kazakhstan-map {
    min-height: 440px;
  }

  .route-strip,
  .source-grid,
  .region-list,
  .runtime-grid,
  .platform-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  main,
  .site-footer {
    width: calc(100% - 28px);
    max-width: calc(100vw - 28px);
  }

  .site-header {
    min-height: 0;
    padding: 12px 14px;
  }

  .main-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    justify-content: stretch;
    overflow-x: visible;
  }

  .main-nav a {
    min-width: 0;
    padding: 8px 6px;
    overflow: hidden;
    text-align: center;
    text-overflow: ellipsis;
  }

  .header-meta {
    font-size: 11px;
  }

  .atlas-copy-panel,
  .content-band {
    padding: 20px;
  }

  .atlas-hero {
    display: flex;
    flex-direction: column;
  }

  .atlas-map-panel,
  .atlas-copy-panel {
    width: calc(100vw - 28px);
    max-width: calc(100vw - 28px);
  }

  .content-band,
  .source-rail {
    max-width: calc(100vw - 28px);
  }

  .atlas-copy-panel {
    order: -1;
  }

  h1 {
    font-size: 32px;
    line-height: 1.04;
  }

  .atlas-copy-panel > p,
  .section-heading > p {
    font-size: 15px;
  }

  .atlas-map-panel {
    min-height: 380px;
  }

  .kazakhstan-map {
    min-height: 330px;
  }

  .route-strip,
  .entity-grid,
  .source-grid,
  .region-list,
  .situation-flow,
  .runtime-grid,
  .platform-grid {
    grid-template-columns: 1fr;
  }

  .selection-metrics {
    grid-template-columns: 1fr;
  }

  .search-box div {
    grid-template-columns: 1fr;
  }

  .search-box button {
    min-height: 44px;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .site-footer {
    flex-direction: column;
  }
}

@media (max-width: 460px) {
  .atlas-copy-panel > .section-kicker,
  .atlas-copy-panel h1,
  .atlas-copy-panel > p,
  .search-box,
  .quick-links,
  .source-rail {
    max-width: 326px;
  }
}
