/* ==========================================================================
   Loja de Pipas — estilos base (estrutura neutra, sem tema)
   Todas as cores/medidas vêm dos tokens abaixo: a etapa de tema troca só este bloco.
   Fontes do sistema (nada para baixar) + ícones SVG inline.
   ========================================================================== */

:root {
    /* Cores (neutras por enquanto) */
    --bg:            #ffffff;
    --surface:       #f4f4f5;
    --surface-2:     #e9e9ec;
    --text:          #18181b;
    --text-muted:    #6b6b73;
    --border:        #d9d9de;
    --accent:        #27272a;
    --accent-text:   #ffffff;
    --accent-soft:   #ececef;
    --success:       #1f7a3d;
    --success-bg:    #e6f4ea;
    --danger:        #b42318;
    --danger-bg:     #fdecea;
    --warning:       #8a5a00;
    --warning-bg:    #fff4d6;

    /* Tipografia: pilha de fontes do sistema */
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;

    /* Forma e espaçamento */
    --radius:    10px;
    --radius-sm: 6px;
    --gap:       1rem;
    --container: 1180px;
    --shadow:    0 1px 2px rgb(0 0 0 / .06), 0 4px 14px rgb(0 0 0 / .05);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font: 16px/1.55 var(--font);
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.1rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 1em; }
ul { margin: 0; padding: 0; list-style: none; }
address { font-style: normal; margin-bottom: 1em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.icon { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-muted); }
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gap); }
.main { flex: 1; padding-block: 1.5rem 3rem; }

/* ---------- Botões ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    padding: .65rem 1.1rem; border: 1px solid var(--accent); border-radius: var(--radius-sm);
    background: var(--accent); color: var(--accent-text);
    font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
    transition: filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.12); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn--ghost:hover { background: var(--surface); filter: none; }
.btn--block { display: flex; width: 100%; }
.btn--lg { padding: .85rem 1.4rem; font-size: 1.05rem; }
.btn--sm { padding: .35rem .7rem; font-size: .875rem; }
.icon-btn {
    display: inline-grid; place-items: center; width: 40px; height: 40px;
    border: 0; border-radius: var(--radius-sm); background: transparent; color: inherit; cursor: pointer;
}
.icon-btn:hover { background: var(--surface); }

/* ---------- Cabeçalho ---------- */
.site-header { border-bottom: 1px solid var(--border); background: var(--bg); position: sticky; top: 0; z-index: 20; }
.site-header__inner { display: flex; align-items: center; gap: var(--gap); min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.15rem; text-decoration: none; }
.search { flex: 1; display: flex; align-items: center; max-width: 520px; margin-inline: auto;
          border: 1px solid var(--border); border-radius: 999px; padding-left: 1rem; background: var(--surface); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; color: inherit; padding: .5rem 0; }
.search input:focus { outline: none; }
.search:focus-within { outline: 3px solid var(--accent); outline-offset: 1px; }
.cart-link { position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: var(--radius-sm); text-decoration: none; }
.cart-link:hover { background: var(--surface); }
.cart-link__count {
    position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 999px; background: var(--accent); color: var(--accent-text);
    font-size: .72rem; font-weight: 700; display: grid; place-items: center;
}
.nav-toggle { display: none; }
.site-nav { border-top: 1px solid var(--border); background: var(--surface); }
.site-nav .container { display: flex; gap: .25rem; overflow-x: auto; scrollbar-width: thin; }
.site-nav a { padding: .6rem .8rem; text-decoration: none; white-space: nowrap; font-size: .95rem; }
.site-nav a:hover { background: var(--surface-2); }

