/* Paleta y tipografías */
:root {
  --font-body: "Trade Gothic BoldTwo", "Trade Gothic", system-ui, -apple-system,
    "Segoe UI", sans-serif;
  --font-title: "Berthold Block", "Berthold", "Impact", system-ui, sans-serif;
  --pant166: #e87722; /* aproximación PANTONE 166 */
  --pant-negro: #111111;
}

/* Todo invisible al inicio (lo levanta GSAP) */
body {
  opacity: 0;
}

/* Lienzo fijo (no responsive) */
body {
  height: 98vh;
  font-family: var(--font-body);
  color: var(--pant-negro);
}

.main-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  width: 100%;
  overflow: hidden;
}
.capture-container {
  width: 520px;
  height: 790px;
  position: relative;
  border: 2px solid black;
  overflow: hidden;
}

/* Mapa */
#svg-map {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 10px;
  width: calc(100% - 20px);
  height: calc(100% - 20px);
  fill: transparent;
  stroke: grey;
  opacity: 0;
  z-index: 0;
}

/* =========================
   INTRO OVERLAY
   ========================= */
.intro-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.9);
  padding: 18px 16px;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
}

.intro-top {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 70%;
  text-align: center;
}
.intro-slogan {
  font-family: var(--font-title);
  font-size: 31px;
  line-height: 2;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pant-negro);
  margin: 0 8px;
  text-align: center;
}

.intro-slogan-line {
  display: block;
  margin: 24px auto;
  text-align: center;
}

.intro-slogan-char {
  display: inline-block;
}
.intro-totals {
  font-family: var(--font-title);
  font-size: 31px;
  line-height: 2;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pant166);
  margin: 0 8px;
  text-align: center;
  opacity: 0; /* la mostrarem amb GSAP */
}

.intro-totals-line {
  display: block;
  margin: 24px auto;
  text-align: center;
}


/* Logos abajo */
.intro-logos {
  --logos-total: 420px;
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 1;
}
.intro-logo,
.intro-logos img {
  height: auto;
  display: block;
  border: 0;
  margin: 0;
  padding: 0;
  object-fit: contain;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.08));
  transform: translateZ(0);
}
#logo-fac-big {
  width: calc(var(--logos-total) * 0.55);
}
#logo-roda-big {
  width: calc(var(--logos-total) * 0.55);
}

/* Anclas invisibles para posicionamiento al píxel */
.intro-items--pixel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}
.intro-item {
  position: absolute;
  left: var(--x);
  bottom: var(--y);
  width: var(--w, 56px);
  opacity: 0;
  transform: translateZ(0);
}
.intro-item--roda {
  left: calc(var(--x) - 50px);
  bottom: calc(var(--y) + 10px);
}
.intro-item,
.intro-item img {
  display: block;
  border: 0;
  margin: 0;
  padding: 0;
}

.intro-overlay--bar {
  background: transparent;
}

/* ====== Barra de título (arriba) ====== */
.focus-title {
  position: absolute;
  left: 16px;
  right: 16px;
  top: 8px;
  z-index: 20;
  background: var(--pant166);
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 26px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  backdrop-filter: none;
  border-top: none;
}


/* ====== Panel inferior con tabla (por si lo reutilizas) ====== */
.entities-panel {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 12px;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  overflow: hidden;
}

.entities-panel table {
  width: 100%;
  border-collapse: collapse;
  font-size: 22px;
  font-weight: 700;
  font-family: var(--font-body);
}

.entities-panel thead th {
  text-align: left;
  padding: 10px 12px;
  background: var(--pant-negro);
  color: #fff;
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

td {
  font-size: 20px;
  font-weight: 700;
  text-transform: uppercase!important;
}

#svg-map {
  z-index: 0;
}
.intro-logos {
  z-index: 20;
}

/* Ventana para animar el cuerpo con blur/fade */
.t-body-window {
  min-height: 140px;
  padding: 6px 0;
  transition: filter 0.25s ease, transform 0.25s ease, opacity 0.25s ease;
}

/* Contenedor de la tabla ya lo tienes; añadimos el layout de grid por filas */
.entities-grid {
  display: grid;
  grid-template-rows: repeat(4, auto);
  row-gap: 6px;
}

.entity-row {
  display: grid;
  grid-template-columns: 1fr;
  column-gap: 12px;
  padding-left: 10px;
  padding-top: 5px;
  padding-bottom: 5px;
}

.entities-grid.cols-2 .entity-row {
  grid-template-columns: 1fr 1fr;
}

.entity-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 22px;
}

.entity-index {
  width: 2ch;
  text-align: right;
  opacity: 0.8;
  font-variant-numeric: tabular-nums;
  color: var(--pant166);
}

.entity-name {
  flex: 1 1 auto;
}

.comarca-entity-name,
.catalunya-nord-entity-name,
.entity-name {
  text-wrap: balance;
}

/* Interacciones bloqueadas (no hace falta, animación auto) */
#focus-title,
#entities-panel {
  pointer-events: none;
}

