/* Бердичів-автоліцей — система «дорожні знаки»:
   білий знак + червона облямівка (трикутник «У»), синій вказівник (кнопки, таблички розділів),
   біла табличка населеного пункту (адреси), асфальт із розміткою (смуга розділів, маршрут навчання). */

:root {
  --white: #fff;
  --concrete: #eceff2;
  --ink: #1c2026;
  --ink-2: #4b535e;
  --line: #d3d9df;
  --asphalt: #30353c;
  --red: #d52b2b;
  --blue: #134fa0;
  --blue-d: #0d3d7e;
  --focus: #f2a900;
  --f: "Overpass", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --wrap: 1180px;
  --pad: clamp(18px, 4vw, 32px);
  --head: 68px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--head) + 8px); }
body {
  margin: 0;
  font-family: var(--f);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
svg { display: block; }
a { color: var(--blue); text-underline-offset: .18em; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-weight: 800; line-height: 1.08; letter-spacing: -.012em; text-wrap: balance; }
h1 { font-size: clamp(2.45rem, 5.2vw, 4.3rem); font-weight: 900; letter-spacing: -.025em; line-height: 1.02; }
h2 { font-size: clamp(1.85rem, 3.3vw, 2.7rem); }
h3 { font-size: 1.3rem; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--pad); }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 6px; }
.skip:focus { top: 12px; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 54px; padding: 0 26px;
  border-radius: 8px; border: 2px solid transparent;
  font: inherit; font-weight: 800; font-size: 1.05rem; line-height: 1;
  text-decoration: none; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-blue:hover { background: var(--blue-d); }
.btn-line { border-color: var(--ink); color: var(--ink); background: transparent; }
.btn-line:hover { background: var(--ink); color: #fff; }
.btn-white { background: #fff; color: var(--blue); }
.btn-white:hover { background: var(--concrete); }
.btn-sm { min-height: 44px; padding: 0 18px; font-size: 1rem; }
.btn-wide { width: 100%; }
.btn:disabled { background: #8a96a3; cursor: default; }

/* ---------- шапка ---------- */
.top { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); backdrop-filter: saturate(1.4) blur(8px); }
.top-in { display: flex; align-items: center; gap: 22px; height: var(--head); }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font-weight: 800; font-size: 1.12rem; letter-spacing: -.01em; margin-right: auto; }
.brand-sign { width: 40px; height: 36px; flex: none; }
.top-call { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 800; text-decoration: none; font-variant-numeric: tabular-nums; }
.top-call svg { width: 19px; height: 19px; color: var(--blue); }
.top-call:hover { color: var(--blue); }

/* ---------- перший екран ---------- */
.hero { padding-top: clamp(36px, 6vw, 72px); }
.hero-in { display: grid; grid-template-columns: 1.08fr .92fr; gap: clamp(32px, 5vw, 72px); align-items: center; padding-bottom: clamp(44px, 6vw, 76px); }
.hero h1 { max-width: 12ch; }
.hero-lead { margin-top: 24px; max-width: 34em; font-size: 1.18rem; color: var(--ink-2); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.hero-hours { display: flex; flex-wrap: wrap; gap: 14px 32px; margin: 36px 0 0; }
.hero-hours div { padding-left: 14px; border-left: 4px solid var(--blue); }
.hero-hours dt { font-weight: 800; }
.hero-hours dd { margin: 0; color: var(--ink-2); font-size: .98rem; }

.hero-pic { position: relative; margin: 0 4% 0 0; }
/* у джерельних фото темна рамка по краю — зрізаємо 2,5% і розтягуємо назад */
.hero-pic img, .gallery img { clip-path: inset(2.5% round 6px); transform: scale(1.0527); }
.hero-pic img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.hero-sign {
  position: absolute; width: 45%; height: auto; aspect-ratio: 112 / 100;
  right: -9%; top: -7%;
  filter: drop-shadow(0 14px 22px rgba(20, 24, 30, .28));
  transform: rotate(7deg);
  transform-origin: 50% 0;
  animation: hang 1.1s cubic-bezier(.3, 1.4, .5, 1) .25s backwards;
}
@keyframes hang {
  from { transform: translateY(-26px) rotate(-12deg); opacity: 0; }
  40% { opacity: 1; }
}

/* смуга-дорога з табличками розділів */
.road { position: relative; background: var(--asphalt); padding: 18px 0; }
.road::before {
  content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 4px; margin-top: -2px;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.9) 0 40px, transparent 40px 80px);
}
.road-in { position: relative; display: flex; gap: 14px; overflow-x: auto; scrollbar-width: none; }
.road-in::-webkit-scrollbar { display: none; }
.plate {
  flex: none; display: inline-flex; align-items: center; gap: 12px;
  padding: 11px 16px 9px 18px; border-radius: 7px;
  background: var(--blue); color: #fff; text-decoration: none;
  font-weight: 800; font-size: 1.06rem;
  box-shadow: inset 0 0 0 3px var(--blue), inset 0 0 0 5px #fff;
}
.plate svg { width: 15px; height: 17px; }
.plate:hover { background: var(--blue-d); box-shadow: inset 0 0 0 3px var(--blue-d), inset 0 0 0 5px #fff; }

/* ---------- секції ---------- */
.sec { padding: clamp(60px, 8vw, 108px) 0; }
.sec-alt { background: var(--concrete); }
.sec-head { max-width: 640px; margin-bottom: clamp(32px, 4vw, 52px); }
.sec-head p { margin-top: 14px; font-size: 1.15rem; color: var(--ink-2); }

/* ціни */
.tariffs { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 3px solid var(--ink); }
.tariff { padding: 28px 28px 0; border-left: 1px solid var(--line); scroll-margin-top: calc(var(--head) + 16px); }
.tariff:first-child { padding-left: 0; border-left: 0; }
.tariff:last-child { padding-right: 0; }
.tariff-note { margin-top: 8px; color: var(--ink-2); font-size: .98rem; min-height: 3.1em; }
.prices { list-style: none; margin: 18px 0 0; padding: 0; }
.prices li { display: grid; grid-template-columns: 46px 1fr auto; grid-template-areas: "cat name sum" "cat desc desc"; gap: 0 14px; align-items: center; padding: 16px 0; border-top: 1px solid var(--line); }
.prices .cat { grid-area: cat; align-self: start; }
.cat {
  display: grid; place-items: center; width: 46px; height: 46px;
  border: 3px solid var(--ink); border-radius: 5px; background: #fff;
  font-weight: 900; font-size: 1.3rem; line-height: 1; padding-top: 3px;
}
.cat-2 { font-size: 1.02rem; letter-spacing: -.02em; }
.p-name { grid-area: name; font-weight: 700; line-height: 1.25; padding-top: 3px; }
.p-desc { grid-area: desc; margin-top: 3px; font-size: .9rem; color: var(--ink-2); line-height: 1.35; }
.p-sum { grid-area: sum; padding-top: 3px; font-weight: 800; font-size: 1.12rem; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* маршрут навчання */
.route { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 28px; position: relative; counter-reset: step; }
.route::before {
  content: ""; position: absolute; left: 0; right: 0; top: 17px; height: 16px; border-radius: 3px;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.9) 0 18px, transparent 18px 34px) 0 50% / 100% 2px no-repeat,
    var(--asphalt);
}
.route li { position: relative; padding-top: 70px; counter-increment: step; }
.route li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  display: grid; place-items: center; width: 50px; height: 50px; border-radius: 50%;
  background: #fff; border: 4px solid var(--ink);
  font-weight: 900; font-size: 1.25rem; padding-top: 3px;
}
.route li:last-child::before { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: inset 0 0 0 3px #fff; }
.route h3 { font-size: 1.15rem; }
.route p { margin-top: 8px; color: var(--ink-2); font-size: .98rem; }

/* фото */
.gallery { display: grid; grid-template-columns: repeat(4, 1fr); gap: 28px 20px; }
.gallery figure { margin: 0; }
.gallery img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: var(--concrete); }
.gallery img[src*="ispyt"] { object-position: 50% 78%; }
.gallery figcaption { margin-top: 10px; font-size: .95rem; color: var(--ink-2); }

