:root {
    --navy: #14213d;
    --navy-dark: #0d1730;
    --gold: #c9a227;
    --gold-light: #e3c766;
    --ink: #1f2933;
    --muted: #5b6672;
    --bg: #f6f7fb;
    --bg-alt: #eef1f7;
    --card: #ffffff;
    --border: #e2e6ee;
    --radius: 14px;
    --shadow: 0 2px 10px rgba(20, 33, 61, 0.07);
    --shadow-hover: 0 10px 28px rgba(20, 33, 61, 0.14);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.65;
}

h1, h2, h3, h4 {
    font-family: Georgia, "Times New Roman", serif;
    line-height: 1.25;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Верхняя панель */

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--navy-dark);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding-top: 14px;
    padding-bottom: 14px;
}

.site-header__brand {
    color: #fff;
    font-family: Georgia, serif;
    font-size: 1.05rem;
    letter-spacing: 0.02em;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 22px;
    flex-wrap: wrap;
}

.site-nav a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.site-nav a:hover {
    color: var(--gold-light);
}

.site-nav a.site-nav__cta {
    padding: 7px 18px;
    border-radius: 999px;
    background: var(--gold);
    color: var(--navy-dark);
    font-weight: 600;
    transition: background 0.2s;
}

.site-nav a.site-nav__cta:hover {
    background: var(--gold-light);
    color: var(--navy-dark);
}

.site-header__brand {
    text-decoration: none;
}

/* Первый экран (hero) */

.hero {
    background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 55%, #1d3358 100%);
    color: #fff;
    padding: 88px 0 96px;
}

.hero h1 {
    margin: 0;
    font-size: clamp(1.9rem, 4.5vw, 3rem);
}

.hero__tagline {
    margin: 16px 0 0;
    max-width: 640px;
    color: var(--gold-light);
    font-size: clamp(1.05rem, 2vw, 1.3rem);
}

.hero__actions {
    margin-top: 36px;
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.btn {
    display: inline-block;
    padding: 13px 28px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: transform 0.15s, box-shadow 0.15s, background 0.2s;
}

.btn--accent {
    background: var(--gold);
    color: var(--navy-dark);
}

.btn--accent:hover {
    background: var(--gold-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn--ghost {
    border: 1px solid rgba(255, 255, 255, 0.45);
    color: #fff;
}

.btn--ghost:hover {
    border-color: var(--gold-light);
    color: var(--gold-light);
    transform: translateY(-2px);
}

/* Секции */

.section {
    padding: 72px 0;
}

.section--alt {
    background: var(--bg-alt);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.section__title {
    margin: 0 0 36px;
    font-size: clamp(1.5rem, 3vw, 2.1rem);
    color: var(--navy);
    position: relative;
    padding-bottom: 14px;
}

.section__title::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 64px;
    height: 4px;
    border-radius: 2px;
    background: var(--gold);
}

/* О компании */

.about-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-left: 5px solid var(--gold);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px 32px;
    max-width: 820px;
    font-size: 1.05rem;
}

.about-card p:first-child {
    margin-top: 0;
}

.about-card p:last-child {
    margin-bottom: 0;
}

/* Услуги */

.service-group + .service-group {
    margin-top: 48px;
}

.service-group__title {
    display: inline-block;
    margin: 0 0 24px;
    padding: 8px 20px;
    border-radius: 999px;
    background: var(--navy);
    color: var(--gold-light);
    font-size: 1.15rem;
    letter-spacing: 0.02em;
}

.service-grid {
    display: grid;
    /* min(100%, ...) не даёт карточкам распирать страницу на очень узких
       экранах и при сильном увеличении масштаба. */
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: 22px;
}

.service-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-top: 4px solid var(--gold);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px 26px;
    transition: transform 0.15s, box-shadow 0.15s;
}

.service-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.service-card h4 {
    margin: 0 0 10px;
    font-size: 1.12rem;
    color: var(--navy);
}

.service-card p {
    margin: 0;
    color: var(--muted);
    font-size: 0.97rem;
}

/* Контакты */

.contacts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
    gap: 22px;
}

