/* ============================================================
   MICRO-COMMERCE - STOREFRONT STYLES
   ============================================================ */

:root {
    --brand: #25352f;
    --brand-dark: #1b2924;

    /* Theme settings — user-editable via site_config.
       primary = header + footer background, secondary = buttons. */
    --color-primary: #25352f;
    --color-secondary: #c98254;

    --page: #f7f5f0;
    --card: #ffffff;
    --image-bg: #eef0eb;
    --text: #26302c;
    --muted: #737a76;
    --border: #e5e5df;
    --accent: #c98254;
    --radius: 18px;
    /* Consistent soft shadow for admin/card surfaces (#4) */
    --card-shadow: 0 1px 2px rgba(31, 40, 35, .06), 0 2px 8px rgba(31, 40, 35, .05);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--page);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.45;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; }

/* =========================
   HEADER
   ========================= */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--color-primary);
    color: #fff;
}

.header-inner {
    width: min(1120px, calc(100% - 32px));
    min-height: 68px;
    margin: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    letter-spacing: -.02em;
}

.brand img {
    display: block;
    height: 28px;
    width: auto;
}

.brand-text small {
    display: block;
    margin-top: 1px;
    font-size: 10px;
    font-weight: 500;
    opacity: .7;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cart-button {
    position: relative;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 12px;
    background: transparent;
    color: #fff;
    cursor: pointer;
}

.cart-button:hover {
    border-color: rgba(255,255,255,.4);
}

.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    display: grid;
    place-items: center;
    border-radius: 99px;
    background: var(--color-secondary);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
}

.menu-button {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 12px;
    background: transparent;
    color: #fff;
    cursor: pointer;
}

.menu-icon,
.menu-icon::before,
.menu-icon::after {
    width: 19px;
    height: 2px;
    display: block;
    background: currentColor;
    border-radius: 99px;
}

.menu-icon { position: relative; }

.menu-icon::before,
.menu-icon::after {
    content: "";
    position: absolute;
    left: 0;
}

.menu-icon::before { top: -6px; }
.menu-icon::after { top: 6px; }

/* =========================
   CATEGORY DRAWER
   ========================= */
.drawer {
    position: fixed;
    inset: 0;
    z-index: 100;
    visibility: hidden;
}

.drawer.open {
    visibility: visible;
    pointer-events: auto;
}

.drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.38);
    opacity: 0;
    transition: opacity .2s ease;
}

.drawer-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: min(320px, 86vw);
    height: 100%;
    padding: 22px;
    background: #fff;
    transform: translateX(100%);
    transition: transform .24s ease;
    box-shadow: -10px 0 30px rgba(0,0,0,.12);
}

.drawer.open .drawer-backdrop { opacity: 1; }
.drawer.open .drawer-panel { transform: translateX(0); }

.drawer-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.drawer-top strong { font-size: 18px; }

.close-button {
    border: 0;
    background: transparent;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: var(--text);
}

.category-link {
    display: block;
    padding: 14px 4px;
    border-bottom: 1px solid var(--border);
    font-weight: 650;
}

.category-link:hover { color: var(--accent); }

/* =========================
   MAIN
   ========================= */
main {
    width: min(1120px, calc(100% - 32px));
    margin: auto;
    flex: 1 0 auto;
}

.hero {
    margin: 22px 0 38px;
    overflow: hidden;
    border-radius: 24px;
    background: var(--card);
    box-shadow: 0 8px 30px rgba(31,40,35,.06);
}

.hero-image {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    min-height: 290px;
    overflow: hidden;
    background: var(--image-bg);
    display: grid;
    place-items: center;
    color: #9aa29d;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .1em;
}

.hero-image img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.hero-content { padding: 26px 22px 28px; }

.eyebrow {
    margin: 0 0 8px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .1em;
}

h1 {
    margin: 0 0 10px;
    font-size: clamp(30px, 8vw, 48px);
    line-height: 1;
    letter-spacing: -.04em;
}

.hero-description {
    max-width: 580px;
    margin: 0 0 20px;
    color: var(--muted);
}

.price { font-size: 22px; font-weight: 800; }

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 20px;
    border: 0;
    border-radius: 12px;
    background: var(--color-secondary);
    color: #fff;
    font-weight: 750;
    cursor: pointer;
    transition: transform .15s ease, opacity .15s ease;
}

