/* =============================================================================
   ESPIADIMONIS — pàgina pública (one-page)
   =============================================================================

   Tema fosc, independent de l'aplicació interna. Tot viu dins de .pub perquè
   no s'escapi cap estil cap a les pantalles privades, que són clares.

   Sistema de formes (no n'afegeixis d'altres a ull):
     --r-chip  pastilles i etiquetes  -> rodó
     --r-btn   botons                 -> 10px
     --r-icon  quadres d'icona        -> 12px
     --r-card  targetes i mèdia       -> 20px
   ============================================================================= */

body.public-page {
  background: #0b0b0d;
}

.pub {
  --ink:            #0b0b0d;
  --ink-2:          #0f0f12;
  --raised:         rgba(255, 255, 255, 0.035);
  --raised-hover:   rgba(255, 255, 255, 0.065);
  --line:           rgba(255, 255, 255, 0.09);
  --line-strong:    rgba(255, 255, 255, 0.18);

  --red:      #e0102a;
  --red-soft: rgba(224, 16, 42, 0.14);
  --red-text: #ff5468;

  --fg:      #ffffff;
  --fg-2:    rgba(255, 255, 255, 0.86);
  --fg-3:    rgba(255, 255, 255, 0.58);
  --fg-4:    rgba(255, 255, 255, 0.40);

  --r-chip: 999px;
  --r-btn:  10px;
  --r-icon: 12px;
  --r-card: 20px;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);

  background: var(--ink);
  color: var(--fg-2);
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.pub h1, .pub h2, .pub h3, .pub h4 {
  font-family: 'Sora', 'Inter', system-ui, sans-serif;
  letter-spacing: -0.025em;
  color: var(--fg);
  font-weight: 700;
}

.pub a { text-decoration: none; }

/* Amplada del contingut + trucs per sortir del contenidor de Bootstrap */
.pub .shell { max-width: 1160px; margin: 0 auto; padding: 0 1.75rem; }
.pub .bleed { width: 100vw; position: relative; left: 50%; margin-left: -50vw; }


/* =============================================================================
   BARRA SUPERIOR
   ============================================================================= */

.pub-topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11, 11, 13, 0.72);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease);
}
/* La vora només apareix quan ja has baixat: a dalt de tot molesta. */
.pub-topbar.is-stuck {
  border-bottom-color: var(--line);
  background: rgba(11, 11, 13, 0.9);
}
.pub-topbar .row-flex {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 68px; gap: 0.75rem;
}
.pub-topbar .brand {
  display: flex; align-items: center; gap: 0.65rem;
  color: var(--fg); font-weight: 700; font-size: 0.98rem;
  white-space: nowrap; overflow: hidden; min-width: 0;
}
.pub-topbar .brand img {
  height: 32px; width: 32px; object-fit: contain;
  border-radius: var(--r-icon); background: #fff; padding: 3px; flex-shrink: 0;
}
.pub-topbar .brand .mark {
  height: 32px; width: 32px; border-radius: var(--r-icon);
  background: var(--red); color: #fff; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.pub-topbar .brand span { overflow: hidden; text-overflow: ellipsis; }

.pub-topbar .nav-links { display: flex; align-items: center; gap: 2rem; }
.pub-topbar .nav-links a {
  color: var(--fg-3); font-size: 0.86rem; font-weight: 500;
  transition: color 0.15s var(--ease); position: relative;
}
.pub-topbar .nav-links a:hover { color: var(--fg); }

.pub-access {
  display: inline-flex; align-items: center; gap: 0.4rem;
  flex-shrink: 0; white-space: nowrap;
  background: #fff; color: #0b0b0d;
  font-weight: 600; font-size: 0.82rem;
  padding: 0.5rem 1.1rem; border-radius: var(--r-btn);
  transition: opacity 0.15s var(--ease);
}
.pub-access:hover { opacity: 0.85; color: #0b0b0d; }


/* =============================================================================
   HERO
   ============================================================================= */

.pub-hero { position: relative; overflow: hidden; }

/* Foto de portada al fons, enfosquida perquè el text hi sigui llegible sempre,
   independentment de la foto que pugi la junta. */
.pub-hero__photo {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center;
  z-index: 0;
}
.pub-hero__photo::after {
  content: '';
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(11,11,13,0.72) 0%, rgba(11,11,13,0.86) 55%, var(--ink) 100%),
    linear-gradient(90deg, rgba(11,11,13,0.9) 0%, rgba(11,11,13,0.35) 70%);
}

.pub-hero__glow {
  position: absolute; width: 680px; height: 680px; border-radius: 50%;
  background: radial-gradient(circle, rgba(224,16,42,0.30), rgba(224,16,42,0) 70%);
  top: -230px; right: -170px; pointer-events: none; z-index: 0;
}
.pub-hero__grid {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,0.9), transparent 75%);
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.9), transparent 75%);
}

