/* ============================================================
   ENCÀRRECS (encarrecs.html)
   ============================================================ */

.commission {
  --yellow: #ffd67a;
  --cream: #fff1d6;
  display: grid;
  grid-template-columns: minmax(0, 40.5fr) minmax(0, 44fr);
  justify-content: space-between;
  align-items: start;
  gap: clamp(24px, 8vw, 120px);
  padding: clamp(84px, 6.3vw, 100px) clamp(16px, 4vw, 60px) 0 clamp(16px, 2.9vw, 44px);
  min-height: 100svh;
  text-transform: none;
}

/* ---------- Formulari ---------- */
.c-form { display: flex; flex-direction: column; align-items: flex-start; gap: clamp(8px, .9vw, 12px); padding-bottom: 48px; }
.c-title, .c-label { text-transform: uppercase; }
.c-title {
  margin: 0 0 clamp(16px, 3vw, 44px);
  white-space: nowrap;
  font: 400 clamp(26px, 3.3vw, 52px)/1 "TheBold", sans-serif;
}

.c-bar {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: clamp(8px, 1vw, 14px);
  margin: 0;
  padding: clamp(5px, .5vw, 8px) clamp(8px, .9vw, 12px);
  border: 0;
  background: var(--yellow);
  transition: box-shadow .2s ease;
}
.c-bar--text { width: min(100%, 36vw, 560px); flex-wrap: nowrap; }
.c-label {
  flex: none;
  min-width: 5.2em;
  font: 400 clamp(14px, 1.6vw, 24px)/1 "TheBold", sans-serif;
  padding-top: .15em;
}
.c-input {
  flex: 1; min-width: 0;
  border: 0; border-radius: 0;
  background: var(--cream);
  color: var(--red);
  font: 700 clamp(14px, 1.5vw, 21px)/1.3 var(--serif);
  padding: .25em .5em;
  resize: none; overflow: hidden;
}
.c-input::placeholder { color: rgba(207, 0, 0, .4); font-weight: 400; }
.c-input:focus { outline: 2px solid var(--red); outline-offset: 0; }
.c-bar--area { align-items: start; }
.c-bar--area .c-label { padding-top: .4em; }
.c-bar--area .c-input { min-height: 1.8em; }

/* fila que apareix/desapareix (enquadrament) */
.c-reveal {
  display: grid;
  grid-template-rows: 0fr;
  margin-top: calc(-1 * clamp(8px, .9vw, 12px));   /* compensa el gap quan està tancada */
  opacity: 0;
  transition: grid-template-rows .4s cubic-bezier(.2,.8,.2,1), margin-top .4s cubic-bezier(.2,.8,.2,1), opacity .25s ease;
}
.c-reveal.is-open { grid-template-rows: 1fr; margin-top: 0; opacity: 1; transition-delay: 0s, 0s, .1s; }
.c-reveal__inner { overflow: hidden; min-height: 0; }
.c-reveal fieldset[disabled] .pill { cursor: default; }

/* pastilles */
.pill { position: relative; cursor: pointer; }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill span {
  display: inline-block;
  min-width: 5.2em;
  padding: .35em .8em;
  border-radius: .45em;
  background: var(--pink);
  color: var(--red);
  font: 700 clamp(12px, 1.15vw, 17px)/1.2 var(--serif);
  text-align: center;
  transition: background .2s ease, color .2s ease, transform .15s ease;
}
.pill:hover span { transform: translateY(-1px); background: #ff8f95; }
.pill input:checked + span { background: var(--red); color: var(--pink); }
.pill input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }

/* fitxers */
.c-files { width: min(100%, 36vw, 560px); }
.c-pick {
  position: relative; cursor: pointer;
  padding: .3em .8em; border-radius: .45em;
  background: var(--cream); color: var(--red);
  font: 700 clamp(12px, 1.15vw, 17px)/1.2 var(--serif);
}
.c-pick:hover { background: #fff; }
.c-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.c-pick:focus-within { outline: 2px solid var(--blue); outline-offset: 2px; }
.c-file-list { list-style: none; margin: 0; padding: 0; width: 100%; display: grid; gap: 4px; }
.c-file-list:empty { display: none; }
.c-file-list li {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: .2em .5em; background: var(--cream);
  font: 400 clamp(12px, 1.05vw, 15px)/1.3 var(--serif);
  text-transform: none;
}
.c-file-list span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-file-list button {
  border: 0; background: none; color: var(--red); cursor: pointer;
  font: 700 18px/1 var(--serif); padding: 0 4px;
}

.c-consent {
  display: flex; gap: .6em; align-items: start;
  max-width: min(100%, 36vw, 560px);
  margin-top: 6px;
  font: 400 clamp(13px, 1.05vw, 15px)/1.35 var(--text);
  text-transform: none;
  cursor: pointer;
}
.c-consent input { accent-color: var(--red); width: 1.1em; height: 1.1em; margin: .1em 0 0; flex: none; }
.c-consent a { color: var(--red); }

/* camps que falten */
.is-missing { box-shadow: 0 0 0 2px var(--red); animation: nudge .35s ease; }
.c-consent.is-missing { box-shadow: none; text-decoration: underline wavy; text-underline-offset: 3px; }
@keyframes nudge {
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* ---------- Comanda ---------- */
.c-order {
  container-type: inline-size;
  position: sticky; top: clamp(70px, 6.3vw, 100px);
  min-height: calc(100svh - clamp(70px, 6.3vw, 100px));
  display: flex; flex-direction: column;
  padding: calc(5% + 10px) 8.5% 6%;   /* % i no cqw: el contenidor és ell mateix */
  background: var(--yellow);
  /* vora de dalt en zig-zag, com el tiquet de la cistella */
  -webkit-mask: conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) 50% / 18px 100%;
  mask: conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) 50% / 18px 100%;
  font-family: var(--serif);
  text-transform: none;
}
.c-order__title {
  margin: 0;
  font: 700 21cqw/1 var(--serif);
  text-align: center;
  text-indent: -1.1cqw;   /* la "c" inicial té més aire a l'esquerra que la "a" final a la dreta: compensa a ull */
  padding-bottom: 1.5cqw;
  border-bottom: 1.6cqw solid var(--red);
}
.c-order__body { margin-top: 10cqw; flex: 1; }
.c-line {
  display: flex; justify-content: space-between; align-items: end; gap: 6cqw;
  font: 700 5cqw/1 var(--serif);
  margin-bottom: 5cqw;
  animation: print-in .35s cubic-bezier(.2,.8,.2,1);
}
.c-line span:last-child { flex: none; font-size: 4.2cqw; }
.c-total {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 6cqw;
  padding: 2.5cqw 0;
  border-block: .6cqw dotted var(--red);
  font: 700 5cqw/1 var(--serif);
  text-transform: uppercase;
}
.c-note { margin: 3cqw 0 0; font-family: var(--text); font-size: 3.4cqw; line-height: 1.35; }
.c-note--line { margin: -3cqw 0 5cqw; font-size: 2.9cqw; opacity: .85; }   /* just a sota d'una línia de la comanda */
.c-empty { margin: 0 0 4cqw; font-size: 4cqw; line-height: 1.35; opacity: .75; }
.c-thanks { margin: 0; font: 700 9cqw/1.1 var(--serif); animation: print-in .5s cubic-bezier(.2,.8,.2,1); }
@keyframes print-in { from { opacity: 0; transform: translateY(-6px); } }

.c-send {
  margin-top: 6cqw;
  padding: 2.5cqw;
  border: 0; border-radius: 2cqw;
  background: var(--red); color: var(--pink);
  font: 700 5cqw/1 var(--serif);
  cursor: pointer;
  transition: filter .2s ease, transform .15s ease;
}
.c-send:hover { filter: brightness(1.12); }
.c-send:active { transform: translateY(1px); }
.c-send:disabled { opacity: .5; cursor: default; filter: none; }
.c-status { min-height: 1.4em; margin: 2cqw 0 0; font-size: 3.4cqw; text-align: center; }