.button:hover { opacity: .92; transform: translateY(-1px); }

.hero-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 18px;
}

.products-heading {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 16px;
    margin-bottom: 16px;
}

.products-heading h2 { margin: 0; font-size: 24px; letter-spacing: -.03em; }
.products-heading p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

/* =========================
   PRODUCT GRID
   ========================= */
.product-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    padding-bottom: 44px;
}

.product-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    position: relative;
    display: flex;
    flex-direction: column;
}

.product-card-link {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    flex: 1;
}

/* Full-width Add-to-Cart button spanning the bottom of the card.
   It is a sibling of the card link, so clicking it does not navigate. */
.add-to-cart-full {
    display: block;
    width: 100%;
    padding: 12px 0;
    border: 0;
    border-top: 1px solid rgba(255,255,255,0);
    border-radius: 0 0 var(--radius) var(--radius);
    background: var(--color-secondary);
    color: #fff;
    font-weight: 750;
    font-size: 14px;
    cursor: pointer;
    text-align: center;
    transition: opacity .15s ease;
}

.add-to-cart-full:hover {
    opacity: .9;
}

/* Disabled Add-to-Cart (product out of stock) */
.add-to-cart-full:disabled,
.button.add-to-cart-disabled {
    background: #c7cdca;
    color: #fff;
    cursor: not-allowed;
    opacity: 1;
    transform: none;
}

.add-to-cart-full:disabled:hover,
.button.add-to-cart-disabled:hover {
    opacity: 1;
    transform: none;
}

.product-card-link:hover .product-image img {
    transform: scale(1.03);
}

.product-image {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;                 /* square images keep the grid uniform */
    overflow: hidden;
    background: var(--image-bg);
    display: grid;
    place-items: center;
    color: #9aa29d;
    font-size: 10px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.product-image img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;                   /* fills the square box, no distortion */
    object-position: center;
    transition: transform .2s ease;
    background: var(--image-bg);
}

.product-info {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    padding: 14px;
}

.badge {
    display: inline-block;
    margin-bottom: 7px;
    padding: 4px 7px;
    border-radius: 99px;
    background: #f2ebe5;
    color: #8d5839;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
}

/* Keep name/description heights stable so cards align regardless of badge presence */
.product-name {
    margin: 0 0 4px;
    font-size: 15px;
    line-height: 1.2;
    min-height: 36px;       /* reserve 2 lines */
}

.product-description {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
    min-height: 50px;       /* reserve 3 lines so cards stay uniform */
    /* clamp long descriptions to 3 lines */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-desc-more {
    display: inline-block;
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    cursor: pointer;
}

.product-desc-more:hover { text-decoration: underline; }

/* Price (left) + availability pill (right) flushed to the edges, pushed to bottom */
.product-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;       /* push to bottom so rows align across cards */
}

.product-price { font-weight: 800; font-size: 16px; }

/* Availability / urgency labels */
.availability {
    display: inline-block;
    font-size: 11px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 99px;
    white-space: nowrap;
}

.availability.avail-ok {
    color: #3a8a4f;
    background: #e7f3e9;
}

.availability.avail-low {
    color: #b3401f;
    background: #fbeae3;
}

.availability.avail-out {
    color: #8b8f8c;
    background: #eceeeb;
}

/* =========================
   FOOTER
   ========================= */
.site-footer {
    background: var(--color-primary);
    color: #fff;
}

.footer-inner {
    width: min(1120px, calc(100% - 32px));
    margin: auto;
    padding: 32px 0;
}

.footer-top {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    padding-bottom: 22px;
}

.footer-brand-name {
    margin: 0 0 4px;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -.02em;
}

.footer-tagline { margin: 0; font-size: 13px; opacity: .78; }

.footer-contact {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.footer-contact a,
.footer-contact span {
    font-size: 13px;
    opacity: .88;
}

.footer-contact a:hover { opacity: 1; text-decoration: underline; }

.footer-social { display: flex; gap: 12px; align-items: center; }

.footer-social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 38px;
    padding: 0 10px;
    border-radius: 99px;
    border: 1px solid rgba(255,255,255,.22);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .02em;
    transition: border-color .15s ease, opacity .15s ease;
}

.footer-social a:hover { border-color: rgba(255,255,255,.6); opacity: 1; }

