@font-face {
  font-family: "TheBold";
  src: url("assets/fonts/THEBOLDFONT-FREEVERSION.woff") format("woff"),
       url("assets/fonts/THEBOLDFONT-FREEVERSION.otf") format("opentype");
  font-display: block;
}
@font-face {
  font-family: "Redaction 50";
  src: url("assets/fonts/redaction-50-latin-400-normal.woff2") format("woff2"),
       url("assets/fonts/redaction-50-latin-400-normal.woff") format("woff");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Redaction 50";
  src: url("assets/fonts/redaction-50-latin-700-normal.woff2") format("woff2"),
       url("assets/fonts/redaction-50-latin-700-normal.woff") format("woff");
  font-weight: 700;
  font-display: swap;
}

/* Textos llargs: Candara (si el visitant la té, Windows / Office) i, si no, Alegreya Sans (lliure, OFL), molt semblant */
@font-face {
  font-family: "Alegreya Sans";
  src: url("assets/fonts/alegreya-sans-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Alegreya Sans";
  src: url("assets/fonts/alegreya-sans-latin-400-italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Alegreya Sans";
  src: url("assets/fonts/alegreya-sans-latin-700-normal.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Ticketing";
  src: url("assets/fonts/Ticketing.ttf") format("truetype");
  font-display: swap;
}

:root {
  --pink: #ffa2a6;
  --red: #cf0000;
  --blue: #178cff;
  --ink: #1b1b22;
  --shade: rgba(40, 38, 52, 0.62);
  --gutter: clamp(16px, 2.6vw, 40px);
  --text: Candara, "Alegreya Sans", "Segoe UI", system-ui, sans-serif;   /* textos llargs */
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--pink);
  color: var(--red);
  font-family: "TheBold", system-ui, sans-serif;
  text-transform: uppercase;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- NAV ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 10;
  display: flex; justify-content: center; flex-wrap: wrap;
  gap: clamp(14px, 3.4vw, 48px);
  padding: clamp(14px, 2.4vw, 28px) var(--gutter);
  font-size: clamp(13px, 1.35vw, 19px);
  pointer-events: none;
  isolation: isolate;
}

.nav a {
  pointer-events: auto;
  color: var(--red);
  text-decoration: none;
  position: relative;
}
.nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 3px;
  background: var(--blue); border-radius: 3px;
  transform: scaleX(0); transform-origin: left;
  transition: transform .3s ease;
}
.nav a:hover::after, .nav a:focus-visible::after,
.nav a[aria-current="page"]::after { transform: scaleX(1); }

section { position: relative; }

/* El contingut es fon (perd opacitat) quan puja cap a la barra.
   Els límits (--fade-from / --fade-to) els calcula site.js segons on acaba el text del menú. */
main {
  /* els valors reals els calcula site.js (initFade) segons on acaba el text del menú */
  --fade-from: 0px;
  --fade-to:   0px;
  -webkit-mask-image: linear-gradient(to bottom, transparent var(--fade-from), #000 var(--fade-to));
  mask-image: linear-gradient(to bottom, transparent var(--fade-from), #000 var(--fade-to));
}

/* ---------- 1 · HERO ---------- */
.hero {
  height: 100svh;
  min-height: 320px;
  display: grid; place-items: center;
}
/* centrat a la pantalla; deixa lloc a dalt i a baix per a la barra */
.hero__svg { width: 100%; max-height: calc(100svh - 180px); overflow: visible; }
.hero__word { font-family: "TheBold"; fill: var(--red); }
.hero__line { fill: var(--blue); }

.word-in {
  opacity: 0;
  transform: translateY(40px);
  transform-box: view-box;
}
.is-ready .word-in {
  opacity: 1; transform: none;
  transition: opacity .9s ease, transform 1.1s cubic-bezier(.2,.8,.2,1);
}

/* ---------- 2 · SOBRE MI ---------- */
.about {
  min-height: 100svh;
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  align-items: start;
  /* el marge esquerre coincideix amb la N de NANINART (--n-left el calcula main.js) */
  padding: clamp(64px, 8vw, 110px) var(--gutter) clamp(24px, 4vw, 60px) var(--n-left, var(--gutter));
  overflow-x: clip;   /* les estrelles poden sortir pels costats, però el peu no es retalla */
}
.about__title {
  margin: 0;
  font-size: clamp(56px, 10.5vw, 170px);
  line-height: .9;
  font-weight: 400;
  white-space: nowrap;
  position: relative; z-index: 1;
}

.about__body {
  max-width: 34em;
  margin-top: clamp(16px, 2.4vw, 36px);
  font-family: var(--text);
  text-transform: none;
  font-size: clamp(16px, 1.35vw, 21px);
  line-height: 1.5;
  position: relative; z-index: 1;
}
.about__body p { margin: 0 0 1em; }
.about__body h2 { font: 700 1.2em/1.2 "Redaction 50", Georgia, serif; margin: 1.2em 0 .4em; }

.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  margin-top: clamp(-90px, -6vw, -20px);
}
.layer {
  position: absolute;
  left: var(--l); top: var(--t); width: var(--w);
  opacity: 0;
  transform: translateY(60px) scale(.6) rotate(-8deg);
}
.layer img { width: 100%; height: auto; will-change: transform; }

.about.is-visible .layer {
  opacity: 1; transform: none;
  transition: opacity .7s ease var(--d), transform 1s cubic-bezier(.34,1.56,.64,1) var(--d);
}
.about.is-visible .layer img {
  animation: bob var(--dur, 5s) ease-in-out var(--delay, 0s) infinite;
}

/* balanceig: cada capa té la seva durada, amplitud i desfasament */
[data-float="nina"] img { --dur: 7.4s;  --delay: -1.2s; --dx: 6px;  --dy: 16px; --rot: 1.6deg; transform-origin: 50% 40%; }
[data-float="e1"]   img { --dur: 4.1s;  --delay: -0.6s; --dx: 4px;  --dy: 10px; --rot: 12deg; }
[data-float="e2"]   img { --dur: 5.3s;  --delay: -2.9s; --dx: -5px; --dy: 12px; --rot: -10deg; }
[data-float="e3"]   img { --dur: 3.7s;  --delay: -1.7s; --dx: 3px;  --dy: 9px;  --rot: 14deg; }
[data-float="e4"]   img { --dur: 4.8s;  --delay: -3.4s; --dx: -4px; --dy: 13px; --rot: -11deg; }
[data-float="e5"]   img { --dur: 6.1s;  --delay: -0.2s; --dx: 5px;  --dy: 11px; --rot: 9deg; }

@keyframes bob {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  25%      { transform: translate(var(--dx), calc(var(--dy) * -1)) rotate(var(--rot)); }
  50%      { transform: translate(0, calc(var(--dy) * -0.35)) rotate(0deg); }
  75%      { transform: translate(calc(var(--dx) * -1), calc(var(--dy) * -0.8)) rotate(calc(var(--rot) * -0.7)); }
}

/* ---------- 3 · TREBALLS ---------- */
.works {
  min-height: 100svh;
  display: grid; align-items: center;
  padding: clamp(70px, 9vw, 120px) 0 clamp(40px, 6vw, 80px);
  overflow: hidden;
}
.works__row {
  --works-gap: clamp(16px, 2.6vw, 40px);
  display: grid;
  /* 3 targetes a dalt i 2 a sota, centrades (mateixa mida): cada targeta ocupa 2 de 6 columnes */
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--works-gap);
  padding: 0 var(--works-gap);   /* als costats, el mateix marge que entre targetes */
}
.works__row .card { grid-column: span 2; }
.works__row .card:nth-child(4) { grid-column: 2 / span 2; }
.card {
  position: relative; display: block;
  aspect-ratio: 3 / 2;   /* = Covers.ASPECT (data/covers.js) */
  border-radius: clamp(14px, 2vw, 26px);
  overflow: hidden;
  isolation: isolate;
  opacity: 0; transform: translateY(50px);
}
.works.is-visible .card {
  opacity: 1; transform: none;
  transition: opacity .7s ease, transform .9s cubic-bezier(.2,.8,.2,1);
}
.works.is-visible .card:nth-child(2) { transition-delay: .12s; }
.works.is-visible .card:nth-child(3) { transition-delay: .24s; }
.works.is-visible .card:nth-child(4) { transition-delay: .36s; }
.works.is-visible .card:nth-child(5) { transition-delay: .48s; }

/* la imatge es col·loca segons el retall triat al panell (data/covers.js) */
.card__frame {
  position: absolute; inset: 0; overflow: hidden;
  background: #e8746f;   /* si encara no té imatge */
  transition: transform .8s cubic-bezier(.2,.8,.2,1);
}
.card img { width: 100%; height: 100%; object-fit: cover; }
.card img[hidden] { display: none; }
.card::before {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: var(--shade);
  transition: opacity .45s ease;
}
.card__label {
  position: absolute; inset: 0; z-index: 2;
  display: grid; place-items: center; text-align: center;
  color: var(--pink);
  font-size: clamp(22px, 4.2vw, 64px);
  line-height: .85;
  transition: transform .5s cubic-bezier(.2,.8,.2,1), opacity .4s ease;
}
.card:hover .card__frame, .card:focus-visible .card__frame { transform: scale(1.06); }
.card:hover::before, .card:focus-visible::before { opacity: 0; }
.card:hover .card__label, .card:focus-visible .card__label { transform: scale(1.08); opacity: 0; }
.card:focus-visible { outline: 4px solid var(--blue); outline-offset: 4px; }

/* ---------- Mòbil ---------- */
@media (max-width: 760px) {
  .about { grid-template-columns: 1fr; align-content: start; }
  .stage { margin-top: 0; width: 115%; margin-left: -5%; }

  .works__row {
    grid-template-columns: repeat(5, 72vw);
    justify-content: start;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 0 var(--gutter) 12px;
    scrollbar-width: none;
  }
  .card { scroll-snap-align: center; }
  .works__row .card, .works__row .card:nth-child(4) { grid-column: auto; }
  .card__label { font-size: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .word-in, .layer, .card { opacity: 1 !important; transform: none !important; transition: none !important; }
  .layer img { animation: none !important; }
}

/* ============================================================
   CISTELLA: botó + tiquet que s'imprimeix
   ============================================================ */
/* logo a dalt a l'esquerra (site.js) */
.site-logo {
  position: fixed; z-index: 30;
  top: clamp(6px, 1vw, 14px); left: clamp(12px, 1.9vw, 28px);
  width: clamp(44px, 4.2vw, 62px); aspect-ratio: 1;
  transition: transform .3s cubic-bezier(.2,.8,.2,1);
}
.site-logo img { width: 100%; height: 100%; object-fit: contain; }
.site-logo:hover { transform: rotate(-8deg) scale(1.06); }
.site-logo:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 50%; }

.cart-btn {
  --size: clamp(44px, 4.2vw, 62px);
  position: fixed; z-index: 30;
  top: clamp(10px, 1.3vw, 18px);
  right: clamp(12px, 1.9vw, 28px);
  width: var(--size); aspect-ratio: 1.3;
  display: grid; place-items: center;
  border: 0; border-radius: 22%;
  background: var(--red); color: var(--pink);
  cursor: pointer;
  transition: transform .2s ease, filter .2s ease;
}
.cart-btn:hover { transform: rotate(-4deg) scale(1.05); }
.cart-btn:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.cart-btn svg { width: 56%; height: auto; }
.cart-btn__count {
  position: absolute; left: -9px; top: -9px;
  min-width: 24px; height: 24px; padding: 0 6px;
  display: none; place-items: center;
  border-radius: 12px;
  background: var(--blue); color: #fff;
  font: 400 14px/1 "TheBold", sans-serif;
  padding-top: 2px;
}
.cart-btn.has-items .cart-btn__count { display: grid; }
.cart-btn__count.bump { animation: bump .45s cubic-bezier(.3,1.8,.5,1); }
@keyframes bump {
  0% { transform: scale(1); }
  35% { transform: scale(1.55); }
  100% { transform: scale(1); }
}

.printer {
  --tw: clamp(280px, 24vw, 380px);
  position: fixed; z-index: 29;
  bottom: 0;
  right: clamp(12px, 1.9vw, 28px);
  width: var(--tw);
}
.printer[hidden] { display: none; }
.printer__window {
  container-type: inline-size;   /* les mides del tiquet (cqw) són relatives a la seva amplada */
  overflow: hidden;
  filter: drop-shadow(3px -2px 6px rgba(60, 0, 0, .3));
  scrollbar-width: none;          /* sense barra: el tiquet puja tot el que cal */
  overscroll-behavior: contain;
}
.printer__window::-webkit-scrollbar { display: none; }

.ticket {
  background: #ffd67a;
  color: var(--red);
  font-family: "Ticketing", ui-monospace, monospace;
  text-transform: none;
  padding: 5cqw 6cqw 7cqw;
  transform: translateY(110%);
  /* vora de dalt trencada: és el tros que surt primer, com un tiquet arrencat */
  -webkit-mask: conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) 50% / 3.2cqw 100%;
  mask: conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) 50% / 3.2cqw 100%;
  padding-top: 12cqw;
}
.ticket p, .ticket h2, .ticket ul { margin: 0; }

