
/* ── FONT COMERCIAL (Graphik eliminat, substituït per Plus Jakarta Sans) ── */

:root {
  --bg: #FEFDF8;
  --brown: #3d2b0e;
  --brown-light: #5c4220;
  --gold: #9b7d35;
  --grey: #9a9490;
  --white: #f9f7f4;
  --font-display: 'Playfair Display', serif;
  --font-body: 'Inter', sans-serif;
  --font-nav: 'Plus Jakarta Sans', 'Inter', sans-serif;
  --font-stencil: 'Stardos Stencil', sans-serif;
  --header-h: 112px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: auto; }
body {
  background: var(--bg);
  color: var(--brown);
  font-family: var(--font-body);
  font-weight: 300;
  overflow-x: hidden;
  padding-top: var(--header-h);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ── JUSTIFIED TEXT ── */
.cal-text p,
.text3 p, .text4 p, .text2 p,
.page p {
  text-align: justify;
  hyphens: auto;
}

/* ── HEADER ── */
header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(254,253,248,0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(61,43,14,0.07);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 2.8rem;
}

/* ── NAV LEFT ── */
.nav-left {
  display: flex;
  align-items: center;
  gap: 2.8rem;
}

/* ── NAV RIGHT ── */
.nav-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2.8rem;
}

header a {
  text-decoration: none;
  color: var(--brown-light);
  font-family: var(--font-nav);
  font-size: 0.68rem;
  font-weight: 300;
  letter-spacing: 0.1em;
  text-transform: capitalize;
  transition: color 0.25s, opacity 0.25s;
  white-space: nowrap;
  opacity: 0.75;
}
header a:hover { color: var(--gold); opacity: 1; }
header a.active {
  color: var(--brown);
  opacity: 1;
  font-weight: 700;
  letter-spacing: 0.06em;
}

/* ── HOME LINK (imatge circular) ── */
header a.home-link {
  opacity: 1;
  flex-shrink: 0;
  text-transform: none;
}
header a.home-link img {
  height: 40px;
  width: 40px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  opacity: 0.85;
  transition: opacity 0.3s;
  mix-blend-mode: multiply;
  animation: slowRotate 240s linear infinite;
}
header a.home-link:hover img { opacity: 1; }

/* ── "en moviment" BRAND CENTRAL ── */
.nav-brand {
  display: flex;
  align-items: baseline;
  gap: 0.2em;
  line-height: 1;
  text-decoration: none;
  opacity: 1 !important;
  padding: 0 2rem;
  text-transform: none;
  font-family: 'Montserrat', 'Inter', sans-serif;
}
.nav-brand:hover { opacity: 1 !important; }
.nb-en {
  font-family: 'Montserrat', 'Inter', sans-serif;
  font-size: 1.1rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--brown);
  text-transform: lowercase;
  opacity: 0.65;
}
.nb-mov {
  font-family: 'Montserrat', 'Inter', sans-serif;
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--brown);
  text-transform: lowercase;
}

/* ── HEADER RIGHT (contact btn + hamburger) ── */
.header-right {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

/* ── CONTACT BUTTON ── */
.contact-btn {
  background: rgba(61,43,14,0.58) !important;
  color: var(--white) !important;
  padding: 1rem 2.2rem;
  border-radius: 50px;
  font-family: var(--font-body);
  font-size: 0.65rem !important;
  letter-spacing: 0.1em;
  text-transform: capitalize;
  font-weight: 700 !important;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.25s !important;
  text-shadow: none !important;
  opacity: 1 !important;
  backdrop-filter: blur(4px);
}
.contact-btn:hover {
  background: rgba(155,125,53,0.82) !important;
  color: var(--white) !important;
  text-shadow: none !important;
  opacity: 1 !important;
}

/* ── HAMBURGER (mobile) ── */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  justify-self: end;
  background: none;
  border: none;
  padding: 4px;
}
.hamburger span {
  display: block; width: 22px; height: 1.5px;
  background: var(--brown); transition: all 0.3s;
}
.mobile-menu {
  display: none;
  position: fixed;
  top: var(--header-h); left: 0; right: 0;
  background: var(--bg);
  border-bottom: 1px solid rgba(61,43,14,0.12);
  padding: 1.5rem 2rem;
  flex-direction: column;
  gap: 1.2rem;
  z-index: 99;
}
.mobile-menu.open { display: flex; }
.mobile-menu a {
  text-decoration: none;
  color: var(--brown-light);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 300;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: color 0.2s, font-weight 0.2s;
}
.mobile-menu a:hover { font-weight: 700; }
.mobile-menu a.active { color: var(--gold); font-weight: 700; }

/* ── PAGE WRAPPER ── */
.page { min-height: calc(100vh - var(--header-h)); padding: 3.5rem 5% 5rem; }
.page-hero { min-height: calc(100vh - var(--header-h)); padding: 0; }

