/* ==================== Reset & Variables ==================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #1a1a2e;
    --primary-light: #2d2d44;
    --accent: #e8a838;
    --accent-hover: #d4952e;
    --bg: #f4f1ec;
    --bg-warm: #ebe7e0;
    --card-bg: #ffffff;
    --text: #1a1a2e;
    --text-secondary: #6b6b7b;
    --text-muted: #9e9eae;
    --border: #e8e4de;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);
    --shadow-xl: 0 20px 60px rgba(0,0,0,0.18);
    --radius: 16px;
    --radius-sm: 10px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ==================== Header ==================== */
.header {
    position: relative;
    text-align: center;
    padding: 72px 24px 56px;
    background: linear-gradient(165deg, #1a1a2e 0%, #2d2d44 40%, #3d3d5c 100%);
    color: #fff;
    overflow: hidden;
}

.header::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -20%;
    width: 140%;
    height: 200%;
    background: radial-gradient(ellipse at 30% 50%, rgba(232,168,56,0.08) 0%, transparent 60%);
    pointer-events: none;
}

.header::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 60px;
    background: var(--bg);
    clip-path: ellipse(55% 100% at 50% 100%);
}

.header h1 {
    font-size: clamp(1.6rem, 4vw, 2.8rem);
    font-weight: 800;
    letter-spacing: 3px;
    position: relative;
    animation: fadeInDown 0.8s ease both;
}

.header h1::after {
    content: "";
    display: block;
    width: 48px;
    height: 3px;
    background: var(--accent);
    margin: 16px auto 0;
    border-radius: 2px;
    animation: expandLine 0.6s 0.4s ease both;
}

@keyframes expandLine {
    from { width: 0; opacity: 0; }
    to { width: 48px; opacity: 1; }
}

.subtitle {
    margin-top: 16px;
    font-size: clamp(0.85rem, 1.5vw, 1rem);
    opacity: 0.7;
    letter-spacing: 4px;
    font-weight: 300;
    position: relative;
    animation: fadeInUp 0.8s 0.2s ease both;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 0.7; transform: translateY(0); }
}

/* ==================== Filter Bar ==================== */
.filter-bar {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 24px 20px;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(244,241,236,0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(232,228,222,0.6);
    transition: box-shadow var(--transition);
}

.filter-bar.scrolled {
    box-shadow: 0 2px 20px rgba(0,0,0,0.06);
}

.filter-btn {
    padding: 10px 24px;
    border: 1.5px solid var(--border);
    border-radius: 100px;
    background: var(--card-bg);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.filter-btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.filter-btn:hover::before {
    left: 100%;
}

.filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.filter-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 4px 16px rgba(26,26,46,0.3);
    transform: translateY(-1px);
}

/* ==================== Product Grid ==================== */
.product-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
    padding: 32px 36px 48px;
    max-width: 1320px;
    margin: 0 auto;
}

/* ==================== Product Card ==================== */
.product-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    opacity: 0;
    transform: translateY(30px);
    animation: cardIn 0.5s ease forwards;
}

.product-card:nth-child(1) { animation-delay: 0.05s; }
.product-card:nth-child(2) { animation-delay: 0.1s; }
.product-card:nth-child(3) { animation-delay: 0.15s; }
.product-card:nth-child(4) { animation-delay: 0.2s; }
.product-card:nth-child(5) { animation-delay: 0.25s; }
.product-card:nth-child(6) { animation-delay: 0.3s; }
.product-card:nth-child(7) { animation-delay: 0.35s; }
.product-card:nth-child(8) { animation-delay: 0.4s; }
.product-card:nth-child(9) { animation-delay: 0.45s; }

@keyframes cardIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.product-card.hidden {
    display: none;
}

