@font-face {
  font-family: "Geologica";
  src: url("fonts/geologica-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Geologica";
  src: url("fonts/geologica-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Geologica";
  src: url("fonts/geologica-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Geologica";
  src: url("fonts/geologica-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Geologica";
  src: url("fonts/geologica-800.woff2") format("woff2");
  font-weight: 800;
  font-display: swap;
}
@font-face {
  font-family: "Boldnova";
  src: url("fonts/boldnova.woff2") format("woff2");
  font-weight: 400 900;
  font-synthesis: none;
  font-display: swap;
}

/* Base verde del manual (verde cardin), franjas retro, grano analógico.
   Sin blanco ni negro puros, como pide la identidad. */
:root {
  --green: #023820;
  --green-deep: #01291A;
  --green-lift: #0A4A2D;
  --orange: #F8A21B;
  --cream: #FEF4E8;
  --ink: #141312;
  --stripe-1: #F8AF33;
  --stripe-2: #F18032;
  --stripe-3: #F24831;
  --line: rgba(254, 244, 232, 0.16);
  --muted: rgba(254, 244, 232, 0.66);
  --ink-line: rgba(20, 19, 18, 0.12);
  --ink-muted: rgba(20, 19, 18, 0.62);
  --wa: #1F8F4E;
  --sun: var(--stripe-1);
  --paper: var(--cream);

  --display: "Boldnova", "Geologica", system-ui, sans-serif;
  --body: "Geologica", system-ui, -apple-system, "Segoe UI", sans-serif;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --gutter: 16px;
  --radius: 14px;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  background: var(--green);
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

body {
  margin: 0;
  background: var(--green);
  color: var(--cream);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: 70; pointer-events: none;
  background-image: var(--grain); opacity: 0.07; mix-blend-mode: overlay;
}
body.locked { overflow: hidden; }

img { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
button, a, [role="button"] { touch-action: manipulation; }
button, .btn, .chip { -webkit-user-select: none; user-select: none; }
svg { display: block; width: 100%; height: auto; }

:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; border-radius: 6px; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--cream); color: var(--ink); padding: 8px 12px; z-index: 80; }
.skip:focus { left: 8px; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 26px; border-radius: 999px; border: 0;
  font-weight: 700; font-size: 1rem; text-decoration: none; cursor: pointer;
  transition: transform 140ms var(--ease-out), background-color 160ms ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--orange); color: var(--ink); }
.btn-dark { background: var(--green); color: var(--cream); }
.btn-wa { background: var(--wa); color: var(--cream); width: 100%; }
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { background: var(--stripe-1); }
  .btn-dark:hover { background: var(--ink); }
}

/* Franjas retro */
.stripes { display: grid; gap: 6px; padding: 6px 0; background: var(--ink); }
.stripes i { display: block; height: 12px; }
.stripes i:nth-child(1) { background: var(--stripe-1); }
.stripes i:nth-child(2) { background: var(--stripe-2); }
.stripes i:nth-child(3) { background: var(--stripe-3); }

/* Portada */
.hero {
  position: relative;
  display: flex; flex-direction: column;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 30%, var(--green-lift), var(--green) 55%, var(--green-deep));
}
.rays {
  position: absolute; inset: -40%;
  background: repeating-conic-gradient(from 0deg at 50% 38%, rgba(254,244,232,0.045) 0deg 7deg, transparent 7deg 18deg);
  pointer-events: none;
}
.hero-inner {
  position: relative;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 20px;
  padding-top: 28px; padding-bottom: 28px;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
  max-width: 1200px; width: 100%; margin: 0 auto;
}
.brand { display: flex; flex-direction: column; align-items: center; width: min(66vw, 280px); }
.badge { width: 100%; height: auto; filter: drop-shadow(0 14px 28px rgba(1, 20, 12, 0.6)); }
.groovy { width: 100%; }
.wordmark { margin: 18px 0 0; width: 100%; }
.hero-sub {
  margin: 12px 0 0;
  font-family: var(--display); font-weight: 800;
  font-size: 1.15rem; letter-spacing: 0.32em; text-indent: 0.32em;
  color: var(--orange);
}
.hero-text { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.hero-copy { margin: 0; max-width: 30ch; font-size: 1.0625rem; line-height: 1.45; color: var(--cream); }

@media (min-width: 900px) {
  .hero-inner { flex-direction: row; justify-content: center; text-align: left; gap: 72px; padding-top: 72px; padding-bottom: 72px; }
  .brand { width: 380px; }
  .hero-text { align-items: flex-start; }
  .hero-copy { font-size: 1.375rem; }
}

/* Catálogo */
.catalog {
  max-width: 1200px; margin: 0 auto;
  padding: 0 var(--gutter) 48px;
  outline: none;
}
.filters-wrap {
  position: sticky; top: 0; z-index: 10;
  margin: 0 calc(var(--gutter) * -1);
  background: var(--green);
  border-bottom: 1px solid var(--line);
}
.filters {
  display: flex; gap: 8px;
  overflow-x: auto; scroll-snap-type: x proximity;
  padding: 12px var(--gutter);
  scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; scroll-snap-align: start;
  min-height: 40px; padding: 0 16px; border-radius: 999px;
  border: 1.5px solid var(--cream); background: transparent; color: var(--cream);
  font-weight: 600; font-size: 0.9375rem; white-space: nowrap; cursor: pointer;
  transition: transform 120ms var(--ease-out), background-color 160ms ease, color 160ms ease;
}
.chip:active { transform: scale(0.96); }
.chip[aria-pressed="true"] { background: var(--orange); border-color: var(--orange); color: var(--ink); }
@media (hover: hover) and (pointer: fine) {
  .chip[aria-pressed="false"]:hover { background: rgba(254,244,232,0.08); }
}

.count { margin: 18px 0 14px; color: var(--muted); font-size: 0.9375rem; }

.grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 28px 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 720px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px 28px; } }
@media (min-width: 1040px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.card { position: relative; min-width: 0; }
.card-open {
  display: block; width: 100%; padding: 0; border: 0; background: none; text-align: left; cursor: pointer;
}
.sleeve-wrap { position: relative; padding-right: 9%; }
.card[data-formato="CD"] .sleeve-wrap { padding-right: 0; }

/* El disco que asoma detrás de la funda (solo vinilos) */
.vinyl {
  position: absolute; top: 50%; right: 0; width: 86%; aspect-ratio: 1; border-radius: 50%;
  transform: translateY(-50%);
  background:
    radial-gradient(circle, var(--orange) 0 15%, var(--ink) 15.5% 17%, transparent 17.5%),
    repeating-radial-gradient(circle, var(--ink) 0 2px, #22211F 2px 3px);
  box-shadow: 0 0 0 1px rgba(254,244,232,0.08);
  transition: transform 260ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .card-open:hover .vinyl { transform: translate(7%, -50%) rotate(25deg); }
}

.sleeve {
  position: relative; aspect-ratio: 1; border-radius: 6px; overflow: hidden;
  background: var(--paper);
  box-shadow: 0 10px 24px -12px rgba(1, 20, 12, 0.85);
}
.card[data-formato="CD"] .sleeve { border-radius: 4px; }
.sleeve img { width: 100%; height: 100%; object-fit: cover; }

/* Funda generada cuando no hay foto */
.gen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 12px;
}
.gen-artist {
  font-family: var(--display); font-weight: 900;
  font-size: clamp(1.05rem, 4.6vw, 1.6rem); line-height: 0.95;
  overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.gen-album { font-size: 0.75rem; font-weight: 500; line-height: 1.2; opacity: 0.85;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.gen.t0 { background: var(--cream); color: var(--green); }
.gen.t1 { background: var(--orange); color: var(--ink); }
.gen.t2 { background: var(--ink); color: var(--orange); }
.gen.t3 { background: var(--stripe-3); color: var(--cream); }

.sticker {
  position: absolute; z-index: 2; top: 8px; left: 8px;
  padding: 4px 10px; border-radius: 999px;
  font-family: var(--display); font-weight: 900; font-size: 0.8125rem; line-height: 1.3;
  transform: rotate(-6deg);
}
.sticker-new { background: var(--orange); color: var(--ink); }
.sticker-out { background: var(--cream); color: var(--ink); top: 42%; left: 50%; transform: translate(-50%, -50%) rotate(-8deg); font-size: 1rem; padding: 6px 14px; }
.has-sticker .gen { padding-top: 44px; }
.card.out .sleeve img, .card.out .gen { filter: grayscale(1); opacity: 0.55; }

.card-info { padding-top: 12px; padding-right: 44px; min-height: 92px; }
.card-artist { margin: 0; font-weight: 700; font-size: 0.9375rem; line-height: 1.25; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-album { margin: 2px 0 0; font-size: 0.875rem; line-height: 1.3; color: var(--muted); overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { margin: 8px 0 0; display: flex; flex-direction: column; gap: 0; }
.price { font-weight: 800; font-size: 1rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fmt { font-size: 0.75rem; font-weight: 600; color: var(--orange); white-space: nowrap; }

.add {
  position: absolute; right: 0; bottom: 4px;
  width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: var(--cream); color: var(--green); font-size: 1.5rem; line-height: 1; cursor: pointer;
  display: grid; place-items: center;
  transition: transform 140ms var(--ease-out), background-color 160ms ease;
}
.add:active { transform: scale(0.92); }
.add.in { background: var(--orange); color: var(--ink); }
.add[disabled] { display: none; }

.empty { padding: 40px 0; text-align: center; color: var(--muted); }

/* Encargos */
.encargo {
  margin-top: 64px; border-radius: var(--radius); overflow: hidden;
  background: var(--orange); color: var(--ink);
}
.encargo-body { padding: 28px 24px 28px; }
.encargo h2 { margin: 0 0 8px; font-family: var(--display); font-size: clamp(1.6rem, 6vw, 2.4rem); line-height: 1.02; color: var(--ink); text-wrap: balance; }
.encargo p { margin: 0 0 20px; max-width: 40ch; }

/* Pie */
.footer { background: var(--ink); color: var(--cream); }
.footer .stripes { background: var(--ink); }
.footer-inner {
  max-width: 1200px; margin: 0 auto;
  display: grid; gap: 28px; align-items: end;
  padding-top: 40px; padding-bottom: calc(110px + env(safe-area-inset-bottom));
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}
.footer-logo { width: 132px; }
.footer-logo img { width: 100%; height: auto; }
.footer-text p { margin: 0 0 12px; max-width: 46ch; color: var(--muted); }
.footer-text .footer-line { font-family: var(--display); font-weight: 800; font-size: 1.25rem; line-height: 1.15; color: var(--orange); }
.footer-links { display: flex; gap: 20px; }
.footer-links a { font-weight: 700; color: var(--cream); text-underline-offset: 4px; }
@media (min-width: 720px) { .footer-inner { grid-template-columns: auto minmax(0, 1fr); gap: 48px; } }

/* Barra del pedido */
.cartbar {
  position: fixed; z-index: 20;
  left: var(--gutter); right: var(--gutter);
  bottom: calc(12px + env(safe-area-inset-bottom));
  max-width: 560px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  min-height: 60px; padding: 0 8px 0 20px; border: 0; border-radius: 999px;
  background: var(--orange); color: var(--ink); cursor: pointer;
  box-shadow: 0 12px 30px -10px rgba(1,20,12,0.9);
  transition: transform 260ms var(--ease-out), opacity 200ms ease;
}
.cartbar[hidden] { display: flex; transform: translateY(140%); opacity: 0; pointer-events: none; }
.cartbar:active { transform: scale(0.98); }
.cartbar-count { font-weight: 600; }
.cartbar-total { font-weight: 800; font-variant-numeric: tabular-nums; margin-left: auto; }
.cartbar-cta { background: var(--ink); color: var(--cream); font-weight: 700; padding: 10px 16px; border-radius: 999px; white-space: nowrap; }
.cartbar.bump { animation: bump 320ms var(--ease-out); }
@keyframes bump { 40% { transform: scale(1.04); } }

/* Hojas que suben desde abajo */
.scrim {
  position: fixed; inset: 0; z-index: 30; background: rgba(1,20,12,0.6);
  transition: opacity 240ms ease;
}
.scrim[hidden] { display: block; opacity: 0; pointer-events: none; }

.sheet {
  position: fixed; z-index: 40; left: 0; right: 0; bottom: 0;
  max-width: 640px; margin: 0 auto; max-height: 92dvh;
  display: flex; flex-direction: column;
  background: var(--cream); color: var(--ink); border-radius: 20px 20px 0 0;
  --line: var(--ink-line); --muted: var(--ink-muted);
  transition: transform 380ms var(--ease-drawer);
}
.sheet[hidden] { display: flex; transform: translateY(105%); visibility: hidden; transition: transform 300ms var(--ease-drawer), visibility 0s 300ms; }
.sheet-handle { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 10px auto 0; flex-shrink: 0; }
.sheet-close {
  position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: rgba(20,19,18,0.07); font-size: 1.6rem; line-height: 1; cursor: pointer;
}
.sheet-body {
  overflow-y: auto; overscroll-behavior: contain;
  padding: 16px 20px calc(24px + env(safe-area-inset-bottom));
}
.sheet-title { margin: 6px 0 16px; font-family: var(--display); font-size: 1.9rem; line-height: 1; }

.d-top { display: grid; grid-template-columns: 42% minmax(0, 1fr); gap: 16px; align-items: start; margin-top: 8px; padding-right: 36px; }
.d-top .sleeve-wrap { padding-right: 0; }
.d-art { margin: 0; font-family: var(--display); font-size: 1.5rem; line-height: 1.05; overflow-wrap: anywhere; }
.d-album { margin: 6px 0 0; font-size: 1rem; line-height: 1.3; overflow-wrap: anywhere; }
.d-price { margin: 12px 0 0; font-size: 1.375rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.d-facts { margin: 20px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.d-facts li { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.d-facts span:first-child { color: var(--muted); }
.d-facts span:last-child { font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.d-note { margin: 16px 0 0; }
.d-stock { margin: 16px 0 0; font-weight: 600; color: var(--green); }
.sheet .fmt { color: var(--green); }
.d-actions { display: flex; gap: 12px; align-items: center; margin-top: 20px; }
.d-actions .btn { flex: 1; }
.d-ask { display: block; margin-top: 14px; text-align: center; font-weight: 600; text-underline-offset: 4px; }

.qty { display: inline-flex; align-items: center; border: 1.5px solid var(--ink); border-radius: 999px; height: 52px; flex-shrink: 0; }
.qty button { width: 44px; height: 100%; border: 0; background: none; font-size: 1.3rem; cursor: pointer; }
.qty button:disabled { opacity: 0.3; cursor: default; }
.qty output { min-width: 24px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

.cart-list { list-style: none; margin: 0; padding: 0; }
.cart-item { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cart-item .sleeve { border-radius: 4px; }
.cart-item .gen { padding: 4px; }
.cart-item .gen-artist { font-size: 0.6rem; -webkit-line-clamp: 3; }
.cart-item .gen-album { display: none; }
.ci-name { font-weight: 700; font-size: 0.9375rem; line-height: 1.25; overflow-wrap: anywhere; }
.ci-sub { font-size: 0.8125rem; color: var(--muted); overflow-wrap: anywhere; }
.ci-price { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 0.875rem; margin-top: 2px; }
.cart-item .qty { height: 40px; }
.cart-item .qty button { width: 34px; }
.cart-total { display: flex; justify-content: space-between; align-items: baseline; padding: 18px 0; font-size: 1.125rem; }
.cart-total strong { font-size: 1.375rem; font-variant-numeric: tabular-nums; }
.fine { margin: 12px 0 0; font-size: 0.8125rem; color: var(--muted); text-align: center; }

.toast {
  position: fixed; z-index: 60; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--cream); color: var(--ink); padding: 10px 18px; border-radius: 999px; font-weight: 600;
  max-width: calc(100vw - 32px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: transform 260ms var(--ease-out), opacity 200ms ease;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

.loading .card { opacity: 0.5; }

.upsell { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 0.9375rem; }
.upsell span { min-width: 0; }
.upsell-btn { flex-shrink: 0; min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--ink); background: transparent; color: var(--ink); font-weight: 700; cursor: pointer; transition: transform 140ms var(--ease-out); }
.upsell-btn:active { transform: scale(0.96); }
.card[data-formato="Accesorio"] .sleeve-wrap { padding-right: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
