:root {
    --background: #f8f5f0;
    --surface: #ffffff;
    --surface-soft: #f1ece5;
    --text: #2d2926;
    --text-soft: #746d66;
    --text-light: #9b9289;
    --accent: #8b4f4b;
    --accent-dark: #713d39;
    --border: #e9e1d8;
    --shadow: 0 10px 30px rgba(45, 41, 38, 0.07);
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: "DM Sans", sans-serif;
    -webkit-font-smoothing: antialiased;
}

body.modal-open {
    overflow: hidden;
}

button,
a,
input,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* =========================
   HERO
   ========================= */

.hero {
    position: relative;
    padding:
        calc(56px + env(safe-area-inset-top))
        20px
        58px;

    background:
        radial-gradient(
            circle at top right,
            rgba(139, 79, 75, 0.12),
            transparent 45%
        );

    border-bottom: 1px solid var(--border);
    text-align: center;
}

.hero-content {
    width: 100%;
    max-width: 620px;
    margin: 0 auto;
}

.hero-eyebrow,
.section-label {
    display: block;
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.16em;
}

.hero h1 {
    margin: 12px 0 18px;

    font-family: "Playfair Display", serif;
    font-size: clamp(42px, 12vw, 76px);
    line-height: 1;
    font-weight: 600;
    letter-spacing: -0.04em;
}

.hero h1 span {
    color: var(--accent);
}

.hero-description {
    max-width: 480px;
    margin: 0 auto 10px;

    color: var(--text);
    font-size: 16px;
    line-height: 1.65;
}

.hero-subtitle {
    margin: 0;

    color: var(--text-soft);
    font-size: 14px;
}

/* =========================
   PAGE
   ========================= */

.page {
    width: 100%;
    max-width: 1200px;

    margin: 0 auto;

    padding:
        34px
        16px
        120px;
}

.intro {
    margin-bottom: 24px;
}

.intro h2 {
    margin: 8px 0;

    font-family: "Playfair Display", serif;
    font-size: 29px;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.intro p {
    margin: 0;

    color: var(--text-soft);
    font-size: 14px;
    line-height: 1.6;
}

/* =========================
   PRODUCTS
   ========================= */

.products-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 12px;
}

.product-card {
    position: relative;

    display: flex;
    flex-direction: column;

    min-width: 0;
    overflow: hidden;

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: var(--radius);

    box-shadow: var(--shadow);

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.product-card.selected {
    border-color: var(--accent);

    box-shadow:
        0 0 0 1px var(--accent),
        var(--shadow);
}

/* =========================
   PRODUCT IMAGE
   ========================= */

.product-image-wrapper {
    position: relative;

    width: 100%;

    aspect-ratio: 1 / 1;

    overflow: hidden;

    background: var(--surface-soft);
}

.product-image {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: cover;

    transition: transform 0.25s ease;
}

.product-card:hover .product-image {
    transform: scale(1.04);
}

/* =========================
   SELECTED INDICATOR
   ========================= */

.product-selected {
    position: absolute;

    top: 9px;
    right: 9px;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 30px;
    height: 30px;

    background: var(--accent);
    color: white;

    border-radius: 50%;

    font-size: 15px;

    opacity: 0;

    transform: scale(0.8);

    transition:
        opacity 0.2s ease,
        transform 0.2s ease;
}

.product-card.selected .product-selected {
    opacity: 1;
    transform: scale(1);
}

/* =========================
   PRODUCT INFO
   ========================= */

.product-info {
    display: flex;
    flex-direction: column;

    flex: 1;

    min-width: 0;

    padding: 13px;
}

.product-name {
    margin: 0;

    font-size: 14px;
    line-height: 1.35;
    font-weight: 600;

    overflow-wrap: anywhere;
}

.product-description {
    display: -webkit-box;

    margin: 6px 0 12px;

    color: var(--text-soft);

    font-size: 12px;
    line-height: 1.45;

    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;

    overflow: hidden;
}

/* =========================
   PRODUCT BOTTOM
   ========================= */

/*
 * Mobile-first:
 *
 * price
 * buttons
 *
 * ficam em linhas separadas para
 * nunca haver sobreposição.
 */

.product-bottom {
    display: flex;
    flex-direction: column;

    gap: 10px;

    margin-top: auto;

    min-width: 0;
}

.product-price {
    display: block;

    color: var(--text);

    font-size: 15px;
    font-weight: 700;

    line-height: 1.2;
}

/* =========================
   PRODUCT ACTIONS
   ========================= */

.product-actions {
    display: flex;
    align-items: stretch;
    justify-content: flex-end;
    gap: 7px;
    width: 100%;
    min-width: 0;
}

.product-link {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    min-width: 0;

    min-height: 42px;

    padding:
        0
        8px;

    border: 1px solid var(--border);

    background: var(--surface);
    color: var(--text);

    border-radius: 10px;

    text-decoration: none;

    font-size: 11px;
    font-weight: 600;

    white-space: nowrap;

    overflow: hidden;
    text-overflow: ellipsis;

    transition:
        background 0.2s ease,
        border-color 0.2s ease;
}

.product-link:hover {
    background: var(--surface-soft);
    border-color: var(--accent);
}

.product-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    min-width: 42px;
    height: 42px;
    padding: 0;
    border: 0;
    background: var(--accent);
    color: white;
    border-radius: 10px;
    font-size: 20px;
    transition:
        background 0.2s ease,
        transform 0.15s ease;
}

