/*
 * Familia (стиль «Путь пациента»): маршрут из четырёх остановок, выбор этапа семьи, искры, нижняя панель как в приложении.
 * Тема окна записи — --bk-*, переключателя способов показа — --m-*.
 * Анимации только при prefers-reduced-motion: no-preference; fill-mode backwards, без остаточного transform.
 * @author Maksym Mariukhnik <max@absoluteweb.com>
 */
:root {
    --white: #fff;
    --bg: #f5f9fc;
    --sky: #dcebf6;
    --sky-2: #bdd8ec;
    --blue: #2a6fa8;
    --blue-dark: #1d5688;
    --ink: #14283a;
    --muted: #566b7c;
    --sun: #ffc94d;
    --coral: #f6a58f;
    --leaf: #8fd3b0;
    --display: 'Unbounded', 'Noto Sans Georgian', sans-serif;
    --sans: 'Rubik', 'Noto Sans Georgian', system-ui, sans-serif;
    --stage: var(--coral);

    --bk-accent: var(--blue);
    --bk-on-accent: #fff;
    --bk-radius: 14px;
    --bk-font: var(--sans);
    --bk-ink: var(--ink);
    --bk-muted: var(--muted);
    --bk-line: rgba(20, 40, 58, .14);
    --bk-soft: rgba(42, 111, 168, .07);

    --m-bg: var(--white);
    --m-accent: var(--ink);
    --m-on-accent: #fff;
    --m-line: rgba(20, 40, 58, .1);
    --m-chip: var(--bg);
    --m-chip-hover: var(--sky);
    --m-radius: 20px;
    --m-btn-radius: 12px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 17px/1.55 var(--sans); }
:lang(ka) body { font-size: 16px; }
:lang(ka) { --display: 'Noto Sans Georgian', sans-serif; }
img { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 8px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* Шапка */
.top { position: sticky; top: 0; z-index: 20; background: rgba(245, 249, 252, .94); backdrop-filter: blur(8px); border-bottom: 1px solid rgba(20, 40, 58, .06); }
.top .wrap { display: flex; align-items: center; gap: 20px; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font: 600 18px var(--display); }
:lang(ka) .brand { font-family: 'Unbounded', sans-serif; }
.brand img { width: 38px; height: 38px; }
.nav { display: flex; gap: 22px; margin-left: auto; font-size: 15px; font-weight: 500; }
.nav a { text-decoration: none; padding: 8px 0; border-bottom: 2px solid transparent; color: var(--muted); }
.nav a:hover { color: var(--ink); }
body[data-page="home"] .nav a[data-href="home"],
body[data-page="services"] .nav a[data-href="services"],
body[data-page="doctors"] .nav a[data-href="doctors"],
body[data-page="about"] .nav a[data-href="about"],
body[data-page="contacts"] .nav a[data-href="contacts"] { color: var(--ink); border-bottom-color: var(--sun); }
.langs { display: flex; background: var(--white); border-radius: 12px; padding: 3px; box-shadow: inset 0 0 0 1px rgba(20, 40, 58, .08); }
.langs button { border: 0; background: none; padding: 7px 10px; border-radius: 9px; font-size: 13px; font-weight: 500; color: var(--muted); cursor: pointer; }
.langs button[aria-pressed="true"] { background: var(--ink); color: var(--white); }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--white); box-shadow: inset 0 0 0 1px rgba(20, 40, 58, .08); flex: none; }
.icon-btn:hover { background: var(--sky); }
.icon-btn svg { width: 20px; height: 20px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 24px; border-radius: 14px; border: 0; background: var(--blue); color: var(--white); font: 500 16px var(--sans); text-decoration: none; cursor: pointer; transition: background .15s, transform .15s; }
.btn:hover { background: var(--blue-dark); }
.btn:active { transform: scale(.98); }
.btn.soft { background: var(--white); color: var(--ink); box-shadow: inset 0 0 0 1px rgba(20, 40, 58, .12); }
.btn.soft:hover { background: var(--sky); }
.bar { display: none; }

