/*
 * Публичный лендинг проекта 03.
 * Mobile-first, без внешних зависимостей. Светлая нейтральная тема, крупные
 * зоны нажатия, видимый фокус, отсутствие горизонтальной прокрутки.
 */

:root {
    /* Палитра подобрана под фотографии древесины: тёплый природный
       серо-бежевый фон вместо почти белого; карточки/секции — светлее фона,
       поэтому визуально различаются. Контраст текста ≥ 4.5:1 (проверено). */
    --bg: #ece4d6;
    --surface: #fbf8f3;
    --ink: #2a2620;
    --muted: #6a6053;
    --line: #ded2c0;
    --accent: #8a4b1f;
    --accent-ink: #ffffff;
    --demo-bg: #fdf1dc;
    --demo-ink: #7a4a00;
    --demo-line: #eddcb6;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(42, 38, 32, 0.06);
    --wrap: 1080px;
    /* Индикатор фокуса: тёмный, с контрастом ≥ 12:1 к светлому фону (не только
       к фону, но и к светлой подложке) — WCAG 1.4.11. */
    --focus: #4a2408;
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

body.site {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

img {
    max-width: 100%;
    height: auto;
}

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

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

/* --- Ссылка «к содержимому» (клавиатура) --- */
.skip-link {
    position: absolute;
    left: 8px;
    top: 8px;
    z-index: 100;
    transform: translateY(-200%);
    padding: 10px 16px;
    background: var(--surface);
    color: var(--ink);
    border: 2px solid var(--focus);
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
}

.skip-link:focus {
    transform: translateY(0);
}

/* Якорные секции не «прячутся» под краем окна при переходе. */
.section,
.site-header,
.hero {
    scroll-margin-top: 12px;
}

.muted {
    color: var(--muted);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* --- Кнопки --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 10px 20px;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    border-radius: 999px;
    border: 1px solid transparent;
}

.btn--primary {
    background: var(--accent);
    color: var(--accent-ink);
}

.btn--primary:hover {
    background: #743f1a;
}

.btn--ghost {
    background: var(--surface);
    color: var(--accent);
    border-color: var(--accent);
}

.btn--ghost:hover {
    background: #efe4d5;
}

/* --- Шапка --- */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.site-header__inner {
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 10px 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
}

.site-header__brand {
    font-size: 1.2rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--ink);
}

.site-header__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.site-header__phone {
    font-weight: 600;
    text-decoration: none;
    color: var(--ink);
    white-space: nowrap;
    /* Крупная зона нажатия на узких экранах. */
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.site-header__order {
    min-height: 40px;
    padding: 6px 16px;
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-left: auto;
}

.site-nav__link {
    padding: 10px 12px;
    border-radius: 999px;
    text-decoration: none;
    color: var(--ink);
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.site-nav__link:hover {
    background: var(--bg);
}

/* --- Hero --- */
/* Первый экран — фотография (декоративный фон) + затемнение под текст.
   Минимальная суммарная непрозрачность затемнения ≥ 0.62 по всей ширине,
   поэтому светлый текст читается и на мобильных (проверено по реальному
   изображению: худший контраст ≈ 4.6:1, обычный текст проходит WCAG AA). */
.hero {
    background-color: #241c13;
    background-image:
        linear-gradient(90deg, rgba(18, 13, 9, 0.35), rgba(18, 13, 9, 0) 65%),
        linear-gradient(rgba(18, 13, 9, 0.62), rgba(18, 13, 9, 0.62)),
        url("/assets/img/hero-firewood.jpg");
    background-position: center, center, center;
    background-size: 100% 100%, 100% 100%, cover;
    background-repeat: no-repeat, no-repeat, no-repeat;
    border-bottom: 1px solid var(--line);
    color: #f3ece0;
}

.hero__inner {
    max-width: var(--wrap);
    margin: 0 auto;
    padding: clamp(44px, 8vw, 92px) 16px;
}

.hero__title {
    margin: 0 0 12px;
    font-size: clamp(1.6rem, 5vw, 2.6rem);
    line-height: 1.2;
    overflow-wrap: break-word;
    color: #ffffff;
    text-shadow: 0 1px 14px rgba(0, 0, 0, 0.45);
}

.hero__intro {
    max-width: 60ch;
    color: #f1eadd;
}

.hero__price {
    margin: 16px 0 0;
    font-size: 1.15rem;
    font-weight: 600;
    color: #ffffff;
}

.hero__actions {
    margin: 20px 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.hero__note {
    margin: 12px 0 0;
}

/* На тёмном фоне подвала фокуса делаем индикатор светлым (WCAG 1.4.11). */
.hero :focus-visible {
    outline-color: #ffffff;
}

.hero .muted,
.hero__note.muted {
    color: #e6dccb;
}

/* --- Секции --- */
.section {
    padding: 32px 0;
    scroll-margin-top: 16px;
}

.section__inner {
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 0 16px;
}

.section__title {
    margin: 0 0 16px;
    font-size: clamp(1.3rem, 3.5vw, 1.8rem);
}

.section__text {
    max-width: 65ch;
}

/* --- Каталог --- */
.catalog__group + .catalog__group {
    margin-top: 32px;
}

.catalog__group-title {
    margin: 0 0 14px;
    font-size: 1.15rem;
    color: var(--muted);
    text-transform: none;
}

.catalog__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 640px) {
    .catalog__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 980px) {
    .catalog__grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* --- Карточка товара --- */
.card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card__media {
    margin: 0;
    aspect-ratio: 4 / 3;
    background: #e9dfd0;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Стабильная пропорция медиа-блока: изображение любой ориентации
       вписывается через object-fit: cover, не растягивая и не искажая карточку. */
    overflow: hidden;
    min-height: 0;
}

.card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.card__body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    gap: 12px;
    padding: 16px;
}

.card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.card__title {
    margin: 0;
    font-size: 1.15rem;
    overflow-wrap: break-word;
}

.card__badge {
    flex: 0 0 auto;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--demo-bg);
    color: var(--demo-ink);
    border: 1px solid var(--demo-line);
    font-size: 0.8rem;
    white-space: nowrap;
}

.card__desc {
    margin: 0;
    color: var(--muted);
}

/* --- Характеристики --- */
.chars {
    margin: 0;
    display: grid;
    gap: 6px;
}

.chars__row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    padding-bottom: 6px;
    border-bottom: 1px dashed var(--line);
}

.chars__row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.chars__label {
    color: var(--muted);
    font-size: 0.9rem;
}

.chars__value {
    margin: 0;
    margin-left: auto;
    text-align: right;
    font-weight: 600;
    overflow-wrap: anywhere;
}

/* --- Цена и уровни --- */
.price {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
}

.price__main {
    font-size: 1.35rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.price__state {
    color: var(--muted);
    font-size: 0.9rem;
}

.tiers-wrap {
    /* Таблица цен при узком экране прокручивается внутри карточки,
       не создавая горизонтальной прокрутки страницы и не обрезаясь. */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tiers {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.tiers caption {
    text-align: left;
}

.tiers th,
.tiers td {
    padding: 6px 8px;
    text-align: left;
    border-bottom: 1px solid var(--line);
}

.tiers th {
    color: var(--muted);
    font-weight: 600;
    white-space: nowrap;
}

.tiers tbody tr:last-child td {
    border-bottom: 0;
}

.card__note {
    margin: 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.card__actions {
    margin: 0;
    margin-top: auto;
}

.card__order {
    width: 100%;
}

/* --- FAQ --- */
.faq {
    margin: 0;
    max-width: 70ch;
}

.faq__q {
    margin: 16px 0 4px;
    font-weight: 700;
}

.faq__q:first-child {
    margin-top: 0;
}

.faq__a {
    margin: 0 0 4px;
    color: var(--muted);
}

/* --- Контакты --- */
.contacts {
    margin: 0;
    display: grid;
    gap: 12px;
}

.contacts__item {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.contacts__label {
    color: var(--muted);
}

.contacts__value {
    margin: 0;
    margin-left: auto;
    font-weight: 600;
    word-break: break-word;
}

.contacts__link {
    color: var(--accent);
    text-decoration: none;
    /* Крупная зона нажатия у контактной ссылки (без сдвига строки). */
    display: inline-block;
    padding: 6px 0;
}

.contacts__link:hover {
    text-decoration: underline;
}

.contacts__meta {
    margin: 12px 0 0;
    color: var(--muted);
}

/* --- Подвал --- */
.site-footer {
    margin-top: 24px;
    background: var(--surface);
    border-top: 1px solid var(--line);
}

.site-footer__inner {
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 24px 16px 32px;
    color: var(--muted);
    font-size: 0.9rem;
}

.site-footer__brand {
    margin: 0 0 8px;
    font-weight: 700;
    color: var(--ink);
}

.site-footer__note {
    margin: 0 0 8px;
    max-width: 70ch;
    overflow-wrap: break-word;
}

/* Краткое предупреждение демо-режима — единственное место на странице. */
.site-footer__demo {
    margin: 0 0 8px;
    max-width: 70ch;
    color: var(--demo-ink);
    overflow-wrap: break-word;
}

.site-footer__copy {
    margin: 0;
}

/* --- Кнопка «Наверх» --- */
.to-top {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 30;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 2px 10px rgba(42, 38, 32, 0.18);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
}

.to-top:hover {
    background: var(--bg);
}

.to-top[hidden] {
    display: none;
}

.to-top__icon {
    font-size: 1.15rem;
    line-height: 1;
}

@media (max-width: 760px) {
    .to-top {
        right: 12px;
        /* Выше закреплённой мобильной панели, чтобы её не перекрывать. */
        bottom: 76px;
        padding: 10px 14px;
    }
}

/* --- Мобильная панель (только узкие экраны) --- */
.mobile-panel {
    display: none;
}

@media (max-width: 760px) {
    .mobile-panel {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 20;
        display: flex;
        gap: 4px;
        padding: 6px 8px;
        background: var(--surface);
        border-top: 1px solid var(--line);
        box-shadow: 0 -1px 4px rgba(42, 38, 32, 0.08);
        overflow-x: auto;
    }

    .mobile-panel__link {
        flex: 0 0 auto;
        padding: 10px 14px;
        border-radius: 999px;
        text-decoration: none;
        color: var(--ink);
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    .mobile-panel__link:hover {
        background: var(--bg);
    }

    .mobile-panel__toggle {
        flex: 0 0 auto;
        min-height: 44px;
        padding: 10px 14px;
        border: 1px solid var(--line);
        border-radius: 999px;
        background: var(--bg);
        color: var(--ink);
        font: inherit;
        font-weight: 600;
        cursor: pointer;
    }

    /* Скрытие работает и для <a>, и для <button>: [hidden] переопределяет display. */
    .mobile-panel__link[hidden],
    .mobile-panel__toggle[hidden] {
        display: none;
    }

    /* Резерв под фиксированную панель, чтобы она не перекрывала контент. */
    body.site {
        padding-bottom: 64px;
    }
}
