:root {
    --bone: #f4efe7;
    --bone-deep: #ebe1d6;
    --paper: #fffdf9;
    --paper-soft: #faf6f1;
    --espresso: #2c211b;
    --espresso-soft: #3a2b23;
    --walnut: #6f4e37;
    --russet: #a65332;
    --russet-deep: #854027;
    --line: #ddd2c6;
    --line-strong: #cdbfb1;
    --muted: #86786d;
    --success: #355e43;
    --danger: #8b2f2f;
    --shadow-soft: 0 12px 34px rgba(50, 35, 27, .07);
    --shadow-strong: 0 18px 50px rgba(31, 22, 17, .12);
}

html[data-theme="dark"] {
    --bone: #171311;
    --bone-deep: #201916;
    --paper: #211a17;
    --paper-soft: #251d19;
    --espresso: #f3e9de;
    --espresso-soft: #ead9ca;
    --walnut: #ceb5a2;
    --russet: #c66a45;
    --russet-deep: #a65434;
    --line: #3a2f2a;
    --line-strong: #4b3d36;
    --muted: #a99a8f;
    --success: #77a882;
    --danger: #d77b7b;
    --shadow-soft: 0 12px 34px rgba(0, 0, 0, .18);
    --shadow-strong: 0 18px 50px rgba(0, 0, 0, .32);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--bone);
    color: var(--espresso);
    font: 400 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; margin: 0 0 12px; line-height: 1.15; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.eyebrow { display: block; margin-bottom: 10px; color: var(--russet); font: 700 .72rem/1.4 Arial, sans-serif; letter-spacing: .18em; text-transform: uppercase; }
