/* ============================================================
   KVARTAL — цифровой город
   Палитра: асфальт / полночь / натрий / неон / бетон / свет
   ============================================================ */

:root {
  --asphalt: #0B0E14;
  --midnight: #131A26;
  --midnight-2: #1A2333;
  --sodium: #FFA028;
  --sodium-dim: rgba(255, 160, 40, .14);
  --neon: #4FD8EB;
  --concrete: #8B93A3;
  --light: #F2F4F8;
  --line: rgba(139, 147, 163, .18);

  --font-display: "Unbounded", system-ui, sans-serif;
  --font-body: "Onest", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --content-w: 1200px;
  --pad: clamp(20px, 4vw, 64px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--asphalt);
  color: var(--light);
  font-family: var(--font-body);
  font-weight: 300;
  line-height: 1.6;
  overflow-x: hidden;
}

.mono { font-family: var(--font-mono); }

::selection { background: var(--sodium); color: var(--asphalt); }

/* ---------- canvas + grain ---------- */

#city-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}

.grain {
  position: fixed;
  inset: -50%;
  z-index: 1;
  pointer-events: none;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 9s steps(6) infinite;
}
@keyframes grain {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-4%, 3%); }
  40% { transform: translate(3%, -5%); }
  60% { transform: translate(-2%, -3%); }
  80% { transform: translate(4%, 4%); }
}

/* ---------- loader ---------- */

.loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--asphalt);
  display: grid;
  place-items: center;
  transition: opacity .8s ease, visibility .8s;
}
.loader.done { opacity: 0; visibility: hidden; }
.loader__inner { display: grid; gap: 18px; justify-items: center; }
.loader__logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(28px, 4vw, 44px);
  letter-spacing: .08em;
}
.loader__status { color: var(--concrete); font-size: 12px; letter-spacing: .12em; }
.loader__bar {
  width: 220px; height: 2px;
  background: var(--line);
  overflow: hidden;
}
.loader__bar i {
  display: block; height: 100%; width: 0;
  background: var(--sodium);
  transition: width .4s ease;
}

/* ---------- header ---------- */

.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px var(--pad);
}
.header::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(11, 14, 20, .85), transparent);
  pointer-events: none;
}
.header > * { position: relative; }
.header__logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: .06em;
  color: var(--light);
  text-decoration: none;
}
.header__dot { color: var(--sodium); }
.header__nav { display: flex; gap: 28px; }
.header__nav a {
  color: var(--concrete);
  text-decoration: none;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: .04em;
  transition: color .25s;
}
.header__nav a:hover, .header__nav a:focus-visible { color: var(--light); }

/* ---------- buttons ---------- */

.btn {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 14px 26px;
  border: 1px solid var(--sodium);
  color: var(--sodium);
  background: transparent;
  cursor: pointer;
  transition: background .25s, color .25s, box-shadow .25s;
}
.btn--solid {
  background: var(--sodium);
  color: var(--asphalt);
}
.btn--solid:hover, .btn--solid:focus-visible {
  box-shadow: 0 0 32px rgba(255, 160, 40, .45);
}
.btn--ghost:hover, .btn--ghost:focus-visible {
  background: var(--sodium-dim);
}
:focus-visible { outline: 2px solid var(--neon); outline-offset: 3px; }

/* ---------- district index (side map) ---------- */

.district-index {
  position: fixed;
  right: clamp(12px, 2vw, 28px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;
  display: grid;
  gap: 14px;
}
.district-index a {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
  color: var(--concrete);
  text-decoration: none;
  font-size: 10px;
  letter-spacing: .14em;
}
.district-index a span { opacity: 0; transform: translateX(6px); transition: opacity .25s, transform .25s; }
.district-index a:hover span, .district-index a:focus-visible span,
.district-index a.active span { opacity: 1; transform: none; }
.district-index a i {
  width: 8px; height: 8px;
  border: 1px solid var(--concrete);
  transform: rotate(45deg);
  transition: background .25s, border-color .25s, box-shadow .25s;
}
.district-index a.active i {
  background: var(--sodium);
  border-color: var(--sodium);
  box-shadow: 0 0 12px rgba(255, 160, 40, .8);
}
.district-index a.active { color: var(--sodium); }

/* ---------- districts (sections) ---------- */

main { position: relative; z-index: 10; }

.district {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 120px var(--pad);
  position: relative;
}
/* Скрим: гарантирует читаемость текста поверх города */
.district::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(100deg,
    rgba(11, 14, 20, .86) 0%,
    rgba(11, 14, 20, .55) 42%,
    rgba(11, 14, 20, .12) 68%,
    transparent 82%);
}
.district__content {
  position: relative;
  width: 100%;
  max-width: var(--content-w);
  margin: 0 auto;
}