/* ===== Overlay de comarca centrado (tabla “suave”) ===== */
.comarca-overlay {
  position: absolute;
  inset: 0;
  /* No centrem verticalment amb flex per evitar que el bloc pugi/baixi */
  z-index: 30;
  pointer-events: none;
  opacity: 0;
}


.comarca-panel {
  position: absolute;
  left: 50%;
  top: 140px; /* Ajusta aquesta Y si vols el bloc més amunt/avall */
  transform: translateX(-50%);
  max-width: 86%;
  padding: 10px 18px;
  background: transparent;
  text-align: center;
}


.comarca-title {
  font-family: var(--font-title);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 34px;
  margin-bottom: 16px; /* més espai amb els números */
  color: var(--pant166);
  white-space: nowrap;
  /* overflow: hidden; */
  text-overflow: ellipsis;
}


.comarca-stats {
  font-family: var(--font-body);
  font-size: 25px;
  font-weight: 700;
  margin-bottom: 16px; /* més espai amb la llista d'entitats */
  color: var(--pant166);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.comarca-stats > div {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}



.comarca-list {
  font-family: var(--font-body)!important;
  font-size: 20px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: #111111!important;
}

.comarca-entity {
  display: flex;
  gap: 8px;
  align-items: center;
}

.comarca-entity.is-long {
  align-items: flex-start;
}


.comarca-entity-index {
  width: 2ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--pant166);
  font-weight: 700;
}

.comarca-entity-name {
  white-space: nowrap;
  font-weight: 700;
  text-transform: uppercase;
}
.comarca-entity-name.is-long {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.25;
}


/* ===== Overlay especial Catalunya Nord (Conflent) ===== */


/* Overlay de totals globals (separat del slogan) */
.totals-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.95);
  z-index: 20; /* per sobre del mapa i de la intro-overlay */
  opacity: 0;
  pointer-events: none;
}

.totals-content {
  max-width: 90%;
  font-family: var(--font-title);
  font-size: 31px;
  line-height: 2;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pant166);
  text-align: center;
}

.totals-line {
  display: block;
  margin: 24px auto;
}
.catalunya-nord-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 31;
  pointer-events: none;
  opacity: 0;
  --dt-color: var(--pant166);
}

.catalunya-nord-panel {
  max-width: 88%;
  text-align: center;
}

.catalunya-nord-map-wrap {
  position: relative;
  display: inline-block;
  margin-bottom: 10px;
}

.catalunya-nord-map {
  width: 220px;
  height: auto;
  margin: 0 auto;
}

.catalunya-nord-map svg {
  width: 100%;
  height: auto;
  display: block;
}

.catalunya-nord-sticker{display:none!important;}

.catalunya-nord-title {
  font-family: var(--font-title);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 30px;
  margin-bottom: 6px;
  color: var(--dt-color);
}

.catalunya-nord-list {
  font-family: var(--font-body);
  font-size: 20px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
}

.catalunya-nord-entity {
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 700;
  text-transform: uppercase;
  color: #111111!important;
  
}

.catalunya-nord-entity.is-long {
  align-items: flex-start;
}


.catalunya-nord-entity-index {
  width: 2ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--dt-color);
  font-weight: 700;
}

.catalunya-nord-entity-name {
  white-space: nowrap;
  font-weight: 700;
}
.catalunya-nord-entity-name.is-long {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.25;
  text-transform: uppercase;
}




/* Sticker FAC en mini-mapa Conflent */
#catalunya-nord-map{ position: relative; }
.catalunya-nord-fac-sticker{
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 52px;
  height: auto;
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.25));
}


/* ===== Extra maps (Conflent / Madrid / València) ===== */
.comarca-map-wrap{
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 8px;
}
.comarca-map-wrap svg{
  width: 100%;
  height: auto;
  max-height: 260px;
}


/* Barra superior del mapa (botón pantalla completa) */
.fac-map-toolbar {
  width: 100%;
  max-width: 100px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  justify-content: flex-end;
  margin-bottom: 8px;
  margin-left: 240px;
  z-index: 10;
}

.fac-map-fullscreen-btn {
  padding: 6px 12px;
  border-radius: 4px;
  border: none;
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font-body);
  background: rgba(17, 17, 17, 0.8);
  color: #ffffff;
  cursor: pointer;
  line-height: 1.4;
}

.fac-map-sound-btn {
  padding: 6px 12px;
  border-radius: 4px;
  border: none;
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font-body);
  background: #ee7402;
  color: #ffffff;
  cursor: pointer;
  line-height: 1.4;
}

.fac-map-fullscreen-btn:hover {
  background: rgba(17, 17, 17, 0.95);
}

.fac-map-fullscreen-btn:focus-visible {
  outline: 2px solid var(--pant166);
  outline-offset: 2px;
}

/* Modo pantalla completa (manteniendo proporción del capture-container) */
.main-container.fac-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #FFF;
}

/* Nos aseguramos de que el lienzo escala desde el centro */
.capture-container {
  transform-origin: center center;
}

/* Cuenta atrás previa a la animación */
.fac-map-countdown {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
  font-size: 64px;
  color: #ffffff;
  text-shadow: 0 0 20px rgba(0, 0, 0, 0.7);
  background: #FFF;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
}
