/* ============================================================
   style.css - ОПТИМИЗИРОВАННАЯ ВЕРСИЯ
   ============================================================ */

/* ===== БАЗОВЫЙ СБРОС ===== */
* { margin:0; padding:0; box-sizing:border-box; }

:root {
    --primary: #2C3E50;
    --secondary: #34495E;
    --accent: #D4A574;
    --gold: #C9A96E;
    --dark: #1A1A2E;
    --light: #F8F5F0;
    --text: #333;
    --text-light: #666;
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
    --shadow-hover: 0 8px 40px rgba(0,0,0,0.15);
    --radius: 12px;
    --font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

html {
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-family);
    background: var(--light);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

/* ===== КОНТЕЙНЕРЫ ===== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ===== ГРИДЫ С АДАПТАЦИЕЙ ===== */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
}

/* ===== КАРТОЧКИ ТОВАРОВ ===== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

.product-card {
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    will-change: transform;
}

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

.product-image {
    width: 100%;
    height: auto;
    aspect-ratio: 1/1;
    object-fit: cover;
    background: #f0ece6;
}

/* ===== КНОПКИ ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 1.5rem;
    border: none;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
    min-height: 48px;
    touch-action: manipulation;
    user-select: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--gold));
    color: white;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(212,165,116,0.3); }

.btn-secondary {
    background: var(--dark);
    color: white;
}
.btn-secondary:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(0,0,0,0.2); }

.btn-block { width: 100%; }

/* ===== ФОРМЫ ===== */
input, select, textarea {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 2px solid #e0ddd8;
    border-radius: 10px;
    font-size: 1rem;
    background: #faf8f6;
    transition: all 0.3s;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: white;
    box-shadow: 0 0 0 3px rgba(212,165,116,0.1);
}

/* ============================================================
   АДАПТИВНОСТЬ
   ============================================================ */

/* ===== ПЛАНШЕТЫ (768px - 1024px) ===== */
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .container { padding: 0 1rem; }
    .products-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.5rem; }
}

/* ===== МОБИЛЬНЫЕ (до 768px) ===== */
@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; gap: 1rem; }
    .products-grid { grid-template-columns: repeat(2, 1fr); gap: 0.8rem; }
    .container { padding: 0 0.8rem; }
    
    .btn { 
        padding: 0.6rem 1rem; 
        font-size: 0.9rem; 
        min-height: 44px;
        width: 100%;
    }
    
    input, select, textarea { font-size: 16px; padding: 0.6rem 0.8rem; }
    
    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.2rem; }
}

/* ===== МАЛЕНЬКИЕ ТЕЛЕФОНЫ (до 480px) ===== */
@media (max-width: 480px) {
    .products-grid { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
    .container { padding: 0 0.5rem; }
    
    .product-card .product-info { padding: 0.8rem; }
    .product-card .product-title { font-size: 0.85rem; min-height: 36px; }
    .product-card .product-price { font-size: 1rem; }
    .product-card .product-image { aspect-ratio: 1/1; }
    
    .btn { font-size: 0.8rem; padding: 0.5rem 0.8rem; min-height: 40px; }
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.3rem; }
    
    .hide-mobile { display: none !important; }
}

/* ===== ТЕЛЕФОНЫ С МАЛЕНЬКИМ ЭКРАНОМ (до 360px) ===== */
@media (max-width: 360px) {
    .products-grid { grid-template-columns: 1fr 1fr; gap: 0.4rem; }
    .product-card .product-title { font-size: 0.75rem; }
    .product-card .product-price { font-size: 0.85rem; }
    .btn { font-size: 0.7rem; padding: 0.4rem 0.6rem; min-height: 34px; }
}

/* ===== ВЫСОКАЯ КОНТРАСТНОСТЬ (для слабовидящих) ===== */
@media (prefers-contrast: high) {
    body { background: white; color: black; }
    .product-card { border: 2px solid black; }
    .btn-primary { background: #D4A574; color: black; }
}

/* ===== ТЕМНАЯ ТЕМА ===== */
@media (prefers-color-scheme: dark) {
    body { background: #1a1a2e; color: #e8e8e8; }
    .product-card { background: #2c2c3e; }
    .product-card .product-title { color: white; }
    input, select, textarea { background: #2c2c3e; color: white; border-color: #444; }
}