:focus-visible { outline: 2px solid var(--russet); outline-offset: 2px; }
.hero-slide :focus-visible, .tile:focus-visible { outline-offset: -3px; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 40; background: var(--paper); border-bottom: 1px solid var(--line); }
.site-announcement { text-align: center; padding: 10px 16px; background: var(--ink, #2c211b); color: var(--paper, #fffdf9); font-size: 0.9rem; }
.site-header-bar { max-width: 1240px; margin: 0 auto; padding: 16px 24px; display: flex; align-items: center; gap: 24px; }
.site-brand { font-family: Georgia, serif; font-size: 1.4rem; letter-spacing: .02em; white-space: nowrap; }
.site-nav { display: flex; gap: 22px; flex: 1; }
.site-nav a { font-size: .92rem; color: var(--walnut); }
.site-nav a:hover { color: var(--russet); }
.site-search { flex: 0 0 260px; }
.site-search input { width: 100%; padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper-soft); color: inherit; font-size: .88rem; }
.site-actions { display: flex; align-items: center; gap: 16px; }
.site-action { font-size: .88rem; font-weight: 600; position: relative; }
.cart-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; margin-left: 4px; border-radius: 999px; background: var(--russet); color: #fff; font-size: .68rem; font-weight: 700; }
.theme-toggle, .nav-toggle { border: 1px solid var(--line); background: var(--paper-soft); border-radius: 8px; width: 36px; height: 36px; cursor: pointer; color: inherit; font-size: 1rem; }
.nav-toggle { display: none; }
@media (max-width: 900px) {
    .site-nav { position: fixed; inset: 0 20% 0 0; background: var(--paper); flex-direction: column; padding: 90px 24px; gap: 18px; transform: translateX(-100%); transition: transform .25s; box-shadow: var(--shadow-strong); }
    .site-nav.open { transform: translateX(0); }
    .nav-toggle { display: block; }
    .site-search { display: none; }
}

/* Alerts */
.site-alert { max-width: 1240px; margin: 16px auto 0; padding: 14px 18px; border-radius: 10px; font-size: .9rem; }
.site-alert-success { background: rgba(53,94,67,.12); color: var(--success); border: 1px solid rgba(53,94,67,.28); }
.site-alert-error { background: rgba(139,47,47,.12); color: var(--danger); border: 1px solid rgba(139,47,47,.28); }

.site-main { flex: 1; }
.container { max-width: 1240px; margin: 0 auto; padding: 0 24px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 26px; border-radius: 999px; border: 1px solid var(--espresso); background: var(--espresso); color: var(--bone); font: 600 .85rem/1 Arial, sans-serif; letter-spacing: .04em; cursor: pointer; text-transform: uppercase; }
.btn:hover { opacity: .88; }
.btn-outline { background: transparent; color: var(--espresso); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* Hero */
.hero { padding: 90px 24px; text-align: center; }
.hero h1 { font-size: clamp(2.6rem, 6vw, 4.6rem); }
.hero p { max-width: 560px; margin: 18px auto 30px; color: var(--walnut); }

/* Hero slider */
.hero-slider { position: relative; height: min(72vh, 640px); min-height: 420px; overflow: hidden; }
.hero-slider-track { position: relative; width: 100%; height: 100%; }
.hero-slide { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; background: var(--bone-deep) center/cover no-repeat; opacity: 0; visibility: hidden; transition: opacity .7s ease; }
.hero-slide.is-active { opacity: 1; visibility: visible; }
.hero-slide-scrim { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.32), rgba(0,0,0,.42)); }
.hero-slide-content { position: relative; z-index: 1; color: #fffdf9; }
.hero-slide-content .eyebrow { color: #f0d8c8; }
.hero-slide-content h1 { font-size: clamp(2.4rem, 5.4vw, 4.2rem); }
.hero-slide-content p { max-width: 560px; margin: 18px auto 30px; color: #f4efe7; }
.hero-slider-arrow { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 44px; height: 44px; border-radius: 999px; border: 1px solid rgba(255,255,255,.5); background: rgba(0,0,0,.25); color: #fff; font-size: 1.6rem; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.hero-slider-arrow:hover { background: rgba(0,0,0,.45); }
.hero-slider-arrow.prev { left: 20px; }
.hero-slider-arrow.next { right: 20px; }
.hero-slider-dots { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 2; display: flex; gap: 10px; }
.hero-slider-dots button { width: 9px; height: 9px; border-radius: 999px; border: none; background: rgba(255,255,255,.5); cursor: pointer; padding: 0; }
.hero-slider-dots button.is-active { background: #fff; width: 24px; }
@media (max-width: 640px) {
    .hero-slider-arrow { width: 36px; height: 36px; font-size: 1.3rem; }
    .hero-slider-arrow.prev { left: 10px; }
    .hero-slider-arrow.next { right: 10px; }
}

/* Category tiles */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; padding: 0 0 70px; }
.tile { position: relative; aspect-ratio: 4/5; border-radius: 16px; overflow: hidden; background: var(--paper-soft); border: 1px solid var(--line); display: flex; align-items: flex-end; padding: 20px; }
.tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile span { position: relative; background: rgba(20,15,12,.55); color: #fff; padding: 8px 14px; border-radius: 999px; font-size: .82rem; font-weight: 600; }

/* Product grid */
.section-heading { display: flex; align-items: baseline; justify-content: space-between; padding: 60px 0 20px; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 26px; padding-bottom: 60px; }
.product-card { display: block; }
.product-card figure { margin: 0 0 14px; aspect-ratio: 3/4; border-radius: 14px; overflow: hidden; background: var(--paper-soft); border: 1px solid var(--line); }
.product-card img { width: 100%; height: 100%; object-fit: cover; }
.product-card .placeholder { width: 100%; height: 100%; display: grid; place-items: center; color: var(--muted); font-size: .8rem; }
.product-card h3 { font-size: 1rem; margin: 0 0 4px; }
.product-card .price { font-weight: 700; }
.product-card .price del { color: var(--muted); font-weight: 400; margin-right: 8px; }
.product-card .out-of-stock { display: inline-block; margin-top: 6px; font-size: .74rem; color: var(--danger); text-transform: uppercase; letter-spacing: .06em; }

/* Shop layout */
.shop-layout { display: grid; grid-template-columns: 240px 1fr; gap: 40px; padding: 36px 0 70px; align-items: start; }
.shop-filters { position: sticky; top: 100px; display: grid; gap: 22px; }
.filter-group h4 { margin: 0 0 10px; font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.filter-group a, .filter-group label { display: flex; justify-content: space-between; padding: 6px 0; font-size: .9rem; color: var(--walnut); }
.filter-group a.active, .filter-group a:hover { color: var(--russet); }
.filter-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-swatches a { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); }
.filter-swatches a.active { border-color: var(--russet); }
.shop-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; font-size: .88rem; color: var(--muted); }
.shop-toolbar select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: inherit; }
@media (max-width: 900px) { .shop-layout { grid-template-columns: 1fr; } .shop-filters { position: static; } }

.pagination { display: flex; gap: 8px; padding: 20px 0; justify-content: center; }
.pagination a { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; }
.pagination a.active { background: var(--espresso); color: var(--bone); border-color: var(--espresso); }

.empty { text-align: center; padding: 80px 20px; color: var(--muted); }

/* Error pages */
.error-page { text-align: center; padding: 120px 24px; max-width: 560px; }
.error-page h1 { font-size: clamp(2.4rem, 5vw, 3.4rem); }
.error-page p { color: var(--walnut); margin: 14px 0 30px; }

/* Product detail */
.product-detail { display: grid; grid-template-columns: 1.1fr 1fr; gap: 50px; padding: 40px 0 80px; }
.product-gallery img { border-radius: 16px; aspect-ratio: 4/5; object-fit: cover; border: 1px solid var(--line); }
.product-gallery-placeholder { aspect-ratio: 4/5; border-radius: 16px; border: 1px solid var(--line); background: var(--paper-soft); display: grid; place-items: center; }
.product-gallery-placeholder .placeholder { color: var(--muted); font-size: .85rem; }
.product-gallery-thumbs { display: flex; gap: 10px; margin-top: 12px; }
.product-gallery-thumbs img { width: 74px; height: 74px; border-radius: 10px; object-fit: cover; cursor: pointer; border: 2px solid transparent; }
.product-gallery-thumbs img.active { border-color: var(--russet); }
.product-info .price { font-size: 1.4rem; font-weight: 700; margin: 10px 0 20px; }
.product-info .price del { color: var(--muted); font-weight: 400; margin-right: 10px; font-size: 1rem; }
.product-info .description { color: var(--walnut); margin-bottom: 26px; }
.stock-note { font-size: .85rem; margin-top: 10px; color: var(--muted); }
.stock-note.low { color: var(--russet); }
.stock-note.out { color: var(--danger); }
@media (max-width: 900px) { .product-detail { grid-template-columns: 1fr; } }

/* Cart & checkout */
.cart-table { width: 100%; border-collapse: collapse; margin-bottom: 30px; }
.cart-table th { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line-strong); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.cart-table td { padding: 16px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.cart-line-product { display: flex; gap: 14px; align-items: center; }
.cart-line-product img { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; }
.cart-qty { display: inline-flex; align-items: center; gap: 8px; }
.cart-qty input { width: 54px; padding: 8px; text-align: center; border: 1px solid var(--line); border-radius: 6px; }
.cart-summary { max-width: 380px; margin-left: auto; display: grid; gap: 10px; }
.cart-summary div { display: flex; justify-content: space-between; }
.cart-summary .grand { border-top: 1px solid var(--line-strong); padding-top: 12px; font-size: 1.1rem; font-weight: 700; }

.checkout-layout { display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px; padding: 40px 0 80px; align-items: start; }
.checkout-panel { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: var(--shadow-soft); }
.checkout-panel + .checkout-panel { margin-top: 22px; }
.form-row { display: grid; gap: 8px; margin-bottom: 16px; }
.form-row.two { grid-template-columns: 1fr 1fr; gap: 16px; display: grid; }
.form-row label { font-size: .82rem; font-weight: 600; color: var(--walnut); }
.form-row input, .form-row select, .form-row textarea { padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: inherit; font-size: .92rem; }
.payment-options { display: grid; gap: 10px; }
.payment-option { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.payment-option input { accent-color: var(--russet); }
@media (max-width: 900px) { .checkout-layout { grid-template-columns: 1fr; } }

/* Auth forms */
.auth-shell { max-width: 440px; margin: 60px auto 100px; padding: 0 24px; }
.auth-shell .checkout-panel { padding: 34px; }
.auth-switch { text-align: center; margin-top: 18px; font-size: .88rem; color: var(--muted); }
.auth-switch a { color: var(--russet); font-weight: 600; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--paper-soft); margin-top: auto; }
.site-footer-inner { max-width: 1240px; margin: 0 auto; padding: 34px 24px; display: flex; flex-wrap: wrap; gap: 18px; align-items: center; justify-content: space-between; }
.site-footer-brand { display: flex; flex-direction: column; gap: 4px; }
.site-footer-brand span { font-size: .8rem; color: var(--muted); }
.site-footer-nav { display: flex; gap: 18px; }
.site-footer-nav a { font-size: .85rem; color: var(--walnut); }
.site-footer-copy { font-size: .78rem; color: var(--muted); }

/* Account */
.account-layout { display: grid; grid-template-columns: 220px 1fr; gap: 36px; padding: 40px 0 80px; }
.account-nav { display: grid; gap: 6px; align-content: start; }
.account-nav a { padding: 10px 14px; border-radius: 8px; font-size: .9rem; }
.account-nav a.active, .account-nav a:hover { background: var(--paper-soft); color: var(--russet); }
@media (max-width: 900px) { .account-layout { grid-template-columns: 1fr; } }
.order-row { display: flex; justify-content: space-between; padding: 16px 0; border-bottom: 1px solid var(--line); }
