/* Base, brand bar, navigation, hero, footer */
*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-height) + 1rem); }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.65;
  color: var(--color-text);
  background: var(--color-page);
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; height: auto; display: block; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.1; margin: 0; text-wrap: balance; }
p { margin: 0 0 var(--space-4); text-wrap: pretty; }
a { color: var(--blue-600); text-underline-offset: 0.2em; }
:focus-visible { outline: 3px solid var(--gold-500); outline-offset: 3px; border-radius: var(--radius-sm); }

.wrap { width: min(100% - 2 * var(--gutter), var(--wrap)); margin-inline: auto; }
.noscript { padding-block: var(--space-7); }

.skip-link {
  position: absolute; left: var(--space-4); top: var(--space-4); z-index: 100;
  padding: var(--space-2) var(--space-4); background: var(--white); color: var(--navy-900);
  border-radius: var(--radius-sm); transform: translateY(-300%);
}
.skip-link:focus { transform: none; }

.kicker {
  font-family: var(--font-display); font-weight: 700; font-size: var(--text-xs);
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold-600); margin: 0 0 var(--space-3);
}
.kicker--light { color: var(--gold-500); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 2.75rem; padding: 0.65rem 1.35rem; border: 1px solid transparent; border-radius: var(--radius-md);
  font: 600 var(--text-sm)/1.2 var(--font-display); letter-spacing: 0.01em; text-decoration: none; cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-out-expo), background-color var(--duration-fast), box-shadow var(--duration-fast);
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn--accent { background: var(--red-600); color: var(--white); box-shadow: 0 8px 20px -8px rgb(220 38 38 / 0.7); }
.btn--accent:hover { background: var(--red-700); }
.btn--ghost { background: rgb(255 255 255 / 0.08); color: var(--white); border-color: rgb(255 255 255 / 0.28); }
.btn--ghost:hover { background: rgb(255 255 255 / 0.16); }
.btn--dark { background: var(--navy-900); color: var(--white); }
.btn--dark:hover { background: var(--navy-800); }
.btn--line { background: transparent; color: var(--navy-900); border-color: var(--slate-300); }
.btn--line:hover { border-color: var(--navy-900); }

.btn--primary { background: var(--brand-900); color: var(--white); box-shadow: 0 8px 20px -10px rgb(18 48 110 / 0.8); }
.btn--primary:hover { background: var(--brand-800); }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Site header: left mark + search, centred title, right authority logo + name */
.site-header { background: var(--mist); }
.site-header__inner { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--space-5); padding-block: var(--space-4); }
.header-start { display: grid; justify-self: start; justify-items: start; gap: var(--space-3); max-width: 17rem; }
.brand { display: inline-grid; gap: var(--space-1); text-decoration: none; color: var(--navy-800); font: 600 var(--text-sm)/1.3 var(--font-body); }
.brand--mark img { height: clamp(2.6rem, 2rem + 2.4vw, 4.25rem); width: auto; mix-blend-mode: multiply; }
.brand--authority { justify-self: end; }
.brand--authority img { height: clamp(3.6rem, 2.8rem + 3vw, 6rem); width: auto; display: block; }
.site-title { font: 800 clamp(1.25rem, 0.8rem + 2vw, 2.4rem)/1.15 var(--font-display); letter-spacing: -0.02em; text-transform: uppercase; color: var(--brand-900); text-decoration: none; text-align: center; }