.t-logo {
  font-family: "Redaction 50", Georgia, serif;
  font-weight: 700;
  font-size: 22cqw;
  line-height: .95;
  text-align: center;
  margin: 6cqw 2cqw 0;
  padding-bottom: 1.5cqw;
  border-bottom: 1.8cqw solid var(--red);
}
.t-order { margin-top: 7cqw !important; font-size: 4cqw; line-height: 1.45; }
.t-head, .t-line, .t-row {
  display: grid;
  grid-template-columns: 16cqw 1fr auto;
  align-items: start;
}
.t-row { grid-template-columns: 1fr auto; }
.t-head {
  margin-top: 1.5cqw;
  padding: 1.4cqw 0;
  border-block: 2px solid var(--red);
  font-size: 4cqw;
}
.t-head span:last-child, .t-price { text-align: right; }
.t-lines { list-style: none; padding: 2cqw 0 1cqw !important; }
.t-line { font-size: 4cqw; padding: 2cqw 0; }
.t-title { display: block; }
.t-meta { display: block; font-size: 2.6cqw; line-height: 1.15; padding-left: 6cqw; }
.t-qty { display: flex; flex-direction: column; align-items: start; gap: .5cqw; }
.t-step { display: flex; gap: 1cqw; }
.t-step button {
  width: 4.6cqw; height: 4.6cqw; padding: 0;
  display: grid; place-items: center;
  border: 1px solid currentColor; border-radius: 50%;
  background: none; color: var(--red);
  font: 400 3.2cqw/1 "Ticketing", monospace;
  cursor: pointer; opacity: .55;
  transition: opacity .15s ease, background .15s ease;
}
.t-step button:hover, .t-step button:focus-visible { opacity: 1; background: rgba(207,0,0,.12); }
.t-empty { padding: 7cqw 0; font-size: 4cqw; text-align: center; line-height: 1.6; }
.t-empty a { color: var(--red); }