/* Первый экран и маршрут */
.hero { padding: 56px 0 32px; overflow-x: clip; }
.hero .clinic { display: inline-flex; align-items: center; font-size: 14px; color: var(--blue-dark); background: var(--sky); padding: 6px 14px; border-radius: 999px; margin-bottom: 20px; }
.hero h1 { font: 600 clamp(34px, 5vw, 60px)/1.08 var(--display); margin: 0 0 14px; letter-spacing: -.02em; }
:lang(ka) .hero h1 { font-weight: 700; line-height: 1.25; letter-spacing: 0; }
.hero .lead { color: var(--muted); font-size: 19px; margin: 0 0 40px; max-width: 46ch; }
.hero[data-stage="planning"] { --stage: var(--sun); }
.hero[data-stage="pregnancy"] { --stage: var(--coral); }
.hero[data-stage="child"] { --stage: var(--leaf); }
.hero[data-stage="adults"] { --stage: var(--sky-2); }

.route { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); margin: 0 0 8px; }
.route::before { content: ""; position: absolute; left: 12.5%; right: 12.5%; top: 31px; height: 4px; border-radius: 2px; background: repeating-linear-gradient(90deg, var(--sky-2) 0 12px, transparent 12px 20px); }
.route .progress { position: absolute; left: 12.5%; top: 31px; height: 4px; border-radius: 2px; background: var(--blue); width: 0; transition: width .9s cubic-bezier(.3, .7, .2, 1); }
.stop { position: relative; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 0 4px; border: 0; background: none; cursor: pointer; text-align: center; }
.stop .dot { position: relative; width: 66px; height: 66px; border-radius: 50%; display: grid; place-items: center; background: var(--white); box-shadow: inset 0 0 0 2px var(--sky-2); color: var(--blue-dark); transition: background .25s, box-shadow .25s, transform .25s; }
.stop .dot svg { width: 30px; height: 30px; }
.stop .label { font-weight: 500; font-size: 16px; line-height: 1.25; }
.stop[aria-pressed="true"] .dot { background: var(--stage); box-shadow: 0 8px 20px -4px color-mix(in srgb, var(--stage) 80%, transparent); transform: scale(1.06); color: var(--ink); }
.stop.done .dot { background: var(--sky); }
.stop:hover .dot { box-shadow: inset 0 0 0 2px var(--blue); }
.spark { position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; pointer-events: none; z-index: 2; }
@media (prefers-reduced-motion: reduce) { .route .progress, .stop .dot, .panel { transition: none; } }

/* Активный этап пульсирует, при выборе из кружка разлетаются искры */
@media (prefers-reduced-motion: no-preference) {
    .stop[aria-pressed="true"] .dot::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; box-shadow: 0 0 0 2px var(--stage); animation: ring 2.4s 1s ease-out infinite; opacity: 0; }
    .stop[aria-pressed="true"] .dot svg { animation: hop .6s cubic-bezier(.3, 1.6, .5, 1) backwards; }
    .route.first .stop { animation: stop-in .7s cubic-bezier(.3, 1.4, .5, 1) backwards; }
    .route.first .stop:nth-of-type(2) { animation-delay: .15s; }
    .route.first .stop:nth-of-type(3) { animation-delay: .3s; }
    .route.first .stop:nth-of-type(4) { animation-delay: .45s; }
    .doc img { transition: transform .5s cubic-bezier(.3, 1.6, .5, 1); }
    .doc:hover img { transform: scale(1.06) rotate(-2deg); }
    html.motion .about img.in { transition-duration: 1.2s; }
}
@keyframes ring { 0% { transform: scale(1); opacity: .9; } 100% { transform: scale(1.7); opacity: 0; } }
@keyframes hop { from { transform: scale(.4) rotate(-20deg); } }
@keyframes stop-in { from { opacity: 0; transform: translateY(18px) scale(.7); } }

