:root {
    --bg: #faf8f5;
    --surface: #ffffff;
    --surface-soft: #f3efe8;
    --border: #e6dfd5;
    --text: #1f1e1c;
    --muted: #6b655e;
    --primary: #1e4d3b;
    --primary-dark: #15382b;
    --accent: #a6743b;
    --danger: #9e2a2b;
    --success-bg: #eaf4ee;
    --success-text: #184e32;
    --error-bg: #fbeaea;
    --error-text: #8c1d18;
    --radius: 10px;
    --shadow: 0 4px 18px rgba(31, 30, 28, 0.06);
}

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

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 18px;
}

/* Topbar */
.topbar {
    background: var(--primary-dark);
    color: #f4efe8;
    font-size: 0.82rem;
    padding: 7px 0;
}
.topbar a { color: #f4efe8; }
.topbar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.topbar-links { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Header */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}
.header-inner {
    display: flex;
    align-items: center;
    gap: 18px;
    padding-top: 12px;
    padding-bottom: 12px;
    flex-wrap: wrap;
}
.brand {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand-name {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    line-height: 1.1;
}
.brand-sub {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1.1px;
    color: var(--accent);
    font-weight: 600;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-left: 12px;
}
.main-nav a {
    color: var(--text);
    font-weight: 500;
    font-size: 0.95rem;
}
.main-nav a:hover { color: var(--primary); text-decoration: none; }

.header-search {
    margin-left: auto;
    display: flex;
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
    background: var(--bg);
}
.header-search input {
    border: 0;
    background: transparent;
    padding: 7px 14px;
    font-size: 0.9rem;
    color: var(--text);
    width: 200px;
    outline: none;
}
.header-search button {
    border: 0;
    background: var(--primary);
    color: #fff;
    padding: 7px 14px;
    font-size: 0.85rem;
    cursor: pointer;
    font-weight: 600;
}
.header-search button:hover { background: var(--primary-dark); }

.cart-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 7px 14px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.9rem;
}
.cart-pill:hover { background: var(--border); text-decoration: none; }
.cart-badge {
    background: var(--primary);
    color: #fff;
    font-size: 0.75rem;
    padding: 1px 7px;
    border-radius: 999px;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px;
    cursor: pointer;
    margin-left: auto;
}
.nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text);
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin: 16px 0 0;
    font-weight: 500;
    font-size: 0.94rem;
}
.alert-success { background: var(--success-bg); color: var(--success-text); border: 1px solid #c5e2d0; }
.alert-error { background: var(--error-bg); color: var(--error-text); border: 1px solid #efc6c4; }

.site-main { padding: 24px 0 56px; min-height: 65vh; }

/* Hero */
.hero {
    background: linear-gradient(135deg, #f3ede3 0%, #eae1d3 100%);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 32px 28px;
    margin-bottom: 26px;
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 24px;
    align-items: center;
}
.hero-tag {
    display: inline-block;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 8px;
}
.hero h1 {
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.6rem, 3vw, 2.3rem);
    margin: 0 0 10px;
    line-height: 1.2;
}
.hero p {
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 1rem;
}
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-info-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    font-size: 0.9rem;
}
.hero-info-card h3 { margin: 0 0 8px; font-size: 1rem; color: var(--primary); }
.hero-info-card p { margin: 0 0 6px; font-size: 0.88rem; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.92rem;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: var(--surface-soft); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 7px 12px; font-size: 0.84rem; }
.btn-block { width: 100%; }

/* Category Pills */
.category-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 22px;
    scrollbar-width: thin;
}
.cat-pill {
    white-space: nowrap;
    padding: 8px 15px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.88rem;
    font-weight: 500;
}
.cat-pill:hover { background: var(--surface-soft); text-decoration: none; }
.cat-pill.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
    gap: 20px;
}
.product-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
    transition: transform 0.15s ease;
}
.product-card:hover { transform: translateY(-2px); }
.product-thumb {
    position: relative;
    aspect-ratio: 4 / 3;
    background: var(--surface-soft);
    overflow: hidden;
}
.product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.swatch-dot {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.product-body {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.product-cat {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--accent);
    font-weight: 700;
    margin-bottom: 4px;
}
.product-title {
    margin: 0 0 6px;
    font-size: 1.02rem;
    line-height: 1.3;
}
.product-title a { color: var(--text); }
.product-meta {
    font-size: 0.82rem;
    color: var(--muted);
    margin-bottom: 12px;
}
.product-price-row {
    margin-top: auto;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 10px;
}
.price {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary);
}
.price small {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--muted);
}
.stock-tag {
    font-size: 0.76rem;
    color: var(--muted);
}

