/* ============================================================
   МістоРух — дизайн-система
   Концепція: Modern Ukrainian urban mobility guide.
   Сигнатура: «лінія маршруту» зі станціями-вузлами.
   ============================================================ */

/* ---- Токени ------------------------------------------------ */
:root {
  /* Палітра (off-white / graphite / asphalt / muted blue / green / amber) */
  --bg:        #F5F6F4;   /* off-white, холоднуватий (асфальт) */
  --surface:   #FFFFFF;
  --surface-2: #EDEFEC;
  --ink:       #1E2427;   /* графіт */
  --ink-soft:  #3A4247;
  --muted:     #5B646A;   /* asphalt grey — вторинний текст */
  --hairline:  #DCE0DD;
  --hairline-2:#C7CDC8;

  --brand:     #22688A;   /* muted blue */
  --brand-ink: #185270;
  --brand-wash:#E7F0F4;
  --green:     #2E7D5B;   /* transport green */
  --green-wash:#E6F1EA;
  --amber:     #D98A21;   /* акцент */
  --amber-wash:#FBEFD9;

  /* Кольори видів транспорту (картографічні, не офіційні) */
  --m-metro:      #2B6C8E;
  --m-tram:       #B8562F;
  --m-trolleybus: #3F8A5E;
  --m-bus:        #C29A2E;
  --m-suburban:   #6B5B8A;

  /* Типографіка. --font-display/-body легко замінити на self-hosted
     (у продакшн: Unbounded для дисплея + Inter для тексту, .woff2). */
  --font-display: "Unbounded", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-body:    "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

  --step--1: clamp(0.82rem, 0.79rem + 0.15vw, 0.9rem);
  --step-0:  clamp(1rem, 0.96rem + 0.2vw, 1.08rem);
  --step-1:  clamp(1.18rem, 1.1rem + 0.4vw, 1.35rem);
  --step-2:  clamp(1.42rem, 1.28rem + 0.7vw, 1.8rem);
  --step-3:  clamp(1.7rem, 1.45rem + 1.25vw, 2.5rem);
  --step-4:  clamp(2.1rem, 1.65rem + 2.25vw, 3.6rem);

  --sp-1: 0.35rem; --sp-2: 0.6rem; --sp-3: 1rem; --sp-4: 1.5rem;
  --sp-5: 2.25rem; --sp-6: 3.25rem; --sp-7: 5rem;

  --radius: 8px;
  --radius-lg: 14px;
  --shadow: 0 1px 2px rgba(30,36,39,0.04), 0 4px 16px rgba(30,36,39,0.05);
  --wrap: 1160px;
  --measure: 68ch;
}

