/* ============================================================
   LÀMINES: catàleg (lamines.html) i fitxa (lamina.html)
   ============================================================ */

.shop {
  --serif: "Redaction 50", "Libre Caslon Text", Georgia, serif;
  min-height: 100svh;
}

/* ---------- Catàleg ---------- */
.catalog {
  padding: clamp(84px, 10vw, 150px) clamp(16px, 6.3vw, 100px) clamp(40px, 6vw, 90px);
}
.catalog__grid {
  list-style: none; margin: 0 auto; padding: 0;
  max-width: 1500px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(28px, 4vw, 64px) clamp(16px, 3.7vw, 60px);
}
.print a {
  display: block;
  color: var(--red);
  text-decoration: none;
}
.print__frame {
  display: block;
  aspect-ratio: 0.707;
  overflow: hidden;
  box-shadow: 3px 4px 5px rgba(60, 0, 0, .35);
  transition: transform .45s cubic-bezier(.2,.8,.2,1), box-shadow .45s ease;
}
.print__frame img {
  width: 100%; height: 100%; object-fit: cover;
}
.print__title {
  display: block;
  margin-top: .45em;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(15px, 1.6vw, 26px);
  line-height: 1;
}
.print__variants {
  display: block;
  margin-top: .3em;
  font-family: var(--serif);
  font-size: clamp(11px, .9vw, 14px);
  text-transform: none;
  opacity: .75;
}
.print a:hover .print__frame,
.print a:focus-visible .print__frame {
  transform: translateY(-6px) rotate(-1.2deg);
  box-shadow: 8px 12px 16px rgba(60, 0, 0, .3);
}
.print:nth-child(even) a:hover .print__frame,
.print:nth-child(even) a:focus-visible .print__frame { transform: translateY(-6px) rotate(1.2deg); }
.print a:focus-visible { outline: none; }
.print a:focus-visible .print__title { text-decoration: underline; }

/* esgotada */
.print__frame { position: relative; }
.print__badge {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-8deg);
  padding: .3em .8em;
  background: var(--red); color: var(--pink);
  font: 700 clamp(14px, 1.5vw, 22px)/1 var(--serif);
}
.is-sold-out .print__frame img { filter: grayscale(.6) opacity(.75); }

/* avisos (vacances, error de càrrega) */
.shop-notice {
  max-width: 40em; margin: 0 auto 2em; padding: .8em 1.2em;
  background: #ffd67a; color: var(--red);
  font: 700 clamp(15px, 1.4vw, 19px)/1.35 var(--serif);
  text-align: center; text-transform: none;
}

/* entrada esglaonada */
.print {
  animation: rise .7s cubic-bezier(.2,.8,.2,1) both;
  animation-delay: calc(var(--i, 0) * 90ms + 100ms);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(40px); }
}

/* ---------- Fitxa de làmina ---------- */
.product {
  --w: min(72.7vw, calc((100svh - 135px) * 1.537));
  width: var(--w);
  margin: 0 auto;
  padding: clamp(84px, 6vw, 110px) 0 clamp(32px, 4vw, 60px);
  display: grid;
  grid-template-columns: 321fr 358fr;
  gap: calc(var(--w) * 0.027);
  align-items: stretch;
}
.product__media { margin: 0; position: relative; }

/* ---------- Zoom ---------- */
.product__media.is-zooming { cursor: crosshair; }
.zoom-lens {
  position: absolute; left: 0; top: 0;
  pointer-events: none;
  border: 2px solid var(--red);
  box-shadow: 0 0 0 9999px rgba(255, 162, 166, .4);   /* vela (rosa) la resta de la làmina */
  opacity: 0;
  transition: opacity .2s ease;
}
.product__media { overflow: hidden; }
.is-zooming .zoom-lens { opacity: 1; }
.product__panel { position: relative; }
.zoom-pane {
  position: absolute; inset: -2px; z-index: 5;
  border: 2px solid var(--red);
  background-color: var(--pink);
  background-repeat: no-repeat;
  pointer-events: none;
  opacity: 0; transform: scale(.98);
  transition: opacity .2s ease, transform .25s cubic-bezier(.2,.8,.2,1);
}
.zoom-pane.is-on { opacity: 1; transform: none; }
.product__media img {
  width: 100%;
  aspect-ratio: 0.707;
  object-fit: cover;
  transition: opacity .25s ease, transform .35s ease;
}
.product__media img.is-swapping { opacity: 0; transform: scale(.985); }