/* ---------- Rodapé ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding-block: 1.5rem; color: var(--text-muted); font-size: .9rem; }
.site-footer p { margin: 0; }

/* ---------- Alertas ---------- */
.alert { padding: .75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; border: 1px solid transparent; }
.alert--success { background: var(--success-bg); color: var(--success); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.alert--error   { background: var(--danger-bg);  color: var(--danger);  border-color: color-mix(in srgb, var(--danger) 25%, transparent); }

/* ---------- Home ---------- */
.hero { background: var(--surface); border-radius: var(--radius); padding: clamp(1.5rem, 5vw, 3.5rem); margin-bottom: 2rem; }
.hero p { color: var(--text-muted); max-width: 52ch; font-size: 1.1rem; }
.section { margin-block: 2rem; }
.section__title { margin-bottom: 1rem; }
.perks { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--gap); }
.perks div { display: flex; flex-direction: column; gap: .25rem; padding: 1.25rem; border: 1px solid var(--border); border-radius: var(--radius); }
.perks span { color: var(--text-muted); font-size: .9rem; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.chip { display: inline-block; padding: .4rem .9rem; border: 1px solid var(--border); border-radius: 999px; text-decoration: none; font-size: .92rem; }
.chip:hover, .chip[aria-current="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

/* ---------- Grade e cartão de produto ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: var(--gap); }
.card { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bg); }
.card:hover { box-shadow: var(--shadow); }
.card__media { aspect-ratio: 1; background: var(--surface); display: grid; place-items: center; }
.card__media img { width: 100%; height: 100%; object-fit: cover; }
.card__placeholder { display: grid; place-items: center; color: var(--text-muted); width: 100%; height: 100%; }
.card__body { display: flex; flex-direction: column; gap: .35rem; padding: .9rem; flex: 1; }
.card__cat { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.card__title { margin: 0; font-size: 1rem; }
.card__title a { text-decoration: none; }
.card__title a:hover { text-decoration: underline; }
.card form, .card .badge { margin-top: auto; }
.price { margin: 0; display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.price s { color: var(--text-muted); font-size: .9rem; }
.price strong { font-size: 1.15rem; }
.price--lg strong { font-size: 1.8rem; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--accent-soft); color: var(--text); }
.badge--muted, .badge--cancelled { background: var(--surface-2); color: var(--text-muted); }
.badge--pending { background: var(--warning-bg); color: var(--warning); }
.badge--paid, .badge--delivered { background: var(--success-bg); color: var(--success); }
.badge--shipped { background: var(--accent-soft); color: var(--text); }

/* ---------- Catálogo ---------- */
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--gap); flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.catalog { display: grid; grid-template-columns: 220px 1fr; gap: 2rem; align-items: start; }
.filter-list li a { display: block; padding: .45rem .6rem; border-radius: var(--radius-sm); text-decoration: none; }
.filter-list li a:hover { background: var(--surface); }
.filter-list li a[aria-current="true"] { background: var(--accent); color: var(--accent-text); }
.sort { display: flex; align-items: center; gap: .5rem; justify-content: flex-end; margin-bottom: 1rem; font-size: .92rem; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 2rem; }

/* ---------- Produto ---------- */
.breadcrumb { font-size: .9rem; color: var(--text-muted); margin-bottom: 1rem; }
.product { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2rem; align-items: start; }
.product__media { aspect-ratio: 1; background: var(--surface); border-radius: var(--radius); overflow: hidden; display: grid; place-items: center; }
.product__media img { width: 100%; height: 100%; object-fit: cover; }
.stock-note { color: var(--text-muted); }
.buy { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; margin-block: 1rem 1.5rem; }
.prose h2 { margin-top: 1.5rem; }

/* ---------- Quantidade ---------- */
.qty { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.qty input { width: 3.2rem; border: 0; text-align: center; font: inherit; background: transparent; color: inherit; -moz-appearance: textfield; appearance: textfield; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty .icon-btn { width: 36px; height: 40px; }

/* ---------- Carrinho / Checkout ---------- */
.cart, .checkout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 2rem; align-items: start; }
.line { display: grid; grid-template-columns: 80px minmax(0, 1fr) auto auto auto; gap: 1rem; align-items: center; padding-block: 1rem; border-bottom: 1px solid var(--border); }
.line__media { width: 80px; height: 80px; background: var(--surface); border-radius: var(--radius-sm); overflow: hidden; display: grid; place-items: center; color: var(--text-muted); }
.line__media img { width: 100%; height: 100%; object-fit: cover; }
.line__info { display: flex; flex-direction: column; min-width: 0; }
.line__name { font-weight: 600; text-decoration: none; }
.line__qty { display: flex; align-items: center; gap: .5rem; }
.line__total { min-width: 6.5rem; text-align: right; }
.summary { border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; background: var(--surface); position: sticky; top: 90px; display: flex; flex-direction: column; gap: .75rem; }
.summary h2 { margin: 0; }
.summary dl { margin: 0; display: grid; gap: .4rem; }
.summary dl div { display: flex; justify-content: space-between; gap: 1rem; }
.summary dt { color: var(--text-muted); }
.summary dd { margin: 0; }
.summary__total { border-top: 1px solid var(--border); padding-top: .6rem; font-size: 1.15rem; font-weight: 700; }
.summary__total dt { color: inherit !important; }
.summary__items li { display: flex; justify-content: space-between; gap: 1rem; padding-block: .35rem; border-bottom: 1px dashed var(--border); font-size: .95rem; }
.order-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; margin-bottom: 1.5rem; }
.panel { border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; background: var(--bg); margin-bottom: 1.5rem; }
.panel h2 { margin-bottom: .75rem; }
.panel dl { margin: 0; display: grid; gap: .4rem; }
.panel dl div { display: flex; justify-content: space-between; gap: 1rem; }
.panel dd { margin: 0; }
.panel .summary__total { border-top: 1px solid var(--border); padding-top: .6rem; }

/* ---------- Formulários ---------- */
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem 1.25rem; margin: 0 0 1.5rem; }
legend { font-weight: 700; padding-inline: .4rem; }
.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: 1rem; min-width: 0; }
.field label { font-weight: 600; font-size: .92rem; }
.field input:not([type="checkbox"]):not([type="file"]), .field select, .field textarea, .qty-input {
    width: 100%; padding: .65rem .8rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
    font: inherit; color: inherit; background: var(--bg);
}
.field textarea { resize: vertical; }
.field__hint { color: var(--text-muted); font-size: .82rem; }
.field__error { color: var(--danger); font-size: .85rem; }
.field--error input, .field--error select, .field--error textarea { border-color: var(--danger); }
.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.row--street { grid-template-columns: minmax(0, 1fr) 8rem; }
.row--city { grid-template-columns: minmax(0, 1fr) 8rem; }
.check { display: inline-flex; align-items: center; gap: .5rem; font-weight: 500; }

