/* IMPOSSIBLE 3D LAB · colores sacados del logo plano */
:root {
  --crema: #F7F5F0;
  --papel: #FFFFFF;
  --arena: #D6D2C8;
  --arena-2: #E9E6DF;
  --salvia: #8BA888;
  --salvia-osc: #5E7B5B;
  --terracota: #C98A5E;
  --cobre: #A86A45;
  --cobre-osc: #8A5434;
  --tinta: #2F3A32;
  --tinta-2: #5C6660;
  --error: #B4472B;
  --radio: 14px;
  --sombra: 0 1px 2px rgba(47, 58, 50, .06), 0 8px 24px -12px rgba(47, 58, 50, .18);
  --f-titulo: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --f-texto: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--crema); color: var(--tinta);
  font: 400 16px/1.5 var(--f-texto);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--cobre-osc); }
h1, h2, h3 { font-family: var(--f-titulo); line-height: 1.15; margin: 0; letter-spacing: -.01em; }
button, input, select, textarea { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--tinta); color: var(--crema); padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--salvia); outline-offset: 2px; }

.wrap { width: min(1200px, 100% - 32px); margin-inline: auto; }

/* Cabecera */
.top { border-bottom: 1px solid var(--arena); background: var(--crema); }
.top__in { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { height: 40px; width: auto; }
.brand .brand__txt { height: 30px; }
.top__claim { margin: 0; color: var(--tinta-2); font-size: 14px; }

/* Distribución */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 32px; align-items: start; padding: 28px 0 64px; }
.catalog, .summary, .tools { min-width: 0; }
.catalog__head h1 { font-size: clamp(30px, 4vw, 44px); font-weight: 700; }
.lead { margin: 10px 0 0; max-width: 62ch; color: var(--tinta-2); }
.lead strong { color: var(--tinta); font-weight: 600; }

.tools { margin: 24px 0 16px; display: grid; gap: 12px; position: sticky; top: 0; z-index: 5; background: var(--crema); padding: 10px 0; }
.search { display: flex; align-items: center; gap: 10px; background: var(--papel); border: 1px solid var(--arena); border-radius: 999px; padding: 0 16px; height: 46px; }
.search:focus-within { border-color: var(--salvia); box-shadow: 0 0 0 3px rgba(139, 168, 136, .25); }
.search svg { width: 18px; height: 18px; fill: none; stroke: var(--tinta-2); stroke-width: 2; flex: none; }
.search input { border: 0; outline: 0; background: none; flex: 1; min-width: 0; height: 100%; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--arena); background: var(--papel); border-radius: 999px; padding: 7px 14px; cursor: pointer; font-size: 14px; font-weight: 500; white-space: nowrap; }
.chip[aria-selected="true"] { background: var(--tinta); color: var(--crema); border-color: var(--tinta); }
.chip:hover:not([aria-selected="true"]) { border-color: var(--terracota); }

.notice { background: #FBEFE6; border: 1px solid #EBCDB8; color: var(--cobre-osc); border-radius: 10px; padding: 10px 14px; font-size: 14px; }

/* Producto */
.list { display: grid; gap: 16px; }
.skeleton { height: 220px; border-radius: var(--radio); background: linear-gradient(90deg, var(--arena-2), #F1EFEA, var(--arena-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty { text-align: center; padding: 48px 16px; color: var(--tinta-2); background: var(--papel); border-radius: var(--radio); border: 1px dashed var(--arena); }

.card { display: grid; grid-template-columns: 220px minmax(0, 1fr); background: var(--papel); border-radius: var(--radio); box-shadow: var(--sombra); overflow: hidden; }
.card__media { position: relative; background: var(--arena-2); min-height: 220px; border: 0; padding: 0; cursor: zoom-in; }
.card__media img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.card__media.is-empty { cursor: default; display: grid; place-items: center; }
.card__media.is-empty img { position: static; width: 72px; height: auto; opacity: .4; object-fit: contain; }
.card__badge { position: absolute; right: 8px; bottom: 8px; background: rgba(47, 58, 50, .78); color: var(--crema); font-size: 12px; border-radius: 999px; padding: 2px 9px; }
.card__body { padding: 18px 20px 20px; display: grid; gap: 10px; align-content: start; }
.card__eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--cobre); font-weight: 600; }
.card__title { font-size: 21px; font-weight: 600; }
.card__desc { margin: 0; color: var(--tinta-2); font-size: 15px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--tinta-2); }
.meta span::before { content: "•"; margin-right: 6px; color: var(--salvia); }
.price { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.price__main { font-family: var(--f-titulo); font-size: 24px; font-weight: 700; }
.price__lote { font-size: 13px; background: #EEF3ED; color: var(--salvia-osc); padding: 3px 10px; border-radius: 999px; font-weight: 500; }

.opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.field { display: grid; gap: 4px; }
.field label { font-size: 13px; font-weight: 600; }
.field .opt { font-weight: 400; color: var(--tinta-2); }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--arena); border-radius: 10px; background: var(--papel);
  padding: 9px 12px; min-height: 42px;
}
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--tinta-2) 50%), linear-gradient(135deg, var(--tinta-2) 50%, transparent 50%); background-position: calc(100% - 18px) 18px, calc(100% - 13px) 18px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 0; border-color: var(--salvia); box-shadow: 0 0 0 3px rgba(139, 168, 136, .25); }
.field.is-bad input, .field.is-bad select { border-color: var(--error); }
.field__err { color: var(--error); font-size: 12px; min-height: 0; }
.swatch[hidden] { display: none; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; border: 1px solid rgba(0,0,0,.15); }