/* 2nd column: legalities (links only, matches store identity, flush bottom) */
.footer-legal {
    display: flex;
    flex-direction: column;
    align-self: end;               /* flush to bottom of footer-top */
    justify-content: flex-end;
}

.footer-legal ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.footer-legal a {
    font-size: 13px;               /* matches tagline/contact sizing */
    line-height: 1.45;
    opacity: .88;
}

.footer-legal a:hover { opacity: 1; text-decoration: underline; }

/* footer identity logo */
.footer-brand .brand {
    color: #fff;
    display: inline-flex;
    margin-bottom: 8px;
}

.footer-brand .brand img {
    height: 26px;
    width: auto;
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,.14);
    padding-top: 18px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
    font-size: 12px;
    opacity: .72;
}

.footer-bottom a:hover { opacity: 1; text-decoration: underline; }

@media (min-width: 700px) {
    .footer-top {
        grid-template-columns: 1.2fr 1fr 1fr;
        align-items: start;
    }
    .footer-social { justify-content: flex-end; }
}

/* =========================
   TOAST
   ========================= */
.toast {
    position: fixed;
    left: 50%;
    bottom: 22px;
    z-index: 200;
    width: max-content;
    max-width: calc(100% - 32px);
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--brand-dark);
    color: #fff;
    font-size: 13px;
    box-shadow: 0 10px 30px rgba(0,0,0,.18);
    /* Hidden by default: fully invisible & non-interactive */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate(-50%, 130%);
    transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
}

.toast.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate(-50%, 0);
}

/* =========================
   PRODUCT DETAIL (single product view)
   ========================= */
.product-page {
    padding: 24px 0 48px;
}

.back-link {
    display: inline-block;
    margin-bottom: 20px;
    color: var(--muted);
    font-size: 14px;
}

.back-link:hover {
    color: var(--accent);
}

.product-detail {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
}

.product-detail-image {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    max-height: 560px;
    overflow: hidden;
    background: var(--image-bg);
    display: grid;
    place-items: center;
    color: #9aa29d;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.product-detail-image img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    transition: transform .2s ease;
    will-change: transform;
}

.product-detail-image:hover {
    cursor: zoom-in;
}

.product-detail-image.zooming img {
    transform: scale(2);
}

.product-detail-info {
    padding: 24px 22px 28px;
}

.product-detail-info h1 {
    margin: 4px 0 12px;
}

.product-detail-description {
    margin: 0 0 20px;
    color: var(--muted);
    font-size: 15px;
}

.product-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 22px;
}

.product-notfound {
    text-align: center;
    padding: 60px 0;
}

.product-notfound p {
    margin: 0 0 24px;
    color: var(--muted);
}

@media (min-width: 700px) {
    .product-detail {
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }

    .product-detail-image {
        max-height: none;
    }

    .product-detail-info {
        padding: 40px;
    }
}

/* =========================
   CART PAGE
   ========================= */
.cart-page {
    padding: 8px 0 48px;
}

.cart-heading {
    margin: 4px 0 20px;
    font-size: 26px;
    letter-spacing: -.03em;
}

.cart-empty {
    text-align: center;
    padding: 40px 0;
}

.cart-empty p {
    margin: 0 0 22px;
    color: var(--muted);
}

