/* ESMOU — estils generals, adaptació a tauleta i mòbil, menú i visor de fotos.
   El disseny base ve dels estils en línia de cada pàgina; aquí només
   s'hi afegeix el que no es pot fer en línia. */

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; }
img { max-width: 100%; }
a, button { -webkit-tap-highlight-color: transparent; }
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, img[tabindex]:focus-visible {
  outline: 3px solid #5A7AFF;
  outline-offset: 2px;
}
[hidden] { display: none !important; }
/* «Salta al contingut»: només es veu quan hi arribes amb el tabulador */
.skip {
  position: absolute; left: -9999px; top: 0; z-index: 1000;
  padding: 12px 20px; border-radius: 999px; background: #000047; color: #F7F3EA;
  font: 600 15px 'Manrope', system-ui, sans-serif; text-decoration: none;
}
.skip:focus { left: 16px; top: 10px; }
main:focus, [data-state="thanks"]:focus, [data-nl-state="done"]:focus { outline: none; }
#contact-form button:disabled { opacity: .6; cursor: default !important; }
a[href^="mailto:"] { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
/* Títols amb Bodoni: tall de text (opsz 11) perquè els traços fins no desapareguin en mida gran */
[style*="Bodoni Moda"], .post-body h2 { font-variation-settings: 'opsz' 11; }

.form-msg { margin: 0; font-size: 15px; line-height: 1.5; color: #9B2C2C; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* Fotos que s'obren en gran */
img.zoomable { cursor: zoom-in; transition: opacity .2s; }
img.zoomable:hover { opacity: .9; }

/* Botó del menú: només al mòbil */
.menu-btn { display: none; }

/* ---------- Visor de fotos ---------- */
/* la barra de desplaçament deixa el seu espai: la pàgina de sota no es mou en obrir i tancar */
html.lb-open { overflow: hidden; scrollbar-gutter: stable; }
.lb {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; flex-direction: column;
  background: #00001C; color: #F7F3EA;
  font-family: 'Manrope', system-ui, sans-serif;
}
.lb-stage {
  flex: 1; min-height: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  padding: 64px 80px 8px;
  touch-action: pan-y pinch-zoom;
}
.lb-img {
  max-width: 100%; max-height: 100%; object-fit: contain;
  border-radius: 0; cursor: zoom-in; user-select: none; -webkit-user-drag: none;
}
.lb.zoomed .lb-stage { overflow: auto; align-items: flex-start; justify-content: flex-start; padding: 0; touch-action: auto; }
.lb.zoomed .lb-img { flex: none; margin: auto; max-width: none; max-height: none; height: auto; border-radius: 0; cursor: zoom-out; }
.lb-bar {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  padding: 14px 24px 20px; font-size: 15px; line-height: 1.45;
}
.lb-cap { color: #E3E5F2; max-width: 72ch; }
.lb-count { color: #A9B8FF; font-weight: 700; letter-spacing: .08em; white-space: nowrap; }
.lb button {
  position: absolute; display: flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; padding: 0; border: 0; border-radius: 999px;
  background: rgba(247, 243, 234, .12); color: #F7F3EA; cursor: pointer;
}
.lb button:hover { background: rgba(247, 243, 234, .24); }
.lb button svg { width: 22px; height: 22px; }
.lb-close { top: 12px; right: 12px; }
.lb-prev { left: 14px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 14px; top: 50%; transform: translateY(-50%); }
.lb.zoomed .lb-prev, .lb.zoomed .lb-next, .lb.zoomed .lb-bar { display: none; }

/* ---------- Articles del blog ---------- */
.post-body h2 { margin: 26px 0 0; font-family: 'Bodoni Moda', 'Bodoni 72', Didot, Georgia, serif; font-weight: 500; font-size: 32px; line-height: 1.2; color: #000047; }
.post-body p, .post-body li { margin: 0; font-size: 18px; line-height: 1.7; color: #353D66; }
.post-body ul { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; }
.post-body strong { color: #000047; }
.post-body a, .qa a { color: #000047; text-decoration: underline; text-underline-offset: 3px; }
.post-body figure { margin: 14px 0; display: flex; flex-direction: column; gap: 10px; }
.post-body figcaption { font-size: 14px; line-height: 1.5; color: #545C86; }

/* ---------- Moviment (tipus Apple) ---------- */
/* L'inici de cada pàgina entra en obrir-la; la resta, en baixar (main.js posa .rv / .rv-img i després .rv-in). */
@keyframes rvUp { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }
@keyframes rvOpen { from { opacity: 0; clip-path: inset(7% 7% 7% 7%); } to { opacity: 1; clip-path: inset(0 0 0 0); } }
.rv-on main > section:first-of-type:not(.hero) > *,
.rv-on main > article > section:first-of-type > *,
.rv-on .hero-text > * { animation: rvUp 1.1s cubic-bezier(.16, 1, .3, 1) both; }
.rv-on .hero-img { animation: rvOpen 1.4s cubic-bezier(.16, 1, .3, 1) .25s both; }
.rv-on main > section:first-of-type > :nth-child(2), .rv-on main > article > section:first-of-type > :nth-child(2), .rv-on .hero-text > :nth-child(2) { animation-delay: .1s; }
.rv-on main > section:first-of-type > :nth-child(3), .rv-on main > article > section:first-of-type > :nth-child(3), .rv-on .hero-text > :nth-child(3) { animation-delay: .2s; }
.rv-on main > section:first-of-type > :nth-child(4), .rv-on main > article > section:first-of-type > :nth-child(4), .rv-on .hero-text > :nth-child(4) { animation-delay: .3s; }
.rv-on .hero-text > :nth-child(5) { animation-delay: .4s; }
.rv { opacity: 0; transform: translateY(36px); transition: opacity 1s cubic-bezier(.16, 1, .3, 1), transform 1.2s cubic-bezier(.16, 1, .3, 1); }
img.rv-img { opacity: 0; clip-path: inset(7% 7% 7% 7%); transition: opacity .9s ease, clip-path 1.4s cubic-bezier(.16, 1, .3, 1); }
.rv.rv-in, img.rv-img.rv-in { opacity: 1; transform: none; clip-path: inset(0 0 0 0); }
/* Només els elements que s'animen: la resta (com el dibuix de la pàgina Història) conserva les seves formes */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rv-on main > section:first-of-type:not(.hero) > *, .rv-on main > article > section:first-of-type > *,
  .rv-on .hero-text > *, .rv-on .hero-img, .rv, img.rv-img { animation: none !important; transition: none !important; opacity: 1 !important; transform: none !important; clip-path: none !important; }
}
/* En imprimir, tot visible encara que no s'hagi baixat fins al final */
@media print {
  .rv-on main > section:first-of-type:not(.hero) > *, .rv-on main > article > section:first-of-type > *,
  .rv-on .hero-text > *, .rv-on .hero-img, .rv, img.rv-img { animation: none !important; transition: none !important; opacity: 1 !important; transform: none !important; clip-path: none !important; }
  .nl, .lb, .menu-btn { display: none !important; }
}

/* ---------- Avís de la llista de correu ---------- */
html.nl-open { overflow: hidden; scrollbar-gutter: stable; }
.nl {
  position: fixed; inset: 0; z-index: 900;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(0, 0, 40, .45);
  font-family: 'Manrope', system-ui, sans-serif; color: #000047;
}
.nl-card {
  position: relative; width: 100%; max-width: 520px; box-sizing: border-box;
  padding: 40px 40px 28px; background: #F7F3EA; border-radius: 6px;
  box-shadow: 0 24px 60px rgba(0, 0, 40, .3); outline: none;
  /* pantalles baixes (mòbil apaïsat, portàtil amb zoom): la finestra es desplaça per dins i la ✕ sempre es veu */
  max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); overflow-y: auto; overscroll-behavior: contain;
}
.nl-body { display: flex; flex-direction: column; gap: 14px; }
.nl-art { display: block; width: 100%; max-width: 300px; height: auto; margin: -6px 0 2px; }
.nl-title {
  margin: 0; padding-right: 32px; font-family: 'Bodoni Moda', 'Bodoni 72', Didot, Georgia, serif;
  font-weight: 500; font-variation-settings: 'opsz' 11; font-size: 36px; line-height: 1.12; color: #000047;
}
.nl-text { margin: 0; font-size: 16px; line-height: 1.6; color: #353D66; }
.nw { white-space: nowrap; }
.nl-form { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.nl-row { display: flex; gap: 8px; }
.nl-row input {
  flex: 1; min-width: 0; height: 52px; box-sizing: border-box; padding: 0 18px;
  border: 1px solid #8A8FA8; border-radius: 999px; background: #FFFFFF;
  font: 16px 'Manrope', system-ui, sans-serif; color: #000047;
}
.nl-row button {
  height: 52px; padding: 0 24px; border: 0; border-radius: 999px; background: #000047; color: #F7F3EA;
  font: 700 16px 'Manrope', system-ui, sans-serif; white-space: nowrap; cursor: pointer;
}
.nl-row button:disabled { opacity: .6; cursor: default; }
.nl-consent { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.5; color: #353D66; cursor: pointer; }
.nl-consent input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: #000047; }
.nl-consent a { color: #545C86; text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; }
.nl-msg { margin: 0; font-size: 14px; line-height: 1.5; color: #9B2C2C; }
.nl-close {
  position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 999px; background: transparent; color: #000047; cursor: pointer;
}
.nl-close:hover { background: rgba(0, 0, 71, .07); }
.nl-close svg { width: 20px; height: 20px; }

/* ---------- Pantalles molt amples: el contingut no passa de 1308 px ---------- */
@media (min-width: 1500px) {
  header, section, footer {
    padding-left: calc((100% - 1308px) / 2) !important;
    padding-right: calc((100% - 1308px) / 2) !important;
  }
}

/* ---------- Tauleta ---------- */
@media (max-width: 1100px) {
  header, section, footer { padding-left: 40px !important; padding-right: 40px !important; }
  [style*="gap: 80px"], [style*="gap: 72px"], [style*="gap: 64px"] { gap: 40px !important; }
  [style*="padding: 96px;"] { padding: 72px 40px !important; }
  h1 { font-size: 50px !important; }
  .site-nav { gap: 22px !important; }
  .wordmark { font-size: min(60px, 17.5cqi) !important; } /* «CREIXENT» cap sempre a la seva columna */
}

/* ---------- Mòbil ---------- */
@media (max-width: 820px) {
  /* Capçalera d'una sola línia; el menú es desplega */
  .site-header {
    position: sticky; top: 0; z-index: 50;
    height: 64px !important; padding: 0 12px 0 16px !important;
  }
  .site-header img { height: 44px !important; }
  html { scroll-padding-top: 72px; } /* ni els enllaços a #contacto, #fotos... ni el que rep el focus queden sota la capçalera fixa */
  .menu-btn {
    display: flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 48px; height: 48px; padding: 0 12px; border: 0; background: transparent; cursor: pointer;
  }
  .menu-btn span { display: block; height: 2px; border-radius: 2px; background: #000047; transition: transform .2s, opacity .2s; }
  .site-header.open .menu-btn span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .site-header.open .menu-btn span:nth-child(2) { opacity: 0; }
  .site-header.open .menu-btn span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .site-nav { display: none !important; }
  .site-header.open .site-nav {
    display: flex !important; position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; align-items: stretch !important; gap: 0 !important;
    padding: 4px 20px 22px; background: #F7F3EA; border-bottom: 1px solid #DCD3C2;
    box-shadow: 0 14px 28px rgba(0, 0, 40, .1); font-size: 18px !important;
  }
  .site-header.open .site-nav > a { padding: 16px 0 !important; border-bottom: 1px solid #E6DECF !important; }
  .site-header.open .site-nav > a[aria-current="page"] { border-bottom: 2px solid #5A7AFF !important; }
  .site-header.open .site-nav > div { padding: 8px 0; font-size: 15px !important; }
  .site-header.open .site-nav > a:last-child { margin-top: 12px; padding: 16px 24px !important; border-bottom: 0 !important; text-align: center; }

  /* Marges */
  section, footer { padding-left: 20px !important; padding-right: 20px !important; }
  section { padding-top: 56px !important; padding-bottom: 56px !important; }
  body > div { overflow-x: clip; }
  header *, section *, footer * { min-width: 0; }
  h1, h2, h3, p, span, a, dd, dt, li { overflow-wrap: break-word; }
  input, select, textarea { width: 100%; max-width: 100%; box-sizing: border-box; }

  /* Tot en una columna */
  [style*="grid-template-columns"] { grid-template-columns: minmax(0, 1fr) !important; }
  .facts, .facts-inv { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .facts > div, .facts-inv > div { border-left: 0 !important; padding: 16px 12px 16px 0 !important; }
  [style*="gap: 96px"] { gap: 64px !important; }
  [style*="gap: 80px"], [style*="gap: 72px"], [style*="gap: 64px"] { gap: 28px !important; }
  [style*="padding: 44px"] { padding: 24px 18px !important; }
  [style*="grid-template-columns: 56px"] { grid-template-columns: 40px minmax(0, 1fr) !important; gap: 12px !important; }

  /* Pàgina Creixent: mosaic de fotos més arrambat */
  .mosaic-sec { padding-top: 16px !important; padding-bottom: 4px !important; }
  .intro { padding-top: 32px !important; }

  /* Portada: primer la foto */
  .hero { padding-top: 20px !important; gap: 24px !important; }
  .hero-img { order: -1; }
  .btns { flex-direction: column; align-items: stretch !important; width: 100%; }
  .btns > a { text-align: center; }

  /* Tipografia */
  h1 { font-size: 36px !important; line-height: 1.14 !important; }
  h2 { font-size: 31px !important; line-height: 1.14 !important; }
  h3 { font-size: 24px !important; }
  [style*="font-size: 64px"], [style*="font-size: 46px"], [style*="font-size: 44px"], [style*="font-size: 38px"] { font-size: 30px !important; line-height: 1.15 !important; }
  .wordmark { font-size: min(46px, 17.5cqi) !important; }
  dd[style*="font-size: 40px"] { font-size: 25px !important; }
  [style*="font-size: 20px"], [style*="font-size: 19px"] { font-size: 17px !important; }

  /* Bandes de color */
  .band { padding: 56px 20px !important; }
  .band-brand { gap: 18px !important; }
  .band-brand .moon { width: 64px !important; }
  .cta, .end { flex-direction: column; align-items: flex-start !important; }
  .cta-text { align-items: flex-start !important; gap: 18px !important; }
  .cta .moon { width: 40px !important; }

  /* Temes de la pàgina Creixent */
  .topics { gap: 56px !important; }
  .topics > div:first-child { margin-bottom: -16px !important; }
  .topic-head { gap: 10px !important; }
  .qa { gap: 8px !important; padding: 22px 0 !important; }

  /* Fileres de fotos: es passen lliscant el dit */
  .prow {
    overflow-x: auto; scroll-snap-type: x mandatory; gap: 10px !important;
    margin-right: -20px; padding-right: 20px; scrollbar-width: none;
  }
  .prow::-webkit-scrollbar { display: none; }
  .prow > .pcell { flex: 0 0 auto !important; scroll-snap-align: start; }
  .prow > .pcell img { height: 220px !important; width: auto !important; max-width: none; }
  [style*="margin-top: -26px"] { margin-top: -18px !important; }

  /* Mosaic de la pàgina Creixent */
  .mosaic { grid-template-columns: 1fr 1fr !important; gap: 8px !important; }
  .mosaic .m-big { grid-column: 1 / -1; grid-row: auto !important; height: auto !important; aspect-ratio: 16 / 9; }
  .mosaic button { right: 10px !important; bottom: 10px !important; padding: 10px 14px !important; font-size: 14px !important; }

  /* Peu */
  .foot-top { flex-direction: column; align-items: flex-start !important; gap: 14px !important; }

  /* Blog */
  .post-body h2 { font-size: 26px; }
  .post-body p, .post-body li { font-size: 17px; }
  .post-head h1 { font-size: 34px !important; }
  .post-head { padding-top: 32px !important; padding-bottom: 16px !important; }
  .post-hero { padding-top: 0 !important; padding-bottom: 0 !important; }
  .post-body-sec { padding-top: 24px !important; }
  .blog-head { padding-bottom: 24px !important; }
  .blog-list { padding-top: 0 !important; }
  .post-cta { flex-direction: column; align-items: flex-start !important; }

  /* Avís de la llista: franja a baix, sense tapar tota la pàgina */
  .nl.nl-sheet { top: auto; padding: 0; background: none; align-items: flex-end; pointer-events: none; }
  .nl-sheet .nl-card {
    max-width: none; max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); padding: 22px 20px 16px; border-radius: 6px 6px 0 0; pointer-events: auto;
    border-top: 1px solid #DCD3C2; box-shadow: 0 -10px 30px rgba(0, 0, 40, .18);
  }
  .nl-sheet .nl-body { gap: 10px; }
  .nl-sheet .nl-title { font-size: 25px !important; line-height: 1.15 !important; }
  .nl-sheet .nl-text { font-size: 15px; line-height: 1.5; }
  .nl-sheet .nl-row button { padding: 0 18px; }
  .nl-sheet .nl-consent { font-size: 13px; }
  .nl-sheet .nl-art { max-width: 250px; margin: -4px 0 0; }

  /* Visor */
  .lb-stage { padding: 60px 0 8px; }
  .lb-prev, .lb-next { top: auto; bottom: 64px; transform: none; }
  .lb-bar { padding: 12px 16px 18px; font-size: 14px; }
}