.buy { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin-top: 4px; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--arena); border-radius: 10px; background: var(--papel); height: 42px; }
.qty button { width: 36px; height: 100%; border: 0; background: none; cursor: pointer; font-size: 18px; color: var(--tinta-2); }
.qty button:hover { color: var(--tinta); }
.qty input { width: 52px; text-align: center; border: 0; height: 100%; -moz-appearance: textfield; background: none; }
.qty input::-webkit-inner-spin-button, .qty input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.qty--sm { height: 32px; }
.qty--sm button { width: 28px; font-size: 16px; }
.qty--sm input { width: 38px; font-size: 14px; }

.btn { border: 0; border-radius: 10px; padding: 0 18px; height: 42px; cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn--main { background: var(--cobre); color: #fff; }
.btn--main:hover { background: var(--cobre-osc); }
.btn--main:disabled { background: var(--arena); color: var(--tinta-2); cursor: not-allowed; }
.btn--ghost { background: transparent; border: 1px solid var(--arena); color: var(--tinta); }
.btn--ghost:hover { border-color: var(--tinta-2); }
.btn--block { width: 100%; height: 48px; font-size: 16px; }
.btn.is-ok { background: var(--salvia-osc); }

/* Resumen */
.summary { position: sticky; top: 16px; }
.summary__box { background: var(--papel); border-radius: var(--radio); box-shadow: var(--sombra); padding: 20px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.summary h2 { font-size: 22px; }
.cart { display: grid; gap: 14px; max-height: min(46vh, 460px); overflow: auto; padding-right: 2px; }
.cart__empty { color: var(--tinta-2); font-size: 14px; margin: 0; padding: 14px; background: var(--crema); border-radius: 10px; text-align: center; }
.grp { border-bottom: 1px solid var(--arena-2); padding-bottom: 12px; }
.grp:last-child { border-bottom: 0; padding-bottom: 0; }
.grp__name { font-weight: 600; font-size: 15px; line-height: 1.3; }
.grp__hint { font-size: 12px; margin-top: 4px; color: var(--salvia-osc); }
.grp__hint.is-warn { color: var(--error); }
.line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; margin-top: 8px; align-items: center; }
.line__opts { font-size: 13px; color: var(--tinta-2); grid-column: 1 / -1; }
.line__ctrl { display: flex; align-items: center; gap: 8px; }
.line__price { font-size: 14px; font-weight: 600; text-align: right; }
.line__unit { display: block; font-weight: 400; color: var(--tinta-2); font-size: 12px; }
.link-btn { background: none; border: 0; color: var(--tinta-2); text-decoration: underline; cursor: pointer; font-size: 13px; padding: 0; }
.link-btn:hover { color: var(--error); }

.promo { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.promo label { font-size: 13px; font-weight: 600; }
.promo__row { display: flex; gap: 8px; }
.promo__row input::placeholder { text-transform: none; }
.promo__row input { flex: 1; min-width: 0; border: 1px solid var(--arena); border-radius: 10px; padding: 0 12px; height: 42px; text-transform: uppercase; }
.promo__msg { margin: 0; font-size: 13px; min-height: 0; }
.promo__msg.ok { color: var(--salvia-osc); }
.promo__msg.bad { color: var(--error); }

.totals { margin: 0; display: grid; grid-template-columns: 1fr auto; row-gap: 6px; font-size: 15px; }
.totals dd { padding-left: 12px; }
.totals dt { color: var(--tinta-2); }
.totals dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.totals .is-disc { color: var(--salvia-osc); }
.totals dt.is-total, .totals dd.is-total { font-family: var(--f-titulo); font-weight: 700; font-size: 22px; color: var(--tinta); padding-top: 8px; border-top: 1px solid var(--arena); }
.totals .is-sub { font-size: 13px; }
.small { font-size: 12.5px; color: var(--tinta-2); margin: 0; }

.fab { display: none; }

/* Pie */
.foot { border-top: 1px solid var(--arena); padding: 24px 0 40px; color: var(--tinta-2); font-size: 14px; }
.foot__in { display: flex; gap: 14px; align-items: center; }
.foot p { margin: 0; }

/* Diálogos */
dialog { border: 0; padding: 0; color: var(--tinta); }
dialog::backdrop { background: rgba(47, 58, 50, .55); backdrop-filter: blur(2px); }
.sheet { width: min(980px, 100% - 24px); max-height: calc(100dvh - 24px); border-radius: 18px; background: var(--crema); overflow: auto; }
.sheet__in { padding: 22px; }
.sheet__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.sheet__head h2 { font-size: 26px; }
.sheet__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
.sheet__grid > section { background: var(--papel); border-radius: var(--radio); padding: 18px; display: grid; gap: 16px; }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--arena); background: var(--papel); cursor: pointer; font-size: 15px; }
.rev-grp { border-bottom: 1px solid var(--arena-2); padding-bottom: 10px; }
.rev-grp h3 { font-family: var(--f-texto); font-size: 15px; font-weight: 600; }
.rev-line { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; margin-top: 6px; }
.rev-line span:first-child { color: var(--tinta-2); }
.rev-line strong, .line__price, .totals dd { white-space: nowrap; }
.form { background: var(--papel); border-radius: var(--radio); padding: 18px; display: grid; gap: 12px; }
.form h3 { font-size: 18px; }
.form__actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.form__err { color: var(--error); margin: 0; font-size: 14px; }
.form__err:empty { display: none; }
.trap { position: absolute; left: -5000px; width: 1px; height: 1px; overflow: hidden; }

.state { padding: 56px 24px; text-align: center; display: grid; justify-items: center; gap: 12px; }
.state[hidden] { display: none; }
.state h2 { font-size: 28px; }
.state p { margin: 0; }
.spinner { width: 48px; height: 48px; border-radius: 50%; border: 4px solid var(--arena); border-top-color: var(--cobre); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.check { width: 72px; height: 72px; }
.check circle { fill: none; stroke: var(--salvia); stroke-width: 3; stroke-dasharray: 160; stroke-dashoffset: 160; animation: draw .6s ease-out forwards; }
.check path { fill: none; stroke: var(--salvia-osc); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .4s .5s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

.gallery { background: transparent; width: min(1000px, 100vw); max-width: 100vw; max-height: 100dvh; overflow: visible; }
.gallery img { max-height: 86dvh; width: auto; margin: auto; border-radius: 12px; background: var(--arena-2); }
.gallery__close { position: absolute; top: -48px; right: 8px; }
.gallery__nav { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%; border: 0; background: rgba(247, 245, 240, .92); font-size: 28px; line-height: 1; cursor: pointer; }
.gallery__prev { left: 8px; }
.gallery__next { right: 8px; }
.gallery__count { text-align: center; color: var(--crema); margin: 10px 0 0; font-size: 14px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; } }

/* Tablet y móvil */
@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .summary { position: static; }
  .cart { max-height: none; }
  .fab {
    display: flex; position: fixed; left: 16px; right: 16px; bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 20; justify-content: space-between; align-items: center; height: 54px; padding: 0 20px;
    background: var(--tinta); color: var(--crema); border: 0; border-radius: 14px; font-weight: 600; box-shadow: 0 10px 30px -10px rgba(0,0,0,.5); cursor: pointer;
  }
  .fab[hidden] { display: none; }
  body.has-fab .foot { padding-bottom: 96px; }
}
@media (max-width: 640px) {
  .top__claim { display: none; }
  .brand .brand__txt { height: 24px; }
  .brand img { height: 34px; }
  .card { grid-template-columns: 1fr; }
  .card__media { min-height: 0; aspect-ratio: 4 / 3; }
  .card__body { padding: 16px; }
  .card__title { font-size: 19px; }
  .opts { grid-template-columns: 1fr; }
  .buy .btn { flex: 1; }
  .sheet { width: 100%; max-width: 100%; max-height: 100dvh; height: 100dvh; margin: 0; border-radius: 0; }
  .sheet__in { padding: 16px; }
  .sheet__grid { grid-template-columns: 1fr; }
  .form__actions .btn { flex: 1; }
}
