:root {
  --ink: #3b2e28;
  --ink-hero: #362b27;
  --text: #69564b;
  --brick: #a65444;
  --brick-dark: #7e3f35;
  --orange: #e78355;
  --ochre: #ab7252;
  --line: #b8ae9c;
  --sand: #f3eedd;
  --light: #fbf8ee;
  --blue: #c9dadb;
  --mint: #e5eeeb;

  --cond: "Roboto Condensed", "Arial Narrow", sans-serif;
  --sans: "Inter", system-ui, sans-serif;
  --serif: "Lora", Georgia, serif;

  --gutter: clamp(20px, 6.67vw, 96px);
  --section-y: clamp(64px, 7.6vw, 110px);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; }
body { margin: 0; background: var(--sand); color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; }
h1, h2, h3, p, ol { margin: 0; }
ol { padding: 0; list-style: none; }
a { color: inherit; }

.wrap { width: 100%; max-width: calc(1248px + 2 * var(--gutter)); margin: 0 auto; padding-inline: var(--gutter); }
.section { padding-block: var(--section-y); }
.bg-light { background: var(--light); }
.bg-sand { background: var(--sand); }
.bg-blue { background: var(--blue); }
.bg-mint { background: var(--mint); }
.serif { font-family: var(--serif); }
.sans { font-family: var(--sans); }

/* ---------- Tipus comuns ---------- */
h2 {
  font-family: var(--cond); font-weight: 700; color: var(--ink);
  font-size: clamp(38px, 4.03vw, 58px); line-height: .98;
}
.h2-42 { font-size: clamp(32px, 2.92vw, 42px); line-height: 1.02; }

.eyebrow {
  display: flex; align-items: center; gap: 12px; margin-bottom: 18px;
  font: 700 11px/normal var(--sans); text-transform: uppercase; color: var(--brick-dark);
}
.eyebrow::before { content: ""; width: 34px; height: 2px; background: var(--orange); }
.eyebrow--dark::before { background: var(--brick); }
.eyebrow--plain { font-size: 10px; color: var(--brick); margin-bottom: 0; }
.eyebrow--plain::before { display: none; }

.lead-19 { font-size: 19px; line-height: 1.5; color: var(--text); }
.lead-21 { font-size: clamp(18px, 1.46vw, 21px); line-height: 1.45; color: var(--text); }

.cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  height: 42px; padding: 0 12px; border: 1px solid var(--brick); border-radius: 10px;
  font: 400 14px/normal var(--sans); color: var(--brick); text-decoration: none; white-space: nowrap;
  transition: background-color .2s, color .2s;
}
.cta img { transition: transform .2s; }
.cta:hover { background: var(--brick); color: var(--light); }
.cta:hover img { transform: translate(2px, -2px); filter: brightness(0) invert(1); }

/* ---------- Navegació ---------- */
.nav {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center;
  height: 88px; padding-inline: max(var(--gutter), calc((100% - 1248px) / 2));
  background: var(--sand); border-bottom: 1px solid var(--line);
}
.nav__brand { flex-shrink: 0; }
.nav__brand img { width: 231px; height: 38px; }
.nav__links { order: 2; display: flex; gap: 28px; margin-left: auto; padding-left: 24px; white-space: nowrap; }
.nav__links a, .footer__nav a { text-decoration: none; }
.nav__links a { font-size: 13px; color: var(--ink); }
.nav__links a:hover, .footer__nav a:hover { text-decoration: underline; text-underline-offset: 4px; }
/* Escriptori (com al Figma): logo · [menú + botó] centrat · logo Fundació.
   El botó no es veu fins que s'ha passat el del hero (un sol botó a la vista); el seu espai queda reservat perquè el menú no es mogui.
   A mòbil el botó ocupa el lloc del logo de la Fundació. */
