/* Estructura de los componentes de compra. Cada boceto define las variables --fx-*. */
:root {
  --fx-bg: #fff;
  --fx-fg: #111;
  --fx-muted: #6b6b6b;
  --fx-line: #e5e5e5;
  --fx-surface: #f6f6f6;
  --fx-accent: #111;
  --fx-on-accent: #fff;
  --fx-radius: 0px;
  --fx-btn-radius: 0px;
  --fx-display: Georgia, serif;
  --fx-body: system-ui, sans-serif;
  --fx-ease: cubic-bezier(.2, .8, .2, 1);
}

.fx-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.fx-icon { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; background: transparent; color: inherit; cursor: pointer; border-radius: 50%; }
.fx-icon:hover { background: var(--fx-surface); }
.fx-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }

.fx-title { font-family: var(--fx-display); font-weight: 400; margin: 0; font-size: 1.4rem; line-height: 1.1; }
.fx-title--xl { font-size: clamp(1.8rem, 3vw, 2.6rem); }
.fx-eyebrow { font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; color: var(--fx-muted); margin: 0 0 .6rem; font-weight: 600; }
.fx-muted { color: var(--fx-muted); font-size: .86rem; margin: .2rem 0; }
.fx-price { font-size: 1.35rem; margin: .8rem 0 0; font-weight: 600; }
.fx-desc { line-height: 1.6; }
.fx-color { display: flex; align-items: center; gap: .5rem; font-size: .9rem; }
.fx-color i { width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--fx-line); }

.fx-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 52px; padding: 0 1.6rem; width: 100%;
  font: 600 .82rem/1 var(--fx-body); letter-spacing: .14em; text-transform: uppercase;
  border: 1px solid var(--fx-fg); color: var(--fx-fg); background: transparent;
  border-radius: var(--fx-btn-radius); cursor: pointer;
  transition: transform .25s var(--fx-ease), background .25s, color .25s;
}
.fx-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.fx-btn:active { transform: scale(.98); }
.fx-btn--primary { background: var(--fx-accent); color: var(--fx-on-accent); border-color: transparent; }
.fx-btn:disabled { opacity: .6; cursor: progress; }

/* ---------- Dialogs ---------- */
.fx-modal, .fx-drawer {
  color: var(--fx-fg); background: var(--fx-bg); font-family: var(--fx-body);
  border: 0; padding: 0; max-width: none; max-height: none;
}
.fx-modal::backdrop, .fx-drawer::backdrop { background: rgb(0 0 0 / .55); backdrop-filter: blur(6px); }

.fx-modal {
  width: min(1040px, calc(100vw - 32px)); max-height: calc(100dvh - 32px);
  border-radius: var(--fx-radius); overflow: auto;
  opacity: 0; translate: 0 24px;
  transition: opacity .35s var(--fx-ease), translate .35s var(--fx-ease), overlay .35s allow-discrete, display .35s allow-discrete;
}
.fx-modal[open] { opacity: 1; translate: 0 0; }
@starting-style { .fx-modal[open] { opacity: 0; translate: 0 24px; } }
.fx-modal__close { position: absolute; top: 12px; right: 12px; z-index: 2; background: var(--fx-bg); }

.fx-drawer {
  margin: 0 0 0 auto; height: 100dvh; width: min(440px, 100vw);
  display: flex; flex-direction: column;
  translate: 100% 0;
  transition: translate .4s var(--fx-ease), overlay .4s allow-discrete, display .4s allow-discrete;
}
.fx-drawer:not([open]) { display: none; }
.fx-drawer[open] { translate: 0 0; }
@starting-style { .fx-drawer[open] { translate: 100% 0; } }
.fx-drawer__head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--fx-line); }
.fx-drawer__foot { padding: 20px; border-top: 1px solid var(--fx-line); display: grid; gap: 12px; }
.fx-drawer__foot:empty { display: none; }

/* Barra de envío gratis */
.fx-ship { padding: 14px 20px 18px; font-size: .86rem; }
.fx-ship:empty { display: none; }
.fx-ship p { margin: 0 0 10px; }
.fx-meter { position: relative; height: 3px; background: var(--fx-line); border-radius: 3px; }
.fx-meter span { position: absolute; inset: 0 auto 0 0; background: var(--fx-accent); border-radius: 3px; transition: width .6s var(--fx-ease); }
.fx-meter i { position: absolute; top: 50%; translate: -50% -50%; color: var(--fx-accent); transition: left .6s var(--fx-ease); }
.fx-meter svg { width: 16px; height: 16px; display: block; }

.fx-lines { list-style: none; margin: 0; padding: 0 20px; overflow: auto; flex: 1; }
.fx-line { display: grid; grid-template-columns: 76px 1fr auto; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--fx-line); }
.fx-line img { width: 76px; aspect-ratio: 3/4; object-fit: cover; border-radius: calc(var(--fx-radius) / 2); }
.fx-line__name { margin: 0; font-weight: 600; }
.fx-line__price { margin: 0; font-weight: 600; white-space: nowrap; }
.fx-qty { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--fx-line); border-radius: 999px; margin-top: 8px; }
.fx-qty .fx-icon { width: 32px; height: 32px; }
.fx-qty span { min-width: 18px; text-align: center; font-size: .9rem; }
.fx-empty { text-align: center; padding: 64px 0; display: grid; justify-items: center; gap: 12px; color: var(--fx-muted); }
.fx-empty > svg { width: 36px; height: 36px; color: var(--fx-accent); }

