:root {
    --cart-page-bg: #fff;
    --cart-page-surface: #fffdf8;
    --cart-page-card: #fff;
    --cart-page-text: #29271f;
    --cart-page-muted: #625e54;
    --cart-page-border: #e6dfd1;
    --cart-page-gold: #9a6b17;
    --cart-page-gold-dark: #76500f;
    --cart-page-focus: #6b4d14;
}

body.cart-page {
    min-height: 100vh;
    padding-top: var(--nav-h);
    background: var(--cart-page-bg);
    color: var(--cart-page-text);
}

.cart-page h1,
.cart-page h2,
.cart-page h3,
.cart-page .brand-name { color: var(--cart-page-text); }

.cart-page a { color: var(--cart-page-gold-dark); }
.cart-page a:hover { color: #4d350c; }

.cart-page .site-header {
    background: rgba(13, 13, 11, .93);
    border-bottom: .5px solid var(--border);
    box-shadow: none;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.cart-page .brand-name { color: var(--gold-light); }
.cart-page .main-nav { background: transparent; }

.cart-main {
    max-width: 1120px;
    margin: 0 auto;
    padding: 3rem 1.25rem 5rem;
}

.cart-heading {
    margin-bottom: 2rem;
    padding-bottom: 1.3rem;
    border-bottom: 1px solid var(--cart-page-border);
}

.cart-heading .section-label { color: var(--cart-page-gold); }
.cart-heading .section-title { margin-bottom: .5rem; }
.cart-heading p { color: var(--cart-page-muted); }

.cart-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(280px, .8fr);
    align-items: start;
    gap: 1.5rem;
}

.cart-panel,
.cart-summary,
.cart-checkout-panel {
    background: var(--cart-page-card);
    border: 1px solid var(--cart-page-border);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(43, 35, 18, .06);
}

.cart-panel { padding: 1.2rem; }
.cart-panel__heading { margin: 0 0 1rem; font-size: 1.25rem; }

.cart-item {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr) 100px auto auto;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
    border-top: 1px solid var(--cart-page-border);
}