.cart-content {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.cart-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cart-item {
    display: grid;
    grid-template-columns: 64px 1fr auto auto;
    align-items: center;
    gap: 14px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    position: relative;
}

.cart-item-image {
    width: 64px;
    height: 64px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--image-bg);
    display: grid;
    place-items: center;
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.cart-item-name {
    font-weight: 700;
    font-size: 14px;
}

.cart-item-price {
    color: var(--muted);
    font-size: 13px;
}

.cart-item-qty {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 4px 6px;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 8px;
    background: var(--brand);
    color: #fff;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: grid;
    place-items: center;
}

.qty-val {
    min-width: 20px;
    text-align: center;
    font-weight: 700;
}

.cart-item-remove {
    justify-self: end;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: var(--image-bg);
    color: var(--muted);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.cart-item-remove:hover {
    background: #f3d9d0;
    color: #b3401f;
}

@media (min-width: 700px) {
    .cart-content {
        flex-direction: row;
        align-items: flex-start;
    }
    .cart-items {
        flex: 1;
    }
    .cart-summary {
        width: 280px;
    }
}

.cart-summary {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    padding: 18px;
}

.cart-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.cart-subtotal {
    font-weight: 800;
    font-size: 20px;
}

.cart-weight {
    color: var(--muted);
    font-size: 13px;
}

.cart-delivery-note {
    margin: 0 0 16px;
    color: var(--muted);
    font-size: 12px;
}

/* =========================
   LARGER SCREENS
   ========================= */
@media (min-width: 700px) {
    .header-inner { min-height: 76px; }
    .hero { display: grid; grid-template-columns: 1.05fr .95fr; margin-top: 30px; }
    .hero-image { min-height: 430px; order: 2; }
    .hero-content { align-self: center; padding: 48px; }
    .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
}

/* =========================
   CHECKOUT
   ========================= */
.checkout-page {
    padding: 8px 0 56px;
}

.checkout-heading {
    margin: 4px 0 20px;
    font-size: 26px;
    letter-spacing: -.03em;
}

.checkout-content { gap: 22px; }

.checkout-form,
.checkout-summary {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    padding: 20px;
}

.form-block {
    border: 0;
    border-bottom: 1px solid var(--border);
    padding: 0 0 18px;
    margin: 0 0 18px;
}

.form-block:last-of-type { border-bottom: 0; }

.form-block legend {
    font-weight: 800;
    font-size: 15px;
    padding: 0 0 10px;
}

.field {
    display: block;
    margin-bottom: 12px;
}

.field span {
    display: block;
    font-size: 13px;
    font-weight: 650;
    margin-bottom: 5px;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font: inherit;
    background: #fff;
}

.field textarea { resize: vertical; }

.seg-control {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.seg-option {
    flex: 1;
    min-width: 150px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    text-align: center;
}

.seg-option:has(input:checked) {
    border-color: var(--color-secondary);
    background: #fdf6f0;
}

.seg-option input { display: none; }

.pickup-note {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.payment-box {
    margin-top: 6px;
    padding: 14px;
    border-radius: 12px;
    background: #faf8f4;
}

.payment-details p { margin: 2px 0; font-size: 14px; }

.payment-instructions {
    color: var(--muted);
    font-size: 13px;
    margin-top: 8px;
}

.qr-code {
    display: block;
    width: 140px;
    height: 140px;
    object-fit: contain;
    margin: 10px 0;
    border-radius: 10px;
}

.check-line {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    margin-top: 14px;
    font-size: 13px;
    cursor: pointer;
}

.check-line input { margin-top: 3px; }

.button-block {
    display: block;
    width: 100%;
    margin-top: 6px;
}

/* ---- summary ---- */
.checkout-summary h2 {
    margin: 0 0 14px;
    font-size: 20px;
    letter-spacing: -.02em;
}

.checkout-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.checkout-item {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 13px;
}

.checkout-item-name em {
    font-style: normal;
    color: var(--muted);
}

.checkout-item-price {
    font-weight: 700;
    white-space: nowrap;
}

.co-subtotal { font-weight: 700; }

.co-total-row {
    border-top: 1px solid var(--border);
    padding-top: 12px;
    margin-top: 10px;
}

.co-total {
    font-weight: 800;
    font-size: 22px;
}

@media (min-width: 700px) {
    .checkout-content {
        display: grid;
        grid-template-columns: 1fr 320px;
        align-items: start;
        gap: 22px;
    }
    .checkout-form { grid-column: 1; }
    .checkout-summary {
        grid-column: 2;
        position: sticky;
        top: 90px;
    }
}

/* =========================
   ORDER CONFIRMATION
   ========================= */
.confirmation-page {
    padding: 30px 0 60px;
}

.confirmation-card {
    max-width: 560px;
    margin: 0 auto;
    text-align: center;
    padding: 32px 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
}

.confirmation-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 14px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #e7f3e9;
    color: #3a8a4f;
    font-size: 30px;
    font-weight: 800;
}

.confirmation-card h1 {
    font-size: 26px;
    margin-bottom: 10px;
}

.confirmation-total {
    font-size: 20px;
    font-weight: 800;
    margin: 10px 0;
}

.confirmation-detail {
    margin: 14px 0;
    padding: 12px;
    background: #faf8f4;
    border-radius: 12px;
}

.confirmation-note {
    color: var(--muted);
    font-size: 14px;
}

.confirmation-actions {
    margin-top: 20px;
}

.muted { color: var(--muted); }
