/**
 * theme.css — слой дизайн-токенов и базовых стилей.
 *
 * Значения, зависящие от цветовой схемы сайта, приходят из PHP:
 * design/top.php печатает :root-блок с --c-brand, --c-accent и т.п.
 * Здесь заданы только значения по умолчанию, чтобы файл работал автономно.
 */

:root {
    /* ---------- Палитра сайта (переопределяется из PHP) ---------- */
    --c-brand: #9a2c2c;
    --c-brand-rgb: 154, 44, 44;
    --c-brand-hover: #b53333;
    --c-brand-soft: #d36767;
    --c-brand-soft-hover: #da8181;
    --c-nav-surface: #ffffff;

    --c-accent: #ffb100;
    --c-accent-rgb: 255, 177, 0;
    --c-accent-fg: #1b1a17;

    --c-price-bg: #ffc800;
    --c-price-fg: #1b1a17;
    --c-price-bd: #ffc458;

    /* ---------- Нейтральная шкала (тёплая) ---------- */
    --c-bg: #f4f2ef;
    --c-bg-deep: #e9e6e1;
    --c-surface: #ffffff;
    --c-surface-2: #faf9f7;
    --c-surface-3: #f2f0ec;

    --c-border: #e7e3dd;
    --c-border-soft: #f0ede8;
    --c-border-strong: #d5cfc6;

    --c-text: #1b1a17;
    --c-text-2: #57534c;
    --c-text-3: #8b857b;
    --c-text-inverse: #ffffff;

    /* ---------- Семантические ---------- */
    --c-sale: #dc2626;
    --c-sale-bg: #fef2f2;
    --c-success: #15803d;
    --c-success-bg: #f0fdf4;
    --c-warn: #b45309;
    --c-warn-bg: #fffbeb;
    --c-danger: #b91c1c;
    --c-info-bg: #eff6ff;

    /* ---------- Типографика ---------- */
    --ff-base: "RalewayRegular", "Raleway", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --ff-semi: "RalewaySemibold", "Raleway", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --ff-light: "RalewayLight", "Raleway", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

    --fs-2xs: 0.6875rem;  /* 11px */
    --fs-xs: 0.75rem;     /* 12px */
    --fs-sm: 0.8125rem;   /* 13px */
    --fs-md: 0.875rem;    /* 14px */
    --fs-base: 1rem;      /* 16px */
    --fs-lg: 1.125rem;    /* 18px */
    --fs-xl: 1.25rem;     /* 20px */
    --fs-2xl: 1.5rem;     /* 24px */
    --fs-h3: clamp(1.0625rem, 0.98rem + 0.4vw, 1.25rem);
    --fs-h2: clamp(1.375rem, 1.15rem + 1.1vw, 1.875rem);
    --fs-h1: clamp(1.5rem, 1.2rem + 1.5vw, 2.125rem);

    --lh-tight: 1.2;
    --lh-snug: 1.35;
    --lh-base: 1.55;
    --lh-loose: 1.7;

    /* ---------- Шкала отступов (шаг 4px) ---------- */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
    --sp-7: 32px;
    --sp-8: 40px;
    --sp-9: 48px;
    --sp-10: 64px;

    /* ---------- Радиусы ---------- */
    --r-xs: 6px;
    --r-sm: 10px;
    --r-md: 14px;
    --r-lg: 18px;
    --r-xl: 24px;
    --r-pill: 999px;

    /* ---------- Тени ---------- */
    --sh-xs: 0 1px 2px rgba(27, 26, 23, 0.05);
    --sh-sm: 0 1px 2px rgba(27, 26, 23, 0.05), 0 2px 6px rgba(27, 26, 23, 0.04);
    --sh-md: 0 2px 4px rgba(27, 26, 23, 0.05), 0 8px 20px rgba(27, 26, 23, 0.07);
    --sh-lg: 0 4px 8px rgba(27, 26, 23, 0.06), 0 16px 36px rgba(27, 26, 23, 0.1);
    --sh-pop: 0 8px 16px rgba(27, 26, 23, 0.1), 0 24px 64px rgba(27, 26, 23, 0.18);
    --sh-inset: inset 0 1px 2px rgba(27, 26, 23, 0.06);
    --ring-brand: 0 0 0 3px rgba(var(--c-brand-rgb), 0.25);
    --ring-accent: 0 0 0 3px rgba(var(--c-accent-rgb), 0.35);

    /* ---------- Анимации ---------- */
    --tr-fast: 0.14s ease;
    --tr: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    --tr-slow: 0.36s cubic-bezier(0.4, 0, 0.2, 1);

    /* ---------- Слои ---------- */
    --z-base: 1;
    --z-sticky: 90;
    --z-header: 100;
    --z-cart: 200;
    --z-overlay: 9000;
    --z-modal: 10000;
    --z-loader: 99990;

    /* ---------- Раскладка ---------- */
    --w-page: 1440px;
    --w-aside: 312px;
    --h-header: 66px;
    --h-navbar: 52px;
    --pad-page: var(--sp-6);
}

@media (max-width: 900px) {
    :root {
        --h-header: 58px;
        --h-navbar: 66px;
        --pad-page: var(--sp-4);
    }
}

/* =====================================================================
   Базовый слой
   ===================================================================== */

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

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

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

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

html,
body {
    width: 100%;
    margin: 0;
    padding: 0;
}

body {
    min-height: 100%;
    background-color: var(--c-bg);
    background-image: none;
    color: var(--c-text);
    font-family: var(--ff-base);
    font-size: var(--fs-base);
    line-height: var(--lh-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.is-locked {
    overflow: hidden;
}

img,
svg,
video {
    max-width: 100%;
    vertical-align: middle;
}

a {
    color: var(--c-brand);
    text-decoration: none;
    transition: color var(--tr-fast);
}

a:hover {
    color: var(--c-brand-hover);
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

table {
    border-collapse: collapse;
}

/* Заголовки: убираем браузерные отступы, размеры задают компоненты */
h1,
h2,
h3,
h4 {
    margin: 0;
    font-weight: 400;
    line-height: var(--lh-tight);
}

hr {
    height: 1px;
    margin: var(--sp-5) 0;
    border: 0;
    background: var(--c-border);
}

::selection {
    background: rgba(var(--c-brand-rgb), 0.18);
}

:focus-visible {
    outline: 2px solid var(--c-brand);
    outline-offset: 2px;
}

/* Скрыто визуально, доступно скринридерам */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Индикатор загрузки без GIF */
.spinner {
    display: inline-block;
    width: 22px;
    height: 22px;
    border: 2.5px solid rgba(var(--c-brand-rgb), 0.18);
    border-top-color: var(--c-brand);
    border-radius: 50%;
    animation: spinner-rotate 0.7s linear infinite;
}

.spinner--sm {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

.spinner--lg {
    width: 34px;
    height: 34px;
    border-width: 3px;
}

.spinner--on-accent {
    border-color: rgba(27, 26, 23, 0.2);
    border-top-color: rgba(27, 26, 23, 0.75);
}

@keyframes spinner-rotate {
    to {
        transform: rotate(360deg);
    }
}

/* Плейсхолдер картинки до загрузки */
.img-skeleton {
    background: linear-gradient(100deg, var(--c-surface-3) 30%, var(--c-surface-2) 50%, var(--c-surface-3) 70%);
    background-size: 220% 100%;
    animation: skeleton-slide 1.4s ease-in-out infinite;
}

@keyframes skeleton-slide {
    from {
        background-position: 130% 0;
    }
    to {
        background-position: -30% 0;
    }
}