.nav__end { display: contents; }
.nav__brand { order: 1; }
.nav__cta { order: 3; flex-shrink: 0; margin-left: 62px; height: 34px; padding: 0 10px; gap: 10px; font-size: 11px; opacity: 0; visibility: hidden; }
.nav.show-cta .nav__cta { opacity: 1; visibility: visible; }
.nav__fundacio { order: 4; flex-shrink: 0; margin-left: auto; padding-left: 24px; }
.nav__cta img { width: 13px; height: 13px; }
.nav__fundacio img { width: 145px; height: auto; }
.nav__fundacio, .nav__cta { transition: opacity .3s, visibility .3s, background-color .2s, color .2s; }

/* ---------- Hero ---------- */
.hero { background: var(--sand); }
.hero__inner { display: flex; gap: 92px; align-items: flex-start; padding-block: 110px; }
.hero__title-block { width: 755px; flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-start; }
.hero__title {
  font-family: var(--cond); font-weight: 700; color: var(--ink-hero);
  font-size: clamp(46px, 5.7vw, 82px); line-height: .91; margin-bottom: 25px;
}
.hero__title-block > .cta { margin-bottom: 40px; }
.hero__copy { flex: 1; align-self: stretch; display: flex; flex-direction: column; justify-content: flex-end; gap: 72px; color: var(--text); font-family: var(--serif); }
.hero__lead { font-size: clamp(19px, 1.53vw, 22px); line-height: 1.5; }
.hero__intro { font-size: 16px; line-height: 1.5; }

.logos { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px 16px; }
.logos--hero { width: 697px; max-width: 100%; }
.logos img { flex-shrink: 0; object-fit: contain; }

/* Carrusel de logos: el JS reparteix els logos en pàgines i les va alternant */
.logos.is-carousel { display: block; }
.logo-track { position: relative; height: 44px; }
.logo-page {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  opacity: 0; transform: translateY(8px); pointer-events: none;
  transition: opacity .7s ease, transform .7s ease;
}
.logo-page.is-active { opacity: 1; transform: none; pointer-events: auto; }
.logo-page.is-leaving { opacity: 0; transform: translateY(-8px); }
.logo-crop { position: relative; overflow: hidden; flex-shrink: 0; display: block; }
.logo-crop img { position: absolute; max-width: none; }

