/* CRC · SECCIÓ OFICIS v2 (20-oct-2026): 8 fitxes d'ofici negre lacat + canto daurat, icona que es dibuixa,
   foto d'obra que es revela al passar / tocar. Es carrega DESPRÉS de style/pagina/or-brill i anul·la les regles velles. */

/* ---------- fons de la secció: negre net amb un brillo daurat; el plànol només com a detall molt tènue ---------- */
.oficis.of-v2,.amb-fondo .oficis.of-v2{
  position:relative;isolation:isolate;overflow:hidden;
  padding:clamp(4.5rem,11vh,8.5rem) 0 clamp(4.5rem,11vh,8rem);
  background:
    radial-gradient(55% 45% at 85% 0%,rgba(212,165,60,.13),transparent 70%),
    radial-gradient(45% 40% at 0% 100%,rgba(212,165,60,.08),transparent 72%),
    linear-gradient(180deg,#09090a 0%,#0c0c0d 50%,#09090a 100%);
}
.oficis.of-v2::before{ /* quadrícula de plànol, gairebé invisible */
  content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;opacity:.05;
  background-image:linear-gradient(rgba(241,212,138,.9) 1px,transparent 1px),linear-gradient(90deg,rgba(241,212,138,.9) 1px,transparent 1px);
  background-size:72px 72px;
  -webkit-mask-image:radial-gradient(70% 60% at 50% 40%,#000,transparent 75%);mask-image:radial-gradient(70% 60% at 50% 40%,#000,transparent 75%);
}
.oficis.of-v2::after{ /* filet daurat superior */
  content:"";position:absolute;left:clamp(16px,5vw,4.5rem);right:clamp(16px,5vw,4.5rem);top:0;height:1px;
  background:linear-gradient(90deg,transparent,rgba(212,165,60,.65),transparent);
}

/* ---------- capçalera ---------- */
.of-v2 .of-cap-sec{
  display:grid;grid-template-columns:minmax(0,1.25fr) minmax(0,1fr);column-gap:clamp(2rem,6vw,6rem);align-items:end;
  padding:0 clamp(16px,5vw,4.5rem) clamp(2.4rem,6vh,4rem);
}
.of-v2 .of-cap-sec .kicker{grid-column:1/-1}
.of-v2 .of-cap-sec h2{max-width:18ch;font-size:clamp(2.2rem,4.8vw,4.6rem);color:#f6f2ea}
.of-v2 .of-intro{margin:0;max-width:40rem;font-size:clamp(1.02rem,1.25vw,1.18rem);line-height:1.6;color:#d2cdc3;
  padding-left:1.4rem;border-left:1px solid rgba(212,165,60,.55)}

/* ---------- graella ---------- */
.oficis.of-v2 .oficis-llista{
  list-style:none;margin:0;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));
  gap:clamp(14px,1.5vw,22px);column-gap:clamp(14px,1.5vw,22px);padding:0 clamp(16px,5vw,4.5rem);
}

/* ---------- fitxa ---------- */
.oficis.of-v2 .ofici{
  --or:#d4a53c;--ink2:#f6f2ea;--txt:#d6d1c7;
  position:relative;isolation:isolate;overflow:hidden;
  display:flex;flex-direction:column;gap:0;grid-column:auto;
  min-height:clamp(31rem,38vw,37rem);padding:clamp(1.3rem,1.6vw,1.8rem);
  border-radius:20px;border:0;border-top:0;
  background:linear-gradient(160deg,#1f1f22 0%,#0d0d0f 42%,#17171a 72%,#070708 100%);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.09),0 30px 60px -30px rgba(0,0,0,.9);
  transform:perspective(1100px) rotateX(var(--rx,0deg)) rotateY(var(--ry,0deg));
  transition:transform .5s var(--ease),box-shadow .5s var(--ease),translate 1s var(--ease),opacity 1s var(--ease);
  will-change:transform;
}
/* canto daurat (vora amb degradat) */
.oficis.of-v2 .ofici::after{
  content:"";position:absolute;inset:0;border-radius:inherit;padding:1px;z-index:3;pointer-events:none;
  background:linear-gradient(150deg,rgba(246,220,140,.95),rgba(212,165,60,.35) 30%,rgba(122,91,28,.25) 60%,rgba(241,212,138,.8));
  -webkit-mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);-webkit-mask-composite:xor;
  mask:linear-gradient(#000 0 0) content-box exclude,linear-gradient(#000 0 0);
  opacity:.55;transition:opacity .5s;
}
/* llum que segueix el ratolí (fx.js posa --fx/--fy) */
.oficis.of-v2 .ofici::before{
  z-index:2;opacity:0;
  background:radial-gradient(420px circle at var(--fx,50%) var(--fy,30%),rgba(241,212,138,.16),transparent 60%);
}
.oficis.of-v2 .ofici-prl{background:linear-gradient(160deg,#1f1f22 0%,#0d0d0f 42%,#17171a 72%,#070708 100%);grid-column:auto}

/* foto d'obra: discreta en repòs, es revela al passar / tocar */
.of-v2 .of-foto{position:absolute;inset:0;z-index:0;overflow:hidden;border-radius:inherit;background:#0b0b0c}
.of-v2 .of-foto img{width:100%;height:100%;object-fit:cover;opacity:.62;filter:grayscale(.35) brightness(.78) contrast(1.05);
  transform:scale(1.06);transition:opacity .8s var(--ease),filter .8s var(--ease),transform 1.6s var(--ease)}
.of-v2 .of-foto::after{content:"";position:absolute;inset:0;
  background:linear-gradient(180deg,rgba(9,9,10,.25) 0%,rgba(9,9,10,.4) 28%,rgba(9,9,10,.88) 52%,#09090a 68%);
  transition:opacity .8s}
.of-v2 .of-foto::before{content:"";position:absolute;inset:0;z-index:1;opacity:0;transition:opacity .8s;
  background:linear-gradient(180deg,rgba(9,9,10,0) 0%,rgba(9,9,10,.15) 28%,rgba(9,9,10,.82) 55%,rgba(9,9,10,.97) 72%)}

/* capçal: icona + número */
.of-v2 .of-top{position:relative;z-index:4;display:flex;align-items:flex-start;justify-content:space-between;gap:1rem}
.of-v2 .of-ico{display:grid;place-items:center;width:clamp(4.4rem,5.4vw,5.4rem);aspect-ratio:1;border-radius:16px;
  background:radial-gradient(circle at 30% 25%,rgba(241,212,138,.14),rgba(10,10,11,.75) 70%);
  border:1px solid rgba(212,165,60,.5);box-shadow:inset 0 1px 0 rgba(255,246,214,.18),0 10px 30px -12px rgba(0,0,0,.9);
  backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);transition:border-color .5s,box-shadow .5s}
.of-v2 .of-ico svg{width:70%;height:70%;overflow:visible;fill:none;stroke:#e6bf62;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;
  filter:drop-shadow(0 0 6px rgba(212,165,60,.35))}
.oficis.of-v2 .of-n{
  font-family:var(--serif);font-weight:300;font-size:clamp(3.6rem,5.2vw,5.4rem);line-height:.8;letter-spacing:-.04em;
  padding:0;grid-row:auto;
  background:linear-gradient(115deg,#8a6420 0%,#d4a53c 22%,#f6dc8c 38%,#d4a53c 55%,#7a5b1c 78%,#d4a53c 100%);background-size:200% 100%;
  -webkit-background-clip:text;background-clip:text;color:transparent!important;
  -webkit-text-fill-color:transparent;-webkit-text-stroke:1.2px rgba(230,191,98,.95);background-image:none;
  animation:none;text-shadow:none}

/* cos: títol, text, botó */
.of-v2 .of-cos{position:relative;z-index:4;margin-top:auto;padding-top:2rem;display:flex;flex-direction:column;align-items:flex-start}
.oficis.of-v2 .ofici h3{font-size:clamp(1.65rem,2vw,2.15rem);line-height:1.08;color:var(--ink2);transform:none;margin:0 0 .85rem;
  text-shadow:0 2px 18px rgba(0,0,0,.8);transition:color .4s}
.oficis.of-v2 .ofici:hover h3{transform:none;margin-left:0}
.oficis.of-v2 .ofici p{color:var(--txt);font-size:1rem;line-height:1.58;max-width:36ch;margin:0}
.of-v2 .of-link{color:inherit;position:static}
.of-v2 .of-link::after{content:"";position:absolute;inset:0;z-index:5;border-radius:20px}
.of-v2 .of-link:focus{outline:none}
.of-v2 .of-cta{margin-top:1.5rem;display:inline-flex;align-items:center;gap:.7rem;min-height:46px;padding:.7rem 1.25rem .7rem 1.35rem;
  border-radius:999px;border:1px solid rgba(212,165,60,.85);color:#f1d48a;
  font:600 .8rem/1 var(--sans);letter-spacing:.16em;text-transform:uppercase;
  background:linear-gradient(160deg,#2a2a2c 0%,#0b0b0c 55%,#1c1c1e 100%);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.12),0 10px 26px -12px rgba(0,0,0,.9);
  transition:color .4s,box-shadow .4s,border-color .4s;position:relative;overflow:hidden}
.of-v2 .of-cta::before{content:"";position:absolute;inset:0;z-index:-1;border-radius:inherit;
  background:linear-gradient(115deg,#8a6420 0%,#d4a53c 22%,#f6dc8c 38%,#d4a53c 55%,#7a5b1c 78%,#d4a53c 100%);background-size:200% 100%;
  opacity:0;transition:opacity .45s var(--ease)}
.of-v2 .of-cta{z-index:0}
.of-v2 .of-cta svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;transition:transform .45s var(--ease)}

/* ---------- estat actiu: hover (ratolí), focus (teclat) o .viva (tàctil, fitxa al centre de pantalla) ---------- */
.oficis.of-v2 .ofici:is(:hover,:focus-within,.viva){box-shadow:inset 0 1px 0 rgba(255,255,255,.12),0 40px 80px -30px rgba(0,0,0,.95),0 0 0 1px rgba(212,165,60,.25),0 20px 60px -20px rgba(212,165,60,.28)}
.oficis.of-v2 .ofici:is(:hover,:focus-within,.viva)::after{opacity:1}
.oficis.of-v2 .ofici:hover::before{opacity:1}
.of-v2 .ofici:is(:hover,:focus-within,.viva) .of-foto img{opacity:.95;filter:none;transform:scale(1.12)}
.of-v2 .ofici:is(:hover,:focus-within,.viva) .of-foto::after{opacity:0}
.of-v2 .ofici:is(:hover,:focus-within,.viva) .of-foto::before{opacity:1}
.of-v2 .ofici:is(:hover,:focus-within,.viva) .of-ico{border-color:rgba(241,212,138,.95);box-shadow:inset 0 1px 0 rgba(255,246,214,.3),0 0 28px -4px rgba(212,165,60,.55)}
.oficis.of-v2 .ofici:is(:hover,:focus-within,.viva) .of-n{background-image:linear-gradient(115deg,#8a6420 0%,#d4a53c 22%,#f6dc8c 38%,#d4a53c 55%,#7a5b1c 78%,#d4a53c 100%);-webkit-text-stroke-color:rgba(246,220,140,.9);animation:orBrilla 5s linear infinite}
.oficis.of-v2 .ofici:is(:hover,:focus-within) h3{color:#fff}
.of-v2 .ofici:is(:hover,:focus-within) .of-cta{color:#120d03;border-color:#f1d48a;box-shadow:inset 0 1px 0 rgba(255,246,214,.6),0 14px 34px -12px rgba(212,165,60,.7)}
.of-v2 .ofici:is(:hover,:focus-within) .of-cta::before{opacity:1;animation:orBrilla 6s linear infinite}
.of-v2 .ofici:is(:hover,:focus-within) .of-cta svg{transform:translateX(5px)}
/* focus visible de teclat */
.oficis.of-v2 .ofici:focus-within{outline:none}
.oficis.of-v2 .ofici:has(.of-link:focus-visible){outline:2px solid #f1d48a;outline-offset:4px}

/* ---------- entrada i dibuix de l'icona (només amb JS i sense reduced-motion) ---------- */
.of-anim .ofici{opacity:0;translate:0 48px;transition-delay:calc(var(--d,0) * 110ms)}
.of-anim .ofici.vist{opacity:1;translate:0 0}
.of-anim .of-ico path{stroke-dasharray:1 1;stroke-dashoffset:1;opacity:0;
  transition:stroke-dashoffset 1.5s cubic-bezier(.65,0,.25,1),opacity .2s;transition-delay:calc(var(--d,0) * 110ms + 250ms + var(--p,0) * 220ms)}
.of-anim .ofici.vist .of-ico path{stroke-dashoffset:0;opacity:1}
.of-anim .ofici.vist{transition:transform .5s var(--ease),box-shadow .5s var(--ease),translate 1s var(--ease) calc(var(--d,0) * 110ms),opacity 1s var(--ease) calc(var(--d,0) * 110ms)}

/* ---------- responsive ---------- */
@media (max-width:1180px){
  .oficis.of-v2 .oficis-llista{grid-template-columns:repeat(2,minmax(0,1fr))}
  .oficis.of-v2 .ofici{min-height:28rem}
}
@media (max-width:860px){
  .of-v2 .of-cap-sec{grid-template-columns:1fr;row-gap:1.4rem}
  .of-v2 .of-intro{max-width:none}
}
@media (max-width:640px){
  .oficis.of-v2 .oficis-llista{grid-template-columns:minmax(0,1fr);gap:16px}
  .oficis.of-v2 .ofici{min-height:0;padding:1.25rem 1.25rem 1.4rem;border-radius:18px}
  /* en mòbil la foto queda a dalt com a finestra, sempre visible en color suau */
  .of-v2 .of-foto img{opacity:.7;filter:grayscale(.3) brightness(.85)}
  .of-v2 .of-foto::after{background:linear-gradient(180deg,rgba(9,9,10,.15) 0%,rgba(9,9,10,.35) 22%,rgba(9,9,10,.92) 46%,#09090a 60%)}
  .of-v2 .of-foto::before{background:linear-gradient(180deg,rgba(9,9,10,0) 0%,rgba(9,9,10,.1) 24%,rgba(9,9,10,.9) 48%,#09090a 62%)}
  .of-v2 .of-cos{padding-top:clamp(6.5rem,30vw,9rem)}
  .oficis.of-v2 .ofici h3{font-size:clamp(1.6rem,7vw,1.95rem)}
  .oficis.of-v2 .ofici p{font-size:1.02rem;max-width:none}
  .of-v2 .of-cta{width:100%;justify-content:space-between}
  .oficis.of-v2 .of-n{font-size:clamp(3.4rem,15vw,4.4rem)}
}
@media (hover:none){
  .oficis.of-v2 .ofici{transform:none}
  .of-v2 .ofici.viva .of-cta{color:#120d03;border-color:#f1d48a}
  .of-v2 .ofici.viva .of-cta::before{opacity:1}
}
@media (prefers-reduced-motion:reduce){
  .oficis.of-v2 .ofici,.of-v2 .of-foto img,.of-v2 .of-cta,.of-v2 .of-cta svg{transition:none!important;transform:none!important}
  .oficis.of-v2 .ofici .of-n,.of-v2 .of-cta::before{animation:none!important}
  .of-v2 .ofici:is(:hover,:focus-within,.viva) .of-foto img{transform:none}
}
