:root {
    --color-bg: #fafaf9;
    --color-surface: #ffffff;
    --color-text: #1c1917;
    --color-text-muted: #78716c;
    --color-border: #e7e5e4;
    --color-accent: #1c1917;
    --color-accent-hover: #44403c;
    --color-error: #dc2626;
    --color-success: #16a34a;
    --font-body: 'Inter', system-ui, -apple-system, sans-serif;
    --font-heading: 'Inter', system-ui, -apple-system, sans-serif;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --max-width: 1200px;
    --transition: 0.2s ease;
}

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

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

a { color: var(--color-accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--color-accent-hover); }

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

/* ── Announcement bar ─────────────────────────────────────────── */

.announcement-bar {
    background: var(--color-accent);
    color: #fff;
    text-align: center;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
}

/* ── Header ───────────────────────────────────────────────────── */

header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

header nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: var(--max-width);
    margin: 0 auto;
}

header .logo {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.02em;
}

header .logo img { height: 36px; width: auto; }

header .nav-links { display: flex; align-items: center; gap: 1.5rem; }
header .nav-links a { color: var(--color-text-muted); font-size: 0.9rem; font-weight: 500; }
header .nav-links a:hover { color: var(--color-text); }

.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: 0.5rem; }
.nav-toggle span { display: block; width: 20px; height: 2px; background: var(--color-text); margin: 4px 0; transition: var(--transition); }

/* ── Main ─────────────────────────────────────────────────────── */

main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem;
    min-height: 60vh;
}

/* ── Footer ───────────────────────────────────────────────────── */

footer {
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: 3rem 2rem 2rem;
    margin-top: 4rem;
}

.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    text-align: center;
}

footer .footer-links { margin-bottom: 1rem; }
footer .footer-links a { margin: 0 0.75rem; color: var(--color-text-muted); font-size: 0.85rem; }
footer .footer-links a:hover { color: var(--color-text); }
footer .footer-social { margin-bottom: 1rem; }
footer .footer-social a { margin: 0 0.5rem; color: var(--color-text-muted); }
footer p { color: var(--color-text-muted); font-size: 0.8rem; }

/* ── Buttons ──────────────────────────────────────────────────── */

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: var(--color-accent);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
    letter-spacing: 0.02em;
    text-align: center;
}
.btn:hover { background: var(--color-accent-hover); color: #fff; transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }
.btn-secondary { background: transparent; color: var(--color-text); border: 1px solid var(--color-border); }
.btn-secondary:hover { background: var(--color-bg); color: var(--color-text); border-color: var(--color-text-muted); }
.btn-small { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.btn-remove { background: none; border: none; color: var(--color-error); cursor: pointer; font-size: 0.85rem; padding: 0; }
.btn-remove:hover { text-decoration: underline; }

/* ── Hero ─────────────────────────────────────────────────────── */

.hero {
    text-align: center;
    padding: 4rem 0 3rem;
}
.hero h1 {
    font-family: var(--font-heading);
    font-size: 2.75rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
    letter-spacing: -0.03em;
    line-height: 1.15;
}
.hero p {
    color: var(--color-text-muted);
    font-size: 1.1rem;
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* ── Section headings ─────────────────────────────────────────── */

.section-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
}

/* ── Product grid ─────────────────────────────────────────────── */

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.product-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: box-shadow var(--transition), transform var(--transition);
}
.product-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.product-card .card-image {
    overflow: hidden;
    aspect-ratio: 1;
    background: var(--color-bg);
}
.product-card .card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}
.product-card:hover .card-image img { transform: scale(1.05); }

.product-card .card-body { padding: 1rem; }
.product-card h3 { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.25rem; }
.product-card h3 a { color: var(--color-text); }
.product-card h3 a:hover { color: var(--color-accent); }
.product-card .price { font-weight: 700; color: var(--color-text); font-size: 1rem; }
.product-card .category-badge { font-size: 0.75rem; color: var(--color-text-muted); margin-bottom: 0.5rem; }
.product-card .card-actions { padding: 0 1rem 1rem; }
.product-card .btn { width: 100%; }

.out-of-stock {
    color: var(--color-text-muted);
    font-style: italic;
    font-size: 0.85rem;
}

/* ── Product detail ───────────────────────────────────────────── */

.product-detail .product-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    margin-top: 1rem;
}