.hero__image { position: relative; height: 510px; overflow: hidden; }
.hero__slide {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top;
  opacity: 0; transform: scale(1.04); transition: opacity 1.4s ease, transform 7s ease-out;
}
.hero__slide.is-active { opacity: 1; transform: scale(1); }
.hero__veil {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(59,46,40,.49) 0%, rgba(59,46,40,0) 60%, rgba(201,218,219,.1) 100%);
}
.hero__caption {
  position: absolute; z-index: 1; left: 0; right: 0; bottom: 42px; margin: 0 auto;
  display: flex; align-items: center; gap: 16px; color: #fff;
}
.hero__caption-label { font: 700 11px/normal var(--sans); text-transform: uppercase; white-space: nowrap; }
.hero__caption-rule { width: 120px; height: 1px; background: #fff; opacity: .7; flex-shrink: 0; }
.hero__caption em { font: italic 16px/normal var(--serif); }

/* ---------- Introduccions de secció ---------- */
.intro { display: grid; grid-template-columns: 720px 1fr; column-gap: 104px; align-items: start; }
.intro__copy { color: var(--text); }
.intro__copy--story { padding-top: 38px; font-size: 18px; line-height: 1.55; }
.intro__copy--story p + p { margin-top: 1.55em; }
.intro--why { padding-top: 35px; min-height: 226px; margin-bottom: 98px; column-gap: 100px; }
.intro--why .intro__copy { padding-top: 36px; font-size: 16px; line-height: 1.55; }
.intro--platform { margin-bottom: 88px; }
.intro--platform .intro__head h2 { max-width: 720px; }
.intro--projects { align-items: end; column-gap: 100px; margin-bottom: 52px; }
.intro--projects .intro__copy { font-size: 18px; line-height: 1.5; padding-bottom: 30px; }

/* ---------- Territori ---------- */
.windows { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; align-items: end; margin-top: 54px; }
.window__img { position: relative; border-radius: 15px; overflow: hidden; margin-bottom: 16px; }
.window__img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.window h3 { font: 700 23px/normal var(--cond); color: var(--ink); margin-bottom: 6px; }
.window p { font-size: 13px; line-height: 1.45; color: var(--text); }

/* ---------- Xifres ---------- */
.facts { display: grid; grid-template-columns: repeat(4, 1fr); border-block: 1px solid var(--text); padding-block: 30px; }
.fact { display: flex; flex-direction: column; gap: 8px; padding-inline: 28px; }
.facts .fact + .fact { border-left: 1px solid var(--text); }
.facts .fact:first-child { padding-left: 0; }
.facts .fact:last-child { padding-right: 0; }
.fact strong { font: 700 48px/normal var(--cond); color: var(--brick); font-variant-numeric: tabular-nums; }
/* Xifres: apareixen amb fos i comptador (el JS afegeix .is-waiting i després .is-counted) */
.fact.is-waiting { opacity: 0; transform: translateY(16px); }
.fact.is-counted { opacity: 1; transform: none; transition: opacity .8s ease, transform .8s cubic-bezier(.2,.7,.2,1); transition-delay: var(--d, 0s); }
.fact span { font-size: 15px; line-height: 1.25; color: var(--ink); }
.fact--plain { padding: 0; }

/* ---------- Què fem ---------- */
.caps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.cap {
  background: var(--light); border-radius: 15px; padding: 24px; min-height: 248px;
  display: flex; flex-direction: column; justify-content: space-between;
  transition: transform .25s, box-shadow .25s;
}
.cap:hover { transform: translateY(-4px); box-shadow: 0 14px 40px rgba(59,46,40,.08); }
.cap__top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font: 700 11px/normal var(--sans); color: var(--brick); }
.cap h3 { font: 400 28px/normal var(--cond); color: var(--ink); margin-bottom: auto; }
.cap p { font-size: 14px; line-height: 1.48; color: var(--text); min-height: 63px; margin-top: 24px; }
.landscape { width: 100%; max-width: 1240px; margin-top: 88px; mix-blend-mode: darken; }

/* ---------- Eixos ---------- */
.axes { display: flex; gap: 88px; align-items: flex-start; }
.axes__intro { width: 520px; flex-shrink: 0; }
.axes__intro h2 { margin-bottom: 18px; }
.peach { width: 143px; height: 143px; margin-top: 50px; filter: drop-shadow(0 6px 3.8px rgba(59,46,40,.25)); }
.axis-list { flex: 1; }
.axis { display: flex; gap: 22px; align-items: flex-start; min-height: 132px; padding-block: 24px; border-bottom: 1px solid var(--line); }
.axis__num { width: 42px; flex-shrink: 0; font: 700 18px/normal var(--cond); color: var(--orange); }
.axis__body { flex: 1; min-width: 0; }
.axis h3 { font: 700 28px/1.05 var(--cond); color: var(--ink); margin-bottom: 8px; }
.axis__sub { font: 18px/1.6 var(--serif); color: var(--text); }
.axis__detail { font: 15px/1.6 var(--serif); color: var(--ochre); }
.axis__icon { width: 48px; height: 48px; flex-shrink: 0; border-radius: 999px; background: var(--mint); display: grid; place-items: center; }

/* ---------- Projectes ---------- */
.projects { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; align-items: end; }
.project {
  height: 500px; display: flex; flex-direction: column; overflow: hidden;
  background: var(--light); border-radius: 32px; box-shadow: 0 14px 40px rgba(59,46,40,.1);
}
.project--short { height: 450px; }
.project__img { height: 284px; flex-shrink: 0; overflow: hidden; }
.project--short .project__img { height: 234px; }
.project__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.project:hover .project__img img { transform: scale(1.04); }
.project__content { flex: 1; padding: 24px; display: flex; flex-direction: column; justify-content: space-between; }
.project__tag { font-size: 10px; text-transform: uppercase; color: var(--brick); }
.project h3 { font: 700 27px/1.05 var(--cond); color: var(--ink); margin-bottom: 9px; }
.project h3 + p { font-size: 13px; line-height: 1.45; color: var(--text); }
.projects__cta { display: flex; justify-content: flex-end; margin-top: 52px; }

