/* Manrope, variable weight 200-800, self-hosted (the CSP allows only 'self').
   Licence: fonts/Manrope-OFL.txt. The browser downloads only the subsets
   the page uses; Russian text needs both (« » and — are in the Latin one).
   base.html preloads both. "optional": if the font is not there for the
   first paint, this visit keeps the system font instead of swapping
   mid-read (that moved the text); the next visit has it cached. */
@font-face {
    font-family: "Manrope";
    font-style: normal;
    font-weight: 200 800;
    font-display: optional;
    src: url("../fonts/manrope-cyrillic-wght-normal.woff2") format("woff2");
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: "Manrope";
    font-style: normal;
    font-weight: 200 800;
    font-display: optional;
    src: url("../fonts/manrope-latin-wght-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    --accent: #5b4ee8;
    --accent-dark: #4638d4;
    --text: #16161d;
    --muted: #5c5c6b;
    --text-soft: #3d3d4a;

    /* Type scale: every font-size below uses one of these */
    --fs-sm: 0.9375rem;                     /* 15px: footer */
    --fs-base: 1.0625rem;                   /* 17px: body text, buttons */
    --fs-lg: 1.25rem;                       /* 20px: card titles, hero lead */
    --fs-label-wide: 1.375rem;              /* 22px: section label, wide screens */
    --fs-xl: clamp(1.75rem, 4vw, 2.5rem);   /* section titles */
    --fs-2xl: clamp(2.25rem, 6vw, 3.5rem);  /* hero title */
    --title: #1e1b4b;
    --surface: #f5f5fa;
    --radius: 8px;
    --container: 960px;
    --gutter: 16px;
}

*, *::before, *::after {
    box-sizing: border-box;
}

/* No `scroll-behavior: smooth` here: with it Chrome also animates the
   scroll restore on reload (F5 at the bottom showed the top first).
   main.js smooth-scrolls in-page links instead. */

body {
    margin: 0;
    font-family: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: var(--fs-base);
    line-height: 1.55;
    color: var(--text);
    background: #fff;
}

img {
    display: block;
    max-width: 100%;
}

h1, h2, h3 {
    margin: 0 0 0.5em;
    line-height: 1.15;
}

/* ===== Buttons ===== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    padding: 0.85em 1.5em;
    border-radius: var(--radius);
    background: var(--accent);
    color: #fff;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}

.btn:hover {
    background: var(--accent-dark);
}

.btn:focus-visible,
.float-chat:focus-visible,
.hero__scroll:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

.btn--outline {
    background: transparent;
    color: var(--accent);
    box-shadow: inset 0 0 0 2px var(--accent);
}

.btn--outline:hover {
    background: var(--accent);
    color: #fff;
}

/* ===== Hero ===== */

.hero {
    position: relative;
    isolation: isolate;
    display: flex;
    align-items: center;
    min-height: 100vh;
    min-height: 100svh;
    overflow: hidden;
    /* Shown until the photo is painted: its average colour (printed by
       tools/prepare_image.py), not a white flash on reload */
    background: #a98a67;
    color: #fff;
}

.hero__bg {
    position: absolute;
    inset: 0;
    z-index: -2;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Darkens the photo so white text stays readable */
.hero::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: rgba(10, 20, 40, 0.45);
}

.hero__brand {
    position: absolute;
    top: 20px;
    left: max(var(--gutter), calc((100% - var(--container)) / 2 + var(--gutter)));
}

/* White logo (tools/prepare_image.py --knockout); width/height in the HTML
   keep its space reserved while it loads */
.hero__brand img {
    display: block;
    width: auto;
    height: 40px;
}

@media (min-width: 768px) {
    .hero__brand img {
        height: 48px;
    }
}

.hero__inner {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 96px var(--gutter);
}

.hero__content {
    max-width: 28rem;
}

@media (min-width: 768px) {
    .hero__content {
        margin-left: 45%;
    }
}

.hero__title {
    font-size: var(--fs-2xl);
    font-weight: 800;
}

.hero__lead {
    margin: 0 0 1.75rem;
    font-size: var(--fs-lg);
    opacity: 0.9;
}

.hero__scroll {
    position: absolute;
    bottom: 16px;
    left: 50%;
    padding: 8px;
    color: #fff;
    transform: translateX(-50%);
}

/* ===== Sections ===== */

.section {
    max-width: var(--container);
    margin: 0 auto;
    padding: 72px var(--gutter);
}

.section--center {
    text-align: center;
}

.section__title {
    font-size: var(--fs-xl);
    font-weight: 800;
}

.section__lead {
    max-width: 32rem;
    margin: 0 auto 1.75rem;
    color: var(--text-soft);
}

.contact__buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.contact__note {
    margin: 1rem 0 0;
    color: var(--muted);
    font-size: var(--fs-sm);
}

/* A contact link without an address yet (index.html: empty contact) */
.contact-link--inactive {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn.contact-link--inactive:hover {
    background: var(--accent);
}

.btn--outline.contact-link--inactive:hover {
    background: transparent;
    color: var(--accent);
}

/* ===== Direction cards ===== */

/* Flex, not grid: an incomplete last row (5 cards = 3 + 2) is centred */
.cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 24px;
}

.card {
    flex: 1 1 100%;
}

@media (min-width: 600px) {
    .card {
        flex: 0 1 calc((100% - 24px) / 2);
    }
}

@media (min-width: 900px) {
    .card {
        flex: 0 1 calc((100% - 2 * 24px) / 3);
    }
}

/* 16:9 on phones keeps five cards from taking four screens; square from
   tablet width up */
.card__img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: var(--radius);
    /* Shown until the image is painted: a soft shape, not a white blink */
    background: var(--surface);
}

