:root {
    --bg: #11110f;
    --surface: #1a1a17;
    --surface-raised: #23231f;
    --line: #39382f;
    --text: #f3f0e7;
    --muted: #aaa79d;
    --gold: #d8b85d;
    --gold-strong: #f0cb67;
    --teal: #5ea99c;
    --danger: #d96c62;
    --success: #75b978;
    --font-display: "Cormorant Garamond", Georgia, serif;
    --font-body: "Montserrat", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { color-scheme: dark; }

body {
    margin: 0;
    min-width: 320px;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
    letter-spacing: 0;
}

button, input, textarea { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--gold-strong); }

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 76px;
    padding: 12px max(20px, calc((100vw - 1180px) / 2));
    border-bottom: 1px solid var(--line);
    background: rgba(17, 17, 15, 0.96);
    backdrop-filter: blur(14px);
}

.brand { display: flex; flex-direction: column; color: var(--text); text-decoration: none; }
.brand-name { font-family: var(--font-display); font-size: 30px; font-weight: 700; line-height: 1; }
.brand-note { margin-top: 3px; color: var(--muted); font-size: 10px; text-transform: uppercase; }

.icon-command {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}
.icon-command:hover { border-color: var(--gold); color: var(--gold-strong); }
.icon-command svg { width: 20px; height: 20px; }
.cart-trigger { position: relative; }
.cart-trigger span {
    position: absolute;
    top: -6px;
    right: -6px;
    display: grid;
    place-items: center;
    min-width: 21px;
    height: 21px;
    padding: 0 5px;
    border: 2px solid var(--bg);
    border-radius: 50%;
    background: var(--gold);
    color: #11110f;
    font-size: 10px;
    font-weight: 700;
}

main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.catalog-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 430px);
    gap: 32px;
    align-items: end;
    padding: 46px 0 30px;
}
.eyebrow { margin: 0 0 7px; color: var(--teal); font-size: 11px; font-weight: 600; text-transform: uppercase; }
h1, h2 { margin: 0; font-family: var(--font-display); line-height: 1; letter-spacing: 0; }
h1 { font-size: 48px; }
h2 { font-size: 38px; }
.catalog-summary { margin: 0; color: var(--muted); font-size: 13px; }

