/* =========================================================
   FAST COMPETICIÓ — mockup de redisseny (Setdedisseny, 2026)
   Sistema: «cinta de balisa». Negre de nit, groc de
   senyalització com a accent restringit, xifres de dorsal i
   cronòmetre. Cada cursa té una taca de color pla pròpia
   (Pa amb Tomàquet = vermell tomàquet).
   Sense cantonades rodones, sense ombres difuses.
   ========================================================= */

:root {
  --ink: #0d0d0c;
  --ink-2: #171715;
  --ink-3: #26251f;
  --paper: #f1eee6;
  --paper-2: #e2ddd0;
  --muted: #9a968a;
  --muted-ink: #5d5a51;
  --line: rgba(241, 238, 230, .16);
  --line-ink: rgba(13, 13, 12, .18);
  --balisa: #ffe100;          /* accent: hover, actiu, CTA, cinta */
  --tomaquet: #e0261b;        /* taca de la Pa amb Tomàquet */
  --tomaquet-fosc: #a3170f;
  --f-sans: "Archivo", "Arial Narrow", Arial, sans-serif;
  --f-mono: "Martian Mono", ui-monospace, Menlo, Consolas, monospace;
  --gutter: clamp(16px, 4vw, 56px);
  --max: 1440px;
  --rule: 3px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 120px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--f-sans);
  font-stretch: 100%;
  font-size: 17px;
  line-height: 1.5;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--balisa); outline-offset: 3px; }