/* ---------- Ecosistema ---------- */
.eco { display: flex; gap: 48px; align-items: flex-start; }
.eco__text { width: 639px; flex-shrink: 0; }
.eco__text h2 { margin-bottom: 18px; }
.eco__facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; width: 428px; max-width: 100%; margin-top: 60px; }
.eco__img { position: relative; flex: 1; max-width: 560px; aspect-ratio: 560 / 445; border-radius: 20px; overflow: hidden; margin-left: auto; }
.eco__img img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Impuls i aliances ---------- */
.alliance { padding: var(--section-y) 30px; }
.alliance__inner { max-width: 1380px; margin: 0 auto; display: flex; align-items: flex-start; }
.alliance__collage { width: 444px; height: 434px; flex-shrink: 0; position: relative; overflow: hidden; }
.alliance__collage img { position: absolute; max-width: none; width: 121.71%; height: 121.69%; left: -10.81%; top: -5.08%; }
.alliance__content { flex: 1; min-width: 0; padding: 64px 96px 56px; display: flex; flex-direction: column; gap: 28px; }
.alliance__text { font-size: 15px; line-height: 1.55; color: var(--text); }
.groups { display: flex; flex-direction: column; gap: 18px; }
.groups__arrows { display: flex; gap: 18px; }
.chev { width: 7.7px; height: 7.7px; }
.chev--l { transform: rotate(-135deg); }
.chev--r { transform: rotate(45deg); }
.groups__tabs { display: flex; gap: 28px; }
.groups__tab { font: 700 9px/normal var(--sans); text-transform: uppercase; color: var(--ink); padding-bottom: 4px; }
.groups__tab.is-active { border-bottom: 1px solid var(--orange); }
.logos--alliance { max-width: 744px; padding-block: 45px; border-block: 1px solid var(--text); }

/* ---------- Peu ---------- */
.footer { background: var(--ink); color: var(--sand); padding: 48px 0 36px; }
.footer__main { display: flex; justify-content: space-between; align-items: flex-start; gap: 32px; margin-bottom: 48px; }
.footer__main img { width: 231px; height: 38px; }
.footer__nav { display: flex; gap: 30px; font-size: 12px; }
.footer__contact { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; }
.footer__mail { font-size: 13px; text-decoration: none; }
.footer__mail:hover { text-decoration: underline; }
.footer__legal { display: flex; justify-content: space-between; gap: 16px; padding-top: 20px; border-top: 1px solid rgba(243,238,221,.25); color: var(--line); font-size: 10px; }
.footer__legal em { font: italic 12px/normal var(--serif); }

/* ---------- Animació d'entrada ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s ease, transform .8s cubic-bezier(.2,.7,.2,1); transition-delay: var(--d, 0s); }
.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Responsive ---------- */
/* Capçalera: primer s'estreny, i per sota de 1120px passa al mode mòbil (logo Fundació ↔ botó) */
@media (max-width: 1366px) {
  .nav__links { gap: 20px; }
  .nav__cta { margin-left: 24px; }
  .nav__fundacio img { width: 120px; }
}
@media (max-width: 1120px) {
  .nav__links { display: none; }
  .nav__end { display: flex; order: 2; position: relative; margin-left: auto; gap: 0; }
  .nav__cta { margin-left: 0; }
  .nav__fundacio { padding-left: 0; margin-left: 0; }
  .nav__fundacio img { width: auto; height: 46px; }
  .nav__cta { position: absolute; right: 0; top: 50%; transform: translateY(-50%); opacity: 0; pointer-events: none; }
  .nav.show-cta .nav__cta { opacity: 1; pointer-events: auto; }
  .nav.show-cta .nav__fundacio { opacity: 0; pointer-events: none; }
}
@media (max-width: 380px) {
  .nav .nav__brand img { width: 140px; }
  .nav__cta { padding: 0 8px; gap: 6px; font-size: 10px; }
  .hero__title { font-size: 40px; }
}

