/* ==========================================================================
   VIGILA AMB LES DROGUES — full de estils
   Paleta i tipografies extretes del disseny original (Canva)
   ========================================================================== */

/* ---------- Tipografies (autoallotjades, funciona sense internet) --------- */
@font-face {
  font-family: 'League Gothic';
  src: url('../fonts/leaguegothic.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Open Sauce One';
  src: url('../fonts/opensauceone-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Open Sauce One';
  src: url('../fonts/opensauceone-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ------------------------------- Tokens ---------------------------------- */
:root {
  --red: #d50d0e;
  --red-bright: #ff3131;
  --red-dark: #a80a0b;
  --ink: #0a0a0a;
  --ink-soft: #333;
  --paper: #f2f2f2;
  --card: #fdfdfd;
  --line: rgba(0, 0, 0, .12);

  --display: 'League Gothic', 'Oswald', 'Arial Narrow', sans-serif;
  --body: 'Open Sauce One', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --wrap: 1120px;
  --radius: 14px;
  --radius-lg: 26px;
  --shadow: 0 6px 24px rgba(0, 0, 0, .10);
  --shadow-lg: 0 14px 40px rgba(0, 0, 0, .16);
  --nav-h: 94px;
}

/* ------------------------------- Reset ----------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 44px); }
body {
  margin: 0;
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background-color: var(--paper);
  background-image: url('../img/texture.jpg');
  background-size: 620px auto;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
/* El full d'estil del navegador no aplica [hidden] als elements SVG */
[hidden] { display: none; }
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; }

/* ---------------------------- Utilitats ---------------------------------- */
.wrap { width: min(100% - 40px, var(--wrap)); margin-inline: auto; }
.section { padding: 76px 0; }
.section + .section { padding-top: 20px; }
.center { text-align: center; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ------------------------------ Titulars --------------------------------- */
h1, h2, h3, h4 { font-family: var(--display); font-weight: 400; margin: 0; line-height: .95; }

.h-section {
  font-size: clamp(2.6rem, 6vw, 4rem);
  text-transform: uppercase;
  letter-spacing: .01em;
  text-align: center;
  margin-bottom: 14px;
}
.h-block {
  font-size: clamp(1.9rem, 4vw, 2.7rem);
  text-transform: uppercase;
  margin-bottom: 12px;
}
.h-block--red { color: var(--red); }
.h-sub {
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 10px;
}
.rule {
  width: 92px; height: 5px; background: var(--red);
  border-radius: 3px; margin: 0 auto 34px;
}
.rule--left { margin-left: 0; margin-right: 0; }

p { margin: 0 0 16px; }
p:last-child { margin-bottom: 0; }
.muted { color: var(--ink-soft); }

/* Els textos ocupen tota l'amplada del contenidor i van justificats */
.prose, .prose p, .intro__text,
.tl__panel p, .modal__content p, .modal__content li,
.flip__back p, .flip__back li,
.ticks li, .stat__label { text-align: justify; }
.prose.center, .prose.center p, .center { text-align: center; }

/* ------------------------------ Capçalera -------------------------------- */
/* La franja opaca evita que el text es vegi per sobre i al voltant de la barra
   negra en fer scroll. */
.navbar {
  position: sticky; top: 0; z-index: 60;
  background: var(--paper);
  padding: 14px 0;
}
.nav {
  width: min(100% - 28px, 1180px);
  margin-inline: auto;
  background: var(--ink);
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 20px;
  padding: 12px 26px 12px 14px;
  min-height: var(--nav-h);
}
.nav__brand { display: flex; align-items: center; gap: 20px; color: #fff; }
.nav__brand:hover { text-decoration: none; }
.nav__logo {
  width: 64px; height: 64px; border-radius: 50%;
  background: #000; flex: none;
}
.nav__name {
  font-family: var(--body); font-weight: 400; font-size: 1.38rem;
  text-transform: uppercase; letter-spacing: .045em; color: #fff;
}
.nav > nav { margin-left: auto; }
.nav__menu {
  display: flex; align-items: center; gap: 20px;
  list-style: none; padding: 0; margin: 0;
}
.nav__link {
  display: block; color: #fff; font-family: var(--body); font-weight: 400;
  font-size: 1.15rem; text-transform: uppercase; letter-spacing: .035em;
  padding: 10px 18px; border-radius: 999px; white-space: nowrap;
  transition: background .18s ease, color .18s ease;
  background: none; border: 0; cursor: pointer;
}
.nav__link:hover, .nav__link:focus-visible { background: var(--red); text-decoration: none; }
.nav__link[aria-current="page"] { color: var(--red-bright); }

/* Desplegable INFO */
.nav__item { position: relative; }
.nav__drop {
  position: absolute; top: calc(100% + 10px); left: 50%; translate: -50% 0;
  min-width: 190px; background: var(--ink); border-radius: var(--radius);
  padding: 8px; list-style: none; margin: 0;
  box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; translate: -50% 8px;
  transition: opacity .18s ease, translate .18s ease, visibility .18s;
}
.nav__item:hover .nav__drop,
.nav__item:focus-within .nav__drop,
.nav__drop.is-open { opacity: 1; visibility: visible; translate: -50% 0; }
.nav__drop .nav__link { font-size: 1.05rem; padding: 9px 14px; }

/* Botó hamburguesa */
.nav__toggle {
  display: none; margin-left: auto;
  width: 46px; height: 46px; border-radius: 50%;
  background: transparent; border: 2px solid rgba(255, 255, 255, .35);
  color: #fff; cursor: pointer;
  align-items: center; justify-content: center;
}
.nav__toggle span, .nav__toggle span::before, .nav__toggle span::after {
  content: ''; display: block; width: 20px; height: 2px; background: #fff;
  transition: transform .22s ease, opacity .22s ease;
}
.nav__toggle span::before { transform: translateY(-6px); }
.nav__toggle span::after { transform: translateY(4px); }
.nav.is-open .nav__toggle span { background: transparent; }
.nav.is-open .nav__toggle span::before { transform: rotate(45deg); }
.nav.is-open .nav__toggle span::after { transform: translateY(-2px) rotate(-45deg); }

/* --------------------------------- Hero ---------------------------------- */
.hero { padding: 70px 0 40px; text-align: center; }
.hero h1 {
  font-size: clamp(3rem, 9vw, 6.2rem);
  text-transform: none;
  margin-bottom: 18px;
}
.hero__claim {
  font-family: var(--display); color: var(--red);
  font-size: clamp(1.5rem, 3.6vw, 2.2rem);
  margin-bottom: 26px;
}
.hero__text {
  font-family: var(--display);
  text-transform: uppercase;
  font-size: clamp(1.05rem, 2.2vw, 1.4rem);
  line-height: 1.35; letter-spacing: .015em;
  max-width: 780px; margin-inline: auto;
}

/* ----------------------------- Targetes info ----------------------------- */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; }
.card {
  display: flex; flex-direction: column; align-items: center;
  background: var(--card); border: 3px solid var(--red);
  border-radius: var(--radius); padding: 26px 18px 30px;
  color: var(--ink); text-align: center;
  transition: transform .22s ease, box-shadow .22s ease, background .22s ease;
}
.card:hover {
  transform: translateY(-6px); box-shadow: var(--shadow-lg);
  text-decoration: none;
}
.card__title {
  font-family: var(--display); color: var(--red);
  font-size: 2.2rem; text-transform: uppercase; margin-bottom: 18px;
}
.card__media {
  height: 210px; display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.card__media img { max-height: 100%; width: auto; }
.card__cta {
  font-family: var(--display); text-transform: uppercase;
  font-size: 1.15rem; letter-spacing: .06em; color: var(--ink);
}
.card:hover .card__cta { color: var(--red); }

/* ------------------------------- Botons ---------------------------------- */
.pill-list { display: grid; gap: 18px; margin-top: 34px; }
.pill {
  display: flex; align-items: center; gap: 20px;
  background: var(--card); border: 3px solid var(--red);
  border-radius: 999px; padding: 14px 30px;
  color: var(--ink); font-family: var(--display);
  font-size: clamp(1.4rem, 3vw, 2rem); text-transform: uppercase;
  transition: background .2s ease, color .2s ease, transform .2s ease;
}
.pill:hover { background: var(--red); color: #fff; text-decoration: none; transform: translateX(6px); }
.pill img { width: 46px; height: 46px; object-fit: contain; flex: none; }
.pill span { flex: 1; text-align: center; }

.btn {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--red); color: #fff;
  font-family: var(--display); font-size: 1.25rem; text-transform: uppercase;
  letter-spacing: .05em; padding: 12px 26px; border-radius: 999px;
  transition: background .2s ease, transform .2s ease;
}
.btn:hover { background: var(--ink); text-decoration: none; transform: translateY(-2px); }
.btn--ghost { background: transparent; color: var(--ink); border: 2px solid var(--ink); }
.btn--ghost:hover { background: var(--ink); color: #fff; }

/* ------------------------- Blocs de contingut ---------------------------- */
.block { margin-bottom: 64px; }

.note {
  background: var(--red); color: #fff; border-radius: var(--radius);
  padding: 16px 22px; font-size: .98rem; line-height: 1.5;
  box-shadow: var(--shadow);
}
.note strong { font-weight: 700; }

/* Bombolla vermella "Sabies que…" */
.fact {
  background: var(--red); color: #fff;
  border-radius: 30px; padding: 20px 28px;
  box-shadow: var(--shadow);
  font-family: var(--display); font-size: 1.35rem; line-height: 1.45;
  text-align: center;
}

/* ------------------- Introducció de fitxa (portada) ---------------------- */
.intro {
  padding: 42px 0 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    'title art'
    'quees fact'
    'text  text';
  column-gap: 40px; row-gap: 10px;
  align-items: start;
}
.intro__title {
  grid-area: title; align-self: center;
  font-size: clamp(3.2rem, 9vw, 6.4rem);
  color: var(--red); text-transform: uppercase;
}
.intro__art { grid-area: art; position: relative; padding-bottom: 10px; }
.intro__art .img-toggle { width: 68%; margin: 4% 0 0 6%; }
.intro__art .img-toggle img { width: 100%; }
.intro__arrow {
  position: absolute; right: 0; bottom: -4px;
  width: 42%; height: auto; overflow: visible;
}
.intro__quees {
  grid-area: quees; align-self: center;
  font-family: var(--display); text-transform: uppercase;
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  padding-left: 6%;
}
.intro .fact, .intro__aside { grid-area: fact; }
.intro__aside .hint { margin-bottom: 10px; }
.intro__text {
  grid-area: text; margin-top: 34px;
  font-family: var(--display); font-size: clamp(1.35rem, 2.4vw, 1.7rem);
  line-height: 1.5;
}

figure { margin: 0; }
.figure {
  background: var(--card); border: 3px solid var(--red);
  border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow);
}
.figure img { border-radius: 6px; margin-inline: auto; }
.figure figcaption {
  font-size: .88rem; color: var(--ink-soft); text-align: center;
  margin-top: 10px; line-height: 1.45;
}

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 34px; align-items: center; }
.split--wide-left { grid-template-columns: 1.35fr 1fr; }
.split--wide-right { grid-template-columns: 1fr 1.35fr; }

/* ------------- Cronologia interactiva (línia + punts clicables) ----------- */
.tl { margin-top: 30px; }
.tl__hint {
  font-family: var(--display); text-transform: uppercase; letter-spacing: .04em;
  font-size: 1.05rem; color: var(--ink-soft); margin-bottom: 20px;
}

.tl__railwrap { overflow-x: auto; overflow-y: hidden; padding: 6px 0 4px; }
.tl__railwrap::-webkit-scrollbar { height: 7px; }
.tl__railwrap::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, .2); border-radius: 4px; }

.tl__rail {
  position: relative; display: flex; align-items: flex-start;
  min-width: 600px;
}
/* la línia va del centre del primer punt al centre de l'últim */
.tl__rail::before {
  content: ''; position: absolute; z-index: 0;
  top: 28px; left: 10%; right: 10%;
  height: 6px; background: var(--red); border-radius: 3px;
}

.tl__step {
  position: relative; z-index: 1;
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  background: none; border: 0; padding: 0 6px; cursor: pointer;
  color: inherit;
}
.tl__dot {
  width: 62px; height: 62px; border-radius: 50%;
  background: var(--card); border: 5px solid var(--red); color: var(--red);
  font-family: var(--display); font-size: 1.85rem; line-height: 1;
  display: grid; place-items: center;
  transition: background .2s ease, color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.tl__label {
  font-family: var(--display); text-transform: uppercase; letter-spacing: .03em;
  font-size: 1.05rem; line-height: 1.15; text-align: center; color: var(--ink-soft);
  transition: color .2s ease;
}
.tl__step:hover .tl__dot { transform: scale(1.08); }
.tl__step:focus-visible { outline: 0; }
.tl__step:focus-visible .tl__dot { box-shadow: 0 0 0 5px rgba(213, 13, 14, .35); }
.tl__step[aria-selected="true"] .tl__dot {
  background: var(--red); color: #fff; transform: scale(1.12);
  box-shadow: 0 6px 18px rgba(213, 13, 14, .35);
}
.tl__step[aria-selected="true"] .tl__label { color: var(--red); }

.tl__panels { margin-top: 34px; }
.tl__panel { display: none; }
.tl__panel.is-active {
  display: grid; grid-template-columns: 1fr auto; gap: 30px; align-items: center;
  background: var(--red); color: #fff;
  border-radius: var(--radius-lg); padding: 28px 32px;
  box-shadow: var(--shadow);
  animation: tl-in .32s ease both;
}
.tl__panel:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }
.tl__panel h3 { font-size: 2.1rem; text-transform: uppercase; margin-bottom: 12px; }
.tl__panel p { font-size: 1rem; line-height: 1.55; }
.tl__panel img {
  width: 260px; border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
}
@keyframes tl-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* --------------------------- Llistes d'efectes ---------------------------- */
.effects { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 30px; }
.effects__head { margin-bottom: 8px; }
.effects__sub {
  font-family: var(--display); font-size: 1.2rem; text-transform: uppercase;
  color: var(--ink-soft); margin-bottom: 16px;
}
.ticks { list-style: none; padding: 0; margin: 0; }
.ticks li {
  position: relative; padding-left: 30px; margin-bottom: 12px; line-height: 1.5;
}
.ticks li::before {
  content: ''; position: absolute; left: 6px; top: .62em;
  width: 10px; height: 10px; border-radius: 50%; background: var(--red);
}
.ticks li strong { color: var(--red); }

/* ----------------------------- Estadístiques ------------------------------ */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 34px; align-items: center; margin-top: 30px; }
.stat {
  background: var(--card); border-radius: var(--radius-lg);
  padding: 26px 28px; box-shadow: var(--shadow); border-top: 6px solid var(--red);
}
.stat__num {
  font-family: var(--display); font-size: clamp(3.4rem, 9vw, 5.4rem);
  color: var(--red); line-height: .9; margin-bottom: 8px;
}
.stat__label { font-size: 1rem; line-height: 1.5; }
.people { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 4px; }
.people i {
  width: 20px; height: 34px; display: block; background: #b9b9b9;
  clip-path: polygon(50% 0, 68% 10%, 68% 24%, 88% 36%, 88% 66%, 74% 66%, 74% 100%, 26% 100%, 26% 66%, 12% 66%, 12% 36%, 32% 24%, 32% 10%);
}
.people i.on { background: var(--red); }

/* -------------------------- Fitxes d'associació --------------------------- */
.assoc { margin-bottom: 70px; }
.assoc__head { display: flex; align-items: center; gap: 22px; margin-bottom: 8px; flex-wrap: wrap; }
.assoc__head h2 { font-size: clamp(2.4rem, 6vw, 3.6rem); color: var(--red); text-transform: uppercase; }
.assoc__head img { width: 92px; flex: none; }
.assoc__links { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 24px; }

/* -------------------------------- Peu ------------------------------------ */
.footer {
  background: var(--ink); color: #fff; margin-top: 70px;
  padding: 54px 0 34px;
}
.footer a { color: #fff; }
.footer__grid {
  display: grid; grid-template-columns: 1fr auto; gap: 30px; align-items: center;
}
.footer__brand { display: flex; align-items: center; gap: 14px; }
.footer__brand img { width: 62px; }
.footer__name { font-family: var(--display); font-size: 1.6rem; text-transform: uppercase; }
.footer__social { display: flex; gap: 14px; flex-wrap: wrap; }
.social {
  display: inline-flex; align-items: center; gap: 10px;
  border: 2px solid rgba(255, 255, 255, .3); border-radius: 999px;
  padding: 10px 20px; font-family: var(--display); font-size: 1.15rem;
  text-transform: lowercase; letter-spacing: .02em;
  transition: background .2s ease, border-color .2s ease;
}
.social:hover { background: var(--red); border-color: var(--red); text-decoration: none; }
.social svg { width: 22px; height: 22px; fill: currentColor; flex: none; }
.footer__legal {
  margin-top: 34px; padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, .15);
  font-size: .85rem; color: rgba(255, 255, 255, .6); text-align: center;
}

/* ====================== COMPONENTS INTERACTIUS ============================ */

/* ---- Imatge que revela un contingut en fer-hi clic ---- */
.img-toggle {
  background: none; border: 0; padding: 0; cursor: pointer;
  border-radius: var(--radius); position: relative; display: block;
  transition: transform .22s ease;
}
.img-toggle:hover { transform: scale(1.04); }
.img-toggle:focus-visible { outline: 3px solid var(--red); outline-offset: 6px; }
.img-toggle::after {
  content: ''; position: absolute; inset: -10px;
  border: 3px dashed rgba(213, 13, 14, .5); border-radius: var(--radius-lg);
  animation: hint-pulse 2.6s ease-in-out infinite;
  pointer-events: none;
}
.img-toggle[aria-expanded="true"]::after { display: none; }
@keyframes hint-pulse {
  0%, 100% { opacity: .35; transform: scale(1); }
  50%      { opacity: .9;  transform: scale(1.03); }
}

.hint {
  font-family: var(--display); text-transform: uppercase; letter-spacing: .04em;
  font-size: 1.05rem; color: var(--red); margin-bottom: 14px;
}
.hint::before { content: '👆 '; }

/* ---- Targetes que giren (flip) ---- */
.flip { perspective: 1400px; }
.flip__inner {
  position: relative; display: block; width: 100%; min-height: 285px;
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; color: inherit; text-align: left; overflow: visible;
  transform-style: preserve-3d;
  transition: transform .6s cubic-bezier(.4, .2, .2, 1);
}
.flip__inner[aria-expanded="true"] { transform: rotateY(180deg); }
.flip__inner:focus-visible { outline: 3px solid var(--red); outline-offset: 6px; }

.flip__face {
  position: absolute; inset: 0; overflow: auto;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: var(--radius); padding: 22px 24px;
  display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.flip__front {
  background: var(--red); color: #fff;
  align-items: center; justify-content: center; text-align: center; gap: 16px;
}
.flip__back {
  background: var(--card); color: var(--ink);
  border: 3px solid var(--red); transform: rotateY(180deg);
}
.flip__title {
  font-family: var(--display); text-transform: uppercase; letter-spacing: .03em;
  font-size: 1.5rem; line-height: 1.1;
}
.flip__back .flip__title { color: var(--red); margin-bottom: 12px; }
.flip__cue {
  font-family: var(--display); text-transform: uppercase; font-size: .95rem;
  letter-spacing: .05em; opacity: .8;
}
.flip__back ul { margin: 0; padding-left: 20px; }
.flip__back li { margin-bottom: 8px; font-size: .95rem; line-height: 1.45; }
.flip__back p { font-size: .95rem; line-height: 1.5; }
.flip__front img { max-height: 130px; width: auto; }

.flip-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 30px; }
.flip-grid--2 { grid-template-columns: 1fr 1fr; }
.flip-grid--tall .flip__inner { min-height: 340px; }

/* ---- Enllaç dins del text que obre una finestra ---- */
.link-pop {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; font-weight: 700; color: var(--red);
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px;
}
.link-pop:hover { color: var(--red-dark); }
.link-pop:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; border-radius: 3px; }
.link-pop::after {
  content: '+'; display: inline-grid; place-items: center;
  width: 1.15em; height: 1.15em; margin-left: .3em; vertical-align: .05em;
  border-radius: 50%; background: var(--red); color: #fff;
  font-size: .75em; line-height: 1; text-decoration: none;
}

