/* ==================== RESET ==================== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font-body);
    background: var(--bg-cream);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
img { max-width: 100%; display: block; }
ul { list-style: none; }
.container { max-width: 1400px; margin: 0 auto; padding: 0 40px; }

/* ==================== PRELOADER ==================== */
.preloader {
    position: fixed; inset: 0;
    background: radial-gradient(ellipse at center, #FBF6F1 0%, #F5EDE6 60%, #EDE3D6 100%);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
    transition: opacity 0.8s ease, visibility 0s linear 0.8s;
}
.preloader.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.preloader::before, .preloader::after {
    content: ''; position: absolute; border-radius: 50%;
    background: radial-gradient(circle, rgba(207,188,174,0.28) 0%, transparent 70%);
    animation: preFloat 6s ease-in-out infinite;
}
.preloader::before { width: 380px; height: 380px; top: -80px; left: -80px; }
.preloader::after  { width: 460px; height: 460px; bottom: -100px; right: -120px; animation-delay: -3s; }
@keyframes preFloat {
    0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.7; }
    50%      { transform: translate(20px, -30px) scale(1.08); opacity: 1; }
}
.preloader-content { position: relative; text-align: center; z-index: 2; }
.preloader-ring {
    position: absolute; top: 50%; left: 50%;
    width: 280px; height: 280px;
    border: 1px solid rgba(157,135,121,0.18);
    border-top-color: var(--brand-brown);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: preSpin 1.6s linear infinite, preRingFade 0.8s ease-out 0.2s both;
}
@keyframes preSpin { from { transform: translate(-50%, -50%) rotate(0deg); } to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes preRingFade { from { opacity: 0; } to { opacity: 1; } }
.preloader-logo {
    position: relative; display: inline-block; padding: 40px 0;
    animation: preLogoReveal 1.1s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.preloader-logo img {
    display: block; height: 140px; width: auto;
    filter: brightness(0) saturate(100%) invert(58%) sepia(8%) saturate(708%) hue-rotate(353deg) brightness(91%) contrast(82%) drop-shadow(0 8px 22px rgba(157,135,121,0.25));
    animation: preBreathe 2.6s ease-in-out 1.1s infinite;
}
@keyframes preLogoReveal {
    0%   { opacity: 0; transform: scale(0.6) rotate(-6deg); filter: blur(8px); }
    60%  { opacity: 1; transform: scale(1.06) rotate(2deg); filter: blur(0); }
    100% { opacity: 1; transform: scale(1) rotate(0deg);    filter: blur(0); }
}
@keyframes preBreathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
.preloader-tagline {
    margin-top: 32px; font-family: var(--font-display); font-style: italic;
    font-size: 14px; letter-spacing: 6px; text-transform: uppercase;
    color: var(--brand-brown); opacity: 0;
    animation: preTaglineUp 0.9s ease-out 0.9s forwards;
}
@keyframes preTaglineUp {
    from { opacity: 0; transform: translateY(14px); letter-spacing: 12px; }
    to   { opacity: 1; transform: translateY(0);    letter-spacing: 6px; }
}
.preloader-line {
    position: relative; width: 220px; height: 1px;
    background: rgba(157,135,121,0.18); margin: 28px auto 0;
    overflow: hidden; opacity: 0;
    animation: preTaglineUp 0.6s ease-out 1.1s forwards;
}
.preloader-line::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent 0%, var(--brand-brown) 50%, transparent 100%);
    animation: preSlide 1.4s ease-in-out infinite;
}
@keyframes preSlide { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ==================== HEADER ==================== */
header {
    position: fixed; top: 0; left: 0; right: 0;
    z-index: 100; height: var(--header-h);
    background: rgba(245, 237, 230, 0.97);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    transition: background 0.3s ease;
}
header.scrolled { background: rgba(251, 246, 241, 0.98); }
.header-content {
    max-width: 1400px; margin: 0 auto; padding: 0 40px;
    height: 100%;
    display: flex; align-items: center; justify-content: space-between;
}
.header-logo { display: inline-flex; align-items: center; transition: transform 0.3s ease; }
.header-logo:hover { transform: scale(1.04); }
.header-logo img {
    height: 64px; width: auto;
    filter: brightness(0) saturate(100%) invert(58%) sepia(8%) saturate(708%) hue-rotate(353deg) brightness(91%) contrast(82%);
}
.header-nav { display: flex; align-items: center; gap: 36px; }
.header-nav .nav-link, .header-nav a {
    font-size: 11px; font-weight: 500; letter-spacing: 2.5px; text-transform: uppercase;
    color: var(--text-muted); transition: color 0.3s ease; position: relative;
}
.header-nav .nav-link.active, .header-nav .nav-link:hover,
.header-nav a.active, .header-nav a:hover { color: var(--brand-brown); }
.header-nav .nav-link::after, .header-nav a::after {
    content: ''; position: absolute; bottom: -4px; left: 0;
    width: 0; height: 1px; background: var(--brand-brown);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.header-nav .nav-link:hover::after, .header-nav .nav-link.active::after,
.header-nav a:hover::after, .header-nav a.active::after { width: 100%; }
.header-actions { display: flex; align-items: center; gap: 20px; }
.header-btn {
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    color: var(--text-muted); transition: background 0.3s ease;
    position: relative;
}
.header-btn:hover { background: rgba(157,135,121,0.10); color: var(--brand-brown); }
.header-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.5; }
.cart-badge {
    position: absolute; top: 2px; right: 2px;
    width: 16px; height: 16px;
    background: var(--brand-brown); color: #FFFFFF;
    font-size: 9px; font-weight: 600;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}
.mobile-toggle {
    display: none; flex-direction: column; gap: 5px;
    width: 44px; height: 44px;
    justify-content: center; align-items: center;
}
.mobile-toggle span {
    display: block; width: 22px; height: 1.5px;
    background: var(--text); transition: transform 0.3s, opacity 0.3s;
}
.mobile-toggle.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.mobile-toggle.open span:nth-child(2) { opacity: 0; }
.mobile-toggle.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

@media (max-width: 1024px) {
    .header-nav {
        display: none; position: absolute; top: var(--header-h); left: 0; right: 0;
        flex-direction: column; gap: 0;
        background: rgba(251,246,241,0.98); backdrop-filter: blur(20px);
        border-bottom: 1px solid var(--border);
        padding: 20px 24px;
        box-shadow: 0 12px 30px rgba(157,135,121,0.12);
    }
    .header-nav.open { display: flex; }
    .header-nav .nav-link, .header-nav a {
        padding: 14px 0; font-size: 13px; letter-spacing: 3px;
        border-bottom: 1px solid var(--border);
    }
    .header-nav .nav-link:last-child, .header-nav a:last-child { border-bottom: none; }
    .mobile-toggle { display: flex; }
}
@media (max-width: 768px) {
    .header-content { padding: 0 20px; }
    .header-logo img { height: 52px; }
}

main { min-height: 60vh; }
/* На главной Hero перекрывает шапку — без padding.
   На внутренних страницах сами секции имеют margin-top (см. .page-hero, .hero, .bc). */

/* ==================== FOOTER ==================== */
footer {
    background: var(--brand-cream);
    padding: 80px 0 0;
    color: var(--text);
    border-top: 1px solid var(--border);
}
footer .footer-grid {
    display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 60px;
    margin-bottom: 60px;
}
footer .footer-about p {
    font-size: 14px; font-weight: 300; color: var(--text-muted);
    line-height: 1.7; margin-top: 20px; margin-bottom: 24px;
}
footer .footer-logo { display: block; margin-bottom: 12px; }
footer .footer-logo img {
    height: 36px; width: auto;
    filter: brightness(0) saturate(100%) invert(58%) sepia(8%) saturate(708%) hue-rotate(353deg) brightness(91%) contrast(82%);
}
footer .footer-socials { display: flex; gap: 12px; }
footer .social-link {
    width: 40px; height: 40px;
    border: 1px solid var(--border); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); transition: all 0.3s ease;
}
footer .social-link:hover {
    border-color: var(--brand-brown); color: var(--brand-brown);
    transform: translateY(-2px);
}
footer .social-link svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.5; }
footer .footer-section h4 {
    font-family: var(--font-display); font-size: 16px; font-weight: 400;
    color: var(--text); margin-bottom: 24px;
}
footer .footer-links { display: flex; flex-direction: column; gap: 12px; }
footer .footer-links a {
    font-size: 13px; font-weight: 300; color: var(--text-muted);
    transition: color 0.3s ease;
}
footer .footer-links a:hover { color: var(--brand-brown); }
footer .footer-links li { font-size: 13px; color: var(--text-muted); font-weight: 300; }
footer .footer-bottom {
    border-top: 1px solid var(--border); padding: 24px 0;
    display: flex; justify-content: space-between; align-items: center;
    gap: 24px; flex-wrap: wrap;
}
footer .footer-copy { font-size: 12px; color: var(--text-dim); }
footer .footer-payments {
    display: flex; gap: 8px; align-items: center;
    font-size: 11px; color: var(--text-dim); letter-spacing: 1px;
}