/* Quick Meter Form on Card */
.meter-form {
    display: flex;
    gap: 8px;
    align-items: center;
}
.meter-input-wrap {
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 7px;
    overflow: hidden;
    background: var(--bg);
}
.meter-btn {
    border: 0;
    background: transparent;
    padding: 6px 9px;
    cursor: pointer;
    font-weight: 700;
    color: var(--text);
}
.meter-btn:hover { background: var(--border); }
.meter-input {
    width: 52px;
    text-align: center;
    border: 0;
    background: transparent;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 6px 2px;
}
.meter-unit {
    font-size: 0.78rem;
    color: var(--muted);
    padding-right: 6px;
}

/* Product Detail */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px;
}
.detail-image {
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface-soft);
    aspect-ratio: 4 / 3;
}
.detail-image img { width: 100%; height: 100%; object-fit: cover; }
.specs-list {
    list-style: none;
    padding: 0;
    margin: 16px 0;
    border-top: 1px solid var(--border);
}
.specs-list li {
    display: flex;
    justify-content: space-between;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.92rem;
}
.specs-list span { color: var(--muted); }
.calc-box {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-top: 16px;
}
.calc-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 12px 0;
    font-size: 1.05rem;
    font-weight: 700;
}

/* Cart & Checkout Tables / Cards */
.two-col {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 24px;
    align-items: start;
}
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}
.cart-table {
    width: 100%;
    border-collapse: collapse;
}
.cart-table th, .cart-table td {
    padding: 12px 8px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}
.cart-table th {
    font-size: 0.82rem;
    text-transform: uppercase;
    color: var(--muted);
}
.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.95rem;
}
.summary-total {
    border-top: 1px solid var(--border);
    padding-top: 12px;
    margin-top: 12px;
    font-size: 1.15rem;
    font-weight: 700;
}

/* Forms */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 5px;
}
.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    background: #fff;
    color: var(--text);
}
.form-control:focus {
    outline: 2px solid rgba(30, 77, 59, 0.25);
    border-color: var(--primary);
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Footer */
.site-footer {
    background: #22201d;
    color: #e6dfd5;
    padding-top: 40px;
}
.site-footer a { color: #e6dfd5; }
.footer-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
    padding-bottom: 32px;
}
.footer-title {
    font-family: Georgia, "Times New Roman", serif;
    margin: 0 0 4px;
    font-size: 1.3rem;
}
.footer-sub {
    color: #c89d66;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 10px;
}
.footer-heading { margin: 0 0 10px; font-size: 1rem; color: #fff; }
.footer-text { font-size: 0.9rem; color: #cbc3b8; margin: 0 0 8px; }
.footer-links { font-size: 0.88rem; margin: 0; }
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 14px 0;
    font-size: 0.82rem;
    color: #a9a196;
}
.footer-bottom-inner {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

/* Responsive */
@media (max-width: 900px) {
    .hero, .detail-grid, .two-col, .footer-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .hide-mobile { display: none; }
    .nav-toggle { display: flex; }
    .main-nav {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        margin-left: 0;
        padding-top: 10px;
        border-top: 1px solid var(--border);
    }
    .main-nav.open { display: flex; }
    .header-search {
        order: 4;
        width: 100%;
        margin-left: 0;
    }
    .header-search input { width: 100%; }
    .form-row { grid-template-columns: 1fr; }
    .cart-table thead { display: none; }
    .cart-table tr {
        display: block;
        border-bottom: 1px solid var(--border);
        padding: 10px 0;
    }
    .cart-table td {
        display: flex;
        justify-content: space-between;
        border: 0;
        padding: 5px 0;
    }
}