/* ---- Reset / база ------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.62;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: var(--brand-ink); text-decoration-color: color-mix(in srgb, var(--brand) 40%, transparent); text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--brand); }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.12; letter-spacing: -0.02em; color: var(--ink); font-weight: 800; margin: 0 0 var(--sp-3); }
h1 { font-size: var(--step-4); letter-spacing: -0.03em; }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); letter-spacing: -0.01em; }
p { margin: 0 0 var(--sp-3); }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 3px; }
::selection { background: color-mix(in srgb, var(--brand) 22%, transparent); }

/* ---- Утиліти ----------------------------------------------- */
.wrap { width: min(100% - 2rem, var(--wrap)); margin-inline: auto; }
.prose { max-width: var(--measure); }
.eyebrow {
  font-family: var(--font-body);
  font-size: var(--step--1); font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--brand); margin: 0 0 var(--sp-2);
  display: inline-flex; align-items: center; gap: 0.5rem;
}
.eyebrow::before { content: ""; width: 22px; height: 2px; background: var(--brand); border-radius: 2px; }
.section { padding-block: var(--sp-6); }
.section + .section { padding-top: 0; }
.section__head { margin-bottom: var(--sp-4); }
.section__head p { color: var(--muted); max-width: 60ch; margin: 0; }
.section__head .row { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.linklike { font-weight: 600; font-size: var(--step--1); white-space: nowrap; }
.skip-link {
  position: absolute; left: 0.5rem; top: -3rem; z-index: 100;
  background: var(--ink); color: #fff; padding: 0.6rem 1rem; border-radius: 6px;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 0.5rem; }

/* ---- Хедер / навігація ------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--hairline);
}
.site-header__bar { display: flex; align-items: center; gap: var(--sp-4); min-height: 62px; }
.brand { display: inline-flex; align-items: center; gap: 0.55rem; font-family: var(--font-display); font-weight: 800; font-size: 1.28rem; letter-spacing: -0.02em; text-decoration: none; color: var(--ink); }
.brand svg { width: 30px; height: 30px; }
.brand .wordmark { color: var(--ink); font-weight: 800; }
.nav { margin-left: auto; }
.nav ul { list-style: none; display: flex; gap: 0.15rem; margin: 0; padding: 0; }
.nav a {
  display: block; padding: 0.5rem 0.7rem; border-radius: 7px; font-size: 0.94rem;
  font-weight: 600; color: var(--ink-soft); text-decoration: none; white-space: nowrap;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { color: var(--brand-ink); background: var(--brand-wash); }
.nav-toggle { display: none; }
.header-search { display: inline-flex; }
.header-search a {
  display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  border: 1px solid var(--hairline-2); border-radius: 8px; color: var(--ink-soft); text-decoration: none;
}
.header-search a:hover { background: var(--surface); border-color: var(--brand); color: var(--brand-ink); }

/* ---- Hero -------------------------------------------------- */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--hairline); background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%); }
.hero__grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: var(--sp-5); align-items: center; padding-block: clamp(2.5rem, 5vw, 4.5rem); }
.hero h1 { margin-bottom: var(--sp-3); }
.hero h1 .accent { color: var(--brand); }
.hero__lead { font-size: var(--step-1); color: var(--ink-soft); max-width: 34ch; margin-bottom: var(--sp-4); }
.hero__cta { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.hero__map { position: relative; aspect-ratio: 1 / 0.92; }
/* декоративна схема ліній праворуч у hero */
.hero__map svg { width: 100%; height: 100%; }

/* Кнопки */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 0.98rem;
  padding: 0.72rem 1.15rem; border-radius: 9px; text-decoration: none; border: 1px solid transparent; cursor: pointer;
}
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-ink); }
.btn--ghost { background: var(--surface); color: var(--ink); border-color: var(--hairline-2); }
.btn--ghost:hover { border-color: var(--brand); color: var(--brand-ink); }

/* ---- Пошук (hero) ------------------------------------------ */
.searchbox { margin-top: var(--sp-4); }
.searchbox form { display: flex; gap: 0.5rem; max-width: 520px; }
.searchbox input {
  flex: 1; font: inherit; padding: 0.8rem 1rem; border-radius: 10px;
  border: 1px solid var(--hairline-2); background: var(--surface); color: var(--ink);
}
.searchbox input:focus-visible { outline: 3px solid var(--brand); outline-offset: 1px; }
.searchbox .hint { color: var(--muted); font-size: var(--step--1); margin-top: 0.5rem; }

/* ---- Сітки карток ------------------------------------------ */
.grid { display: grid; gap: var(--sp-3); }
.grid--modes { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

/* Картка виду транспорту */
.mode-card {
  position: relative; display: flex; flex-direction: column; gap: 0.4rem;
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius);
  padding: var(--sp-3) var(--sp-3) var(--sp-3) calc(var(--sp-3) + 5px); text-decoration: none; color: var(--ink);
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.mode-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; border-radius: var(--radius) 0 0 var(--radius); background: var(--accent, var(--brand)); }
.mode-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--hairline-2); }
.mode-card .name { font-family: var(--font-display); font-weight: 800; font-size: 1.12rem; }
.mode-card .meta { color: var(--muted); font-size: var(--step--1); }
.mode-card .arrow { margin-top: auto; color: var(--accent, var(--brand)); font-weight: 700; font-size: var(--step--1); }

/* Загальна інфо-картка / карта статті */
.card {
  display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--hairline); border-radius: var(--radius); overflow: hidden;
  text-decoration: none; color: var(--ink);
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--hairline-2); }
.card__body { padding: var(--sp-3); display: flex; flex-direction: column; gap: 0.4rem; }
.card__kicker { font-size: var(--step--1); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--brand); }
.card h3 { margin: 0; font-size: 1.15rem; }
.card p { margin: 0; color: var(--muted); font-size: 0.96rem; }
.card__meta { margin-top: auto; padding-top: 0.5rem; color: var(--muted); font-size: var(--step--1); display: flex; gap: 0.6rem; }

/* Чіп-теґи видів транспорту */
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.82rem; font-weight: 600; padding: 0.25rem 0.6rem; border-radius: 999px; background: var(--surface-2); color: var(--ink-soft); border: 1px solid var(--hairline); }
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent, var(--muted)); }
a.chip { text-decoration: none; transition: border-color 0.12s ease, background 0.12s ease; }
a.chip:hover { border-color: var(--accent, var(--brand)); background: var(--surface); }