.product__panel {
  border: 2px solid var(--red);
  padding: calc(var(--w) * 0.025);
  font-family: var(--serif);
  display: flex; flex-direction: column;
}
.product__title, .product__price {
  margin: 0;
  font-weight: 700;
  font-size: calc(var(--w) * 0.042);
  line-height: 1.05;
}
.product__price { margin-top: .2em; }
.product__desc {
  margin: 1em 0 0;
  font-family: var(--text);
  text-transform: none;
  font-size: clamp(12px, calc(var(--w) * 0.0145), 16px);
  line-height: 1.3;
}

.product__rows {
  margin-top: calc(var(--w) * 0.05);
  border-top: 1px solid var(--red);
}
.row {
  display: grid;
  grid-template-columns: 1fr 2fr auto;
  align-items: center;
  gap: 8px;
  min-height: calc(var(--w) * 0.045);
  padding: .35em calc(var(--w) * 0.017);
  border-bottom: 1px solid var(--red);
  text-transform: none;
  font-size: clamp(13px, calc(var(--w) * 0.02), 20px);
}
.row[hidden] { display: none; }
.row__value { text-align: center; font-weight: 700; }
.row__more {
  appearance: none; border: 0; background: none; padding: 0 2px;
  color: var(--red);
  font: 400 1.6em/1 var(--serif);
  cursor: pointer;
}

/* desplegable de mides: s'obre fent créixer l'alçada (grid 0fr → 1fr) */
.row__drop {
  display: grid;
  grid-template-rows: 0fr;
  border-bottom: 1px solid transparent;
  transition: grid-template-rows .4s cubic-bezier(.2,.8,.2,1), border-color .2s ease .2s;
}
.row__drop.is-open {
  grid-template-rows: 1fr;
  border-bottom-color: var(--red);
  transition: grid-template-rows .45s cubic-bezier(.2,.8,.2,1), border-color 0s;
}
.row__drop-inner { overflow: hidden; min-height: 0; }
.row__drop .sizes { padding-top: .5em; }
.row__drop .row__note { padding-bottom: .6em; }
.row__drop .size-opt, .row__drop .row__note {
  opacity: 0; transform: translateY(-8px);
  transition: opacity .2s ease, transform .2s ease, background .15s ease, border-color .15s ease;
}
.row__drop.is-open .size-opt, .row__drop.is-open .row__note {
  --d: calc(var(--i, 3) * 60ms + 80ms);   /* entrada esglaonada */
  opacity: 1; transform: none;
  transition: opacity .35s ease var(--d), transform .35s cubic-bezier(.2,.8,.2,1) var(--d),
              background .15s ease, border-color .15s ease;
}
.sizes { display: grid; gap: 4px; }
.size-opt {
  display: grid;
  grid-template-columns: 1fr 2fr auto;
  align-items: center;
  padding: .35em calc(var(--w) * 0.017);
  border: 1px solid transparent;
  background: none; color: var(--red);
  font: 400 clamp(12px, calc(var(--w) * 0.017), 17px)/1.2 var(--serif);
  text-align: left;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.size-opt span:nth-child(2) { text-align: center; }
.size-opt span:last-child { font-weight: 700; }
.size-opt:hover { border-color: var(--red); }
.size-opt[aria-checked="true"] { background: var(--red); color: var(--pink); }
.size-opt:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.row__note {
  margin: 0;
  padding: .5em calc(var(--w) * 0.017) 0;
  text-transform: none;
  font-size: clamp(12px, calc(var(--w) * 0.015), 15px);
}

.swatches {
  grid-column: 2 / 4;
  display: flex; gap: clamp(10px, calc(var(--w) * 0.025), 22px);
  justify-content: center;
  padding-right: calc(var(--w) * 0.05);
}
.swatch {
  width: clamp(18px, calc(var(--w) * 0.028), 28px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1.5px solid #4a0000;
  padding: 0;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
}
.swatch:hover { transform: scale(1.12); }
.swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--pink), 0 0 0 4px var(--red); }
.swatch:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; }