/* Card Badge */
.card-badge {
    position: absolute;
    top: 14px;
    left: 14px;
    background: linear-gradient(135deg, var(--accent) 0%, #f0b84a 100%);
    color: #fff;
    padding: 5px 14px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    z-index: 2;
    letter-spacing: 0.5px;
    box-shadow: 0 3px 10px rgba(232,168,56,0.3);
}

/* Card Image */
.card-image {
    width: 100%;
    aspect-ratio: 4/3;
    overflow: hidden;
    cursor: pointer;
    background: var(--bg-warm);
    position: relative;
}

.card-image::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 60%, rgba(0,0,0,0.04) 100%);
    pointer-events: none;
    transition: opacity var(--transition);
}

.card-image:hover::after {
    opacity: 0;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-image:hover img {
    transform: scale(1.08);
}

/* Card Info */
.card-info {
    padding: 18px 20px 20px;
}

.card-info h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text);
    letter-spacing: 0.3px;
}

.specs {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.spec-row {
    font-size: 0.82rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
}

.spec-row i {
    font-style: normal;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 20px;
    background: var(--bg);
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    margin-right: 10px;
    flex-shrink: 0;
    letter-spacing: 0.5px;
}

/* Price Row */
.price-row {
    display: flex;
    align-items: baseline;
    gap: 4px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.price {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -0.5px;
}

.price-tbd {
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 500;
}

.unit {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-left: 2px;
}

/* ==================== Footer ==================== */
.footer {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
    letter-spacing: 1px;
}

/* ==================== Modal ==================== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.92);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 24px;
    animation: fadeIn 0.25s ease;
}

.modal-overlay.show {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    text-align: center;
    animation: modalZoom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalZoom {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-content img {
    max-width: 100%;
    max-height: 82vh;
    border-radius: var(--radius-sm);
    object-fit: contain;
    box-shadow: var(--shadow-xl);
}

.modal-close {
    position: absolute;
    top: -48px;
    right: -8px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    font-size: 1.6rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition);
    backdrop-filter: blur(10px);
}

.modal-close:hover {
    background: rgba(255,255,255,0.25);
    transform: rotate(90deg);
}

.modal-caption {
    color: rgba(255,255,255,0.7);
    margin-top: 16px;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

/* ==================== Tablet (≤1024px) ==================== */
@media (max-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 22px;
        padding: 28px 24px 40px;
    }

    .header {
        padding: 60px 20px 48px;
    }
}

/* ==================== Mobile (≤640px) ==================== */
@media (max-width: 640px) {
    .header {
        padding: 52px 16px 44px;
    }

    .header h1 {
        letter-spacing: 1px;
    }

    .subtitle {
        letter-spacing: 2px;
    }

    .filter-bar {
        padding: 16px 12px;
        gap: 8px;
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .filter-bar::-webkit-scrollbar {
        display: none;
    }

    .filter-btn {
        padding: 8px 18px;
        font-size: 0.82rem;
        flex-shrink: 0;
    }

    .product-grid {
        grid-template-columns: 1fr;
        gap: 18px;
        padding: 20px 16px 32px;
    }

    .product-card {
        border-radius: var(--radius-sm);
    }

    .product-card:hover {
        transform: translateY(-4px);
    }

    .card-image {
        aspect-ratio: 16/9;
    }

    .card-info {
        padding: 16px;
    }

    .card-info h3 {
        font-size: 0.95rem;
    }

    .price {
        font-size: 1.3rem;
    }

    .modal-content {
        max-width: 95vw;
    }

    .modal-close {
        top: -44px;
        right: 0;
    }
}

/* ==================== Small Mobile (≤380px) ==================== */
@media (max-width: 380px) {
    .header h1 {
        font-size: 1.3rem;
    }

    .card-badge {
        font-size: 0.72rem;
        padding: 4px 10px;
    }
}

/* ==================== Scrollbar ==================== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.15);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.25);
}

/* ==================== Selection ==================== */
::selection {
    background: rgba(232,168,56,0.3);
    color: var(--text);
}