.category-tabs {
    display: flex;
    gap: 8px;
    padding-bottom: 18px;
    overflow-x: auto;
    scrollbar-width: none;
}
.category-tabs::-webkit-scrollbar { display: none; }
.category-tab {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}
.category-tab.active { border-color: var(--gold); background: var(--gold); color: #11110f; font-weight: 600; }

.catalog { min-height: 420px; padding: 4px 0 70px; }
.catalog-status { padding: 60px 0; color: var(--muted); text-align: center; }
.product-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.product-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
}
.product-media {
    position: relative;
    display: grid;
    place-items: center;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-bottom: 1px solid var(--line);
    background: #292922;
}
.product-media img { width: 100%; height: 100%; object-fit: cover; }
.media-placeholder { color: #807d70; font-family: var(--font-display); font-size: 20px; text-align: center; }
.type-chip {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 5px 8px;
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 3px;
    background: rgba(17,17,15,.82);
    color: var(--text);
    font-size: 9px;
    text-transform: uppercase;
}
.product-body { display: flex; flex: 1; flex-direction: column; padding: 18px; }
.product-category { margin: 0 0 5px; color: var(--teal); font-size: 10px; text-transform: uppercase; }
.product-title { margin: 0; font-family: var(--font-display); font-size: 27px; line-height: 1.05; overflow-wrap: anywhere; }
.product-description { min-height: 44px; margin: 10px 0 18px; color: var(--muted); font-size: 12px; }
.product-footer { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-top: auto; }
.product-price { font-size: 16px; font-weight: 600; white-space: nowrap; }
.stock-state { margin: 5px 0 0; color: var(--muted); font-size: 10px; }
.stock-state.out { color: var(--danger); }

.primary-command, .secondary-command, .add-command {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border-radius: 4px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
.primary-command, .add-command { border: 1px solid var(--gold); background: var(--gold); color: #11110f; }
.primary-command:hover, .add-command:hover { background: var(--gold-strong); }
.secondary-command { border: 1px solid var(--line); background: transparent; color: var(--text); }
.add-command { width: 42px; height: 42px; min-height: 42px; padding: 0; }
.add-command svg { width: 18px; }
.add-command:disabled { border-color: var(--line); background: var(--surface-raised); color: var(--muted); cursor: not-allowed; }

.site-footer {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    padding: 28px 0 40px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 11px;
}

.cart-drawer {
    width: min(520px, 100%);
    max-width: none;
    height: 100%;
    max-height: none;
    margin: 0 0 0 auto;
    padding: 0;
    border: 0;
    background: var(--surface);
    color: var(--text);
}
.cart-drawer::backdrop { background: rgba(0,0,0,.68); backdrop-filter: blur(3px); }
.cart-drawer[open] { animation: drawer-in .2s ease-out; }
@keyframes drawer-in { from { transform: translateX(40px); opacity: .5; } }
.drawer-shell { display: grid; grid-template-rows: auto 1fr auto; height: 100%; }
.drawer-header, .drawer-total { display: flex; align-items: center; justify-content: space-between; padding: 20px; border-bottom: 1px solid var(--line); }
.drawer-total { border-top: 1px solid var(--line); border-bottom: 0; font-size: 17px; }
.drawer-body { overflow-y: auto; padding: 20px; }
.cart-items { display: grid; gap: 10px; }
.cart-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.cart-line-name { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.cart-line-meta { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.quantity-control { display: grid; grid-template-columns: 32px 34px 32px; align-items: center; text-align: center; }
.quantity-control button { width: 32px; height: 32px; border: 1px solid var(--line); background: transparent; color: var(--text); cursor: pointer; }
.empty-cart { display: grid; place-items: center; min-height: 260px; color: var(--muted); text-align: center; }
.empty-cart svg { width: 32px; height: 32px; }

.checkout-form { margin-top: 28px; }
.form-section { display: grid; gap: 13px; margin: 0 0 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.form-section h3 { margin: 0 0 2px; font-size: 14px; }
label { display: grid; gap: 6px; color: var(--text); font-size: 11px; font-weight: 500; }
.field-hint { color: var(--muted); font-size: 9px; font-weight: 400; }
input, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--bg);
    color: var(--text);
    padding: 11px 12px;
    outline: none;
}
input:focus, textarea:focus { border-color: var(--gold); }
textarea { resize: vertical; }
.segmented-control { display: grid; grid-template-columns: 1fr 1fr; }
.segmented-control label { display: block; }
.segmented-control input { position: absolute; opacity: 0; pointer-events: none; }
.segmented-control span { display: grid; place-items: center; min-height: 40px; border: 1px solid var(--line); color: var(--muted); cursor: pointer; }
.segmented-control label + label span { border-left: 0; }
.segmented-control input:checked + span { border-color: var(--gold); background: var(--gold); color: #11110f; }
.delivery-note { display: flex; gap: 8px; align-items: center; margin: 0; color: var(--muted); font-size: 10px; }
.delivery-note svg { width: 16px; }
.consent-row { grid-template-columns: 18px 1fr; align-items: start; margin-bottom: 16px; color: var(--muted); }
.consent-row input { width: 16px; height: 16px; margin: 1px 0 0; accent-color: var(--gold); }
.checkout-form > .primary-command { width: 100%; gap: 10px; }
.checkout-form > .primary-command svg { width: 17px; }
.form-error { min-height: 20px; color: var(--danger); font-size: 11px; }
.test-notice { margin: 10px 0 0; color: var(--muted); font-size: 9px; text-align: center; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 50; max-width: 340px; padding: 12px 15px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-raised); opacity: 0; transform: translateY(8px); pointer-events: none; transition: .2s; }
.toast.visible { opacity: 1; transform: translateY(0); }

.payment-page { display: grid; min-height: 100vh; place-items: center; padding: 20px; }
.payment-panel { width: min(460px, 100%); padding: 30px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.payment-panel h1 { font-size: 36px; overflow-wrap: anywhere; }
.payment-panel p { color: var(--muted); }
.payment-amount { color: var(--gold-strong) !important; font-size: 30px; font-weight: 600; }
.payment-actions, .result-panel { display: grid; gap: 12px; }
.result-panel.success { border-top: 3px solid var(--success); }
.result-panel.failure { border-top: 3px solid var(--danger); }

@media (max-width: 820px) {
    .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .catalog-heading { grid-template-columns: 1fr; gap: 12px; padding-top: 34px; }
    h1 { font-size: 42px; }
}

@media (max-width: 540px) {
    .site-header { min-height: 68px; padding-inline: 16px; }
    .brand-name { font-size: 26px; }
    main, .site-footer { width: calc(100% - 28px); }
    .catalog-heading { padding: 28px 0 22px; }
    h1 { font-size: 37px; }
    .catalog-summary { font-size: 11px; }
    .product-grid { grid-template-columns: 1fr; gap: 12px; }
    .product-card { display: grid; grid-template-columns: 118px minmax(0, 1fr); min-height: 176px; }
    .product-media { aspect-ratio: auto; min-height: 100%; border-right: 1px solid var(--line); border-bottom: 0; }
    .media-placeholder { padding: 8px; font-size: 15px; }
    .type-chip { top: 8px; left: 8px; }
    .product-body { padding: 14px; }
    .product-title { font-size: 23px; }
    .product-description { min-height: 0; margin: 7px 0 12px; font-size: 10px; }
    .product-price { font-size: 14px; }
    .site-footer { flex-direction: column; }
    .cart-drawer { width: 100%; }
}