/* Панель этапа: цветная полоса сверху меняется вместе с этапом */
.panel { margin-top: 36px; background: var(--white); border-radius: 28px; padding: 36px; display: grid; grid-template-columns: 1fr 1.05fr; gap: 24px 40px; border-top: 6px solid var(--stage); transition: border-color .4s; box-shadow: 0 20px 50px -30px rgba(20, 40, 58, .3); }
.stage-note { grid-column: 1 / -1; order: -2; margin: 0; font-size: 19px; line-height: 1.45; max-width: 72ch; }
.panel h2 { font: 600 20px/1.3 var(--display); margin: 0 0 18px; }
:lang(ka) .panel h2 { font-weight: 700; }
.svc { display: grid; gap: 10px; }
.svc div { background: var(--bg); border-radius: 16px; padding: 14px 18px; }
.svc b { display: block; font-weight: 500; }
.svc span { font-size: 15px; color: var(--muted); }
.panel-docs .g-modes { margin: 0 0 14px; padding: 12px 14px; }
.docs { display: grid; gap: 14px; }
.doc { display: grid; grid-template-columns: 88px 1fr; gap: 18px; align-items: center; padding: 16px; border-radius: 20px; box-shadow: inset 0 0 0 1px rgba(20, 40, 58, .08); }
.doc img { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; object-position: 50% 18%; background: var(--sky); }
.doc h3, .doc h2 { margin: 0; font: 600 18px/1.3 var(--sans); }
.doc .role { margin: 0 0 6px; color: var(--blue-dark); font-size: 15px; }
.doc .meta { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.doc .row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.doc .btn { min-height: 44px; padding: 0 18px; font-size: 15px; }
.doc-inline { grid-column: 1 / -1; }
body[data-view="list"] .panel, body[data-view="inline"] .panel { grid-template-columns: 1fr; }
body[data-view="list"] .panel-docs, body[data-view="inline"] .panel-docs { order: -1; }

/* Факты */
.trust { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 56px 0 0; }
.trust div { background: var(--white); border-radius: 20px; padding: 20px; }
.trust b { display: block; font: 600 28px/1.1 'Unbounded', sans-serif; margin-bottom: 6px; color: var(--blue-dark); }
.trust span { font-size: 15px; color: var(--muted); }

section { padding: 80px 0; }
.hero { padding: 56px 0 32px; }
.h2 { font: 600 clamp(26px, 3vw, 36px)/1.2 var(--display); margin: 0 0 14px; }
:lang(ka) .h2 { font-weight: 700; line-height: 1.35; }
.about { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; }
.about img { border-radius: 28px; aspect-ratio: 5/4; object-fit: cover; object-position: 50% 60%; width: 100%; height: auto; background: var(--sky); }
.about p { color: var(--muted); font-size: 18px; margin: 0 0 24px; }

.contact-sec { padding-top: 0; }
.contact { background: var(--ink); color: var(--white); border-radius: 32px; padding: 40px; display: grid; grid-template-columns: 1fr 1.1fr; gap: 36px; }
.contact .h2 { color: var(--white); }
.contact p { margin: 0 0 6px; }
.contact .addr { font-size: 19px; }
.contact .muted { color: #a9bfd0; font-size: 15px; margin-bottom: 24px; }
.contact .btns { display: grid; gap: 10px; max-width: 360px; }
.contact .btn.soft { background: rgba(255, 255, 255, .08); color: var(--white); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18); }
.contact .btn.soft:hover { background: rgba(255, 255, 255, .16); }
.contact .btn:not(.soft) { background: var(--sun); color: var(--ink); }
.contact .btn:not(.soft):hover { background: #ffd777; }
.map { border-radius: 22px; overflow: hidden; min-height: 360px; background: #23415a; }
.map iframe { width: 100%; height: 100%; min-height: 360px; border: 0; }
.foot { padding: 32px 0 48px; color: var(--muted); font-size: 14px; }
.foot .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }

/* Внутренние страницы (общие блоки shared/pages) */
.page { max-width: 1120px; margin: 0 auto; padding: 56px 24px 88px; }
.page-title { font: 600 clamp(30px, 4.4vw, 48px)/1.15 var(--display); margin: 0 0 40px; letter-spacing: -.01em; }
:lang(ka) .page-title { font-weight: 700; line-height: 1.3; letter-spacing: 0; }
.docs-page { grid-template-columns: repeat(2, 1fr); gap: 20px; }
.docs-page .doc { grid-template-columns: 140px 1fr; align-items: start; padding: 22px; background: var(--white); box-shadow: 0 16px 40px -30px rgba(20, 40, 58, .4); }
.docs-page .doc img { width: 140px; height: 140px; }
.docs-page .doc h2 { font-size: 20px; }
.docs-page .bio { margin: 0 0 12px; color: var(--muted); font-size: 15px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; padding: 0; list-style: none; }
.chips li { font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--sky); color: var(--blue-dark); }
.docs-page[data-mode="inline"] { grid-template-columns: 1fr; }
.docs-page[data-mode="list"] { display: block; }

.svc-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.svc-card { display: flex; flex-direction: column; align-items: flex-start; padding: 26px; background: var(--white); border-radius: 22px; border-left: 6px solid var(--sky-2); box-shadow: 0 16px 40px -32px rgba(20, 40, 58, .4); }
.svc-card:nth-child(4n+1) { border-left-color: var(--sun); }
.svc-card:nth-child(4n+2) { border-left-color: var(--coral); }
.svc-card:nth-child(4n+3) { border-left-color: var(--leaf); }
.svc-title { font: 600 19px/1.3 var(--display); margin: 0 0 8px; }
:lang(ka) .svc-title { font-weight: 700; font-size: 18px; }
.svc-text { margin: 0 0 12px; color: var(--muted); font-size: 15px; }
.svc-docs { margin: 0 0 18px; font-size: 14px; color: var(--muted); }
.svc-docs b { color: var(--ink); font-weight: 500; }
.svc-book { margin-top: auto; min-height: 44px; padding: 0 20px; font-size: 15px; }

.about-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 56px; align-items: start; }
.about-text p { font-size: 18px; margin: 0 0 22px; max-width: 54ch; }
.about-photo img { width: 100%; height: auto; aspect-ratio: 4/5; object-fit: cover; border-radius: 28px; background: var(--sky); }
.about-facts { display: flex; flex-wrap: wrap; gap: 16px; margin: 48px 0 0; padding: 0; list-style: none; }
.about-facts li { background: var(--white); border-radius: 20px; padding: 20px 28px; min-width: 180px; }
.about-facts strong { font: 600 32px/1.1 var(--display); color: var(--blue-dark); display: block; margin-bottom: 6px; }
.about-facts span { color: var(--muted); font-size: 15px; display: block; max-width: 18ch; }