.district__head { max-width: 640px; margin-bottom: clamp(40px, 6vh, 72px); }

.district__sign {
  display: inline-block;
  font-size: 12px;
  letter-spacing: .18em;
  color: var(--concrete);
  border: 1px solid var(--line);
  padding: 8px 14px;
  margin-bottom: 24px;
  background: rgba(11, 14, 20, .6);
  backdrop-filter: blur(4px);
}
.district__sign b { color: var(--sodium); font-weight: 500; margin-right: 10px; }

.district__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(34px, 5.4vw, 64px);
  line-height: 1.08;
  letter-spacing: .01em;
  margin-bottom: 22px;
}
.district__lede {
  color: var(--concrete);
  font-size: clamp(15px, 1.4vw, 18px);
  max-width: 520px;
}

/* ---------- hero ---------- */

.district--hub { justify-content: flex-end; padding-bottom: 12vh; }

.eyebrow {
  font-size: 12px;
  letter-spacing: .28em;
  color: var(--sodium);
  margin-bottom: 22px;
}
.hero__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(32px, 8.5vw, 118px);
  line-height: .98;
  letter-spacing: .01em;
  text-transform: uppercase;
  display: grid;
}
.hero__accent {
  color: transparent;
  -webkit-text-stroke: 2px var(--sodium);
  text-shadow: 0 0 48px rgba(255, 160, 40, .35);
}
.hero__sub {
  max-width: 520px;
  color: var(--concrete);
  font-size: clamp(15px, 1.5vw, 18px);
  margin: 28px 0 36px;
}
.hero__actions { display: flex; flex-wrap: wrap; gap: 16px; }

.hub__telemetry {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  margin: 8vh auto 0;
  max-width: var(--content-w);
  width: 100%;
}
.hub__telemetry > div {
  background: rgba(11, 14, 20, .78);
  backdrop-filter: blur(6px);
  padding: 18px 20px;
  display: grid;
  gap: 6px;
}
.telemetry__key {
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--concrete);
}
.telemetry__val {
  font-size: clamp(22px, 2.4vw, 32px);
  font-weight: 500;
  color: var(--sodium);
}

.scroll-hint {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 10px;
  letter-spacing: .2em;
  color: var(--concrete);
  text-transform: uppercase;
}
.scroll-hint i {
  width: 1px; height: 36px;
  background: linear-gradient(to bottom, var(--sodium), transparent);
  animation: hint 2s ease-in-out infinite;
}
@keyframes hint {
  0%, 100% { transform: scaleY(.4); transform-origin: top; opacity: .4; }
  50% { transform: scaleY(1); opacity: 1; }
}

/* ---------- cards (dev district) ---------- */

.cards {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.card {
  background: rgba(19, 26, 38, .82);
  backdrop-filter: blur(8px);
  padding: 28px 26px 34px;
  position: relative;
  overflow: hidden;
  transition: background .3s;
}
.card::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 2px;
  background: var(--sodium);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .4s ease;
}
.card:hover { background: rgba(26, 35, 51, .9); }
.card:hover::after { transform: scaleX(1); }
.card__addr {
  display: block;
  font-size: 10px;
  letter-spacing: .16em;
  color: var(--sodium);
  margin-bottom: 40px;
}
.card h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 19px;
  margin-bottom: 12px;
}
.card p { color: var(--concrete); font-size: 14.5px; }

/* ---------- seo district ---------- */

.seo-grid {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: clamp(28px, 4vw, 64px);
  align-items: start;
}
.seo-list { list-style: none; display: grid; gap: 0; }
.seo-list li {
  display: flex;
  gap: 22px;
  padding: 24px 18px;
  border-top: 1px solid var(--line);
  background: rgba(11, 14, 20, .62);
  backdrop-filter: blur(6px);
}
.seo-list li:last-child { border-bottom: 1px solid var(--line); }
.seo-list__num {
  color: var(--neon);
  font-size: 12px;
  letter-spacing: .1em;
  padding-top: 5px;
  min-width: 44px;
}
.seo-list h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 17px;
  margin-bottom: 8px;
}
.seo-list p { color: var(--concrete); font-size: 14.5px; }