/* ---- Сигнатура: лінія маршруту (route-line) ---------------- */
.route-line { list-style: none; margin: var(--sp-3) 0; padding: 0; position: relative; }
.route-line li {
  position: relative; padding: 0.15rem 0 0.9rem 1.9rem; line-height: 1.5;
}
.route-line li::before { /* лінія */
  content: ""; position: absolute; left: 8px; top: 0.55rem; bottom: -0.35rem; width: 3px;
  background: var(--line-color, var(--brand));
}
.route-line li:last-child::before { display: none; }
.route-line li::after { /* вузол-станція */
  content: ""; position: absolute; left: 2px; top: 0.35rem; width: 15px; height: 15px;
  border-radius: 50%; background: var(--surface); border: 3px solid var(--line-color, var(--brand));
}
.route-line li.is-interchange::after { width: 17px; height: 17px; left: 1px; border-width: 4px; }
.route-line li b { font-weight: 700; }
.route-line li .sub { display: block; color: var(--muted); font-size: var(--step--1); }

/* ---- Таблиці ----------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--hairline); border-radius: var(--radius); margin: var(--sp-4) 0; }
table { border-collapse: collapse; width: 100%; font-size: 0.96rem; }
th, td { text-align: left; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--hairline); }
thead th { background: var(--surface-2); font-family: var(--font-body); font-weight: 700; color: var(--ink); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--brand-wash) 55%, transparent); }

/* Таблиця маршрутів */
.route-table td:first-child { white-space: nowrap; width: 1%; }
.route-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 2.1rem; height: 1.7rem; padding: 0 0.45rem; border-radius: 6px; background: var(--accent, var(--brand)); color: #fff; font-weight: 800; font-size: 0.9rem; font-family: var(--font-display); }
.route-note { color: var(--muted); font-size: 0.9rem; }

/* Фігура-схема (мапа ліній метро) */
.map-figure { margin: var(--sp-4) 0; border: 1px solid var(--hairline); border-radius: var(--radius-lg); background: var(--surface); padding: var(--sp-3); overflow-x: auto; }
.map-figure img { display: block; width: 100%; height: auto; min-width: 720px; }
.map-figure figcaption { margin-top: 0.6rem; color: var(--muted); font-size: var(--step--1); }
@media (min-width: 940px) {
  /* Виходимо за вузьку колонку тексту праворуч, вирівнюючись по її лівому краю */
  .content .map-figure { width: min(96vw, 1120px); }
  .map-figure img { min-width: 0; }
}
a.route-badge { text-decoration: none; margin: 0.15rem 0.25rem 0.15rem 0; }
a.route-badge:hover { filter: brightness(1.08); }
.route-badges { margin: 0.5rem 0 0; }
.route-h1 { display: flex; align-items: center; gap: 0.6rem; margin: 0 0 var(--sp-3); }
.route-h1 h1 { margin: 0; }
.route-h1__badge { min-width: 2.7rem; height: 2rem; font-size: 1.1rem; }

/* ---- Стаття / контент -------------------------------------- */
.article { padding-block: var(--sp-5) var(--sp-7); }
.article__header { border-bottom: 1px solid var(--hairline); padding-bottom: var(--sp-4); margin-bottom: var(--sp-4); }
.article__meta { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; color: var(--muted); font-size: var(--step--1); margin-top: var(--sp-3); }
.content { max-width: var(--measure); }
.content h2 { margin-top: var(--sp-5); padding-top: 0.2rem; }
.content h3 { margin-top: var(--sp-4); }
.content ul, .content ol { padding-left: 1.25rem; margin: 0 0 var(--sp-3); }
.content li { margin-bottom: 0.35rem; }
.content > p:first-of-type { }
.content a { font-weight: 500; }

/* Резюме / прямий-відповідь блок */
.answer {
  background: var(--brand-wash); border: 1px solid color-mix(in srgb, var(--brand) 25%, var(--hairline));
  border-left: 4px solid var(--brand); border-radius: var(--radius);
  padding: var(--sp-3) var(--sp-4); margin: 0 0 var(--sp-4);
}
.answer p { margin: 0; }
.answer strong { color: var(--brand-ink); }