/* ---------- Mòbil ---------- */
@media (max-width: 900px) {
  .commission { grid-template-columns: 1fr; gap: 24px; padding-right: clamp(16px, 4vw, 60px); }
  .c-bar--text, .c-files, .c-consent { width: 100%; max-width: none; }
  .c-order { position: static; min-height: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .c-line, .c-thanks, .is-missing { animation: none; }
  .c-reveal { transition: none; }
}

/* ---------- Guia per l'encàrrec (botó + finestra) ---------- */
.c-guide-row { width: min(100%, 36vw, 560px); display: flex; justify-content: center; margin: clamp(10px, 1.6vw, 24px) 0; }
.c-guide-btn {
  padding: .35em 1.1em .3em;
  border: 3px solid var(--red); background: var(--cream); color: var(--red); cursor: pointer;
  font: 700 clamp(15px, 1.6vw, 24px)/1 var(--serif); text-transform: uppercase;
  transition: background .2s ease, transform .2s ease;
}
.c-guide-btn:hover { background: #fff; transform: translateY(-1px); }
.c-guide-btn:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

.guide {
  --cream: #fff3de;
  --h: min(790px, 86svh);                 /* alçada de la finestra: les mides dels dibuixos en surten */
  --stage: calc(var(--h) - clamp(60px, 7vw, 110px));
  width: min(1340px, 94vw); height: var(--h); max-width: none; max-height: none;
  padding: 0; border: clamp(4px, .45vw, 7px) solid var(--red); border-radius: 0;
  background: var(--cream); color: var(--red); overflow: hidden;
  text-transform: none;
}
.guide[open] { display: grid; grid-template-rows: auto 1fr; animation: guide-in .35s cubic-bezier(.2,.8,.2,1); }
.guide::backdrop { background: rgba(80, 0, 0, .28); }
@keyframes guide-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.guide__title {
  margin: 0; padding: clamp(16px, 2.4vw, 36px) clamp(18px, 2.6vw, 36px) 0;
  font: 700 clamp(22px, 3vw, 46px)/1 var(--serif); text-transform: uppercase;
}
.guide__btn {
  position: absolute; z-index: 3;
  width: clamp(36px, 3.6vw, 56px); aspect-ratio: 1; border-radius: 50%;
  border: 0; padding: 0 0 .12em; background: var(--red); color: var(--pink); cursor: pointer;
  font: 700 clamp(22px, 2.6vw, 40px)/1 var(--serif); display: grid; place-items: center;
  transition: transform .2s ease, filter .2s ease;
}
.guide__btn:hover { transform: scale(1.08); filter: brightness(1.1); }
.guide__btn:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.guide__btn[hidden] { display: none; }
.guide__close { top: clamp(14px, 2vw, 28px); right: clamp(14px, 2vw, 28px); }
.guide__nav { top: 50%; translate: 0 -50%; }
.guide__nav:hover { transform: scale(1.08); }
.guide__nav--prev { left: clamp(10px, 3vw, 46px); }
.guide__nav--next { right: clamp(10px, 3vw, 46px); }

.guide__viewport { position: relative; overflow: hidden; min-height: 0; }
.guide__track { display: flex; height: 100%; transition: transform .55s cubic-bezier(.45, 0, .2, 1); }
.guide__slide { flex: 0 0 100%; height: 100%; min-width: 0; position: relative; box-sizing: border-box; }

/* les etiquetes (rosa, grans, sobre els dibuixos) */
.guide figcaption, .guide__cut span {
  font: 700 clamp(26px, 4.6vw, 70px)/1 var(--serif); color: var(--pink); letter-spacing: .01em;
}
.guide img { display: block; -webkit-user-drag: none; user-select: none; }

/* 1. acabats: tres peces, cada una amb l'etiqueta a sota */
.guide__slide--acabat {
  display: grid; grid-template-columns: 1fr 1fr 1fr; align-items: center;
  padding: 0 clamp(52px, 8vw, 130px) clamp(10px, 2vw, 30px);
}
.guide__piece { position: relative; margin: 0; display: flex; justify-content: center; }
.guide__piece img { max-width: 100%; height: auto; object-fit: contain; }
.guide__piece--lineal img { max-height: calc(var(--stage) * .66); }
.guide__piece--basic img { max-height: calc(var(--stage) * .8); translate: 0 -6%; }
.guide__piece--complet img { max-height: calc(var(--stage) * .6); translate: 0 -8%; }
.guide__piece figcaption { position: absolute; }
.guide__piece--lineal figcaption { left: 0; bottom: 2%; }
.guide__piece--basic figcaption { bottom: -10%; }
.guide__piece--complet figcaption { right: -4%; bottom: -14%; }

/* 2. enquadraments: la figura sencera amb les línies on talla cada un */
.guide__slide--enq { display: grid; place-items: center; padding-bottom: clamp(10px, 1.6vw, 24px); }
.guide__body { position: relative; margin: 0; translate: 0 -4%; }
.guide__body img { height: calc(var(--stage) * .92); width: auto; position: relative; z-index: 2; }   /* el dibuix, per sobre de les línies */
.guide__cut {
  position: absolute; z-index: 1; top: var(--y); left: 2%; width: 232%;
  border-top: clamp(2px, .2vw, 3px) solid var(--red);
  rotate: -.4deg;
}
.guide__cut--wide { left: -12%; width: 230%; }
.guide__cut span { position: absolute; right: 0; bottom: .05em; white-space: nowrap; font-size: clamp(20px, 2.5vw, 42px); }

@media (max-width: 700px) {
  .c-guide-row { width: 100%; }
  .guide { --h: min(620px, 88svh); }
  /* al mòbil, cada acabat és una pàgina sencera (lineal → bàsic → complet → enquadraments) */
  .guide__slide--acabat { display: contents; }
  .guide__piece { flex: 0 0 100%; height: 100%; align-items: center; padding: 0 48px 12px; box-sizing: border-box; }
  .guide__piece img { max-height: calc(var(--stage) * .72) !important; translate: none !important; }
  .guide__piece figcaption { left: 0 !important; right: 0 !important; bottom: 4% !important; text-align: center; font-size: clamp(30px, 10vw, 44px); }
  .guide__body { translate: -22% -2%; }
  .guide__body img { height: calc(var(--stage) * .85); }
  .guide__cut, .guide__cut--wide { width: 175%; }
  .guide__cut span { font-size: clamp(18px, 5.6vw, 26px); }
}
@media (prefers-reduced-motion: reduce) {
  .guide[open], .guide__track { animation: none; transition: none; }
}