.product__buy {
  margin-top: calc(var(--w) * 0.03);
  display: grid;
  grid-template-columns: calc(var(--w) * 0.085) 1fr;
  gap: calc(var(--w) * 0.008);
}
.qty, .add {
  font-family: var(--serif);
  font-size: clamp(13px, calc(var(--w) * 0.019), 19px);
  min-height: calc(var(--w) * 0.03);
}
.qty {
  appearance: none;
  border: 1px solid var(--red);
  background: transparent
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23cf0000' stroke-width='1.3'/%3E%3C/svg%3E")
    no-repeat right .5em center / .7em;
  color: var(--red);
  font-weight: 700;
  padding: 0 1.6em 0 .7em;
  cursor: pointer;
}
.add {
  border: 0;
  background: var(--red);
  color: var(--pink);
  font-weight: 700;
  cursor: pointer;
  transition: filter .2s ease, transform .2s ease;
}
.add:hover { filter: brightness(1.12); }
.add:disabled, .qty:disabled { opacity: .45; cursor: default; filter: none; }
.add:active { transform: translateY(1px); }
.product__soon {
  margin: .6em 0 0;
  min-height: 1.3em;
  text-transform: none;
  font-size: clamp(12px, calc(var(--w) * 0.015), 15px);
}

/* ---------- També et pot agradar (sota la fitxa) ---------- */
.related { padding: clamp(24px, 4vw, 60px) clamp(16px, 6.3vw, 100px) clamp(48px, 6vw, 90px); }
.related[hidden] { display: none; }
.related__title {
  max-width: 1500px; margin: 0 auto clamp(18px, 2.4vw, 36px);
  padding-top: clamp(20px, 3vw, 40px); border-top: 2px solid var(--red);
  /* Redaction: la TheBold no té accents ("També") */
  font: 700 clamp(22px, 2.6vw, 40px)/1 var(--serif); text-transform: uppercase;
}

/* ---------- Mòbil / tauleta ---------- */
@media (max-width: 900px) {
  .catalog__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .print__title { font-size: clamp(15px, 3.4vw, 22px); }

  .product {
    --w: calc(100vw - 32px);
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .product__media img { max-height: 75svh; width: auto; margin: 0 auto; }
  .product__panel { padding: 18px; }
  .product__title, .product__price { font-size: clamp(26px, 8vw, 40px); }
  .product__buy { grid-template-columns: 70px 1fr; }
  .qty, .add { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .print { animation: none; }
  .row__drop, .row__drop .size-opt, .row__drop .row__note { transition: none !important; }
}

/* ---------- Gràcies (després de pagar) ---------- */
.thanks {
  min-height: 100svh;
  display: grid; place-content: center; justify-items: center;
  gap: 1rem;
  padding: 100px 20px 60px;
  text-align: center;
  font-family: var(--serif);
  text-transform: none;
}
.thanks__title {
  margin: 0;
  font: 700 clamp(56px, 11vw, 160px)/1 var(--serif);
  animation: rise .8s cubic-bezier(.2,.8,.2,1) both;
}
.thanks__text { margin: 0; max-width: 32em; font-family: var(--text); font-size: clamp(16px, 1.5vw, 22px); }
.thanks__back {
  margin-top: 1.5rem;
  padding: .6em 1.4em;
  background: var(--red); color: var(--pink);
  font-weight: 700; text-decoration: none;
}
.thanks__back:hover { filter: brightness(1.12); }