/* ── TABS ── */
.tabs { display: flex; gap: 0.4rem; margin-bottom: 2.5rem; flex-wrap: wrap; }
.tab-btn {
  background: none;
  border: 1px solid rgba(61,43,14,0.2);
  padding: 0.3rem 1rem;
  font-family: var(--font-body);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 300;
  color: var(--brown-light);
  cursor: pointer;
  transition: all 0.2s;
}
.tab-btn.active, .tab-btn:hover {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--white);
  font-weight: 700;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── BREADCRUMB ── */
.breadcrumb {
  font-size: 0.72rem;
  color: var(--grey);
  margin-bottom: 1.8rem;
  letter-spacing: 0.03em;
}
.breadcrumb strong { color: var(--brown); }
.breadcrumb a { color: var(--grey); text-decoration: none; }
.breadcrumb a:hover { color: var(--gold); }

/* ── PROJECT GROUP ── */
.project-group { margin-bottom: 3rem; }
.pg-title { font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; color: var(--brown); margin-bottom: 0.15rem; }
.pg-sub { font-size: 0.7rem; color: var(--grey); letter-spacing: 0.06em; margin-bottom: 1.1rem; font-family: var(--font-body); font-weight: 300; }

/* ── PHOTO GRID ── */
.photo-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 1.2rem; }
.photo-card { aspect-ratio: 3/4; overflow: hidden; background: var(--gold); }
.photo-card img { width: 100%; height: 100%; object-fit: cover; filter: sepia(5%) saturate(90%); transition: transform 0.5s ease; }
.photo-card:hover img { transform: scale(1.04); }

/* ── TEXT LAYOUTS ── */
.text3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 2.5rem; padding-top: 2.5rem; border-top: 1px solid rgba(61,43,14,0.1); margin-top: 2rem; }
.text3 h3 { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; color: var(--gold); margin-bottom: 0.8rem; grid-column: 1/-1; }
.text4 { display: grid; grid-template-columns: repeat(3,1fr); gap: 2rem; padding-top: 2.5rem; border-top: 1px solid rgba(61,43,14,0.1); margin-top: 2rem; }
.text2 { display: grid; grid-template-columns: repeat(3,1fr); gap: 2rem; padding-top: 2.5rem; border-top: 1px solid rgba(61,43,14,0.1); margin-top: 2rem; }
.text2 h3 { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; color: var(--gold); margin-bottom: 0.8rem; }
.text3 p, .text4 p, .text2 p { font-size: 0.8rem; line-height: 1.85; color: var(--brown-light); margin-bottom: 0.7rem; font-family: var(--font-body); font-weight: 300; }

/* ── FOOTER ── */
footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  border-top: 1px solid rgba(61,43,14,0.12);
  padding: 0 2.8rem;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 2rem;
  font-family: var(--font-nav);
  font-size: 0.58rem;
  color: var(--grey);
  letter-spacing: 0.1em;
  background: var(--bg);
  z-index: 90;
}
body { padding-bottom: 52px; }

/* ── MOBILE BACK BUTTON ── */
.back-mobile {
  display: none;
  align-items: center;
  gap: 0.4rem;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--grey);
  padding: 0;
  transition: color 0.2s;
}
.back-mobile:hover { color: var(--gold); }
.back-mobile::before { content: '←'; margin-right: 0.3rem; }

/* ── REVEAL ANIMATION ── */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.65s ease, transform 0.65s ease; }
.reveal.visible { opacity: 1; transform: none; }

@keyframes slowRotate {
  from { transform: rotate(0deg) scale(1.12); }
  to   { transform: rotate(360deg) scale(1.12); }
}

header a.nav-link { display: inline; }