.pub-hero__inner { position: relative; z-index: 1; padding: 6.5rem 0 5rem; }
.pub-hero.has-photo .pub-hero__inner { padding: 8.5rem 0 6.5rem; }


@keyframes pub-pulse {
  70%  { box-shadow: 0 0 0 7px rgba(255,84,104,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,84,104,0); }
}

.pub-hero h1 {
  font-weight: 800;
  font-size: clamp(2.5rem, 5.4vw, 4.1rem);
  line-height: 1.04;
  margin-bottom: 1.35rem;
  max-width: 16ch;
}
.pub-hero .lead {
  color: var(--fg-3);
  font-size: 1.1rem;
  line-height: 1.72;
  max-width: 54ch;
  margin-bottom: 2.25rem;
}

.pub-cta-row { display: flex; gap: 0.85rem; flex-wrap: wrap; }

.pub-btn-primary,
.pub-btn-outline {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-weight: 600; font-size: 0.92rem;
  padding: 0.82rem 1.55rem; border-radius: var(--r-btn);
  white-space: nowrap;
  transition: transform 0.15s var(--ease), filter 0.15s var(--ease),
              background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.pub-btn-primary { background: var(--red); color: #fff; border: 1px solid var(--red); }
.pub-btn-primary:hover { filter: brightness(1.12); transform: translateY(-1px); color: #fff; }
.pub-btn-outline { background: transparent; border: 1px solid var(--line-strong); color: var(--fg); }
.pub-btn-outline:hover { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.4); color: var(--fg); }


/* =============================================================================
   BANDA DE XIFRES
   ============================================================================= */

.pub-stats {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--ink-2);
}
.pub-stats__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
}
.pub-stats__item {
  background: var(--ink-2);
  padding: 2.4rem 1.5rem;
  text-align: center;
}
.pub-stats__num {
  font-family: 'Sora', sans-serif;
  font-size: clamp(2rem, 3.6vw, 2.9rem);
  font-weight: 800;
  color: var(--fg);
  line-height: 1;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}
.pub-stats__num .plus { color: var(--red); }
.pub-stats__label {
  margin-top: 0.6rem;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--fg-4);
  font-weight: 600;
}


/* =============================================================================
   SECCIONS
   ============================================================================= */

.pub-section { padding: 6rem 0; position: relative; }
.pub-section + .pub-section { border-top: 1px solid var(--line); }

.pub-section__head { margin-bottom: 3rem; max-width: 620px; }
.pub-section__eyebrow {
  font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.13em;
  color: var(--red-text); margin-bottom: 0.85rem;
  display: flex; align-items: center; gap: 0.6rem;
}
.pub-section__eyebrow::before {
  content: ''; width: 22px; height: 1px; background: var(--red);
}
.pub-section h2 {
  font-size: clamp(1.75rem, 3vw, 2.35rem);
  line-height: 1.15;
  margin-bottom: 0.75rem;
}
.pub-section .sub { color: var(--fg-3); font-size: 1rem; line-height: 1.7; }


/* --- Qui som ---------------------------------------------------------------- */
.pub-about { display: grid; grid-template-columns: 1.25fr 0.75fr; gap: 4rem; align-items: start; }
.pub-about__text p { color: var(--fg-3); font-size: 1rem; line-height: 1.85; margin-bottom: 1.15rem; }
.pub-about__text p:last-child { margin-bottom: 0; }

.pub-about__aside {
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 2rem 1.75rem;
  position: sticky;
  top: 100px;
}
.pub-about__logo {
  width: 84px; height: 84px; object-fit: contain;
  margin-bottom: 1.25rem;
  filter: drop-shadow(0 8px 22px rgba(0,0,0,0.45));
}
.pub-about__fact { padding: 0.85rem 0; border-bottom: 1px solid var(--line); }
.pub-about__fact:last-child { border-bottom: 0; padding-bottom: 0; }
.pub-about__fact .k {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--fg-4); margin-bottom: 0.2rem;
}
.pub-about__fact .v { color: var(--fg); font-weight: 600; font-size: 0.95rem; }