::selection { background: var(--balisa); color: var(--ink); }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
/* La capçalera i el que va sobre el vídeo de portada, de cantó a cantó */
.hdr .wrap, .hero-home .wrap { max-width: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Tipografia de sistema ---------- */
.d {                     /* display: Archivo amb l'eix d'amplada a fons */
  font-family: var(--f-sans);
  font-stretch: 62%;
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  line-height: .84;
  letter-spacing: -.012em;
  margin: 0;
}
.lbl {                   /* etiquetes: el mateix eix, a l'altre extrem */
  font-family: var(--f-sans);
  font-stretch: 125%;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  line-height: 1.2;
}
.m {                     /* xifres de cronòmetre */
  font-family: var(--f-mono);
  font-stretch: 87.5%;
  font-variant-numeric: tabular-nums;
}
.lead { font-size: clamp(18px, 1.6vw, 22px); line-height: 1.45; max-width: 46ch; }
.muted { color: var(--muted); }

/* ---------- Cinta de balisa ---------- */
.tape {
  height: 22px;
  background: repeating-linear-gradient(-45deg, var(--balisa) 0 16px, var(--ink) 16px 32px);
  border-block: 2px solid var(--ink);
}

/* ---------- Capçalera ---------- */
/* La barra d'idiomes i accessos ràpids marxa amb l'scroll (top negatiu); la principal es queda enganxada. */
.hdr {
  position: sticky; top: -36px; z-index: 900;
  background: var(--ink);
  border-bottom: 1px solid var(--line);
}
.hdr__main { display: flex; align-items: center; gap: 28px; height: 76px; }
.topbar { border-bottom: 1px solid var(--line); }
.topbar__in { display: flex; justify-content: flex-end; align-items: stretch; height: 35px; }
.topbar a, .lang span {
  display: inline-flex; align-items: center; gap: 8px; padding: 0 14px; text-decoration: none;
  font-family: var(--f-sans); font-stretch: 125%; font-weight: 700; font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
}
.topbar__dl:hover { color: var(--balisa); }
.topbar__ins { background: var(--balisa); color: var(--ink); transition: background .15s; }
.topbar__ins:hover { background: var(--paper); }
.topbar__ins .arr { font-family: var(--f-mono); font-weight: 400; transition: transform .2s; }
.topbar__ins:hover .arr { transform: translateX(3px); }
.lang { display: flex; margin-left: 10px; }
.lang a, .lang span { padding: 0 7px; color: var(--muted); }
.lang [aria-current] { color: var(--paper); }
.lang a:hover { color: var(--balisa); }
.nav .nav__m { display: none; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; flex-shrink: 0; }
.brand__logo { display: block; height: 63px; aspect-ratio: 772 / 337; }
.brand__logo > * { display: block; width: 100%; height: 100%; }

/* ---------- Logo FAST vectoritzat, per peces (assets/js/logo.js) ----------
   Creu: contorn blanc a sota de les quatre fletxes (així el contorn és la unió).
   Lletres: cada una amb la seva ombra, per poder-les moure per separat. */
.fl { overflow: visible; }
.fl-o { fill: none; stroke: #fff; stroke-width: 12.8; stroke-linejoin: miter; stroke-miterlimit: 4; }
.fl-f { fill: #ff6600; }
.fl-g { fill: #fff; }
.fl-s { fill: #000; transform: translate(3.25px, 4px); }
.fl-x, .fl-a, .fl-l { transform-box: fill-box; transform-origin: center; }
.fl:not(.is-in) .fl-a, .fl:not(.is-in) .fl-l { opacity: 0; }
/* entrada: la creu gira i les fletxes surten del centre; les lletres entren de costat, com si frenessin */
@keyframes fl-spin { from { transform: rotate(-30deg) scale(.55); } to { transform: none; } }
@keyframes fl-burst {
  from { transform: translate(calc(var(--dx) * -90px), calc(var(--dy) * -90px)) scale(.3); opacity: 0; }
  45% { opacity: 1; }
  72% { transform: translate(calc(var(--dx) * 14px), calc(var(--dy) * 14px)) scale(1.03); }
  to { transform: none; }
}
@keyframes fl-in { from { transform: translateX(-120px) skewX(-22deg); opacity: 0; } 55% { opacity: 1; } to { transform: none; } }
/* després, tres cops de batec (i s'atura: res no es mou indefinidament) */
@keyframes fl-kick { 0%, 16%, 100% { transform: none; } 6% { transform: translate(calc(var(--dx) * 18px), calc(var(--dy) * 18px)); } }
@keyframes fl-skick { 0%, 16%, 100% { transform: translate(3.25px, 4px); } 6% { transform: translate(7.8px, 9.6px); } }
.fl.is-in .fl-x { animation: fl-spin .95s cubic-bezier(.2, .9, .25, 1.15) backwards; }
.fl.is-in .fl-a { animation: fl-burst .95s cubic-bezier(.2, .9, .3, 1) backwards, fl-kick 5s 2.4s 3 ease-out; }
.fl.is-in .fl-l { animation: fl-in .6s calc(.3s + var(--i) * .055s) cubic-bezier(.15, .9, .2, 1) backwards; }
.fl.is-in .fl-s { animation: fl-skick 5s 2.4s 3 ease-out; }
/* entrada llarga de la portada (.fl-intro, assets/js/portada.js): un cop dins, la creu agafa embranzida, fa una volta
   sencera amb les fletxes recollides i les dispara enfora en aturar-se. Propietats rotate/translate: se sumen a l'entrada. */
@keyframes fl-whirl {
  0% { rotate: 0deg; animation-timing-function: cubic-bezier(.3, 0, .4, 1); }
  20% { rotate: -28deg; animation-timing-function: cubic-bezier(.55, 0, .2, 1); }
  80% { rotate: 374deg; animation-timing-function: ease-in-out; }
  100% { rotate: 360deg; }
}
@keyframes fl-pump {
  0%, 100% { translate: 0 0; }
  20% { translate: calc(var(--dx) * -12px) calc(var(--dy) * -12px); }
  70% { translate: calc(var(--dx) * -16px) calc(var(--dy) * -16px); }
  84% { translate: calc(var(--dx) * 30px) calc(var(--dy) * 30px); }
}
.fl.is-in.fl-intro .fl-x { animation: fl-spin .95s cubic-bezier(.2, .9, .25, 1.15) backwards, fl-whirl 1.5s 1.5s; }
.fl.is-in.fl-intro .fl-a { animation: fl-burst .95s cubic-bezier(.2, .9, .3, 1) backwards, fl-pump 1.5s 1.5s ease-in-out, fl-kick 5s 7s 3 ease-out; }
.fl.is-in.fl-intro .fl-s { animation: fl-skick 5s 7s 3 ease-out; }
/* en passar-hi el ratolí, les fletxes s'obren i l'ombra s'allarga (propietat translate: se suma a l'animació) */
.fl-a, .fl-s { transition: translate .35s cubic-bezier(.2, .9, .3, 1.5); }
a:hover .fl-a, a:focus-visible .fl-a, .fl-hot:hover .fl-a { translate: calc(var(--dx) * 20px) calc(var(--dy) * 20px); }
a:hover .fl-s, a:focus-visible .fl-s, .fl-hot:hover .fl-s { translate: 4px 5px; }
@media (prefers-reduced-motion: reduce) { .fl * { animation: none !important; transition: none !important; } }
.nav { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.nav a {
  text-decoration: none; padding: 12px 12px; min-height: 44px; display: inline-flex; align-items: center;
  position: relative;
}
.nav a::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 6px; height: 3px;
  background: var(--balisa); transform: scaleX(0); transform-origin: left; transition: transform .2s;
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--balisa); }
.nav a:hover::after, .nav a[aria-current="page"]::after { transform: scaleX(1); }
.burger {
  display: none; margin-left: auto; width: 48px; height: 48px; background: none; border: 2px solid var(--paper);
  cursor: pointer; position: relative;
}
.burger span, .burger::before, .burger::after {
  content: ""; position: absolute; left: 10px; right: 10px; height: 3px; background: var(--paper); transition: transform .2s, opacity .2s;
}
.burger::before { top: 13px; } .burger span { top: 21px; } .burger::after { top: 29px; }
.burger[aria-expanded="true"]::before { transform: translateY(8px) rotate(45deg); }
.burger[aria-expanded="true"] span { opacity: 0; }
.burger[aria-expanded="true"]::after { transform: translateY(-8px) rotate(-45deg); }

@media (max-width: 1080px) {
  .burger { display: block; }
  .nav { display: none; }
  .topbar .topbar__dl { display: none; }   /* al mòbil va dins del menú */
  .hdr.open .nav .nav__m { display: flex; }
  .hdr.open .nav {
    display: flex; flex-direction: column; align-items: stretch; gap: 0;
    position: absolute; top: 100%; left: 0; right: 0; height: calc(100vh - 77px); height: calc(100svh - 77px);
    background: var(--ink); padding: 12px var(--gutter) 76px; overflow-y: auto;
    border-top: var(--rule) solid var(--balisa);
  }
  .hdr.open .nav a {
    font-stretch: 62%; font-weight: 900; font-style: italic; text-transform: uppercase;
    font-size: 35px; line-height: 1; letter-spacing: 0; padding: 12px 0; border-bottom: 1px solid var(--line);
  }
  .hdr.open .nav a::after { display: none; }
  .brand__logo { height: 54px; }
}

/* ---------- Botons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 12px 22px;
  font-family: var(--f-sans); font-stretch: 112%; font-weight: 800; font-size: 15px;
  letter-spacing: .06em; text-transform: uppercase; text-decoration: none;
  border: var(--rule) solid currentColor; background: transparent; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
/* hover pla: canvia el color, la fletxa avança. Res d'ombres sòlides desplaçades. */
.btn:hover { background: var(--balisa); color: var(--ink); border-color: var(--balisa); }
.btn--yellow { background: var(--balisa); color: var(--ink); border-color: var(--ink); }
.btn--yellow:hover { background: var(--paper); border-color: var(--paper); }
.on-paper .btn--yellow:hover, .btn--yellow.on-light:hover { background: var(--ink); color: var(--balisa); border-color: var(--ink); }
.btn--ink { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn--ink:hover { background: var(--balisa); color: var(--ink); border-color: var(--ink); }
.btn .arr { font-family: var(--f-mono); font-weight: 400; display: inline-block; transition: transform .2s cubic-bezier(.2, .9, .3, 1.4); }
.btn:hover .arr { transform: translateX(4px); }
.btn--sm { min-height: 44px; padding: 8px 14px; font-size: 13px; border-width: 2px; }

/* ---------- Seccions ---------- */
.sec { padding: clamp(64px, 9vw, 128px) 0; position: relative; }
.on-paper { background: var(--paper); color: var(--ink); }
.on-paper .muted { color: var(--muted-ink); }
.on-red { background: var(--tomaquet); color: var(--paper); }
/* Paisatge de fons en B/N multiplicat sobre el color de la cursa: el vermell es manté, el castell o el turó hi queden com una tinta */
.fons-castell, .fons-turo { position: relative; isolation: isolate; }
.fons-castell::before, .fons-turo::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: var(--fons) var(--fons-pos, center) / cover no-repeat;
  mix-blend-mode: multiply; opacity: .5; filter: contrast(1.15);
}
.fons-castell { --fons: url(../img/fons-castell.jpg); --fons-pos: 50% 50%; }
.fons-turo { --fons: url(../img/fons-turo.jpg); --fons-pos: 45% 55%; }
.sec-head {
  display: grid; grid-template-columns: auto 1fr auto; align-items: end; gap: 20px 32px;
  border-top: var(--rule) solid currentColor; padding-top: 18px; margin-bottom: clamp(32px, 5vw, 64px);
}
.sec-num { font-family: var(--f-mono); font-size: 14px; padding-top: 4px; align-self: start; }
.sec-num b {
  display: inline-block; background: var(--balisa); color: var(--ink); padding: 4px 8px; transform: skewX(-12deg);
  font-weight: 700;
}
.sec-head h2 { font-size: clamp(43px, 7.2vw, 118px); }
.sec-head p { margin: 0; max-width: 36ch; justify-self: end; }
@media (max-width: 860px) {
  .sec-head { grid-template-columns: 1fr; }
  .sec-head p { justify-self: start; }
}

/* ---------- Fotos amb tractament ---------- */
.ph { position: relative; overflow: hidden; background: var(--ink-3); }
.ph img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.15) brightness(.9); transition: filter .5s, transform .8s; }
a:hover .ph img, .ph:hover img { filter: grayscale(0) contrast(1.05); transform: scale(1.03); }
.credit {
  position: absolute; right: 0; bottom: 0; background: var(--ink); color: var(--muted);
  font-family: var(--f-mono); font-size: 10px; padding: 4px 8px; max-width: 100%;
}
.credit a { color: inherit; }

/* ---------- Comptador ---------- */
.count { display: flex; gap: 0; border: 2px solid currentColor; width: max-content; max-width: 100%; }
.count div { padding: 10px 14px 8px; border-right: 2px solid currentColor; text-align: left; }
.count div:last-child { border-right: 0; }
.count b { display: block; font-family: var(--f-mono); font-weight: 600; font-size: clamp(26px, 3vw, 40px); line-height: 1; font-variant-numeric: tabular-nums; }
.count span { font-family: var(--f-sans); font-stretch: 125%; font-weight: 700; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }

/* ---------- Formularis ---------- */
.field { display: grid; gap: 6px; }
.field label { font-family: var(--f-sans); font-stretch: 125%; font-weight: 700; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.field input, .field select, .field textarea {
  min-height: 48px; padding: 10px 12px; border: 2px solid currentColor; background: transparent; border-radius: 0;
}
.on-paper .field input, .on-paper .field select { background: #fff; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 3px solid var(--balisa); outline-offset: 0; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.check input { width: 22px; height: 22px; accent-color: var(--ink); margin: 2px 0 0; flex-shrink: 0; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, calc(100% + 48px)); z-index: 2000; visibility: hidden;
  background: var(--balisa); color: var(--ink); border: 2px solid var(--ink);
  padding: 14px 18px; font-weight: 700; max-width: calc(100vw - 32px); transition: transform .3s, visibility 0s .3s;
}
.toast.show { transform: translate(-50%, 0); visibility: visible; transition: transform .3s; }

/* ---------- Peu ---------- */
.ftr { background: var(--ink); color: var(--paper); padding-top: clamp(56px, 7vw, 96px); overflow: hidden; border-top: var(--rule) solid var(--balisa); }
.ftr__grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 40px; padding-bottom: 48px; }
.ftr__logo { display: block; height: 78px; aspect-ratio: 772 / 337; margin-bottom: 22px; }
.ftr__logo > * { display: block; width: 100%; height: 100%; }
.ftr__salut { margin: 14px 0 0; color: var(--balisa); }
.ftr h3 { margin: 0 0 14px; color: var(--muted); white-space: nowrap; }
.ftr ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ftr a { text-decoration: none; display: inline-flex; min-height: 36px; align-items: center; }
.ftr a:hover { color: var(--balisa); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.ftr__big {
  font-size: clamp(90px, 21vw, 340px); white-space: nowrap; line-height: .78;
  margin-bottom: -.12em; color: var(--paper); user-select: none; letter-spacing: -.02em;
}
.ftr__big { pointer-events: none; }   /* les lletres gegants s'enfilen sobre la línia legal: que no en tapin els enllaços */
.ftr__legal { position: relative; z-index: 1; }
.ftr__big span { color: transparent; -webkit-text-stroke: 2px var(--paper); }
.ftr__legal { display: flex; flex-wrap: wrap; gap: 12px 28px; justify-content: space-between; border-top: 1px solid var(--line); padding-block: 18px; font-size: 13px; color: var(--muted); }
.ftr__legal img { height: 16px; width: auto; display: inline-block; vertical-align: -3px; filter: brightness(0) invert(1); opacity: .8; }
.ftr__legal a:hover img { opacity: 1; }   /* es queda en blanc: el verd original no es veu sobre negre */
@media (max-width: 860px) { .ftr__grid { grid-template-columns: 1fr 1fr; } .ftr__grid > :first-child { grid-column: 1 / -1; } }

/* ---------- Modal (dialog) ---------- */
dialog.dlg {
  border: var(--rule) solid var(--ink); padding: 0; width: min(760px, calc(100vw - 24px)); max-height: calc(100vh - 32px);
  background: var(--paper); color: var(--ink);
}
dialog.dlg::backdrop { background: rgba(13, 13, 12, .82); }
.dlg__top { display: flex; align-items: center; gap: 12px; background: var(--ink); color: var(--paper); padding: 12px 16px; position: sticky; top: 0; z-index: 2; }
.dlg__top .lbl { color: var(--balisa); }
.dlg__top button { margin-left: auto; width: 44px; height: 44px; border: 2px solid var(--paper); background: none; color: var(--paper); cursor: pointer; font-size: 20px; }
.dlg__top button:hover { background: var(--balisa); color: var(--ink); border-color: var(--balisa); }
.dlg__body { padding: 24px; display: grid; gap: 18px; }
.dlg__body h2 { font-size: clamp(32px, 4.8vw, 51px); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 620px) { .grid2 { grid-template-columns: 1fr; } .dlg__body { padding: 18px 16px; } }
.sig { border: 2px solid var(--ink); background: #fff; position: relative; }
.sig canvas { display: block; width: 100%; height: 160px; touch-action: none; cursor: crosshair; }
.sig small { position: absolute; left: 12px; bottom: 8px; color: var(--muted-ink); pointer-events: none; }
.sig .line { position: absolute; left: 12px; right: 12px; bottom: 30px; border-bottom: 1px dashed var(--muted-ink); pointer-events: none; }
.demo-note { font-size: 13px; background: var(--paper-2); padding: 10px 12px; border-left: 4px solid var(--ink); }