/* Made in Kazakhstan + Разработка сайта */
footer .footer-made-in {
    display: inline-flex; align-items: center; gap: 10px;
    font-size: 12px; color: var(--text-muted);
}
footer .footer-made-in .flag-kz {
    width: 24px; height: 12px;
    border-radius: 2px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
    flex-shrink: 0;
}
footer .footer-made-in-text { letter-spacing: 0.2px; }
footer .footer-made-in-text a {
    color: var(--brand-brown); text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color .3s ease, color .3s ease;
}
footer .footer-made-in-text a:hover {
    color: var(--brand-brown-deep);
    border-bottom-color: var(--brand-brown);
}
footer .footer-made-in-text strong { font-weight: 600; }

@media (max-width: 600px) {
    footer .footer-bottom { flex-direction: column; gap: 14px; text-align: center; }
    footer .footer-made-in { justify-content: center; flex-wrap: wrap; }
}
@media (max-width: 1024px) { footer .footer-grid { grid-template-columns: 1fr 1fr; gap: 40px; } }
@media (max-width: 600px) {
    footer .footer-grid { grid-template-columns: 1fr; gap: 32px; }
    footer .footer-bottom { flex-direction: column; gap: 12px; text-align: center; }
    footer { padding-top: 50px; }
}

/* ==================== GPU композитинг (убираем зернистость) ==================== */
.product-image img, .rcard-img img, .gallery-main img,
.category-card img, .editorial-image img, .founder-image img,
.hero-bg img, .related-card img {
    -webkit-backface-visibility: hidden; backface-visibility: hidden;
    -webkit-transform: translateZ(0); transform: translateZ(0);
    will-change: transform;
    image-rendering: -webkit-optimize-contrast;
}