/* --- Activitats -------------------------------------------------------------- */
.pub-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }

.pub-activity {
  border-radius: var(--r-card);
  overflow: hidden;
  background: var(--raised);
  border: 1px solid var(--line);
  display: flex; flex-direction: column;
  transition: transform 0.22s var(--ease), background 0.22s var(--ease),
              border-color 0.22s var(--ease);
}
.pub-activity:hover {
  transform: translateY(-5px);
  background: var(--raised-hover);
  border-color: var(--line-strong);
}
.pub-activity__media {
  position: relative; aspect-ratio: 16 / 10;
  background: rgba(0,0,0,0.4); overflow: hidden;
}
.pub-activity__media img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.4s var(--ease);
}
.pub-activity:hover .pub-activity__media img { transform: scale(1.05); }
.pub-activity__media .ph {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.14); font-size: 2.2rem;
}
.pub-activity__date {
  position: absolute; top: 12px; left: 12px;
  background: rgba(11,11,13,0.82);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  color: var(--fg); font-size: 0.72rem; font-weight: 600;
  padding: 0.35rem 0.75rem; border-radius: var(--r-chip);
  display: flex; align-items: center; gap: 0.35rem;
}
.pub-activity__body { padding: 1.35rem 1.4rem 1.5rem; flex: 1; }
.pub-activity__body h3 { font-size: 1.06rem; margin-bottom: 0.5rem; line-height: 1.35; }
.pub-activity__body p { color: var(--fg-3); font-size: 0.89rem; line-height: 1.65; margin: 0; }

.pub-empty {
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-card);
  padding: 3.5rem 1.5rem; text-align: center;
  color: var(--fg-4); grid-column: 1 / -1;
}
.pub-empty i { font-size: 1.9rem; color: rgba(255,255,255,0.2); margin-bottom: 0.85rem; display: block; }


/* --- Galeria ------------------------------------------------------------------ */
.pub-gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
}
/* La primera foto ocupa quatre cel·les: una graella plana de vuit quadrats
   iguals és avorrida i no destaca res. */
.pub-gallery__item:first-child { grid-column: span 2; grid-row: span 2; }

.pub-gallery__item {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--r-icon);
  overflow: hidden;
  border: 1px solid var(--line);
  cursor: zoom-in;
  background: var(--raised);
}
.pub-gallery__item img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.45s var(--ease), opacity 0.2s var(--ease);
}
.pub-gallery__item:hover img { transform: scale(1.06); }
.pub-gallery__item figcaption {
  position: absolute; inset: auto 0 0 0;
  padding: 1.6rem 0.9rem 0.75rem;
  background: linear-gradient(transparent, rgba(11,11,13,0.9));
  color: var(--fg); font-size: 0.8rem; font-weight: 500;
  opacity: 0; transform: translateY(6px);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}
.pub-gallery__item:hover figcaption { opacity: 1; transform: none; }

/* Visor a pantalla completa */
.pub-lightbox {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(6, 6, 7, 0.94);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 2.5rem;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s var(--ease);
}
.pub-lightbox.is-open { opacity: 1; pointer-events: auto; }
.pub-lightbox img {
  max-width: 100%; max-height: 100%;
  border-radius: var(--r-icon);
  box-shadow: 0 30px 90px rgba(0,0,0,0.7);
}
.pub-lightbox__close {
  position: absolute; top: 1.25rem; right: 1.25rem;
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: rgba(255,255,255,0.06); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}
.pub-lightbox__close:hover { background: rgba(255,255,255,0.14); }


/* --- Junta --------------------------------------------------------------------- */

.pub-contact { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 3rem; align-items: start; }

.pub-contact__card {
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 0.5rem 1.5rem;
}
.pub-contact__row {
  display: flex; align-items: center; gap: 1rem;
  padding: 1.2rem 0; border-bottom: 1px solid var(--line);
}
.pub-contact__row:last-child { border-bottom: none; }
.pub-contact__row .ic {
  width: 42px; height: 42px; border-radius: var(--r-icon);
  background: var(--red-soft); color: var(--red-text);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.05rem; flex-shrink: 0;
}
.pub-contact__row .k {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--fg-4); margin-bottom: 0.2rem;
}
.pub-contact__row a, .pub-contact__row .v {
  color: var(--fg); font-weight: 600; font-size: 0.95rem;
}
.pub-contact__row a:hover { color: var(--red-text); }