.cart-item:first-child { border-top: 0; }
.cart-item__image { width: 76px; height: 76px; object-fit: contain; border-radius: 8px; background: #faf8f3; }
.cart-item__details { min-width: 0; }
.cart-item__details h3 { font-family: var(--font-body); font-size: .97rem; line-height: 1.35; }
.cart-item__variant,
.cart-item__unit-price { color: var(--cart-page-muted); font-size: .82rem; }
.cart-item__quantity { display: grid; gap: .3rem; color: var(--cart-page-muted); font-size: .78rem; }
.cart-item__quantity input,
.cart-form input,
.cart-form select,
.cart-form textarea {
    width: 100%;
    min-height: 44px;
    padding: .65rem .75rem;
    border: 1px solid #cfc7b8;
    border-radius: 7px;
    background: #fff;
    color: var(--cart-page-text);
    font: inherit;
}

.cart-item__quantity input { max-width: 100px; }
.cart-form textarea { min-height: 100px; resize: vertical; }
.cart-item__quantity input:focus,
.cart-form input:focus,
.cart-form select:focus,
.cart-form textarea:focus { outline: 2px solid var(--cart-page-focus); outline-offset: 1px; }
.cart-item__subtotal { font-weight: 700; white-space: nowrap; }
.cart-item__remove { border: 0; padding: .45rem; background: transparent; color: #9c3028; font: inherit; cursor: pointer; }
.cart-item__remove:hover { text-decoration: underline; }

.cart-empty {
    padding: 2.5rem 1rem;
    color: var(--cart-page-muted);
    text-align: center;
}

.cart-checkout-prompt {
    display: flex;
    align-items: center;
    gap: .7rem;
    width: fit-content;
    max-width: 100%;
    margin: 1.2rem 0 0;
    padding: .7rem .9rem;
    border-radius: 8px;
    background: #f8f6f0;
    color: var(--cart-page-gold-dark);
    font-size: .9rem;
    font-weight: 700;
    text-decoration: none;
}

.cart-checkout-prompt:hover { background: #f1ecdf; }
.cart-checkout-prompt__arrow { font-size: 1.6rem; line-height: 1; }

.cart-empty[hidden],
[hidden] { display: none !important; }

.cart-summary { position: sticky; top: calc(var(--nav-h) + 1rem); padding: 1.3rem; }
.cart-summary h2 { margin: 0 0 1rem; font-size: 1.2rem; }
.cart-summary__row { display: flex; justify-content: space-between; gap: 1rem; margin: .6rem 0; color: var(--cart-page-muted); }
.cart-summary__row strong { color: var(--cart-page-text); text-align: right; white-space: nowrap; }
.cart-summary__tax-total { padding-top: .6rem; border-top: 1px solid var(--cart-page-border); }
.cart-summary__total { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--cart-page-border); color: var(--cart-page-text); font-size: 1.1rem; font-weight: 700; }
.cart-summary__note { margin-top: .9rem; color: var(--cart-page-muted); font-size: .8rem; }

.cart-checkout-panel { grid-column: 1; padding: 1.4rem; }
.cart-checkout-panel h2 { scroll-margin-top: calc(var(--nav-h) + 1rem); margin-bottom: .5rem; font-size: 1.35rem; }
.cart-checkout-panel > p { margin-bottom: 1.2rem; color: var(--cart-page-muted); }
.cart-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.cart-form__field { display: grid; gap: .4rem; color: var(--cart-page-text); font-size: .88rem; font-weight: 600; }
.cart-form__field--full { grid-column: 1 / -1; }
.cart-form__checkbox { display: flex; align-items: center; gap: .65rem; color: var(--cart-page-text); font-size: .9rem; font-weight: 600; }
.cart-form__checkbox input[type="checkbox"] { width: 1.15rem; min-height: 1.15rem; margin: 0; padding: 0; accent-color: #177d51; }
.cart-form__invoice { display: grid; grid-template-columns: 1fr; gap: 1rem; min-width: 0; margin: 0; padding: 1rem; border: 1px solid var(--cart-page-border); border-radius: 8px; }
.cart-form__invoice legend { padding: 0 .35rem; color: var(--cart-page-gold-dark); font-size: .9rem; font-weight: 700; }
.cart-form select:disabled { background: #f3f1ec; color: #777267; cursor: wait; }
.cart-location-source { margin: 0; color: var(--cart-page-muted); font-size: .8rem; font-weight: 400; }
.cart-form__actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.cart-submit {
    min-height: 48px;
    padding: .75rem 1.4rem;
    border: 0;
    border-radius: 7px;
    background: #177d51;
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.cart-submit:hover { background: #126840; }
.cart-submit:disabled { opacity: .5; cursor: not-allowed; }
.cart-clear {
    min-height: 44px;
    padding: .65rem 1rem;
    border: 1px solid var(--cart-page-border);
    border-radius: 7px;
    background: #fff;
    color: var(--cart-page-text);
    font: inherit;
    cursor: pointer;
}

.cart-page .cart-continue-floating {
    position: fixed;
    right: max(1rem, env(safe-area-inset-right));
    bottom: max(1rem, env(safe-area-inset-bottom));
    z-index: 30;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .55rem;
    min-height: 48px;
    padding: .75rem 1rem;
    border: 1px solid #9a6500;
    border-radius: 999px;
    background: linear-gradient(135deg, #ffdf62 0%, #ffc928 48%, #f0a900 100%);
    box-shadow: 0 5px 18px rgba(106, 72, 0, .32), inset 0 1px 0 rgba(255, 255, 255, .65);
    color: #342300;
    font-size: .94rem;
    font-weight: 700;
    text-decoration: none;
    text-shadow: 0 1px 0 rgba(255, 255, 255, .28);
}

.cart-page .cart-continue-floating:hover {
    background: linear-gradient(135deg, #ffe98b 0%, #ffd548 48%, #f7b916 100%);
    color: #241800;
    transform: translateY(-2px);
}
.cart-page .cart-continue-floating:focus-visible { outline: 3px solid #29271f; outline-offset: 3px; }

.cart-thank-you {
    grid-column: 1 / -1;
    padding: clamp(2rem, 6vw, 4rem) 1.5rem;
    border: 1px solid var(--cart-page-border);
    border-radius: 12px;
    background: var(--cart-page-card);
    box-shadow: 0 8px 24px rgba(43, 35, 18, .06);
    text-align: center;
}

.cart-thank-you__logo { display: block; width: min(240px, 70%); max-height: 125px; margin: 0 auto 1.5rem; object-fit: contain; }
.cart-thank-you__check { display: grid; width: 88px; height: 88px; place-items: center; margin: 0 auto 1rem; border-radius: 50%; background: #e8f5ed; color: #177d51; }
.cart-thank-you__check svg { width: 64px; height: 64px; }
.cart-thank-you h2 { margin: 0 0 .7rem; color: #177d51; font-size: clamp(1.5rem, 4vw, 2rem); }
.cart-thank-you p { max-width: 620px; margin: 0 auto 1.4rem; color: var(--cart-page-muted); line-height: 1.65; }
.cart-thank-you__order-reference,
.cart-thank-you__delivery { margin-bottom: .5rem !important; }
.cart-thank-you__order-reference strong,
.cart-thank-you__delivery strong { color: var(--cart-page-text); }

.cart-status { min-height: 1.4em; margin: .6rem 0; color: #17643d; font-size: .88rem; }
.cart-status.is-error { color: #a52922; }
.cart-expiry-note { margin-top: .75rem; color: var(--cart-page-muted); font-size: .8rem; }

.cart-page .site-footer {
    background: #f8f6f0;
    border-top: 1px solid var(--cart-page-border);
}

.cart-page .footer-copy,
.cart-page .footer-links a { color: var(--cart-page-muted); }
.cart-page .footer-links a:hover { color: var(--cart-page-gold-dark); }

.cart-link {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}

.cart-link--icon {
    position: relative;
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    justify-content: center;
    padding: 0;
    color: var(--gold-light);
}

.cart-link--icon:hover { color: var(--cream); }
.cart-link--icon svg { display: block; }

.cart-link__count {
    display: inline-grid;
    min-width: 1.35rem;
    height: 1.35rem;
    place-items: center;
    padding: 0 .25rem;
    border-radius: 99px;
    background: var(--gold);
    color: #16130c;
    font-size: .72rem;
    font-weight: 700;
}

.cart-link--icon .cart-link__count {
    position: absolute;
    top: 0;
    right: 0;
    transform: translate(25%, -20%);
}

.cart-card-controls {
    display: grid;
    grid-template-columns: 75px minmax(0, 1fr);
    align-items: end;
    gap: .5rem;
    margin-top: .7rem;
}

.cart-card-controls label { display: grid; gap: .25rem; color: var(--cream-muted); font-size: .75rem; }
.cart-card-controls input,
.cart-product-controls input {
    width: 100%;
    min-height: 38px;
    padding: .4rem;
    border: 1px solid var(--border-solid);
    border-radius: 5px;
    background: var(--bg-input);
    color: var(--text);
    font: inherit;
}

.cart-card-controls button,
.cart-product-controls button {
    min-height: 40px;
    padding: .55rem .8rem;
    border: 1px solid var(--gold);
    border-radius: 5px;
    background: var(--gold);
    color: #17130b;
    font: inherit;
    font-size: .82rem;
    font-weight: 700;
    cursor: pointer;
}

.cart-card-controls button:hover,
.cart-product-controls button:hover { background: var(--gold-light); }
.cart-product-controls { display: flex; flex-wrap: wrap; align-items: end; gap: .75rem; margin: 1rem 0; }
.cart-product-controls label { display: grid; gap: .25rem; color: var(--cream-muted); font-size: .82rem; }
.cart-product-controls input { width: 90px; }
.cart-add-status { min-height: 1.5em; color: var(--gold-light); font-size: .85rem; }

@media (max-width: 850px) {
    .cart-layout { grid-template-columns: 1fr; }
    .cart-summary { position: static; }
}

@media (max-width: 700px) {
    .cart-page .main-nav.open {
        background: rgba(13, 13, 11, .98);
        border-bottom: .5px solid var(--border);
    }
}

@media (max-width: 600px) {
    .cart-main { padding: 2rem .85rem 3rem; }
    .cart-panel { padding: .9rem; }
    .cart-item { grid-template-columns: 58px minmax(0, 1fr) auto; gap: .65rem; }
    .cart-item__image { width: 58px; height: 58px; }
    .cart-item__quantity { grid-column: 2; }
    .cart-item__subtotal { grid-column: 3; grid-row: 2; font-size: .86rem; }
    .cart-item__remove { grid-column: 3; grid-row: 1; justify-self: end; }
    .cart-form { grid-template-columns: 1fr; }
    .cart-form__field--full,
    .cart-form__actions { grid-column: auto; }
    .cart-checkout-panel { padding: 1rem; }
    .cart-page .cart-continue-floating { right: max(.7rem, env(safe-area-inset-right)); bottom: max(.7rem, env(safe-area-inset-bottom)); min-height: 44px; padding: .65rem .85rem; font-size: .86rem; }
}