/* ── RESPONSIVE ── */
@media (max-width: 1035px) {
  header {
    grid-template-columns: 1fr auto;
    padding: 0 1.5rem;
  }
  .nav-left .nav-link { display: none; }
  .nav-brand { display: none; }
  .nav-right { display: none; }
  .header-right { display: flex; }
  .hamburger { display: flex; }
  .page { padding: 2rem 1.5rem 4rem; }

  /* Photo grids */
  .photo-grid { grid-template-columns: 1fr 1fr; }

  /* Text layouts → 1 col */
  .text3, .text4, .text2 { grid-template-columns: 1fr !important; gap: 1.5rem; }
  .text3 h3, .text4 h3 { grid-column: 1 !important; }

  /* Level 1 landing cards → 1 col */
  .fus-cards, .tal-cards, .coop-cards {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .fus-landing, .tal-landing, .coop-landing { padding: 2rem 1.5rem 3rem; }

  /* Càlcul grid → 1 col */
  .cal-grid { grid-template-columns: 1fr !important; }
  .cal-label:nth-child(1), .cal-label:nth-child(4), .cal-label:nth-child(7),
  .cal-text:nth-child(2),  .cal-text:nth-child(5),  .cal-text:nth-child(8),
  .cal-photo:nth-child(3), .cal-photo:nth-child(6), .cal-photo:nth-child(9) {
    grid-column: 1; grid-row: auto;
  }

  /* Tabs bar → centrat, scroll horitzontal */
  .fus-detail-tabs, .tal-detail-tabs, .coop-detail-tabs {
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    padding: 1.5rem 0 0 !important;
  }
  .tabs-left {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    width: 100%;
    justify-content: flex-start;
    gap: 0.4rem;
    padding: 0 1.5rem 2px;
  }
  .tabs-left::-webkit-scrollbar { display: none; }
  .tabs-left .tab-btn { flex-shrink: 0; }
  .saber-btn { align-self: center !important; text-align: center; }

  /* Cooperació Base A inline grid */
  .basea-grid { grid-template-columns: 1fr !important; }
  .basea-grid > div[style*="grid-column"] { grid-column: 1 !important; }

  /* Footer */
  footer { flex-direction: column; gap: 0.5rem; text-align: center; padding: 1.5rem; }
}

@media (max-width: 1035px) {
  .photo-grid { grid-template-columns: 1fr; }

  /* Cards still 1 col but photo not too tall */
  .fus-card-photo, .tal-card-photo, .coop-card-photo { aspect-ratio: 4/3; }

  /* ══ MOBILE START ══════════════════════════════════════════════
     Capçalera + menú lateral per a pàgines internes (fusteria,
     calcul, tallers, cooperacio, moviment, contacte). Estén el
     bloc 1035px existent sense modificar-lo.

     Per deshabilitar tot el bloc mobile: comenta des d'aquí fins
     a "MOBILE END".
     Requereix la lògica JS a nav.js (final del fitxer) per al
     sincronisme body.menu-open i el botó de tancar injectat.
  ═══════════════════════════════════════════════════════════════ */

  /* Header més prim a mòbil. Override la variable global perquè
     totes les regles que la fan servir s'ajustin alhora (header
     height, body padding-top, .page min-height, etc.). El JS
     hardcoded HEADER_H=112 segueix igual; l'efecte visual de
     hide-on-scroll continua sent correcte. */
  :root { --header-h: 64px; }

  /* ── HEADER: hamburger ESQ · brand CENTRE · contact DRETA ── */

  /* Re-activa nav-right (al bloc 1035px té display:none, que oculta
     tot l'arbre incloent .header-right i el .hamburger). A <=1035px
     el necessitem visible per poder mostrar contact-btn i hamburger.
     Els 2 .nav-link de dins (Cooperació, Qui som?) es mantenen
     ocults explícitament. */
  header .nav-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }
  header .nav-right > .nav-link { display: none; }

  /* Hamburger fixat a l'esquerra del header (estava a la dreta dins .header-right) */
  header .hamburger {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    z-index: 2;
  }

  /* Brand "en moviment" ocult: al seu lloc posem el logo (empremta) */
  header .nav-brand { display: none; }

  /* Logo (empremta arbre) centrat — manté l'animació slowRotate */
  header a.home-link {
    display: flex;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
  }

  /* Contacta'ns (top-right) — més compacte, manté tap target ≥44px */
  header .contact-btn {
    padding: 0.7rem 1.2rem !important;
    font-size: 0.55rem !important;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  /* Header padding global ajustat */
  header { padding: 0 1rem !important; }

  /* ── MENÚ LATERAL (mobile) — substitueix el dropdown superior ── */

  .mobile-menu {
    /* Override del display:none global (perquè el transform funcioni
       i la transició es vegi) */
    display: flex !important;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: auto;
    width: 280px;
    height: 100vh;
    background: rgba(61,43,14,0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: none;
    padding: 4.5rem 2rem 2rem;
    gap: 0.4rem;
    transform: translateX(-100%);
    transition: transform 0.55s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 110;
  }
  .mobile-menu.open {
    transform: translateX(0);
  }

  /* Items del menú — estètica matching index.html .side-menu */
  .mobile-menu a {
    font-family: 'Stardos Stencil', sans-serif !important;
    font-size: 1.4rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.03em !important;
    text-transform: capitalize !important;
    color: #fefdf8 !important;
    opacity: 0.88;
    text-decoration: none;
    line-height: 1.15;
    padding: 0.7rem 0;
    min-height: 44px;
    display: flex;
    align-items: center;
    transition: opacity 0.2s, color 0.2s;
  }
  .mobile-menu a:active {
    opacity: 1;
    color: #9b7d35 !important;
  }
  .mobile-menu a.active {
    color: #9b7d35 !important;
    opacity: 1;
  }

  /* Botó de tancar (✕) — injectat per nav.js a primera càrrega */
  .mobile-menu-close {
    position: absolute;
    top: 1.2rem;
    right: 1.2rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #fefdf8;
    opacity: 0.55;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0.6rem;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
  }
  .mobile-menu-close:active { opacity: 1; }

  /* ── OVERLAY (backdrop) quan el menú està obert ── */
  body.menu-open::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 105;
    pointer-events: auto;
  }
  /* Bloqueja scroll del body quan el menú està obert */
  body.menu-open { overflow: hidden; }
  /* ══ MOBILE END ════════════════════════════════════════════════ */
}