/* ---- Mapa del cos amb punts clicables ---- */
.body-map { position: relative; max-width: 430px; margin: 26px auto 0; }
.body-map img { width: 100%; }
.hotspot {
  position: absolute; width: 13%; height: 8.2%;
  translate: -50% -50%;
  background: none; border: 0; padding: 0; cursor: pointer;
  border-radius: 50%;
  transition: box-shadow .2s ease, scale .2s ease;
}
.hotspot::after {
  content: ''; position: absolute; inset: -5px; border-radius: 50%;
  border: 2px dashed rgba(213, 13, 14, .6);
}
.hotspot:hover, .hotspot:focus-visible {
  outline: 0; scale: 1.12;
  box-shadow: 0 0 0 7px rgba(213, 13, 14, .22);
}
.hotspot:hover::after, .hotspot:focus-visible::after { border-style: solid; }

/* ---- Imatge comparativa amb zones seleccionables ---- */
.leafmap { position: relative; max-width: 760px; margin: 24px auto 0; }
.leafmap > img { width: 100%; border-radius: var(--radius); }
.leaf-tab {
  position: absolute; top: 3%; height: 94%;
  background: none; border: 3px solid transparent; border-radius: 12px;
  cursor: pointer; padding: 0;
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}
.leaf-tab:hover { border-color: rgba(213, 13, 14, .5); transform: translateY(-3px); }
.leaf-tab:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
.leaf-tab[aria-selected="true"] {
  border-color: var(--red); background: rgba(213, 13, 14, .1);
}
.leaf-tab__name {
  position: absolute; left: 50%; bottom: -34px; translate: -50% 0;
  font-family: var(--display); text-transform: uppercase; letter-spacing: .04em;
  font-size: 1.15rem; color: var(--ink-soft); white-space: nowrap;
}
.leaf-tab[aria-selected="true"] .tl__label,
.leaf-tab[aria-selected="true"] .leaf-tab__name { color: var(--red); }
.leafmap + .tl__panels { margin-top: 54px; }