.search { position: relative; width: min(100%, 17rem); z-index: 1; }
.search.is-open { z-index: 80; }
.search input { width: 100%; height: 2.6rem; padding: 0 2.6rem 0 1.1rem; font: inherit; font-size: var(--text-sm); color: var(--navy-900); background: var(--white); border: 1px solid var(--slate-300); border-radius: var(--radius-pill); transition: border-color var(--duration-fast), box-shadow var(--duration-fast); }
.search input::placeholder { color: var(--slate-500); }
.search input:hover { border-color: var(--slate-500); }
.search input:focus { outline: none; border-color: var(--brand-900); box-shadow: 0 0 0 3px var(--blue-100); }
.search input::-webkit-search-cancel-button { display: none; }
.search > svg { position: absolute; right: 0.85rem; top: 0.7rem; width: 1.2rem; height: 1.2rem; fill: none; stroke: var(--slate-600); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.search__results { position: absolute; z-index: 80; top: calc(100% + 0.4rem); left: 0; width: min(24rem, 92vw); max-height: min(22rem, 70vh); overflow: auto; margin: 0; padding: var(--space-2); list-style: none; background: var(--white); border: 1px solid var(--color-line); border-radius: var(--radius-md); box-shadow: var(--shadow-lift); }
.search__results a { display: grid; gap: 2px; padding: 0.55rem 0.75rem; border-radius: var(--radius-sm); color: var(--navy-900); text-decoration: none; font-size: var(--text-sm); line-height: 1.35; }
.search__results a:hover, .search__results a:focus-visible, .search__results a.is-active { background: var(--mist); color: var(--brand-900); }
.search__results a[data-kind="project"] strong::before { content: "Layihə · "; font-weight: 600; color: var(--slate-500); }
.search__results span { font-size: var(--text-xs); color: var(--slate-500); }
.search__empty { padding: 0.6rem 0.75rem; font-size: var(--text-sm); color: var(--slate-500); }

/* Main navigation: solid brand-blue bar, centred items */
.main-nav { position: sticky; top: 0; z-index: 50; background: var(--brand-900); color: var(--white); box-shadow: 0 8px 22px -14px rgb(11 31 77 / 0.9); }
.main-nav__inner { display: flex; align-items: center; justify-content: center; min-height: var(--nav-height); }
.main-nav__menu { display: flex; justify-content: center; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.main-nav__toggle { display: none; }

.nav-item { position: relative; }
.nav-link {
  display: flex; align-items: center; gap: 0.4rem; height: var(--nav-height); padding-inline: 0.9rem;
  font: 500 var(--text-base) var(--font-body); color: rgb(255 255 255 / 0.9); text-decoration: none; white-space: nowrap;
  border-bottom: 3px solid transparent; transition: color var(--duration-fast), border-color var(--duration-fast), background-color var(--duration-fast);
}
.nav-link::after { content: ""; width: 0.4rem; height: 0.4rem; border: solid currentColor; border-width: 0 2px 2px 0; transform: translateY(-2px) rotate(45deg); opacity: 0.6; }
.nav-link--plain::after { display: none; }
.nav-item:hover > .nav-link, .nav-item:focus-within > .nav-link, .nav-link.is-active { color: var(--white); background: rgb(255 255 255 / 0.08); border-bottom-color: var(--gold-500); }

.nav-sub {
  position: absolute; top: 100%; left: 0; min-width: 19rem; margin: 0; padding: var(--space-3); list-style: none;
  background: var(--white); border-radius: 0 0 var(--radius-md) var(--radius-md); box-shadow: var(--shadow-lift);
  border-top: 3px solid var(--gold-500);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity var(--duration-fast), transform var(--duration-normal) var(--ease-out-expo), visibility var(--duration-fast);
}
.nav-item:nth-last-child(2) .nav-sub, .nav-item:nth-last-child(3) .nav-sub { left: auto; right: 0; }
.nav-item:hover > .nav-sub, .nav-item:focus-within > .nav-sub { opacity: 1; visibility: visible; transform: none; }
.nav-sub a {
  display: grid; grid-template-columns: 1.6rem 1fr; align-items: baseline; padding: 0.55rem 0.7rem; border-radius: var(--radius-sm);
  color: var(--navy-900); font-size: var(--text-sm); font-weight: 500; line-height: 1.35; text-decoration: none;
  transition: background-color var(--duration-fast), color var(--duration-fast);
}
.nav-sub a::before { content: attr(data-num); font: 700 var(--text-xs) var(--font-display); color: var(--gold-600); }
.nav-sub a:hover, .nav-sub a:focus-visible, .nav-sub a.is-active { background: var(--mist); color: var(--brand-900); }

/* Hero: welcome panel, quick links, sector tiles, headline figures */
.hero { position: relative; isolation: isolate; overflow: clip; padding-block: var(--space-6) var(--space-7); background: linear-gradient(180deg, var(--mist), var(--color-page)); }
.hero__motif { position: absolute; z-index: -1; right: -14%; top: -30%; width: min(60rem, 80vw); color: rgb(15 23 42 / 0.045); animation: motif-turn 200s linear infinite; }
.hero__top { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr); gap: var(--space-5); align-items: center; }

.welcome { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr); gap: var(--space-5); align-items: center; padding: clamp(1.25rem, 0.6rem + 2vw, 2.25rem) clamp(1.25rem, 0.6rem + 2.4vw, 2.75rem); background: rgb(15 23 42 / 0.045); border-radius: var(--radius-lg); }
.welcome h1 { font: 700 clamp(1.6rem, 1rem + 1.7vw, 2.4rem)/1.15 var(--font-body); letter-spacing: -0.015em; color: var(--navy-700); }
.welcome h1 span { display: block; max-width: 14ch; margin-top: var(--space-1); font-weight: 400; color: var(--slate-500); }
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }

