:root {
  --bg: #f4f5f1;
  --surface: #ffffff;
  --ink: #15181c;
  --muted: #6a7078;
  --line: #e2e4de;
  --accent: #ffe100;
  --accent-ink: #0b0b0c;
  --accent-soft: #fff6b8;
  --header: #0b0b0c;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --display: 'Big Shoulders Display', Impact, 'Arial Narrow', sans-serif;
  --warn: #c2410c;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1113; --surface: #181b1f; --ink: #eef0ec; --muted: #9aa0a6;
    --line: #2a2e33; --accent: #ffe100; --accent-ink: #0b0b0c; --accent-soft: #3a3510; --warn: #fb923c;
    --ok: #4ade80; --ok-soft: #12301d;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: 'Archivo', system-ui, sans-serif; }
a { color: inherit; }
img { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; }
input { font: inherit; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

header.top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--header); color: #fff;
}
header.top .muted { color: #b9bbbf; }
header.top .btn.ghost { color: #fff; border-color: #3a3b3f; }
.brand img { height: 34px; width: auto; display: block; }
.brand { display: flex; align-items: center; gap: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
header.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { font-weight: 900; font-size: 22px; letter-spacing: -0.5px; text-decoration: none; }
.brand span { color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 12px 20px; font-weight: 800;
  background: var(--accent); color: var(--accent-ink); text-decoration: none;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.small { padding: 8px 14px; font-size: 14px; }
.btn.danger { background: transparent; color: var(--warn); border: 1px solid var(--line); }

.cart-btn { position: relative; }
.badge {
  position: absolute; top: -6px; right: -6px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
  background: var(--ink); color: var(--bg); font-size: 12px; display: grid; place-items: center;
}

.hero { padding: 36px 0 20px; }
.hero h1 { font-family: var(--display); text-transform: uppercase; font-size: clamp(46px, 9vw, 84px); line-height: .9; margin: 0 0 10px; font-weight: 900; letter-spacing: .5px; }
.search { display: flex; max-width: 560px; margin: 20px 0 6px; background: var(--surface); border: 2px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font-size: 18px; font-weight: 600; padding: 14px 16px; outline: none; }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.search .btn { border-radius: 0; background: var(--ink); color: var(--bg); }
.search:focus-within { box-shadow: 6px 6px 0 var(--accent); }
.result-count { min-height: 1.4em; margin: 10px 0 0; }
.hero p { color: var(--muted); margin: 0; max-width: 560px; }

.packs { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 0; }
.pack { background: var(--accent-soft); border-radius: 999px; padding: 6px 12px; font-size: 14px; font-weight: 600; }

.albums { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; padding: 16px 0 60px; }
.album { background: var(--surface); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); text-decoration: none; }
.album .cover { aspect-ratio: 3/2; background: var(--line); object-fit: cover; width: 100%; }
.album .info { padding: 12px 14px; }
.album h3 { margin: 0 0 4px; font-size: 18px; }
.album small { color: var(--muted); }

.back { display: inline-block; margin: 20px 0 4px; color: var(--muted); text-decoration: none; font-weight: 600; }
.album-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; padding-bottom: 12px; }
.share-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.share-wa { background: #25d366; color: #fff; }
.album-head h2 { margin: 0; font-family: var(--display); text-transform: uppercase; font-size: clamp(34px, 6vw, 54px); font-weight: 900; line-height: .95; letter-spacing: .5px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; padding-bottom: 100px; }
.photo { position: relative; border-radius: 10px; overflow: hidden; background: var(--line); aspect-ratio: 1; }
.photo img { width: 100%; height: 100%; object-fit: cover; user-select: none; -webkit-user-drag: none; }
.photo .add {
  position: absolute; right: 8px; bottom: 8px; width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: var(--surface); color: var(--ink); font-size: 22px; font-weight: 800; box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.photo.in-cart { outline: 3px solid var(--accent); outline-offset: -3px; }
.photo.in-cart .add { background: var(--accent); color: var(--accent-ink); }

/* Álbum gratis */
.album { position: relative; }
.free-tag { position: absolute; top: 10px; left: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 900; font-size: 13px; letter-spacing: .5px; padding: 5px 10px; border-radius: 999px; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.free-box { background: var(--accent-soft); border-radius: var(--radius); padding: 14px 16px; margin: 0 0 16px; display: grid; gap: 10px; }
.free-box p { margin: 0; }
.free-box .btn { justify-self: start; }
.photo .dl { position: absolute; right: 8px; bottom: 8px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.photo .dl:disabled { opacity: .6; }
.photo.saved { outline: 3px solid var(--ok); outline-offset: -3px; }

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

/* Carrito */
.drawer-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; display: none; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100%); background: var(--surface); z-index: 41;
  transform: translateX(100%); transition: transform .25s ease; display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.drawer.open + .drawer-bg, .drawer-bg.open { display: block; }
.drawer header { display: flex; justify-content: space-between; align-items: center; padding: 16px; border-bottom: 1px solid var(--line); }
.drawer header h3 { margin: 0; font-size: 20px; }
.drawer .items { flex: 1; overflow: auto; padding: 12px 16px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; align-content: start; }
.drawer .item { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; }
.drawer .item img { width: 100%; height: 100%; object-fit: cover; }
.drawer .item button {
  position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.6); color: #fff; font-size: 14px;
}
.drawer footer { border-top: 1px solid var(--line); padding: 16px; display: grid; gap: 10px; }
.row { display: flex; justify-content: space-between; align-items: baseline; }
.total { font-size: 26px; font-weight: 900; }
.muted { color: var(--muted); font-size: 14px; }
.field { width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.error { color: var(--warn); font-size: 14px; min-height: 1em; }
.hint { background: var(--accent-soft); border-radius: 10px; padding: 10px 12px; font-size: 14px; }

/* Barra inferior en el álbum */
.cartbar {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 30;
  display: none; align-items: center; gap: 12px; padding: 8px 8px 8px 18px; border-radius: 999px;
  background: var(--ink); color: var(--bg); box-shadow: 0 8px 30px rgba(0,0,0,.3); white-space: nowrap;
}
.cartbar.show { display: flex; }

/* Visor */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 50; display: none; flex-direction: column; }
.lightbox.open { display: flex; }
.lightbox img { flex: 1; object-fit: contain; min-height: 0; margin: auto; max-height: calc(100% - 80px); }
.lightbox .bar { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; gap: 8px; }
.lightbox .nav { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.3); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.status { display: inline-block; padding: 6px 12px; border-radius: 999px; font-weight: 800; font-size: 14px; }
.status.paid { background: var(--ok-soft); color: var(--ok); }
.status.pending { background: #fff4d6; color: #8a5a00; }
.status.rejected, .status.cancelled { background: #fde2d9; color: var(--warn); }

.demo-banner { background: #fff4d6; color: #6b4600; text-align: center; font-size: 13px; padding: 6px 12px; }
@media (prefers-color-scheme: dark) { .demo-banner, .status.pending { background: #3a2e0f; color: #ffd98a; } }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.table-wrap { overflow-x: auto; }

/* Código de descuento */
.total-wrap { display: inline-flex; align-items: baseline; gap: 8px; }
.total-wrap s { font-size: 16px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; font-weight: 600; font-size: 14px; cursor: pointer; }
.coupon { display: grid; gap: 8px; }
.coupon-form { display: flex; gap: 8px; }
.coupon-form .field { flex: 1; min-width: 0; text-transform: uppercase; }
.coupon-form[hidden], .coupon-ok[hidden] { display: none; }
.coupon-ok { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--ok-soft); color: var(--ok); border-radius: 10px; padding: 10px 12px; font-size: 14px; font-weight: 700; }
.coupon-ok .link-btn { color: inherit; font-size: 13px; }
.toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60; background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-weight: 700; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.3); max-width: calc(100% - 32px); text-align: center; transition: opacity .6s; }
.toast.out { opacity: 0; }