.ct-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px 56px; align-items: start; }
.ct-list { margin: 0; }
.ct-list dt { color: var(--muted); font-size: 14px; margin: 22px 0 4px; }
.ct-list dt:first-child { margin-top: 0; }
.ct-list dd { margin: 0; font: 500 21px/1.35 var(--sans); }
.ct-list a { text-underline-offset: 4px; text-decoration-color: var(--sun); text-decoration-thickness: 2px; }
.ct-msgs a { margin-right: 20px; }
.ct-actions { display: flex; flex-wrap: wrap; gap: 12px; align-content: start; }
.btn-ghost { background: var(--white); color: var(--ink); box-shadow: inset 0 0 0 1px rgba(20, 40, 58, .14); }
.btn-ghost:hover { background: var(--sky); }
.ct-map { grid-column: 1 / -1; width: 100%; height: 400px; border: 0; border-radius: 24px; background: var(--sky); }

@media (max-width: 1080px) {
    .top .wrap { flex-wrap: wrap; gap: 4px 12px; padding-top: 10px; padding-bottom: 4px; }
    .langs { margin-left: auto; }
    .nav { order: 3; flex-basis: 100%; margin-left: 0; flex-wrap: wrap; justify-content: space-between; gap: 0 8px; }
    .nav a { padding: 8px 0; font-size: 14px; }
}
@media (max-width: 900px) {
    .panel { grid-template-columns: 1fr; padding: 24px; }
    .panel-docs { order: -1; }
    .trust { grid-template-columns: repeat(2, 1fr); }
    .about, .contact, .about-grid, .ct-grid { grid-template-columns: minmax(0, 1fr); }
    .contact { padding: 28px; }
    .docs-page { grid-template-columns: 1fr; }
    .svc-list { grid-template-columns: 1fr; }
    section { padding: 64px 0; }
    .about-photo img { max-width: 420px; }
}
@media (max-width: 420px) { .nav a { font-size: 13px; } .nav { gap: 0 4px; } }
@media (max-width: 640px) {
    .wrap { padding: 0 16px; }
    .page { padding: 32px 16px 64px; }
    .hero { padding-top: 28px; }
    .top .call { display: none; }
    .stop .dot { width: 52px; height: 52px; }
    .stop .dot svg { width: 24px; height: 24px; }
    .route::before, .route .progress { top: 24px; }
    .stop .label { font-size: 13px; }
    .panel { margin-left: -4px; margin-right: -4px; padding: 20px 16px; border-radius: 22px; }
    .stage-note { font-size: 17px; }
    .doc { grid-template-columns: 64px 1fr; gap: 14px; }
    .doc img { width: 64px; height: 64px; }
    .docs-page .doc { grid-template-columns: 88px 1fr; padding: 16px; }
    .docs-page .doc img { width: 88px; height: 88px; }
    .doc .btn { width: 100%; }
    .trust b { font-size: 24px; }
    .ct-list dd { font-size: 19px; overflow-wrap: anywhere; }
    /* Нижняя панель как в приложении: запись, Telegram, звонок */
    .bar { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px); box-shadow: 0 -8px 24px rgba(20, 40, 58, .1); }
    .bar .btn { min-height: 50px; }
    .bar .icon-btn { width: 50px; height: 50px; }
    body { padding-bottom: 84px; }
}