.contact-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px 26px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.contact-card__label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gold);
    font-weight: 700;
}

.contact-card a {
    color: var(--navy);
    text-decoration: none;
    font-weight: 600;
    word-break: break-word;
}

.contact-card a:hover {
    color: var(--gold);
}

.map-embed {
    margin-top: 22px;
    padding: 14px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.map-embed__links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    margin-bottom: 10px;
    font-size: 0.85rem;
}

.map-embed__links a {
    color: var(--muted);
    text-decoration: none;
}

.map-embed__links a:hover {
    color: var(--gold);
}

.map-embed iframe {
    display: block;
    width: 100% !important;
    height: 420px !important;
    border: none !important;
    border-radius: 10px;
}

/* Тосты (всплывающие сообщения) */

.toast-stack {
    position: fixed;
    top: 76px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    width: min(560px, calc(100vw - 32px));
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 22px;
    border-radius: var(--radius);
    box-shadow: 0 14px 40px rgba(20, 33, 61, 0.35);
    color: #fff;
    font-size: 1.08rem;
    font-weight: 600;
    animation: toast-in 0.45s cubic-bezier(0.21, 1.02, 0.73, 1);
}

/* Отсчёт до автоскрытия: тонкая полоска вдоль верхней грани тоста в его же
   цветовой гамме, чтобы не бросалась в глаза. Длительность должна совпадать
   с таймаутом 5000 мс в base.html. */
.toast__progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 4px;
    width: 100%;
    background: rgba(255, 255, 255, 0.45);
    transform-origin: left;
    animation: toast-progress 5s linear forwards;
}

.toast--success {
    background: linear-gradient(135deg, #1e8e46, #27ae60);
}

.toast--error,
.toast--warning {
    background: linear-gradient(135deg, #b03030, #d04545);
}

.toast__icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.22);
    font-size: 1.2rem;
}

.toast__text {
    flex: 1;
}

.toast__close {
    flex-shrink: 0;
    border: none;
    background: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

.toast__close:hover {
    color: #fff;
}

.toast--hiding {
    opacity: 0;
    transform: translateY(-14px);
    transition: opacity 0.5s, transform 0.5s;
}

@keyframes toast-progress {
    from {
        transform: scaleX(1);
    }
    to {
        transform: scaleX(0);
    }
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(-24px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Плашки с ошибками */

.alert {
    margin: 20px 0 0;
    padding: 14px 20px;
    border-radius: var(--radius);
    border: 1px solid;
    font-weight: 500;
}

.alert--success {
    background: #eefaf0;
    border-color: #bfe6c8;
    color: #1d6b34;
}

.alert--error {
    background: #fdf0f0;
    border-color: #f0c4c4;
    color: #a13232;
}

/* Страница заявки */

.page-hero {
    background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 55%, #1d3358 100%);
    color: #fff;
    padding: 52px 0 56px;
}

.page-hero h1 {
    margin: 0;
    font-size: clamp(1.6rem, 3.5vw, 2.4rem);
}

.page-hero p {
    margin: 12px 0 0;
    color: rgba(255, 255, 255, 0.85);
}

.form-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-top: 4px solid var(--gold);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px 36px;
    max-width: 640px;
}

.form-field {
    margin-bottom: 20px;
}

.form-field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--navy);
    font-size: 0.95rem;
}

.form-card input,
.form-card select,
.form-card textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    color: var(--ink);
    font: inherit;
    font-size: 0.97rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-card input:focus,
.form-card select:focus,
.form-card textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.18);
}

.form-card textarea {
    resize: vertical;
    min-height: 110px;
}

.form-field--captcha {
    margin-top: 26px;
}

/* Блок «Я не робот», оформлен по образцу привычных капча-виджетов */

.captcha-box {
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: 320px;
    padding: 16px 20px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    box-shadow: var(--shadow);
    user-select: none;
}

.captcha-box input[type="checkbox"] {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    accent-color: #1e8e46;
    cursor: pointer;
}

.captcha-box label {
    margin: 0;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
}