/* ---- Finestra flotant (popup) ---- */
.modal[hidden] { display: none; }
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; padding: 20px;
}
.modal__backdrop {
  position: absolute; inset: 0; background: rgba(0, 0, 0, .62);
  animation: modal-fade .2s ease both;
}
.modal__box {
  position: relative; width: 100%; max-width: 640px; max-height: 86vh; overflow: auto;
  background: var(--card); color: var(--ink);
  border-radius: var(--radius-lg); border-top: 9px solid var(--red);
  padding: 34px 36px; box-shadow: var(--shadow-lg);
  animation: modal-pop .26s cubic-bezier(.2, .9, .3, 1.1) both;
}
.modal__close {
  position: absolute; top: 14px; right: 14px;
  width: 42px; height: 42px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--red); color: #fff; font-size: 1.5rem; line-height: 1;
  transition: background .2s ease;
}
.modal__close:hover { background: var(--ink); }
.modal__content h3 {
  font-family: var(--display); text-transform: uppercase; color: var(--red);
  font-size: 2rem; margin: 0 44px 14px 0;
}
.modal__content img {
  width: 100%; border-radius: 10px; margin-bottom: 18px;
  border: 3px solid var(--red);
}
.modal__content p { font-size: 1rem; line-height: 1.6; }
.modal__content ul { padding-left: 22px; margin: 0; }
.modal__content li { margin-bottom: 8px; line-height: 1.5; }
body.is-locked { overflow: hidden; }