.product-action:active {
    transform: scale(0.94);
}

.product-action:hover {
    background: var(--accent-dark);
}

.product-action.selected {
    background: var(--accent);
    color: #ffffff;

    transform: none;
}

/* =========================
   UNAVAILABLE
   ========================= */

.product-unavailable {
    position: absolute;

    inset: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 20px;

    background: rgba(45, 41, 38, 0.5);

    color: white;

    text-align: center;

    font-size: 12px;
    font-weight: 600;

    letter-spacing: 0.02em;
}

/* =========================
   CART BUTTON
   ========================= */

.cart-button {
    position: fixed;

    right: 16px;

    bottom:
        calc(16px + env(safe-area-inset-bottom));

    z-index: 50;

    display: flex;
    align-items: center;

    gap: 8px;

    min-height: 52px;

    padding:
        0
        10px
        0
        16px;

    border: 0;

    background: var(--text);
    color: white;

    border-radius: 999px;

    box-shadow:
        0 12px 30px rgba(0, 0, 0, 0.18);
}

.cart-icon {
    font-size: 20px;
}

.cart-label {
    font-size: 13px;
    font-weight: 600;
}

.cart-count {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 25px;
    height: 25px;

    background: var(--accent);

    border-radius: 50%;

    font-size: 12px;
    font-weight: 700;
}

/* =========================
   MODALS
   ========================= */