/* Виноска-факт */
.callout { background: var(--surface); border: 1px solid var(--hairline); border-left: 4px solid var(--amber); border-radius: var(--radius); padding: var(--sp-3) var(--sp-4); margin: var(--sp-4) 0; }
.callout .label { font-weight: 700; color: var(--amber); font-size: var(--step--1); text-transform: uppercase; letter-spacing: 0.08em; }

/* ---- Блок джерел ------------------------------------------- */
.sources { margin-top: var(--sp-5); border-top: 1px solid var(--hairline); padding-top: var(--sp-4); }
.sources h2 { font-size: var(--step-1); }
.sources ol { padding-left: 1.2rem; color: var(--muted); font-size: 0.92rem; }
.sources li { margin-bottom: 0.5rem; }
.sources .stamp { color: var(--muted); font-weight: 600; }

/* ---- FAQ --------------------------------------------------- */
.faq { margin-top: var(--sp-5); }
.faq details { border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--surface); margin-bottom: 0.6rem; }
.faq summary { cursor: pointer; padding: 0.9rem 1rem; font-weight: 700; font-family: var(--font-display); font-size: 1.02rem; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--brand); font-weight: 700; }
.faq details[open] summary::after { content: "–"; }
.faq details > div { padding: 0 1rem 1rem; color: var(--ink-soft); }
.faq details > div p { margin: 0; }

/* ---- Related ----------------------------------------------- */
.related { margin-top: var(--sp-5); }

/* ---- Breadcrumbs ------------------------------------------- */
.crumbs { padding-block: var(--sp-3); font-size: var(--step--1); }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0; padding: 0; color: var(--muted); }
.crumbs li { display: inline-flex; align-items: center; gap: 0.4rem; }
.crumbs li + li::before { content: "›"; color: var(--hairline-2); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--brand-ink); }
.crumbs [aria-current="page"] { color: var(--ink-soft); }

/* ---- Хабові списки ----------------------------------------- */
.page-header { padding-block: var(--sp-5) var(--sp-4); border-bottom: 1px solid var(--hairline); }
.page-header p { color: var(--muted); max-width: 62ch; font-size: var(--step-1); }

/* ---- Блок «Про проєкт» / нотатка --------------------------- */
.note { background: var(--surface-2); border-radius: var(--radius-lg); padding: var(--sp-4); }
.note--disclaimer { border: 1px dashed var(--hairline-2); background: var(--surface); }
.note p:last-child { margin-bottom: 0; }

/* ---- Футер ------------------------------------------------- */
.site-footer { background: var(--ink); color: #C6CCce; margin-top: var(--sp-7); padding-block: var(--sp-6) var(--sp-4); }
.site-footer a { color: #E7EBEA; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(4, 1fr); gap: var(--sp-4); }
.footer-brand .brand { color: #fff; }
.footer-brand .brand .wordmark { color: #fff; }
.footer-brand p { color: #9AA2A5; font-size: 0.92rem; max-width: 30ch; margin-top: var(--sp-2); }
.footer-col h4 { color: #fff; font-family: var(--font-body); font-size: 0.82rem; letter-spacing: 0.1em; text-transform: uppercase; margin: 0 0 var(--sp-2); }
.footer-col ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.4rem; font-size: 0.94rem; }
.footer-bottom { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: var(--sp-5); padding-top: var(--sp-3); border-top: 1px solid #2E3639; color: #8A9295; font-size: var(--step--1); }

/* ---- Мобільна навігація ------------------------------------ */
@media (max-width: 900px) {
  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center; margin-left: auto;
    width: 42px; height: 42px; border: 1px solid var(--hairline-2); border-radius: 8px;
    background: var(--surface); cursor: pointer; color: var(--ink);
  }
  .nav { position: fixed; inset: 62px 0 auto 0; margin: 0; background: var(--surface); border-bottom: 1px solid var(--hairline); box-shadow: var(--shadow); transform: translateY(-120%); transition: transform 0.22s ease; max-height: calc(100dvh - 62px); overflow-y: auto; }
  .nav[data-open="true"] { transform: translateY(0); }
  .nav ul { flex-direction: column; padding: 0.5rem; gap: 0.1rem; }
  .nav a { padding: 0.85rem 0.8rem; font-size: 1.02rem; }
  .header-search { margin-left: 0.5rem; }
}
@media (max-width: 780px) {
  .hero__grid { grid-template-columns: 1fr; }
  .hero__map { display: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
  .searchbox form { flex-direction: column; }
  .btn { width: 100%; justify-content: center; }
}

/* ---- Доступність: анімації --------------------------------- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* Приховати візуально, лишити для скрінрідерів */
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