.district-map { width: 100%; max-width: 17rem; max-height: 22rem; justify-self: center; overflow: visible; }
.district-map__depth { fill: #a87b12; stroke: #a87b12; stroke-width: 4; stroke-linejoin: round; filter: drop-shadow(0 8px 10px rgb(120 86 10 / 0.35)); }
.district-map__land { fill: url(#map-fill); stroke: url(#map-edge); stroke-width: 4.5; stroke-linejoin: round; }
.district-map__shine { fill: none; stroke: rgb(255 255 255 / 0.7); stroke-width: 1; stroke-linejoin: round; transform: translate(-0.8px, -0.8px); }
.district-map__river { fill: none; stroke: #4cb4ee; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.district-map__pin path { fill: var(--gold-500); stroke: #a87b12; stroke-width: 1; }
.district-map__pin circle { fill: #fffaf0; }
.district-map__pin { animation: pin-bob 2.8s var(--ease-out-expo) infinite alternate; }

.quick { display: flex; flex-direction: column; padding: var(--space-4) var(--space-5) var(--space-3); background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }
.quick h2 { display: flex; align-items: center; gap: var(--space-4); font-size: clamp(1.35rem, 1.05rem + 0.9vw, 1.75rem); font-weight: 800; color: var(--brand-900); }
.quick h2::after { content: ""; flex: 1; height: 3px; border-radius: 2px; background: var(--gold-500); }
.quick ul { margin: var(--space-2) 0 0; padding: 0; list-style: none; }
.quick li + li { border-top: 1px solid var(--color-line); }
.quick li a { display: flex; align-items: center; gap: var(--space-3); padding-block: 0.55rem; color: var(--navy-900); font-weight: 500; font-size: var(--text-base); line-height: 1.35; text-decoration: none; transition: color var(--duration-fast), transform var(--duration-normal) var(--ease-out-expo); }
.quick li a:hover { color: var(--brand-800); transform: translateX(4px); }
.quick li svg { flex: none; width: 3rem; height: 3rem; padding: 0.45rem; background: var(--gold-100); border-radius: var(--radius-md); fill: none; stroke: var(--gold-600); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.quick__all { align-self: flex-end; padding-top: var(--space-3); font: 600 var(--text-sm) var(--font-body); color: var(--brand-900); text-decoration: none; }
.quick__all::after { content: " →"; color: var(--gold-600); }
.quick__all:hover { text-decoration: underline; }

.sectors { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-2); margin: var(--space-4) 0 0; padding: var(--space-2); list-style: none; background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }
.sector { display: flex; align-items: center; gap: var(--space-3); height: 100%; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--tile); color: var(--navy-900); text-decoration: none; transition: transform var(--duration-normal) var(--ease-out-expo), box-shadow var(--duration-normal); }
.sector:hover { transform: translateY(-4px); box-shadow: 0 14px 24px -16px var(--ink); }
.sector svg { flex: none; width: 2.6rem; height: 2.6rem; fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.sector span { font-size: var(--text-xs); line-height: 1.35; color: var(--slate-600); }
.sector strong { display: block; margin-bottom: 2px; font: 700 var(--text-sm)/1.2 var(--font-display); color: var(--navy-900); }
.sector--green { --tile: #dff5e4; --ink: #24894a; }
.sector--amber { --tile: #fbf0d0; --ink: #a87a0c; }
.sector--rose { --tile: #fde3e5; --ink: #cf3d4b; }
.sector--blue { --tile: #dcedff; --ink: #1c74c4; }
.sector--violet { --tile: #e9e4fb; --ink: #6748cf; }

.hero-stats { display: grid; grid-template-columns: repeat(5, 1fr); margin: var(--space-5) 0 0; background: var(--white); color: var(--navy-900); border-radius: var(--radius-lg) var(--radius-lg) var(--radius-sm) var(--radius-sm); box-shadow: var(--shadow-card); border-bottom: 4px solid var(--gold-500); }
.hero-stats > div { display: flex; flex-direction: column-reverse; justify-content: flex-end; padding: var(--space-5) var(--space-5) var(--space-4); border-left: 1px solid var(--color-line); }
.hero-stats > div:first-child { border-left: 0; }
.hero-stats dt { font-size: var(--text-xs); line-height: 1.4; color: var(--color-muted); }
.hero-stats dd { margin: 0 0 var(--space-1); font: 800 clamp(1.5rem, 1rem + 1.6vw, 2.3rem)/1 var(--font-display); letter-spacing: -0.02em; color: var(--brand-900); }
.hero-stats dd small { font-size: 0.45em; font-weight: 700; letter-spacing: 0; color: var(--gold-600); margin-left: 0.3em; }

/* Footer */
.site-footer { margin-top: var(--space-section); padding-block: var(--space-7); background: var(--brand-950); color: rgb(255 255 255 / 0.7); font-size: var(--text-sm); }
.site-footer__inner { display: grid; grid-template-columns: 1.4fr 1fr; gap: var(--space-7); }
.site-footer__title { font: 700 var(--text-lg)/1.3 var(--font-display); color: var(--white); max-width: 34rem; }
.site-footer p a { color: var(--gold-500); }
.site-footer__links { margin: 0; padding: 0; list-style: none; columns: 2; }
.site-footer__links a { display: inline-block; padding-block: 0.3rem; color: rgb(255 255 255 / 0.8); text-decoration: none; }
.site-footer__links a:hover { color: var(--gold-500); }

@keyframes pin-bob { to { transform: translateY(-6px); } }
@keyframes motif-turn { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 72rem) {
  .sectors { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero__top { grid-template-columns: minmax(0, 1fr); }
  .quick ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
  .quick li + li { border-top: 0; }
}

@media (max-width: 62rem) {
  .main-nav__inner { justify-content: flex-start; }
  .main-nav__toggle {
    display: inline-flex; align-items: center; gap: var(--space-3); min-height: 2.5rem; padding: 0 var(--space-3);
    background: transparent; border: 1px solid rgb(255 255 255 / 0.35); border-radius: var(--radius-md); color: var(--white); font: 600 var(--text-sm) var(--font-display); cursor: pointer;
  }
  .main-nav__toggle-bars, .main-nav__toggle-bars::before, .main-nav__toggle-bars::after { display: block; width: 1.1rem; height: 2px; background: currentColor; transition: transform var(--duration-normal) var(--ease-out-expo); }
  .main-nav__toggle-bars { position: relative; }
  .main-nav__toggle-bars::before, .main-nav__toggle-bars::after { content: ""; position: absolute; left: 0; }
  .main-nav__toggle-bars::before { transform: translateY(-6px); }
  .main-nav__toggle-bars::after { transform: translateY(6px); }
  .main-nav__toggle[aria-expanded="true"] .main-nav__toggle-bars { background: transparent; }
  .main-nav__toggle[aria-expanded="true"] .main-nav__toggle-bars::before { transform: rotate(45deg); }
  .main-nav__toggle[aria-expanded="true"] .main-nav__toggle-bars::after { transform: rotate(-45deg); }
  .main-nav__menu {
    position: absolute; inset: 100% 0 auto 0; display: none; flex-direction: column; justify-content: flex-start; gap: 0; max-height: calc(100dvh - var(--nav-height)); overflow-y: auto;
    padding: var(--space-3) var(--gutter) var(--space-6); background: var(--brand-900); border-top: 1px solid rgb(255 255 255 / 0.15);
  }
  .main-nav__menu.is-open { display: flex; }
  .nav-link { height: auto; padding: var(--space-4) 0 var(--space-2); border-bottom: 0; font-weight: 700; color: var(--gold-500); }
  .nav-item:hover > .nav-link, .nav-item:focus-within > .nav-link, .nav-link.is-active { background: transparent; color: var(--gold-500); }
  .nav-link::after { display: none; }
  .nav-sub, .nav-item:nth-last-child(2) .nav-sub, .nav-item:nth-last-child(3) .nav-sub {
    position: static; min-width: 0; padding: 0; background: transparent; box-shadow: none; border-top: 0; opacity: 1; visibility: visible; transform: none;
    border-left: 1px solid rgb(255 255 255 / 0.2);
  }
  .nav-sub a { color: rgb(255 255 255 / 0.9); }
  .nav-sub a::before { color: var(--gold-500); }
  .nav-sub a:hover, .nav-sub a:focus-visible, .nav-sub a.is-active { background: rgb(255 255 255 / 0.1); color: var(--white); }
  .hero-stats { grid-template-columns: repeat(6, 1fr); }
  .hero-stats > div { grid-column: span 2; border-top: 1px solid var(--color-line); }
  .hero-stats > div:nth-child(-n+3) { border-top: 0; }
  .hero-stats > div:nth-child(n+4) { grid-column: span 3; }
  .hero-stats > div:nth-child(4) { border-left: 0; }
}

@media (max-width: 52rem) {
  .site-header__inner { grid-template-columns: 1fr auto; gap: var(--space-3) var(--space-4); }
  .header-start { grid-column: 1 / -1; max-width: none; justify-self: stretch; }
  .search { width: 100%; }
  .search__results { width: 100%; }
  .brand--authority img { height: clamp(3rem, 12vw, 4.5rem); }
  .welcome { grid-template-columns: 1fr; text-align: left; }
  .district-map { max-width: 12rem; }
  .sectors { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick ul { grid-template-columns: 1fr; gap: 0; }
  .quick li + li { border-top: 1px solid var(--color-line); }
  .site-footer__inner { grid-template-columns: 1fr; }
}

@media (max-width: 34rem) {
  .sectors { grid-template-columns: 1fr; }
  .hero-stats { grid-template-columns: 1fr 1fr; }
  .hero-stats > div, .hero-stats > div:nth-child(n+4) { grid-column: auto; border-top: 1px solid var(--color-line); padding: var(--space-4); }
  .hero-stats > div:nth-child(-n+2) { border-top: 0; }
  .hero-stats > div:nth-child(odd) { border-left: 0; }
  .hero-stats > div:nth-child(even) { border-left: 1px solid var(--color-line); }
  .hero-stats > div:last-child { grid-column: 1 / -1; }
  .site-footer__links { columns: 1; }
}

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