@media (max-width: 1280px) {
  .hero__title-block { width: 56%; }
  .hero__copy { min-width: 0; }
  .logos { justify-content: flex-start; gap: 20px 28px; }
  .intro { grid-template-columns: 1fr 1fr; column-gap: 64px; }
  .axes { gap: 56px; }
  .axes__intro { width: 42%; }
  .eco { gap: 64px; }
  .eco__text { width: auto; flex: 1; }
  .alliance__content { padding: 40px 0 40px 56px; }
  .alliance__collage { width: 360px; height: 352px; }
}

@media (max-width: 1024px) {
  .hero__inner { flex-direction: column; gap: 48px; padding-block: 72px; }
  .hero__title-block { width: 100%; }
  .hero__copy { gap: 24px; }
  .hero__image { height: 420px; }
  .intro, .intro--why, .intro--projects { grid-template-columns: 1fr; row-gap: 24px; }
  .intro__copy--story, .intro--why .intro__copy, .intro--projects .intro__copy { padding: 0; }
  .intro--why { min-height: 0; margin-bottom: 48px; }
  .windows { grid-template-columns: 1fr 1fr; }
  .windows .window:last-child { grid-column: span 2; }
  .window__img { height: 320px !important; }
  .facts { grid-template-columns: 1fr 1fr; row-gap: 28px; }
  .facts .fact:nth-child(3) { border-left: 0; padding-left: 0; }
  .facts .fact:nth-child(2) { padding-right: 0; }
  .caps, .projects { grid-template-columns: 1fr 1fr; }
  .project, .project--short { height: auto; }
  .project__img, .project--short .project__img { height: 240px; }
  .project__content { gap: 32px; }
  .axes, .eco { flex-direction: column; }
  .axes__intro, .eco__text { width: 100%; }
  .eco__img { width: 100%; max-width: none; }
  .alliance__inner { flex-direction: column; align-items: center; }
  .alliance__content { padding: 40px var(--gutter) 0; width: 100%; }
  .footer__main { flex-wrap: wrap; }
}

@media (max-width: 640px) {
  :root { --gutter: 20px; }
  .nav { height: 72px; }
  .nav__brand img { width: 170px; height: auto; }
  .nav__fundacio img { height: 40px; }
  .hero__inner { padding-block: 48px; }
  .logos { flex-wrap: wrap; justify-content: flex-start; gap: 20px 24px; }
  .hero__image { height: 360px; }
  .hero__caption { flex-direction: column; align-items: flex-start; gap: 8px; bottom: 24px; }
  .hero__caption-rule { display: none; }
  .windows, .caps, .projects { grid-template-columns: 1fr; }
  .windows .window:last-child { grid-column: auto; }
  .window__img { height: 260px !important; }
  .facts { grid-template-columns: 1fr; }
  .facts .fact { border-left: 0 !important; padding-inline: 0; }
  .facts .fact + .fact { padding-top: 20px; border-top: 1px solid rgba(105,86,75,.3); }
  .cap { min-height: 200px; }
  .eco__facts { grid-template-columns: 1fr 1fr; width: 100%; }
  .axis { gap: 14px; }
  .axis__num { width: 26px; }
  .axis__icon { display: none; }
  .axis h3 { font-size: 24px; }
  .projects__cta { justify-content: flex-start; }
  .alliance { padding-inline: 0; }
  .alliance__collage { width: 300px; height: 293px; }
  .footer__nav { flex-wrap: wrap; gap: 12px 20px; }
  .footer__contact { align-items: flex-start; }
  .footer__legal { flex-direction: column; }
}