.traffic-chart {
  border: 1px solid var(--line);
  background: rgba(19, 26, 38, .82);
  backdrop-filter: blur(8px);
  padding: 22px;
  position: sticky;
  top: 120px;
}
.traffic-chart figcaption {
  font-size: 10px;
  letter-spacing: .18em;
  color: var(--concrete);
  margin-bottom: 16px;
}
.traffic-chart svg { width: 100%; height: auto; display: block; }
.traffic-chart__grid line { stroke: var(--line); stroke-width: 1; }
.traffic-chart__line {
  stroke: var(--sodium);
  stroke-width: 2.5;
  filter: drop-shadow(0 0 6px rgba(255, 160, 40, .6));
}
.traffic-chart__labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--concrete);
  letter-spacing: .1em;
  margin-top: 12px;
}

/* ---------- cases ---------- */

.cases {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: clamp(16px, 2vw, 28px);
}
.case {
  border: 1px solid var(--line);
  background: rgba(19, 26, 38, .82);
  backdrop-filter: blur(8px);
  padding: 30px 28px;
  display: grid;
  gap: 18px;
  align-content: start;
  transition: border-color .3s, transform .3s;
}
.case:hover { border-color: rgba(255, 160, 40, .5); transform: translateY(-4px); }
.case__img {
  margin: -30px -28px 0;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.case__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: brightness(.85) saturate(1.05);
  transition: transform .5s ease;
}
.case:hover .case__img img { transform: scale(1.04); }
.case__tag {
  display: block;
  font-size: 10px;
  letter-spacing: .16em;
  color: var(--neon);
  margin-bottom: 14px;
}
.case h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 21px;
}
.case > p { color: var(--concrete); font-size: 14.5px; }
.case__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
  padding-top: 18px;
  gap: 10px;
}
.case__stats dt {
  font-size: 9.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--concrete);
  margin-bottom: 4px;
}
.case__stats dd { font-size: 19px; font-weight: 500; color: var(--sodium); }

/* ---------- stages / process ---------- */

.stages {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
/* Заполняет пустые ячейки сетки, чтобы сквозь них не светил город */
.stages::after {
  content: "";
  grid-column: auto / -1;
  background: rgba(19, 26, 38, .82);
}
.stage {
  background: rgba(19, 26, 38, .82);
  backdrop-filter: blur(8px);
  padding: 26px 22px 32px;
  position: relative;
}
.stage__num {
  display: block;
  font-size: 12px;
  color: var(--neon);
  letter-spacing: .1em;
  margin-bottom: 34px;
}
.stage h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 17px;
  margin-bottom: 10px;
}
.stage p { color: var(--concrete); font-size: 13.5px; }

/* ---------- contact ---------- */

.district--contact { justify-content: center; }
.district--contact .district__content { max-width: 760px; text-align: left; }

.contact__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(32px, 5vw, 58px);
  line-height: 1.08;
  margin-bottom: 20px;
}
.contact-form {
  margin-top: 40px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}
.contact-form label { display: grid; gap: 8px; }
.contact-form label span {
  font-size: 10px;
  letter-spacing: .18em;
  color: var(--concrete);
}
.contact-form input,
.contact-form textarea {
  background: rgba(19, 26, 38, .82);
  border: 1px solid var(--line);
  color: var(--light);
  font-family: var(--font-body);
  font-size: 15px;
  padding: 14px 16px;
  resize: vertical;
  transition: border-color .25s;
}
.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--sodium);
}
.contact-form input::placeholder,
.contact-form textarea::placeholder { color: rgba(139, 147, 163, .55); }
.contact-form__wide { grid-column: 1 / -1; }
.contact-form__submit { grid-column: 1 / -1; justify-self: start; }
.contact-form__note {
  grid-column: 1 / -1;
  font-size: 11px;
  color: var(--concrete);
  letter-spacing: .06em;
}

.footer {
  max-width: var(--content-w);
  margin: 10vh auto 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding-top: 22px;
  font-size: 11px;
  color: var(--concrete);
  letter-spacing: .08em;
}

/* ---------- reveal animation base ---------- */

.reveal { opacity: 0; transform: translateY(28px); }
.no-js .reveal, .reveal.shown { opacity: 1; transform: none; }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .seo-grid { grid-template-columns: 1fr; }
  .traffic-chart { position: static; }
  .header__nav { display: none; }
}

@media (max-width: 640px) {
  .district-index { display: none; }
  .contact-form { grid-template-columns: 1fr; }
  .hub__telemetry { grid-template-columns: 1fr 1fr; }
  .header__cta { display: none; }
  .scroll-hint span { display: none; }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .grain { animation: none; }
  .scroll-hint i { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
}