/* ---------- Tabelas ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.table th, .table td { padding: .65rem .5rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table__actions { white-space: nowrap; text-align: right; }
.table__actions form, .table__actions a { display: inline-grid; vertical-align: middle; }
.table__product { display: flex; align-items: center; gap: .75rem; }
.thumb { width: 40px; height: 40px; border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; display: grid; place-items: center; color: var(--text-muted); flex: none; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Estado vazio ---------- */
.empty { text-align: center; padding: 3rem 1rem; display: flex; flex-direction: column; align-items: center; gap: .75rem; color: var(--text-muted); }
.empty h1 { color: var(--text); }

/* ---------- Responsivo ---------- */
@media (max-width: 860px) {
    .catalog { grid-template-columns: 1fr; gap: 1rem; }
    .catalog__filters .filter-list { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .25rem; }
    .catalog__filters .filter-list a { white-space: nowrap; border: 1px solid var(--border); border-radius: 999px; }
    .product, .cart, .checkout { grid-template-columns: 1fr; }
    .summary { position: static; }
}
@media (max-width: 720px) {
    .site-header__inner { flex-wrap: wrap; padding-block: .5rem; }
    .nav-toggle { display: inline-grid; }
    .brand { margin-right: auto; }
    .search { order: 5; flex-basis: 100%; max-width: none; }
    .site-nav { display: none; }
    .site-nav.is-open { display: block; }
    .site-nav .container { flex-direction: column; }
    .line { grid-template-columns: 64px minmax(0, 1fr) auto; }
    .line__media { width: 64px; height: 64px; }
    .line__qty { grid-column: 2 / -1; }
    .line__total { text-align: left; }
    .row, .row--street, .row--city { grid-template-columns: 1fr; }
    .row--street, .row--city { grid-template-columns: minmax(0, 1fr) 6rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