.t-sums { border-top: 2px solid var(--red); padding-top: 2cqw; font-size: 4cqw; line-height: 1.5; }
.t-discount { font-size: 2.7cqw; line-height: 1.25; padding: 1.5cqw 0 0 9cqw; gap: 4cqw; align-items: center; }
.t-total {
  margin-top: 6cqw;
  padding-bottom: 2cqw;
  border-bottom: 2px solid var(--red);
  font-size: 4cqw;
  align-items: end;
}
.t-total span:first-child { font-size: 6cqw; }
.t-buy {
  display: block;
  width: 64%; margin: 9cqw auto 0;
  padding: 1.6cqw 0 1cqw;
  border: 0; border-radius: 2cqw;
  background: var(--red); color: var(--pink);
  font: 400 5.6cqw/1 "Ticketing", monospace;
  cursor: pointer;
  transition: transform .15s ease, filter .15s ease;
}
.t-buy:hover { filter: brightness(1.12); }
.t-buy:active { transform: translateY(1px); }
.t-buy:disabled { opacity: .4; cursor: default; filter: none; }
.t-status { min-height: 1.4em; margin-top: 2cqw !important; text-align: center; font-size: 3cqw; }

@media (max-width: 760px) {
  .nav { justify-content: flex-start; padding-left: 70px; padding-right: 76px; gap: 6px 16px; }
  .printer { --tw: calc(100vw - 24px); right: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .cart-btn__count.bump { animation: none; }
}

/* ============================================================
   PEU DE PÀGINA (totes les pàgines; el crea site.js)
   ============================================================ */
.site-foot {
  --yellow-foot: #ffd67a;
  position: relative;
  display: grid;
  grid-template-columns: 1fr minmax(240px, 28vw);
  gap: 24px clamp(24px, 5vw, 80px);
  padding: clamp(32px, 4.5vw, 64px) clamp(16px, 7.5vw, 120px) 0;
  background: var(--yellow-foot);
  border-top: 4px solid var(--red);
  color: var(--red);
  font-family: "Redaction 50", Georgia, serif;
  text-transform: none;
}
.site-foot a { color: var(--red); }
.site-foot__main { display: flex; flex-direction: column; align-items: flex-start; padding-bottom: clamp(24px, 3vw, 40px); }
.site-foot__title { margin: 0 0 .9em; font: 700 clamp(20px, 2.2vw, 34px)/1 "Redaction 50", Georgia, serif; text-transform: uppercase; }
.site-foot__mail { margin: 0; font-size: clamp(14px, 1.3vw, 18px); }
.site-foot__mail a { text-decoration: none; }
.site-foot__mail a:hover { text-decoration: underline; }
.site-foot__social { display: flex; gap: clamp(6px, .7vw, 10px); margin: 1.1em 0 0; min-height: 1px; }
.site-foot__social a { display: block; width: clamp(22px, 2.3vw, 32px); aspect-ratio: 1; transition: transform .2s ease; }
.site-foot__social a:hover { transform: translateY(-2px) rotate(-6deg); }
.site-foot__social svg { width: 100%; height: 100%; fill: currentColor; display: block; }
.site-foot__legal {
  display: flex; flex-wrap: wrap; gap: .5em 1.6em;
  margin-top: auto; padding-top: clamp(32px, 6vw, 90px);
  font-size: clamp(13px, 1.15vw, 16px);
}
.site-foot__legal a { text-decoration: none; }
.site-foot__legal a:hover { text-decoration: underline; }
.site-foot__art { align-self: end; width: 100%; max-width: 440px; height: auto; justify-self: center; margin-bottom: clamp(20px, 2.6vw, 40px); }
.site-foot__copy {
  position: absolute; right: clamp(12px, 1.5vw, 24px); bottom: clamp(10px, 1.2vw, 18px); margin: 0;
  font-size: clamp(11px, .8vw, 13px);
}
.site-foot :focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

@media (max-width: 760px) {
  .site-foot { grid-template-columns: 1fr; padding-bottom: 36px; }
  .site-foot__main { padding-bottom: 0; }
  .site-foot__legal { padding-top: 28px; }
  .site-foot__art { width: 72%; }
  .site-foot__copy { left: 16px; right: auto; }
}