.product-images .main-image { border-radius: var(--radius-md); overflow: hidden; background: var(--color-bg); }
.product-images .main-image img { width: 100%; aspect-ratio: 1; object-fit: cover; }

.thumbnails { display: flex; gap: 0.5rem; margin-top: 0.75rem; }
.thumbnails img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color var(--transition);
}
.thumbnails img:hover, .thumbnails img.active { border-color: var(--color-accent); }

.product-info { padding-top: 0.5rem; }
.product-info .breadcrumbs { font-size: 0.8rem; color: var(--color-text-muted); margin-bottom: 1rem; }
.product-info .breadcrumbs a { color: var(--color-text-muted); }
.product-info .breadcrumbs a:hover { color: var(--color-text); }
.product-info h1 { font-family: var(--font-heading); font-size: 2rem; font-weight: 700; margin-bottom: 0.5rem; letter-spacing: -0.02em; }
.product-info .price { font-size: 1.5rem; font-weight: 700; margin-bottom: 1rem; }
.product-info .description { color: var(--color-text-muted); margin-bottom: 1.5rem; line-height: 1.7; }
.product-info .stock { color: var(--color-success); font-size: 0.85rem; margin-bottom: 1rem; }
.product-info .stock.low { color: #d97706; }
.product-info .stock.out { color: var(--color-error); }

.variant-selector { margin-bottom: 1.5rem; }
.variant-selector label { display: block; font-weight: 600; margin-bottom: 0.5rem; font-size: 0.9rem; }
.variant-selector select { padding: 0.5rem 1rem; border: 1px solid var(--color-border); border-radius: var(--radius-sm); font-size: 0.9rem; }

.quantity-selector { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1.5rem; }
.quantity-selector label { font-weight: 600; font-size: 0.9rem; }
.quantity-selector input[type="number"] { width: 70px; padding: 0.5rem; border: 1px solid var(--color-border); border-radius: var(--radius-sm); text-align: center; }

.related-products { margin-top: 4rem; }

/* ── Cart ─────────────────────────────────────────────────────── */

.cart-table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; }
.cart-table th { text-align: left; padding: 0.75rem; border-bottom: 2px solid var(--color-border); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-muted); }
.cart-table td { padding: 0.75rem; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
.cart-table .cart-item-image { width: 64px; height: 64px; object-fit: cover; border-radius: var(--radius-sm); }
.cart-table input[type="number"] { width: 60px; padding: 0.3rem; border: 1px solid var(--color-border); border-radius: var(--radius-sm); text-align: center; }

.cart-summary { text-align: right; margin-top: 1.5rem; padding: 1.5rem; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.cart-summary .total { font-size: 1.25rem; font-weight: 700; margin-bottom: 1rem; }

.cart-empty { text-align: center; padding: 4rem 0; }
.cart-empty p { color: var(--color-text-muted); margin-bottom: 1.5rem; }

/* Mobile cart layout */
.cart-mobile-card { display: none; }

/* ── Checkout ─────────────────────────────────────────────────── */

.checkout-page #checkout-container { min-height: 400px; }
.checkout-page .payments-not-configured {
    text-align: center;
    padding: 3rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

/* ── Search ───────────────────────────────────────────────────── */

.search-form { display: flex; gap: 0.5rem; margin-bottom: 2rem; }
.search-form input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    transition: border-color var(--transition);
}
.search-form input:focus { outline: none; border-color: var(--color-accent); }
.search-form button { padding: 0.75rem 1.5rem; }

/* ── Filters / categories ─────────────────────────────────────── */

.filters { margin-bottom: 2rem; }
.categories { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.categories a {
    padding: 0.4rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all var(--transition);
}
.categories a:hover { border-color: var(--color-text); color: var(--color-text); }
.categories a.active { background: var(--color-accent); color: #fff; border-color: var(--color-accent); }

/* ── Order details ────────────────────────────────────────────── */

.order-details {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 2rem;
    margin-top: 1.5rem;
}
.order-details h2 { margin-bottom: 1rem; }
.order-details table { width: 100%; margin: 1rem 0; border-collapse: collapse; }
.order-details td { padding: 0.5rem 0; border-bottom: 1px solid var(--color-border); }
.order-details .order-total { font-size: 1.1rem; font-weight: 700; }
.order-success { color: var(--color-success); }

/* ── Forms ────────────────────────────────────────────────────── */

.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; margin-bottom: 0.35rem; font-weight: 600; font-size: 0.9rem; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    max-width: 400px;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    transition: border-color var(--transition);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--color-accent);
}

/* ── Content pages ────────────────────────────────────────────── */

.content-page { max-width: 760px; margin: 0 auto; padding: 2rem 0; }
.content-page h1 { font-family: var(--font-heading); font-size: 2rem; font-weight: 700; margin-bottom: 1.5rem; letter-spacing: -0.02em; }
.page-body { line-height: 1.8; color: var(--color-text); }
.page-body h2 { font-size: 1.35rem; font-weight: 700; margin: 2rem 0 0.75rem; }
.page-body h3 { font-size: 1.1rem; font-weight: 600; margin: 1.5rem 0 0.5rem; }
.page-body p { margin-bottom: 1rem; }
.page-body ul, .page-body ol { margin: 0.5rem 0 1rem 1.5rem; }
.page-body li { margin-bottom: 0.35rem; }
.page-body details { margin-bottom: 0.75rem; border-bottom: 1px solid var(--color-border); padding-bottom: 0.75rem; }
.page-body summary { cursor: pointer; font-weight: 600; padding: 0.5rem 0; }
.page-body details p { margin-top: 0.5rem; color: var(--color-text-muted); }
.page-body a { text-decoration: underline; }

/* ── 404 page ─────────────────────────────────────────────────── */

.not-found { text-align: center; padding: 4rem 0; }
.not-found h1 { font-size: 2rem; margin-bottom: 0.75rem; }
.not-found p { color: var(--color-text-muted); margin-bottom: 2rem; }
.not-found-actions { display: flex; gap: 1rem; justify-content: center; margin-bottom: 2rem; }
.not-found-search { max-width: 400px; margin: 0 auto; display: flex; gap: 0.5rem; }
.not-found-search input { flex: 1; padding: 0.6rem; border: 1px solid var(--color-border); border-radius: var(--radius-sm); }

/* ── Pagination ───────────────────────────────────────────────── */

.pagination { display: flex; justify-content: center; gap: 0.5rem; margin-top: 2.5rem; }
.pagination a, .pagination span {
    padding: 0.5rem 0.9rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--color-text);
}
.pagination a:hover { background: var(--color-bg); border-color: var(--color-text-muted); }
.pagination .active { background: var(--color-accent); color: #fff; border-color: var(--color-accent); }

/* ── Utility ──────────────────────────────────────────────────── */

.error { color: var(--color-error); }
.category-badge {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    background: var(--color-bg);
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    display: inline-block;
}
.text-muted { color: var(--color-text-muted); }

/* ── Responsive ───────────────────────────────────────────────── */

@media (max-width: 768px) {
    :root { --max-width: 100%; }

    header nav { position: relative; }

    .nav-toggle { display: block; }

    header .nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: -2rem;
        right: -2rem;
        background: var(--color-surface);
        border-bottom: 1px solid var(--color-border);
        padding: 1rem 2rem;
        gap: 0.75rem;
        z-index: 99;
    }
    header .nav-links.open { display: flex; }

    main { padding: 1rem; }

    .hero h1 { font-size: 1.75rem; }
    .hero p { font-size: 0.95rem; }

    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
    .product-card h3 { font-size: 0.85rem; }
    .product-card .price { font-size: 0.9rem; }

    .product-detail .product-layout { grid-template-columns: 1fr; gap: 1.5rem; }

    .cart-table { display: none; }
    .cart-mobile-card {
        display: block;
        background: var(--color-surface);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-md);
        padding: 1rem;
        margin-bottom: 0.75rem;
    }
    .cart-mobile-card .item-row { display: flex; gap: 1rem; align-items: center; }
    .cart-mobile-card .item-image { width: 64px; height: 64px; object-fit: cover; border-radius: var(--radius-sm); }
    .cart-mobile-card .item-details { flex: 1; }
    .cart-mobile-card .item-name { font-weight: 600; }
    .cart-mobile-card .item-price { color: var(--color-text-muted); font-size: 0.9rem; }
    .cart-mobile-card .item-actions { margin-top: 0.75rem; display: flex; align-items: center; gap: 0.75rem; }

    footer { padding: 2rem 1rem; }
}

@media (max-width: 480px) {
    .product-grid { grid-template-columns: 1fr; }
}