/* ветерани — синя інформаційна табличка */
.vet { padding: 0 0 clamp(60px, 8vw, 108px); }
.vet-plate {
  display: grid; grid-template-columns: 1fr auto; gap: 28px 48px; align-items: center;
  padding: clamp(28px, 4vw, 48px);
  background: var(--blue); color: #fff; border-radius: 12px;
  box-shadow: inset 0 0 0 7px var(--blue), inset 0 0 0 10px #fff;
}
.vet-plate h2 { font-size: clamp(1.6rem, 2.8vw, 2.25rem); }
.vet-plate p { margin-top: 14px; max-width: 46em; color: #dfe8f6; }

/* адреси — таблички населених пунктів */
.places { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 4vw, 56px); }
.city-sign {
  display: inline-flex; flex-direction: column; align-items: center;
  min-width: 250px; padding: 18px 34px 14px;
  background: #fff; border-radius: 9px;
  box-shadow: inset 0 0 0 5px #fff, inset 0 0 0 8px var(--ink), 0 1px 0 rgba(0,0,0,.06), 0 10px 24px -14px rgba(20,24,30,.35);
}
.city-sign span { font-weight: 800; font-size: clamp(2rem, 4vw, 2.75rem); line-height: 1; letter-spacing: -.01em; padding-top: 6px; }
.city-sign small { margin-top: 6px; font-weight: 600; font-size: 1rem; letter-spacing: .01em; }
.place-addr { margin-top: 26px; font-size: 1.3rem; }
.hours { margin: 14px 0 0; }
.hours div { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 11px 0; border-top: 1px solid #c9d0d8; }
.hours dt { font-weight: 700; }
.hours dd { margin: 0; color: var(--ink-2); }
.maplink { display: inline-flex; align-items: center; gap: 8px; margin-top: 18px; font-weight: 800; }
.maplink svg { width: 20px; height: 20px; }

/* заявка */
.form-grid { display: grid; grid-template-columns: .9fr 1.1fr; gap: clamp(32px, 5vw, 72px); align-items: start; }
.form-side > p { margin-top: 14px; font-size: 1.15rem; color: var(--ink-2); }
.contacts { list-style: none; margin: 28px 0 0; padding: 0; display: grid; gap: 12px; }
.contacts a { display: inline-flex; align-items: center; gap: 12px; font-weight: 800; font-size: 1.2rem; color: var(--ink); text-decoration: none; }
.contacts a:hover { color: var(--blue); }
.contacts svg { width: 24px; height: 24px; color: var(--blue); }
.muted { margin-top: 24px; color: var(--ink-2); font-size: .98rem; }

.order { display: grid; gap: 20px; padding: clamp(22px, 3.5vw, 36px); background: var(--concrete); border-radius: 12px; }
.fld { display: grid; gap: 7px; margin: 0; padding: 0; border: 0; font-weight: 700; font-size: .98rem; min-width: 0; }
.fld legend { padding: 0; margin-bottom: 7px; }
.order input:not([type=radio]), .order select {
  width: 100%; min-height: 54px; padding: 4px 14px 0;
  font: inherit; font-weight: 400; font-size: 1.06rem; color: var(--ink);
  background: #fff; border: 2px solid #bcc4cd; border-radius: 8px;
}
.order select { padding-right: 40px; appearance: none; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 18'%3E%3Cpath d='M2.5 6 8 11.5 13.5 6' fill='none' stroke='%231c2026' stroke-width='2.6'/%3E%3C/svg%3E") no-repeat right 14px center / 16px; }
.order input:focus, .order select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(19, 79, 160, .22); }
.order .bad { border-color: var(--red) !important; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span {
  display: block; padding: 13px 14px 11px; border-radius: 8px;
  background: #fff; border: 2px solid #bcc4cd; font-weight: 800;
}
.seg small { display: block; font-weight: 400; font-size: .9rem; color: var(--ink-2); }
.seg input:checked + span { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); background: #f2f6fc; }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-msg:empty { display: none; }
.form-msg { padding: 14px 16px; border-radius: 8px; background: #fff; border-left: 5px solid var(--blue); font-weight: 600; }
.form-msg.err { border-left-color: var(--red); }
.consent { font-size: .88rem; color: var(--ink-2); }

/* підвал */
.foot { background: var(--asphalt); color: #c9d0d8; padding: 44px 0 48px; font-size: .98rem; }
.foot-in { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 24px 40px; }
.foot b { color: #fff; }
.foot a { color: #fff; }
.foot-brand { display: flex; gap: 14px; align-items: flex-start; }

/* нижня панель на телефоні */
.dock { display: none; }

/* ---------- адаптив ---------- */
@media (max-width: 1020px) {
  .gallery { grid-template-columns: 1fr 1fr; }
  .tariffs { grid-template-columns: 1fr; border-top: 0; }
  .tariff, .tariff:first-child, .tariff:last-child { padding: 0; border: 0; }
  .tariff + .tariff { margin-top: 44px; }
  .tariff h3 { padding-top: 18px; border-top: 3px solid var(--ink); }
  .tariff-note { min-height: 0; }
  .route { grid-template-columns: 1fr; gap: 26px; }
  .route::before { left: 17px; right: auto; top: 0; bottom: 0; width: 16px; height: auto;
    background:
      repeating-linear-gradient(180deg, rgba(255,255,255,.9) 0 18px, transparent 18px 34px) 50% 0 / 2px 100% no-repeat,
      var(--asphalt); }
  .route li { padding: 4px 0 0 76px; min-height: 50px; }
  .route p { max-width: 36em; }
}

@media (max-width: 860px) {
  .hero-in { grid-template-columns: 1fr; }
  .hero h1 { max-width: 14ch; }
  .hero-pic { max-width: 520px; margin: 8px 9% 0 0; }
  .places, .form-grid { grid-template-columns: 1fr; }
  .vet-plate { grid-template-columns: 1fr; }
  .vet-plate .btn { justify-self: start; }
  .foot-in { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  :root { --head: 60px; }
  body { font-size: 1rem; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .top-cta { display: none; }
  .top-call span { display: none; }
  .top-call { width: 44px; height: 44px; justify-content: center; border: 2px solid var(--ink); border-radius: 8px; }
  .brand-sign { width: 34px; height: 30px; }
  .brand { font-size: 1.02rem; }
  .hero-lead { font-size: 1.06rem; }
  .hero-cta .btn { flex: 1 1 220px; }
  .gallery { grid-template-columns: 1fr 1fr; gap: 18px 12px; }
  .gallery figcaption { font-size: .88rem; }
  .hours div { grid-template-columns: 120px 1fr; }
  .city-sign { min-width: 0; padding: 16px 28px 12px; }
  .dock {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    padding: 10px var(--pad) calc(10px + env(safe-area-inset-bottom));
    background: rgba(255,255,255,.97); border-top: 1px solid var(--line);
  }
  .dock .btn { min-height: 50px; padding: 0 12px; font-size: 1rem; }
  .dock .btn-line { background: #fff; }
}

@media (max-width: 400px) {
  .seg { grid-template-columns: 1fr; }
  .cat { width: 42px; height: 42px; }
  .prices li { grid-template-columns: 42px 1fr auto; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-sign { animation: none; }
  .btn { transition: none; }
}