.pub-map {
  border-radius: var(--r-card);
  overflow: hidden;
  border: 1px solid var(--line);
  min-height: 320px;
  background: var(--raised);
}
.pub-map iframe { width: 100%; height: 100%; min-height: 320px; border: 0; display: block; filter: grayscale(1) invert(0.92) contrast(0.85); }
.pub-map__fallback {
  min-height: 320px; height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 0.9rem; text-align: center; padding: 2rem;
  color: var(--fg-4);
}
.pub-map__fallback i { font-size: 2rem; color: var(--red); }

/* --- Xarxes socials --------------------------------------------------------------- */
.pub-social { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.pub-social a {
  width: 42px; height: 42px; border-radius: var(--r-icon);
  border: 1px solid var(--line);
  background: var(--raised);
  color: var(--fg-3);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  transition: background 0.15s var(--ease), color 0.15s var(--ease),
              border-color 0.15s var(--ease), transform 0.15s var(--ease);
}
.pub-social a:hover {
  background: var(--red); border-color: var(--red);
  color: #fff; transform: translateY(-2px);
}

/* --- Crida final ------------------------------------------------------------------ */
.pub-cta {
  position: relative;
  border-radius: var(--r-card);
  border: 1px solid var(--line);
  background:
    radial-gradient(900px 320px at 50% 0%, rgba(224,16,42,0.20), transparent 70%),
    var(--raised);
  padding: 4rem 2rem;
  text-align: center;
  overflow: hidden;
}
.pub-cta h2 { margin-bottom: 0.85rem; }
.pub-cta p { color: var(--fg-3); max-width: 48ch; margin: 0 auto 2rem; line-height: 1.7; }
.pub-cta .pub-cta-row { justify-content: center; }


/* =============================================================================
   PEU
   ============================================================================= */

.pub-footer {
  background: #060607;
  border-top: 1px solid var(--line);
  padding: 2.5rem 0;
  color: var(--fg-4);
  font-size: 0.82rem;
}
.pub-footer__inner {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 1rem;
}
.pub-footer a { color: var(--fg-3); font-weight: 500; }
.pub-footer a:hover { color: var(--fg); }


/* =============================================================================
   APARICIÓ EN FER SCROLL
   Sense JS actiu, .reveal es queda visible: mai amaguem contingut de forma
   permanent per culpa d'una animació.
   ============================================================================= */

.pub .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.55s var(--ease), transform 0.55s var(--ease);
}
.pub .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .pub .reveal { opacity: 1; transform: none; transition: none; }
  .pub *, .pub *::before, .pub *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}


/* =============================================================================
   RESPONSIU
   ============================================================================= */

@media (max-width: 991px) {
  .pub-cards   { grid-template-columns: repeat(2, 1fr); }
  .pub-about   { grid-template-columns: 1fr; gap: 2.5rem; }
  .pub-about__aside { position: static; }
  .pub-contact { grid-template-columns: 1fr; gap: 2rem; }
  .pub-topbar .nav-links { display: none; }
  .pub-section { padding: 4.5rem 0; }
}

@media (max-width: 700px) {
  .pub .shell { padding: 0 1.15rem; }
  .pub-cards { grid-template-columns: 1fr; }
  .pub-stats__grid { grid-template-columns: 1fr; }
  .pub-stats__item { padding: 1.75rem 1rem; }
  .pub-gallery { grid-template-columns: repeat(2, 1fr); }
  .pub-gallery__item:first-child { grid-column: span 2; grid-row: span 1; aspect-ratio: 16 / 10; }
  .pub-hero__inner,
  .pub-hero.has-photo .pub-hero__inner { padding: 4rem 0 3.5rem; }
  .pub-hero h1 { max-width: none; }
  .pub-cta { padding: 3rem 1.25rem; }
  .pub-cta-row { flex-direction: column; }
  .pub-cta-row > * { justify-content: center; }
  .pub-footer__inner { flex-direction: column; text-align: center; }
}

@media (max-width: 420px) {
  .pub-topbar .brand { font-size: 0.86rem; max-width: 55vw; }
  .pub-access { font-size: 0.76rem; padding: 0.45rem 0.8rem; }
}