.captcha-box--passed {
    border-color: #bfe6c8;
    background: #eefaf0;
}

.captcha-box--passed label {
    color: #1d6b34;
}

.captcha-dialog {
    border: none;
    border-radius: var(--radius);
    box-shadow: 0 24px 70px rgba(13, 23, 48, 0.45);
    padding: 28px 32px;
    width: min(400px, calc(100vw - 40px));
    text-align: center;
}

.captcha-dialog::backdrop {
    background: rgba(13, 23, 48, 0.55);
}

.captcha-dialog h3 {
    margin: 0 0 6px;
    color: var(--navy);
}

.captcha-dialog__hint {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 0.95rem;
}

.captcha-dialog__image {
    display: block;
    margin: 0 auto 14px;
    max-width: 100%;
    min-height: 74px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
}

.captcha-dialog__input {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font: inherit;
    font-size: 1.15rem;
    text-align: center;
    letter-spacing: 0.35em;
    text-transform: uppercase;
}

.captcha-dialog__input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.18);
}

.captcha-dialog__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 16px;
}

.captcha-dialog__actions .btn {
    padding: 10px 18px;
    font-size: 0.92rem;
    border: none;
    cursor: pointer;
}

.btn--outline {
    background: none;
    border: 1px solid var(--border) !important;
    color: var(--navy);
}

.btn--outline:hover {
    border-color: var(--gold) !important;
    color: var(--gold);
}

.form-card input.input--invalid {
    border-color: #c94f4f;
    box-shadow: 0 0 0 3px rgba(201, 79, 79, 0.15);
}

.field-error {
    margin: 6px 0 0;
    color: #a13232;
    font-size: 0.88rem;
}

.btn--submit {
    border: none;
    cursor: pointer;
    width: 100%;
    margin-top: 6px;
}

/* Подвал */

.footer {
    background: var(--navy-dark);
    color: rgba(255, 255, 255, 0.7);
    padding: 28px 0;
    text-align: center;
    font-size: 0.9rem;
}

.footer p {
    margin: 0;
}

/* --- Адаптивная раскладка ---------------------------------------------- */

/* Широкие мониторы: даём контенту дышать вместо огромных полей. */
@media (min-width: 1500px) {
    .container {
        max-width: 1280px;
    }

    body {
        font-size: 1.05rem;
    }
}

/* Планшеты и узкие окна ноутбуков (а также ~125–150% масштаба на десктопе). */
@media (max-width: 900px) {
    .section {
        padding: 56px 0;
    }

    .hero {
        padding: 68px 0 76px;
    }

    .about-card {
        padding: 24px 26px;
    }
}

/* Телефоны / очень крупный масштаб. */
@media (max-width: 720px) {
    .container {
        padding: 0 16px;
    }

    .site-header__inner {
        flex-direction: column;
        gap: 10px;
        padding-top: 12px;
        padding-bottom: 12px;
        text-align: center;
    }

    .site-nav {
        justify-content: center;
        gap: 14px 18px;
    }

    .hero {
        padding: 52px 0 60px;
        text-align: center;
    }

    .hero__tagline {
        margin-left: auto;
        margin-right: auto;
    }

    .hero__actions {
        justify-content: center;
    }

    .section {
        padding: 44px 0;
    }

    .section__title {
        margin-bottom: 26px;
    }

    .service-group + .service-group {
        margin-top: 36px;
    }

    .form-card {
        padding: 24px 18px;
    }

    .toast-stack {
        top: 12px;
    }

    .toast {
        padding: 16px 18px;
        font-size: 1rem;
    }
}

/* Небольшие телефоны. */
@media (max-width: 480px) {
    .hero__actions {
        flex-direction: column;
        align-items: stretch;
    }

    .btn {
        text-align: center;
    }

    .service-card {
        padding: 20px 18px;
    }

    .contact-card {
        padding: 18px 20px;
    }

    .map-embed iframe {
        height: 280px !important;
    }

    .captcha-dialog {
        padding: 22px 18px;
    }

    .captcha-dialog__actions {
        flex-direction: column;
        align-items: stretch;
    }
}