@media (min-width: 768px) {
    .card__img {
        aspect-ratio: 1;
    }
}

.card__title {
    margin: 16px 0 6px;
    color: var(--title);
    font-size: var(--fs-lg);
    font-weight: 700;
}

.card__lead {
    margin: 0 0 0.5em;
    font-weight: 600;
}

.card__list {
    margin: 0;
    padding-left: 1.1em;
    color: var(--text-soft);
}

.card__list li + li {
    margin-top: 4px;
}

.card__list li::marker {
    color: var(--accent);
}

/* ===== Extra service ===== */

/* Right under the cards: no extra top padding, it belongs to them */
.extra {
    padding-top: 0;
}

.extra__box {
    padding: 28px 24px;
    border-radius: var(--radius);
    background: var(--surface);
    text-align: center;
}

.extra__title {
    margin: 0 0 0.4em;
    color: var(--title);
    font-size: var(--fs-lg);
    font-weight: 700;
}

.extra__text {
    margin: 0;
    color: var(--text-soft);
}

/* ===== About ===== */

.about {
    display: grid;
    align-items: center;
    gap: 40px;
}

@media (min-width: 768px) {
    .about {
        grid-template-columns: 1fr 1fr;
    }
}

.eyebrow {
    margin: 0 0 0.5rem;
    color: var(--accent);
    font-size: var(--fs-base);
    font-weight: 600;
}

/* Next to a 40px title 15px gets lost on a wide screen */
@media (min-width: 768px) {
    .eyebrow {
        font-size: var(--fs-label-wide);
    }
}

.about__text p:not(.eyebrow) {
    color: var(--text-soft);
}

/* One round portrait, centred in its column */
.about__photos {
    width: 100%;
    max-width: 340px;
    margin: 0 auto;
}

.about__portrait {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 50%;
    /* Shown until the photo is painted: its average colour, not a white blink */
    background: #5f4c3d;
}

/* ===== Reviews ===== */

/* Two columns on desktop (4 reviews = 2 x 2), one on phones */
.reviews__list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 1.75rem;
    text-align: left;
}

.review {
    margin: 0;
    padding: 20px 22px;
    border-radius: var(--radius);
    background: var(--surface);
}

.review__text {
    margin: 0 0 12px;
    color: var(--text-soft);
}

.review__author {
    font-weight: 600;
}

.review__meta {
    color: var(--muted);
    font-size: var(--fs-sm);
    font-weight: 400;
}

/* ===== Error pages (404, 500) ===== */

.error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100svh;
    text-align: center;
}

/* ===== Footer ===== */

.footer {
    background: var(--surface);
}

.footer__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px 24px;
    max-width: var(--container);
    margin: 0 auto;
    /* Bottom room so the floating button does not cover the footer text */
    padding: 32px var(--gutter) 96px;
    color: var(--muted);
    font-size: var(--fs-sm);
}

.footer__inner p {
    margin: 0;
}

.footer__brand {
    color: var(--text);
    font-weight: 700;
}

/* The logo's tagline */
.footer__tagline {
    margin-left: 6px;
    color: var(--muted);
    font-weight: 400;
}

.footer__links {
    display: flex;
    gap: 16px;
}

.footer__links a {
    color: var(--accent);
}

.footer__note {
    flex-basis: 100%;
}

/* ===== Floating "Написать нам" button ===== */

.float-chat {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 10;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-weight: 500;
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    transition: background 0.2s;
}

/* Set by main.js after the first state is applied: no slide-in on load */
.float-chat--animated {
    transition: background 0.2s, opacity 0.2s, transform 0.2s, visibility 0.2s;
}

.float-chat:hover {
    background: var(--accent-dark);
}

/* Set by main.js while the hero is on screen */
.float-chat--hidden {
    visibility: hidden;
    opacity: 0;
    transform: translateY(8px);
}
