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

:root {
  --vermell: #DA121A;
  --groc: #FCDD09;
  --blanc: #FFFFFF;
  --negre: #212121;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: var(--font);
  background: var(--blanc);
}

/* ── Escenes ─────────────────────────────────────────── */
.escena {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  transition: opacity 0.6s ease;
}

.escena.hidden {
  opacity: 0;
  pointer-events: none;
}

.escena.activa {
  opacity: 1;
  pointer-events: auto;
}

.fons-vermell {
  background: var(--vermell);
}

/* ── Helpers ─────────────────────────────────────────── */
.hidden {
  opacity: 0;
}

.visible {
  opacity: 1;
}

/* ── ESCENA 1 ────────────────────────────────────────── */

#escena1 {
  justify-content: flex-start;
  padding-top: clamp(8rem, 28vh, 16rem);
}

.escena1-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 560px;
  width: 100%;
  gap: 1.2rem;
}

.titol-fix {
  font-size: clamp(1.1rem, 4vw, 1.6rem);
  font-weight: 400;
  color: var(--negre);
  transition: opacity 0.8s ease;
  line-height: 1.4;
}

.frase-dinamica {
  font-size: clamp(1.5rem, 6vw, 2.4rem);
  font-weight: 700;
  color: var(--negre);
  line-height: 1.3;
  transition: opacity 0.5s ease;
}

/* ── ESCENA 2 ────────────────────────────────────────── */
.escena2-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.5rem;
  max-width: 560px;
  width: 100%;
  z-index: 2;
  position: relative;
}

.text-gran {
  font-size: clamp(1.3rem, 5vw, 2rem);
  font-weight: 400;
  color: var(--negre);
  transition: opacity 0.8s ease;
  line-height: 1.4;
}

.text-cta-blanc {
  font-size: clamp(1.1rem, 4.5vw, 1.8rem);
  font-weight: 900;
  color: var(--negre);
  letter-spacing: 0.03em;
  transition: opacity 0.8s ease;
  line-height: 1.3;
}

/* ── Senyera ─────────────────────────────────────────── */
.senyera {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: opacity 0.4s ease;
  z-index: 1;
}

.senyera.hidden {
  opacity: 0;
}

.senyera.visible {
  opacity: 1;
}

.franja {
  flex: 1;
  width: 0%;
  transition: width 0.4s ease;
}

.franja.groc {
  background: var(--groc);
}

.franja.vermell {
  background: var(--vermell);
}

.franja.expandida {
  width: 100%;
}

/* "PUGEM" sobre la senyera */
.senyera-pugem {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(3.5rem, 18vw, 8rem);
  font-weight: 900;
  color: var(--negre);
  letter-spacing: 0.12em;
  z-index: 2;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

/* ── ESCENA 3 ────────────────────────────────────────── */
.escena3-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 1.2rem;
  max-width: 560px;
  width: 100%;
  padding-top: clamp(6rem, 22vh, 12rem);
  position: relative;
  z-index: 2;
}

.text-amb-pugem {
  font-size: clamp(1.6rem, 6vw, 2.5rem);
  font-weight: 900;
  color: var(--blanc);
  line-height: 1.2;
  transition: opacity 0.6s ease, transform 0.6s ease;
  transform: scale(1.15);
}

.ticker-wrapper {
  overflow: hidden;
  transition: opacity 0.6s ease;
  width: 100%;
  height: var(--ticker-h, 3.5rem);
}

.ticker {
  display: flex;
  flex-direction: column;
  transition: transform 0.5s ease;
}

.ticker-item {
  display: flex;
  align-items: center;
  font-size: clamp(1.1rem, 4.5vw, 1.6rem);
  color: var(--blanc);
  font-weight: 600;
  line-height: 1.3;
  width: 100%;
  height: var(--ticker-h, 3.5rem);
  padding: 0;
}

/* ── Fotos escena 3 ──────────────────────────────────── */
.escena3-fotos {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 42%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  padding: 0 12px 12px;
  pointer-events: none;
  z-index: 1;
}

.foto-slot {
  flex: 1;
  max-width: 120px;
  aspect-ratio: 3/4;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255,255,255,0.15);
  border: 2px dashed rgba(255,255,255,0.4);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.foto-slot.visible {
  opacity: 1;
  transform: translateY(0);
}

.foto-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Si la imatge no existeix, mostra el placeholder buit */
.foto-slot img[src=""],
.foto-slot img:not([src]) {
  display: none;
}

/* ── ESCENA 4 ────────────────────────────────────────── */
.escena4-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  gap: 1.2rem;
  max-width: 560px;
  width: 100%;
}

.frase-climax {
  font-size: clamp(1.3rem, 5vw, 2rem);
  font-weight: 700;
  color: var(--blanc);
  line-height: 1.4;
  transition: opacity 0.5s ease;
}

.cta-wrapper {
  margin-top: 0.5rem;
  transition: opacity 0.8s ease;
}

.cta-btn {
  display: inline-block;
  padding: 1rem 2rem;
  background: var(--blanc);
  color: var(--vermell);
  font-size: clamp(1rem, 4vw, 1.3rem);
  font-weight: 900;
  text-decoration: none;
  border-radius: 50px;
  min-height: 48px;
  min-width: 200px;
  text-align: center;
  transition: transform 0.3s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  position: relative;
  z-index: 31;
}

.cta-btn:hover,
.cta-btn:focus {
  transform: scale(1.04);
  outline: none;
}

/* ── Línia de pols (a baix, puja cap amunt) ──────────── */
.linia-pols {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--vermell);
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  animation: pols-linia 2s ease-in-out infinite;
}

.linia-pols.activa {
  opacity: 1;
}

@keyframes pols-linia {
  0%   { box-shadow: 0 0 0px 0px rgba(218, 18, 26, 0); }
  50%  { box-shadow: 0 -4px 14px 5px rgba(218, 18, 26, 0.7); }
  100% { box-shadow: 0 0 0px 0px rgba(218, 18, 26, 0); }
}

/* ── Farciment vermell de baix cap amunt (escena 2) ──── */
.fill-vermell {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 0%;
  background: var(--vermell);
  z-index: 0;
  pointer-events: none;
  transition: height 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.fill-vermell.ple {
  height: 100%;
}

/* ── Zones de navegació ──────────────────────────────── */
.nav-area {
  position: fixed;
  top: 0;
  bottom: 0;
  z-index: 30;
  cursor: pointer;
  background: transparent;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.nav-enrere  { left: 0;  width: 40%; }
.nav-endavant{ right: 0; width: 60%; }

/* ── Barres de progrés (story) ───────────────────────── */
.progress-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 4px;
  padding: max(8px, env(safe-area-inset-top, 8px)) 8px 0 8px;
  z-index: 20;
  pointer-events: none;
}

.progress-track {
  flex: 1;
  height: 3px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: #fff;
  border-radius: 2px;
}

/* Escena 1 té fons blanc: barres fosques */
body.progres-fosc .progress-track {
  background: rgba(0, 0, 0, 0.18);
}

body.progres-fosc .progress-fill {
  background: var(--negre);
}
