/* ===========================================================
   MATSU — base compartida (tipografies, tokens, utilitats)
   Paleta de marca: BLUE SKIN #0B1624 · SILVER SCALES #F0F0F0
   =========================================================== */

@font-face {
  font-family: 'JMH Typewriter';
  src: url('../fonts/jmh-thin.woff2?v=2d681ee4') format('woff2');
  font-weight: 200; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'JMH Typewriter';
  src: url('../fonts/jmh-regular.woff2?v=17960862') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'JMH Typewriter';
  src: url('../fonts/jmh-bold.woff2?v=d530b343') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'JMH Typewriter';
  src: url('../fonts/jmh-black.woff2?v=bbd5342e') format('woff2');
  font-weight: 900; font-style: normal; font-display: swap;
}

:root {
  --navy: #0b1624;
  --navy-soft: #121f31;
  --navy-deep: #060c15;
  --silver: #f0f0f0;
  --silver-dim: #a8b0ba;

  --mono: 'JMH Typewriter', ui-monospace, 'SF Mono', Menlo, monospace;
  --sans: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  /* 400 és el pes més lleuger que es carrega d'Instrument Sans: demanar 300
     queia igualment a 400 amb la font carregada, però el fallback del sistema
     sí que té un 300 i el text sortia més fi mentre la font no arribava. */
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
a { color: inherit; }

:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

/* ---------- utilitats tipogràfiques ---------- */
.mono {
  font-family: var(--mono);
  font-weight: 400;
  text-transform: uppercase;
}

.eyebrow {
  font-family: var(--mono);
  font-size: clamp(0.62rem, 0.8vw, 0.72rem);
  letter-spacing: 0.32em;
  text-transform: uppercase;
}

/* ---------- marca (màscara CSS: el color el posa el CSS) ---------- */
/* La variant <img> no depèn de mask-image, que falla en file:// i en alguns navegadors. */
img.wordmark, img.iso {
  display: block; height: auto;
  background: none;
  -webkit-mask-image: none; mask-image: none;
}

span.wordmark, span.iso {
  display: block;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center;  mask-position: center;
  -webkit-mask-size: contain;     mask-size: contain;
}
span.wordmark {
  aspect-ratio: 985.56 / 185.02;
  -webkit-mask-image: url('../brand/wordmark.svg?v=b01ad95d');
  mask-image: url('../brand/wordmark.svg?v=b01ad95d');
}
span.iso {
  aspect-ratio: 302.7 / 280.6;
  -webkit-mask-image: url('../brand/iso.svg?v=0650c343');
  mask-image: url('../brand/iso.svg?v=0650c343');
}

/* ---------- scroll reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
}
.reveal.in-view { opacity: 1; transform: none; }
.reveal.d1 { transition-delay: 0.08s; }
.reveal.d2 { transition-delay: 0.16s; }
.reveal.d3 { transition-delay: 0.24s; }

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(6, 12, 21, 0.97);
  display: none; align-items: center; justify-content: center;
  padding: 5vh 6vw;
}
.lightbox.active { display: flex; }
.lightbox img { max-width: 100%; max-height: 90vh; width: auto; object-fit: contain; }
.lightbox button {
  position: absolute; color: var(--silver);
  font-family: var(--mono); line-height: 1;
  opacity: 0.6; transition: opacity 0.3s;
}
.lightbox button:hover { opacity: 1; }
.lb-close { top: 26px; right: 30px; font-size: 1.1rem; letter-spacing: 0.2em; }
.lb-prev, .lb-next { top: 50%; transform: translateY(-50%); font-size: 2rem; padding: 20px; }
.lb-prev { left: 8px; }
.lb-next { right: 8px; }
.lb-count {
  position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%);
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.25em;
  color: var(--silver); opacity: 0.5;
}

/* ---------- selector d'idioma ---------- */
.lang {
  display: flex; gap: 2px; align-items: center;
  font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.2em;
}
.lang button {
  padding: 6px 7px; opacity: 0.45;
  transition: opacity 0.3s;
}
.lang button:hover { opacity: 0.85; }
.lang button.active { opacity: 1; box-shadow: inset 0 -1px 0 currentColor; }

/* ---------- cookies ---------- */
.cookies {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 250;
  display: none; align-items: center; justify-content: space-between;
  gap: 28px; flex-wrap: wrap;
  padding: 18px clamp(20px, 5vw, 60px);
  background: var(--navy-deep);
  border-top: 1px solid rgba(240, 240, 240, 0.12);
  color: var(--silver);
}
.cookies.visible { display: flex; }
.cookies p { font-size: 0.78rem; line-height: 1.7; opacity: 0.75; max-width: 60ch; }
.cookies .acts { display: flex; gap: 10px; }
.cookies button {
  font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.2em;
  text-transform: uppercase; padding: 11px 20px;
  border: 1px solid rgba(240, 240, 240, 0.3);
  transition: 0.3s;
}
.cookies button:hover { border-color: var(--silver); }
.cookies button.ok { background: var(--silver); color: var(--navy); border-color: var(--silver); }

/* ---------- accessibilitat ---------- */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
