/* ─────────────────────────────────────────────────────────────
   v4-modules.css — Mòdul: Mapa interactiu + Instagram bento
   Extret de styles.css del v1 local. Carregar després de v4.css.
   ───────────────────────────────────────────────────────────── */

/* ── BACK TO TOP (flotant, sobre la crisis bar) ── */
.back-top {
  position: fixed;
  right: 1.25rem;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 1.25rem);
  z-index: 160;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--grad-fire);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  border: none; cursor: pointer;
  box-shadow: 0 6px 20px rgba(230,35,20,.38);
  opacity: 0; transform: translateY(12px);
  transition: opacity .25s ease, transform .25s ease, background .15s;
  pointer-events: none;
}
.back-top.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.back-top:hover { background: linear-gradient(135deg, var(--g-start) 0%, var(--g-warm) 100%); }
.back-top:focus-visible { outline: 2px solid var(--c-orange); outline-offset: 3px; }
@media (min-width: 720px) {
  .back-top { right: 1.5rem; width: 48px; height: 48px; }
}

/* Tokens addicionals que v4.css no defineix */
:root {
  --c-surface:        #ffffff;
  --c-whatsapp:       #25D366;
  --c-open:           #15803d;
  --gradient-obrofeel: linear-gradient(135deg, #8B2FC9, #00B4A2);
  --radius-sm:        10px;
  --radius:           16px;
  --radius-lg:        24px;
  --shadow-soft:      0 4px 24px rgba(28,5,16,.08);
}

/* ── FIX CRÍTIC: respectar atribut [hidden] sobre elements amb display flex ──
   v4.css força display:flex a .m-menu i .cookie-banner sense respectar el
   navegador default per [hidden], cosa que els deixa invisibles però capturant
   clicks sobre tot el viewport. Aquesta regla restaura el comportament correcte. */
.m-menu[hidden],
.cookie-banner[hidden],
[hidden] { display: none !important; }

/* ── BANNER DE COOKIES ── */
.cookie-banner {
  position: fixed;
  left: 1rem; right: 1rem;
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  z-index: 200;
  max-width: 640px;
  margin-inline: auto;
  background: #1C0510;
  color: #F3ECDC;
  border: 1px solid rgba(236,97,22,.3);
  border-radius: 16px;
  padding: 1rem 1.25rem;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  box-shadow: 0 8px 30px rgba(28,5,16,.3);
  animation: cookie-in .35s ease both;
}
@keyframes cookie-in {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cookie-banner__text {
  flex: 1; min-width: 200px;
  font-family: var(--font-body, sans-serif);
  font-size: .82rem; line-height: 1.5;
  color: rgba(243,236,220,.85);
}
.cookie-banner__text a {
  color: var(--c-orange, #f19e18);
  text-decoration: underline; text-underline-offset: 2px;
}
.cookie-banner__text a:hover { color: #fff; }
.cookie-banner__btn {
  flex-shrink: 0;
  min-height: 42px; padding: .5rem 1.5rem;
  background: var(--grad-warm, linear-gradient(135deg,#ea4c15,#ec6116));
  color: #fff;
  border-radius: 100px;
  font-family: var(--font-label, sans-serif); font-weight: 700; font-size: .85rem;
  cursor: pointer;
  transition: transform .15s, filter .15s;
}
.cookie-banner__btn:hover { filter: brightness(1.08); }
.cookie-banner__btn:active { transform: translateY(1px); }
@media (max-width: 480px) {
  .cookie-banner { flex-direction: column; align-items: stretch; text-align: center; }
  .cookie-banner__btn { width: 100%; }
}

/* ── MAPA CHIPS ── */
.mapa-chips {
  display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem;
}
.mapa-chip {
  padding: .35rem .875rem; border-radius: 100px;
  border: 1.5px solid rgba(28,5,16,.15);
  font-family: var(--font-label); font-size: .7rem; font-weight: 700;
  background: var(--c-surface); color: var(--c-ink);
  transition: background-color .15s, border-color .15s, color .15s;
}
.mapa-chip:hover { border-color: var(--g-warm, #ec6116); }
.mapa-chip.is-active { background: var(--c-dark); color: var(--c-cream); border-color: var(--c-dark); }
.mapa-chip:focus-visible { outline: 2px solid var(--g-warm, #ec6116); outline-offset: 2px; }

/* ── TABS ── */
.mapa-tabs {
  display: flex; background: rgba(28,5,16,.06);
  border-radius: var(--radius-sm); padding: 3px; margin-bottom: 1rem; width: fit-content;
}
.mapa-tab {
  padding: .4rem 1rem; border-radius: calc(var(--radius-sm) - 2px);
  font-family: var(--font-label); font-size: .75rem; font-weight: 700;
  color: rgba(28,5,16,.4); transition: background-color .15s, color .15s, box-shadow .15s;
}
.mapa-tab.is-active { background: var(--c-surface); color: var(--c-dark); box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.mapa-tab:focus-visible { outline: 2px solid var(--g-warm, #ec6116); outline-offset: 2px; }

/* ── SVG MAP ── */
.mapa-svg-wrap {
  border-radius: var(--radius-lg); overflow: hidden;
  background: rgba(236,97,22,.03); border: 1px solid rgba(28,5,16,.06);
  margin-bottom: .5rem;
  max-width: 560px;
  margin-inline: auto;
}
.mapa-svg-wrap svg { width: 100%; height: auto; }

/* ── Hint (placeholder) per a la columna esquerra del mapa ── */
.mapa-hint {
  display: none;
  margin-top: 1.25rem;
  padding: 1.25rem 1.5rem;
  background: rgba(236,97,22,.04);
  border: 1.5px dashed rgba(236,97,22,.22);
  border-radius: var(--radius);
  color: rgba(28,5,16,.55);
  font-size: .85rem; line-height: 1.5;
}
.mapa-hint__arrow {
  display: inline-block; margin-right: .5rem;
  font-family: var(--font-display); font-style: italic; font-weight: 800;
  font-size: 1.4rem; color: var(--g-warm, #ec6116);
  vertical-align: middle;
}
.mapa-hint p { display: inline; font-family: var(--font-display); font-style: italic; }

/* ── DESKTOP: layout 2 columnes només quan Mapa actiu ── */
@media (min-width: 980px) {
  #mapa:has(#tab-btn-mapa.is-active) > .col {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    column-gap: 3rem;
    align-items: start;
  }
  /* Tot el bloc esquerre va a la columna 1 */
  #mapa:has(#tab-btn-mapa.is-active) > .col > .cap,
  #mapa:has(#tab-btn-mapa.is-active) > .col > .sec__h,
  #mapa:has(#tab-btn-mapa.is-active) > .col > .sec__lead,
  #mapa:has(#tab-btn-mapa.is-active) > .col > .mapa-tabs,
  #mapa:has(#tab-btn-mapa.is-active) > .col > .mapa-drawer,
  #mapa:has(#tab-btn-mapa.is-active) > .col > .mapa-hint {
    grid-column: 1;
  }
  /* Mapa SVG a la columna 2, ancorat al top */
  #mapa:has(#tab-btn-mapa.is-active) > .col > #tab-mapa {
    grid-column: 2;
    grid-row: 1 / span 8;
    align-self: start;
    position: sticky;
    /* Centra verticalmente el mapa en el viewport mientras hace sticky */
    top: clamp(4rem, calc(50vh - 280px), 35vh);
  }
  #mapa:has(#tab-btn-mapa.is-active) .mapa-svg-wrap {
    max-width: 100%;
    margin-inline: 0;
  }
  /* Hint només visible quan no hi ha drawer obert i estem a Mapa */
  #mapa:has(#tab-btn-mapa.is-active) > .col > .mapa-hint {
    display: block;
  }
  /* Quan el drawer està visible (no hidden), amagem el hint */
  #mapa:has(#tab-btn-mapa.is-active):has(#mapa-drawer:not([hidden])) > .col > .mapa-hint {
    display: none;
  }
  /* El drawer en desktop perd el shadow superior (no és bottom-sheet) */
  #mapa:has(#tab-btn-mapa.is-active) > .col > .mapa-drawer {
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(28,5,16,.06);
    border-radius: var(--radius);
    margin-top: 1.25rem;
  }
}

/* ── Comarques SVG ── */
.map-comarca {
  fill: rgba(236,97,22,.07); stroke: rgba(28,5,16,.18); stroke-width: 1.5;
  cursor: pointer; transition: fill .2s, stroke .2s, stroke-width .2s;
}
.map-comarca:hover { fill: rgba(241,158,24,.2); stroke: rgba(236,97,22,.45); }
.map-comarca:focus-visible {
  fill: rgba(241,158,24,.2);
  stroke: var(--g-warm, #ec6116); stroke-width: 2.5;
  outline: none;
}
.map-comarca.is-active {
  fill: rgba(236,97,22,.16);
  stroke: var(--g-warm, #ec6116); stroke-width: 2.5;
}
.map-comarca.is-dim { opacity: .3; pointer-events: none; }

/* ── Pins — heartbeat (latido + glow càlid) ── */
@keyframes pin-heartbeat {
  0%, 100% { stroke-width: 1.5; }
  40%       { stroke-width: 3.2; }
  65%       { stroke-width: 1.5; }
}
@keyframes pin-glow {
  0%, 100% { filter: drop-shadow(0 0 2px rgba(236,97,22,.2)); }
  40%       { filter: drop-shadow(0 0 8px rgba(236,97,22,.6)); }
}

.map-pin {
  transition: transform .25s cubic-bezier(.34,1.56,.64,1);
  transform-origin: center; transform-box: fill-box;
}
.map-pin__bg {
  fill: var(--c-surface);
  stroke: var(--g-warm, #ec6116); stroke-width: 1.5;
  transition: stroke-width .2s;
}
/* Latido en pins inactius */
.map-pin:not(.is-active):not(.is-dim) .map-pin__bg {
  animation: pin-heartbeat 2.8s ease-in-out infinite;
}
.map-pin:not(.is-active):not(.is-dim) {
  animation: pin-glow 2.8s ease-in-out infinite;
}
/* Pin actiu: escala + fons taronja sòlid + ocell blanc ben visible */
.map-pin.is-active { transform: scale(1.2); animation: none; }
.map-pin.is-active .map-pin__bg {
  fill: var(--g-warm, #ec6116);
  stroke: var(--g-warm, #ec6116); stroke-width: 2;
  filter: drop-shadow(0 4px 14px rgba(236,97,22,.5));
  animation: none;
}
/* Ocell blanc sobre fons taronja quan actiu */
.map-pin.is-active image {
  filter: brightness(0) invert(1)
    drop-shadow(0 0 1px rgba(255,255,255,.6));
}
.map-pin.is-dim { opacity: .3; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .map-pin:not(.is-active):not(.is-dim) .map-pin__bg,
  .map-pin:not(.is-active):not(.is-dim) { animation: none; }
}

.map-label {
  font-family: var(--font-label); font-size: 11px; font-weight: 700;
  fill: rgba(28,5,16,.5); pointer-events: none; user-select: none;
}

/* ── DRAWER ── */
.mapa-drawer {
  background: #F3ECDC; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: .75rem 1.25rem 1.5rem;
  box-shadow: 0 -6px 28px rgba(28,5,16,.1);
  border: 1px solid rgba(236,97,22,.12);
  margin-top: .5rem;
}
.mapa-drawer[hidden] { display: none; }
/* Animació d'entrada quan s'obre (sense dependre de opacity base) */
.mapa-drawer.is-open {
  animation: drawer-in .3s ease both;
}
@keyframes drawer-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .mapa-drawer.is-open { animation: none; }
}
.mapa-drawer__handle {
  width: 36px; height: 4px; border-radius: 2px;
  background: rgba(28,5,16,.1); margin: 0 auto .875rem;
}
.mapa-drawer__header {
  display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: .25rem;
}
.mapa-drawer__name {
  font-family: var(--font-display); font-style: italic; font-weight: 800;
  font-size: 1.25rem; color: var(--c-dark);
}
.mapa-drawer__entity { font-size: .8rem; color: rgba(28,5,16,.5); margin-bottom: .625rem; }
.mapa-drawer__close {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(28,5,16,.07); font-size: .875rem; color: var(--c-dark);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.mapa-drawer__close:focus-visible { outline: 2px solid var(--g-warm, #ec6116); outline-offset: 2px; }

.mapa-drawer__addr {
  display: inline-flex; align-items: center; gap: .25rem;
  font-size: .8rem; color: var(--g-warm, #ec6116);
  margin-bottom: .875rem;
  text-decoration: underline; text-underline-offset: 2px;
  text-decoration-color: rgba(236,97,22,.4);
}
.mapa-drawer__addr:hover {
  color: var(--g-start, #e62314);
  text-decoration-color: var(--g-start, #e62314);
}

/* ── INSTAGRAM BENTO ── */
.ig-bento {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: .5rem;
  margin-bottom: 1rem;
}
.ig-tile { border-radius: var(--radius); overflow: hidden; aspect-ratio: 1; }
.ig-tile--large { grid-row: 1 / 3; aspect-ratio: auto; }
.ig-tile > div, .ig-tile > a { display: block; height: 100%; }
.ig-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ig-tile--text {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 1rem; text-align: center; gap: .375rem;
}
.ig-tile--text-dark {
  background:
    radial-gradient(circle at 18% 18%, rgba(230,35,20,.28)  0%, transparent 52%),
    radial-gradient(circle at 82% 85%, rgba(241,158,24,.22) 0%, transparent 52%),
    var(--c-dark);
  position: relative; overflow: hidden;
}
.ig-tile--text-dark::before {
  content: '';
  position: absolute; inset: 0;
  background: url('../assets/images/brand/PajaritoBlanco.png') no-repeat center / 72%;
  opacity: .28;
  pointer-events: none;
}
@media (max-width: 640px) {
  .ig-tile--text-dark::before {
    background-size: 88%; /* logo més gran a mòbil */
    opacity: .32;
  }
}
.ig-tile--text-dark > * { position: relative; z-index: 1; }
.ig-tile__quote {
  font-family: var(--font-display); font-style: italic; font-weight: 800;
  font-size: clamp(1rem, 3vw, 1.4rem); color: var(--c-cream); line-height: 1.2;
  letter-spacing: -.01em;
}
.ig-tile__handle {
  font-family: var(--font-label); font-size: .75rem; font-weight: 700;
  color: rgba(243,236,220,.55); letter-spacing: .04em;
  margin-top: .25rem;
}

/* ── IG BAR ── */
.ig-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: #F3ECDC; border-radius: var(--radius); padding: .875rem 1.25rem; border: 1px solid rgba(236,97,22,.12);
  box-shadow: var(--shadow-soft);
}
.ig-bar__profile { display: flex; align-items: center; gap: .75rem; }
.ig-bar__avatar img { width: 56px; height: 56px; border-radius: 50%; }
.ig-bar__handle { font-family: var(--font-label); font-size: .8rem; font-weight: 700; color: var(--c-dark); }
.ig-bar__sub    { font-size: .7rem; color: rgba(28,5,16,.4); }
.ig-bar__btn    { padding: .5rem 1rem; font-size: .8rem; }

.mapa-drawer__btns { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .375rem; }
.mapa-btn {
  padding: .625rem .375rem; border-radius: var(--radius-sm); text-align: center;
  font-family: var(--font-label); font-size: .7rem; font-weight: 700;
  display: flex; flex-direction: column; align-items: center; gap: .2rem;
  white-space: nowrap;
}
/* Mòbil: pills horitzontals */
@media (max-width: 500px) {
  .mapa-drawer__btns {
    grid-template-columns: 1fr;
    gap: .3rem;
  }
  .mapa-btn {
    flex-direction: row;
    justify-content: center;
    gap: .5rem;
    padding: .75rem 1rem;
    border-radius: 100px;
    font-size: .82rem;
  }
}
.mapa-btn:focus-visible { outline: 2px solid var(--g-warm, #ec6116); outline-offset: 2px; }
.mapa-btn--phone    { background: var(--grad-warm, linear-gradient(135deg,#ea4c15,#ec6116)); color: #fff; }
.mapa-btn--whatsapp { background: var(--c-whatsapp); color: #fff; }
.mapa-btn--email    { background: rgba(28,5,16,.07); color: var(--c-dark); }
[aria-disabled="true"] { opacity: .35; pointer-events: none; }

/* ── LLISTA ── */
.mapa-llista { list-style: none; display: flex; flex-direction: column; gap: .5rem; }
.mapa-llista-card {
  background: #F3ECDC; border-radius: var(--radius); padding: .875rem 1rem; border: 1px solid rgba(236,97,22,.15);
  box-shadow: 0 2px 8px rgba(28,5,16,.06); display: flex; align-items: center; gap: .75rem;
  cursor: pointer; transition: transform .15s;
}
.mapa-llista-card:hover { transform: translateX(3px); box-shadow: 0 4px 16px rgba(236,97,22,.18); }
.mapa-llista-card:focus-visible { outline: 2px solid var(--g-warm, #ec6116); outline-offset: 2px; }
.mapa-llista-card.is-dim { opacity: .35; pointer-events: none; }
.mapa-llista-card__bar { width: 4px; align-self: stretch; border-radius: 2px; flex-shrink: 0; }
.mapa-llista-card__body { flex: 1; }
.mapa-llista-card__name { font-family: var(--font-display); font-style: italic; font-weight: 800; font-size: .95rem; color: var(--c-dark); }
.mapa-llista-card__entity { font-size: .75rem; color: rgba(28,5,16,.5); margin-top: .125rem; }
.mapa-llista-card__status { font-family: var(--font-label); font-size: .65rem; font-weight: 700; margin-top: .25rem; }
.mapa-llista-card__status--open   { color: var(--c-open); }
.mapa-llista-card__status--closed { color: rgba(28,5,16,.4); }
.mapa-llista-card__arrow { font-size: 1.1rem; color: rgba(28,5,16,.15); }

/* ── OBROFEEL ── */
.obrofeel {
  margin-top: 1.25rem; background: var(--gradient-obrofeel);
  border-radius: var(--radius); padding: 1rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
}
.obrofeel__logo {
  font-family: var(--font-display); font-style: italic; font-weight: 900;
  font-size: 1.5rem; color: #fff; letter-spacing: -.02em;
}
.obrofeel__logo span { font-style: normal; }
.obrofeel__info { display: flex; flex-direction: column; gap: .125rem; }
.obrofeel__num { font-family: var(--font-body); font-size: .9rem; font-weight: 700; color: #fff; display: block; }
.obrofeel__sub { font-size: .75rem; color: rgba(255,255,255,.7); }