.modal {
    position: fixed;

    inset: 0;

    z-index: 100;

    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.modal.hidden {
    display: none;
}

.modal-overlay {
    position: absolute;

    inset: 0;

    background:
        rgba(20, 18, 16, 0.55);

    backdrop-filter: blur(3px);
}

.modal-content {
    position: relative;

    z-index: 1;

    width: 100%;
    max-height: 90vh;

    overflow-y: auto;

    padding:
        28px
        20px
        calc(24px + env(safe-area-inset-bottom));

    background: var(--surface);

    border-radius:
        24px
        24px
        0
        0;

    box-shadow:
        0 -10px 40px rgba(0, 0, 0, 0.15);
}

.modal-close {
    position: absolute;

    top: 14px;
    right: 16px;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 40px;
    height: 40px;

    border: 0;

    background: var(--surface-soft);
    color: var(--text);

    border-radius: 50%;

    font-size: 23px;
    line-height: 1;
}

.modal-content h2 {
    margin:
        8px
        40px
        20px
        0;

    font-family: "Playfair Display", serif;

    font-size: 30px;
    line-height: 1.15;
}

/* =========================
   CART
   ========================= */

.cart-items {
    display: flex;
    flex-direction: column;

    gap: 8px;

    margin-top: 18px;
}

.cart-item {
    display: flex;
    align-items: center;

    gap: 12px;

    padding: 10px;

    background: var(--background);

    border-radius: 13px;
}

.cart-item-image {
    flex: 0 0 auto;

    width: 52px;
    height: 52px;

    object-fit: cover;

    border-radius: 10px;
}

.cart-item-info {
    min-width: 0;
    flex: 1;
}

.cart-item-name {
    margin: 0;

    font-size: 13px;
    font-weight: 600;

    overflow-wrap: anywhere;
}

.cart-item-price {
    margin-top: 3px;

    color: var(--text-soft);

    font-size: 12px;
}

.cart-remove {
    flex: 0 0 auto;

    width: 40px;
    height: 40px;

    padding: 0;

    border: 0;

    background: transparent;
    color: var(--text-light);

    font-size: 22px;
}

.cart-footer {
    margin-top: 22px;
}

.cart-total {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 16px;

    margin-bottom: 14px;

    color: var(--text-soft);

    font-size: 14px;
}

.cart-total strong {
    color: var(--text);

    font-size: 20px;
}

/* =========================
   BUTTONS
   ========================= */

.primary-button,
.secondary-button {
    width: 100%;

    min-height: 50px;

    border-radius: 13px;

    font-weight: 700;
}

.primary-button {
    border: 0;

    background: var(--accent);
    color: white;
}

.primary-button:hover {
    background: var(--accent-dark);
}

.primary-button:disabled {
    opacity: 0.6;

    cursor: not-allowed;
}

.secondary-button {
    border: 1px solid var(--border);

    background: var(--surface);
    color: var(--text);
}

/* =========================
   FORM
   ========================= */

.form-field {
    display: flex;
    flex-direction: column;

    gap: 8px;

    margin-bottom: 18px;
}

.form-field label {
    font-size: 0.9rem;
    font-weight: 600;
}

.form-field input,
.form-field textarea {
    width: 100%;

    border: 1px solid #ddd5cd;

    border-radius: 12px;

    padding:
        12px
        14px;

    font: inherit;

    background: #fff;
    color: var(--text);
}

.form-field input {
    min-height: 48px;
}

.form-field textarea {
    min-height: 110px;

    resize: vertical;
}

.form-field input:focus,
.form-field textarea:focus {
    outline: none;

    border-color: var(--accent);

    box-shadow:
        0 0 0 3px
        rgba(125, 63, 53, 0.1);
}

.optional {
    font-weight: 400;

    opacity: 0.65;
}

/* =========================
   PIX
   ========================= */

.pix-modal-content {
    text-align: center;
}

.pix-description {
    max-width: 390px;

    margin:
        0 auto
        20px;

    color: var(--text-soft);

    font-size: 14px;
    line-height: 1.55;
}

.pix-value {
    display: flex;
    flex-direction: column;

    gap: 3px;

    margin-bottom: 18px;

    color: var(--text-soft);

    font-size: 12px;
}

.pix-value strong {
    color: var(--accent);

    font-size: 24px;
}

.pix-qr-wrapper {
    display: flex;
    justify-content: center;

    margin-bottom: 22px;
}

.pix-qr-wrapper img {
    width: min(220px, 65vw);
    height: min(220px, 65vw);

    padding: 10px;

    background: white;

    border: 1px solid var(--border);

    border-radius: 16px;
}

.pix-label {
    display: block;

    margin-bottom: 7px;

    text-align: left;

    color: var(--text-soft);

    font-size: 12px;
    font-weight: 600;
}

.pix-copy textarea {
    width: 100%;

    min-height: 88px;

    resize: none;

    padding: 11px;

    border: 1px solid var(--border);

    border-radius: 12px;

    background: var(--background);
    color: var(--text-soft);

    font-family: monospace;

    font-size: 10px;
    line-height: 1.4;
}

.pix-copy .secondary-button {
    margin-top: 8px;
}

.copy-feedback {
    min-height: 20px;

    margin:
        8px
        0
        0;

    color: var(--accent);

    font-size: 12px;
    font-weight: 600;
}

/* =========================
   PIX CUSTOM VALUE
   ========================= */

.pix-custom-value {
    margin: 24px 0;
}

.pix-amount-input {
    display: flex;
    align-items: center;

    gap: 8px;

    margin-top: 8px;

    padding:
        12px
        16px;

    background: #ffffff;

    border: 1px solid #ddd5cc;

    border-radius: 12px;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.pix-amount-input:focus-within {
    border-color: var(--accent);

    box-shadow:
        0 0 0 3px
        rgba(125, 63, 53, 0.1);
}

.pix-amount-input span {
    flex: 0 0 auto;

    color: #6f675f;

    font-size: 1rem;
    font-weight: 600;
}

.pix-amount-input input {
    width: 100%;

    min-width: 0;

    border: 0;

    outline: 0;

    background: transparent;

    font-family: inherit;

    font-size: 1.25rem;
    font-weight: 600;

    color: var(--text);
}

.pix-amount-help {
    margin: 8px 0 0;

    font-size: 0.82rem;
    line-height: 1.5;

    color: #817970;
}

#generate-pix {
    width: 100%;

    margin-bottom: 24px;
}

.pix-payment {
    margin-top: 8px;
}

.pix-payment.hidden {
    display: none;
}

/* =========================
   STATES
   ========================= */

.loading {
    grid-column: 1 / -1;

    padding:
        60px
        20px;

    color: var(--text-soft);

    text-align: center;

    font-size: 14px;
}

.empty-cart {
    padding:
        30px
        10px;

    color: var(--text-soft);

    text-align: center;

    font-size: 14px;
}

/* =========================
   TABLET
   ========================= */

@media (min-width: 600px) {

    .page {
        padding:
            48px
            28px
            120px;
    }

    .products-grid {
        grid-template-columns:
            repeat(3, minmax(0, 1fr));

        gap: 18px;
    }

    .product-info {
        padding: 16px;
    }

    .product-name {
        font-size: 15px;
    }

}

/* =========================
   DESKTOP
   ========================= */

@media (min-width: 900px) {

    .hero {
        padding-top: 90px;
        padding-bottom: 90px;
    }

    .products-grid {
        grid-template-columns:
            repeat(4, minmax(0, 1fr));

        gap: 20px;
    }

    /*
     * No desktop, podemos voltar a colocar
     * preço e ações na mesma linha.
     */

    .product-bottom {
        flex-direction: row;

        align-items: flex-end;
        justify-content: space-between;

        gap: 12px;
    }

    .product-actions {
        width: auto;

        display: flex;

        align-items: center;

        gap: 6px;
    }

    .product-link {
        width: auto;

        min-height: 36px;

        padding:
            0
            9px;

        font-size: 11px;
    }

    .product-action {
        width: 36px;
        min-width: 36px;
        height: 36px;
    }

    .modal {
        align-items: center;
    }

    .modal-content {
        width: 100%;
        max-width: 520px;
        max-height: 85vh;

        padding: 34px;

        border-radius: 24px;
    }
}

/* =========================
   VERY SMALL PHONES
   ========================= */

@media (max-width: 359px) {

    .page {
        padding-left: 12px;
        padding-right: 12px;
    }

    .products-grid {
        gap: 8px;
    }

    .product-info {
        padding: 10px;
    }

    .product-name {
        font-size: 13px;
    }

    .product-description {
        font-size: 11px;
    }

    .product-price {
        font-size: 14px;
    }

    .product-actions {
        gap: 5px;
    }

    .product-action {
        width: 40px;
        min-width: 40px;
        height: 40px;
    }

    .product-link {
        min-height: 40px;

        font-size: 10px;
    }

    .cart-label {
        display: none;
    }

    .cart-button {
        padding-left: 14px;
    }
}