@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-pop {
  from { opacity: 0; transform: translateY(18px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

/* --------------------------- Aparició en scroll --------------------------- */
.reveal { opacity: 0; transform: translateY(22px); }
.reveal.is-visible {
  opacity: 1; transform: none;
  transition: opacity .6s ease, transform .6s ease;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
  .img-toggle::after { animation: none; }
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ------------------------------ Responsive -------------------------------- */
@media (max-width: 900px) {
  .cards { grid-template-columns: 1fr; }
  .split, .split--wide-left, .split--wide-right,
  .effects, .stats { grid-template-columns: 1fr; }
  .intro {
    grid-template-columns: 1fr;
    grid-template-areas: 'title' 'art' 'fact' 'quees' 'text';
    row-gap: 4px;
  }
  .intro__art { max-width: 420px; margin-inline: auto; width: 100%; }
  .intro__quees { padding-left: 0; margin-top: 26px; }
  .intro .fact { margin-top: 10px; }
  .intro__text { margin-top: 18px; }

  .tl__panel.is-active { grid-template-columns: 1fr; padding: 24px; }
  .tl__panel img { width: 100%; max-width: 340px; order: -1; margin-inline: auto; }

  .flip-grid, .flip-grid--2 { grid-template-columns: 1fr; }
  .modal__box { padding: 28px 22px; max-height: 90vh; }
  .modal__content h3 { font-size: 1.7rem; }
}

@media (max-width: 780px) {
  :root { --nav-h: 72px; }
  .nav { border-radius: var(--radius-lg); flex-wrap: wrap; padding: 10px 14px; }
  .nav > nav { margin-left: 0; flex-basis: 100%; }
  .nav__brand { gap: 12px; min-width: 0; }
  .nav__logo { width: 46px; height: 46px; }
  .nav__name { font-size: .95rem; letter-spacing: .02em; }
  .nav__toggle { display: inline-flex; margin-left: auto; }
  .nav__menu {
    flex-basis: 100%; flex-direction: column; align-items: stretch;
    gap: 2px; margin: 0; max-height: 0; overflow: hidden;
    transition: max-height .3s ease, padding .3s ease;
  }
  .nav.is-open .nav__menu { max-height: 520px; padding: 10px 0 6px; }
  .nav__link { text-align: left; }
  .nav__drop {
    position: static; translate: none; opacity: 1; visibility: visible;
    box-shadow: none; padding: 0 0 0 18px; min-width: 0;
    max-height: 0; overflow: hidden; transition: max-height .25s ease;
  }
  .nav__item:hover .nav__drop, .nav__item:focus-within .nav__drop { max-height: 0; }
  .nav__drop.is-open { max-height: 220px; }
  .section { padding: 54px 0; }
  body { font-size: 16px; }
  .footer__grid { grid-template-columns: 1fr; }
}

/* Les cares de les targetes són absolutes: en pantalles estretes el text
   necessita més alçada per no quedar tallat. */
@media (max-width: 560px) {
  .flip__inner { min-height: 330px; }
  .flip-grid--tall .flip__inner { min-height: 440px; }
}
@media (max-width: 430px) {
  .flip__inner { min-height: 365px; }
  .flip-grid--tall .flip__inner { min-height: 530px; }
}

/* -------------------------------- Print ----------------------------------- */
@media print {
  .nav, .footer__social { display: none; }
  body { background: #fff; }
  .reveal { opacity: 1; transform: none; }
}