.fx-totals { margin: 0; display: grid; gap: 6px; font-size: .92rem; }
.fx-totals div { display: flex; justify-content: space-between; }
.fx-totals dt { color: var(--fx-muted); }
.fx-totals dd { margin: 0; }
.fx-totals__grand { font-size: 1.1rem; font-weight: 700; padding-top: 8px; border-top: 1px solid var(--fx-line); margin-top: 4px; }
.fx-totals__grand dt { color: var(--fx-fg); }

.fx-pay-logos { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 0; }
.fx-pay-logos span { font-size: .68rem; letter-spacing: .06em; padding: 4px 8px; border: 1px solid var(--fx-line); border-radius: 4px; color: var(--fx-muted); }

/* ---------- Ficha de producto ---------- */
.fx-product[open] { display: grid; grid-template-columns: 1.1fr 1fr; }
.fx-product__gallery { background: var(--fx-surface); display: grid; align-content: start; }
.fx-product__main { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; }
.fx-thumbs { display: flex; gap: 6px; padding: 8px; overflow-x: auto; }
.fx-thumb { flex: 0 0 56px; padding: 0; border: 1px solid transparent; background: none; cursor: pointer; opacity: .6; }
.fx-thumb.is-on { opacity: 1; border-color: var(--fx-fg); }
.fx-thumb img { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; }
.fx-product__info { padding: clamp(24px, 4vw, 48px); display: grid; align-content: start; gap: 10px; }
.fx-sizes { border: 0; padding: 0; margin: 6px 0; display: flex; gap: 8px; flex-wrap: wrap; }
.fx-sizes legend { font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 8px; font-weight: 600; }
.fx-sizes input { position: absolute; opacity: 0; pointer-events: none; }
.fx-sizes span { display: grid; place-items: center; min-width: 52px; height: 44px; border: 1px solid var(--fx-line); border-radius: var(--fx-btn-radius); cursor: pointer; font-weight: 600; transition: .2s; }
.fx-sizes input:checked + span { background: var(--fx-fg); color: var(--fx-bg); border-color: var(--fx-fg); }
.fx-sizes input:focus-visible + span { outline: 2px solid var(--fx-accent); outline-offset: 2px; }
.fx-sizes .is-out span { opacity: .35; text-decoration: line-through; cursor: not-allowed; }
.fx-low { margin: 0; font-size: .82rem; font-weight: 600; color: var(--fx-accent); }
.fx-perks { list-style: none; padding: 16px 0 0; margin: 6px 0 0; border-top: 1px solid var(--fx-line); display: grid; gap: 6px; font-size: .84rem; color: var(--fx-muted); }
.fx-perks li::before { content: '✦ '; color: var(--fx-accent); }

/* ---------- Checkout ---------- */
.fx-checkout[open] { display: grid; grid-template-columns: 1.4fr 1fr; }
.fx-checkout__form { padding: clamp(24px, 4vw, 48px); display: grid; gap: 14px; align-content: start; }
.fx-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fx-span { grid-column: 1 / -1; }
.fx-field { display: grid; gap: 6px; font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; color: var(--fx-muted); font-weight: 600; }
.fx-field input {
  font: 1rem var(--fx-body); color: var(--fx-fg); background: var(--fx-surface);
  border: 1px solid var(--fx-line); border-radius: var(--fx-btn-radius); padding: 13px 14px; text-transform: none; letter-spacing: 0;
}
.fx-field input:focus { outline: 2px solid var(--fx-accent); outline-offset: -1px; }
.fx-field input:user-invalid { border-color: #d9534f; }
.fx-check { display: flex; gap: 10px; align-items: flex-start; font-size: .82rem; color: var(--fx-muted); }
.fx-check input { accent-color: var(--fx-accent); margin-top: 2px; }
.fx-summary { background: var(--fx-surface); padding: clamp(24px, 4vw, 48px) clamp(20px, 3vw, 36px); display: grid; align-content: start; gap: 16px; }
.fx-summary ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.fx-summary li { display: grid; grid-template-columns: 48px 1fr auto; gap: 12px; align-items: center; font-size: .86rem; }
.fx-summary img { width: 48px; aspect-ratio: 3/4; object-fit: cover; border-radius: 4px; }

.fx-result { grid-column: 1 / -1; text-align: center; padding: 64px 32px; display: grid; justify-items: center; gap: 14px; max-width: 520px; margin: auto; }
.fx-result > svg { width: 48px; height: 48px; color: var(--fx-accent); animation: fx-pop .8s var(--fx-ease); }
.fx-result .fx-btn { max-width: 320px; }
@keyframes fx-pop { from { scale: 0; rotate: -90deg; } }

.fx-toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 100; translate: -50% calc(100% + 48px); opacity: 0;
  background: var(--fx-fg); color: var(--fx-bg); font: 500 .9rem var(--fx-body);
  padding: 12px 20px; border-radius: 999px; transition: translate .4s var(--fx-ease), opacity .4s; pointer-events: none;
  max-width: calc(100vw - 32px);
}
.fx-toast.is-on { translate: -50% 0; opacity: 1; }

@media (max-width: 760px) {
  .fx-modal { width: 100vw; max-height: 100dvh; height: 100dvh; margin: 0; border-radius: 0; }
  .fx-product[open], .fx-checkout[open] { grid-template-columns: 1fr; align-content: start; }
  .fx-grid { grid-template-columns: 1fr; }
  .fx-summary { order: -1; }
}

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