/* Форма обратной связи: дружелюбная, крупные скруглённые поля, жёлтая кнопка. */
[data-contact-form] {
    --cf-accent: var(--blue);
    --cf-radius: 18px;
    --cf-btn-radius: 16px;
    --cf-line-strong: rgba(20, 40, 58, .18);
    --cf-field-bg: var(--white);
    --cf-error: #c0392b;
    --cf-bg: var(--sky);
    --cf-pad: 44px;
    border-radius: 32px;
}
.cf-intro h2 { font: 600 clamp(24px, 3vw, 34px)/1.2 var(--display); }
:lang(ka) .cf-intro h2 { font-weight: 700; line-height: 1.3; }
.cf-intro p { color: var(--ink); }
.cf-field input[type=text], .cf-field input[type=tel], .cf-field textarea { border-color: transparent; }
.cf-pill span { border-color: transparent; }
.cf-pill input:checked + span { background: var(--blue); color: #fff; }
.cf-submit { background: var(--sun); color: var(--ink); min-height: 56px; }
.cf-submit:hover:not(:disabled) { filter: brightness(.96); }
.cf-note { color: var(--ink); opacity: .75; }
.cf-done { background: var(--white); border-color: transparent; }
.cf-done h2 { font-family: var(--display); font-size: clamp(22px, 2.8vw, 30px); }
.cf-tick { background: var(--leaf); color: var(--ink); }
@media (max-width: 820px) { [data-contact-form] { --cf-pad: 24px 18px; border-radius: 24px; } }
