/* ====== RESET BÀSIC ====== */
* { box-sizing: border-box; }
html, body { height: 100%; }

html, body {
  overflow-x: hidden; /* Bloquea scroll lateral global */
}

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: #0f172a;
  background: #ffffff;
  overflow: hidden; /* el scroll el gestionem a "app" */
}

a { color: inherit; }
button { font: inherit; }

/* ====== VARIABLES ====== */
:root{
  --green: #1f7a5a;
  --green-dark: #176247;
  --light: #ffffff;
  --muted: rgba(15, 23, 42, 0.75);

  --nav-h: 64px;
  --radius: 16px;

  --shadow: 0 10px 30px rgba(2,6,23,0.12);
}

/* ====== LOADER ====== */
.loader{
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 9999;
  display: grid;
  place-items: center;
}

.loader--hidden{
  opacity: 0;
  pointer-events: none;
  transition: opacity 450ms ease;
}

.loader__inner{
  display: grid;
  gap: 14px;
  justify-items: center;
}

.loader__logo{
  font-weight: 800;
  letter-spacing: 0.5px;
  font-size: clamp(28px, 5vw, 44px);
  transform-origin: center;
  animation: pop 900ms ease-in-out infinite alternate;
}

.loader__ring{
  width: 48px;
  height: 48px;
  border: 4px solid rgba(31,122,90,0.2);
  border-top-color: var(--green);
  border-radius: 999px;
  animation: spin 900ms linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { to { transform: scale(1.05); } }

/* ====== NAVBAR FIXA (MOBILE FIRST, NO DESBORDA) ====== */
.nav{
  position: fixed;
  top: 0; left: 0; right: 0;
  width: 100%;
  max-width: 100%;
  height: var(--nav-h);
  padding: 10px 10px;

  display: grid;
  grid-template-columns: auto 1fr auto; /* centre flexible */
  align-items: center;
  gap: 8px;

  z-index: 1000;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(15,23,42,0.08);

  overflow: hidden; /* evita que res surti */
}

.nav__left, .nav__center, .nav__right { min-width: 0; }

.brand{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-width: 0;
}

.brand__mark{
  width: 34px; height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--green);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.brand__name{
  font-weight: 800;
  display: none; /* mobile: amaguem nom */
  white-space: nowrap;
}

/* Centre: si no cap, scroll horitzontal NOMÉS als botons */
.nav__center{
  display: flex;
  gap: 6px;
  align-items: center;

  justify-content: flex-start;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;

  padding: 2px 4px;
  scrollbar-width: none;
}
.nav__center::-webkit-scrollbar{ display: none; }

.nav__btn{
  flex: 0 0 auto;
  border: 1px solid rgba(15,23,42,0.12);
  background: rgba(255,255,255,0.9);
  color: #0f172a;
  padding: 8px 10px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
  transition: transform 120ms ease, background 120ms ease;
  white-space: nowrap; /* el text no trenca dins del botó */
}
.nav__btn:active{ transform: scale(0.98); }

.nav__btn--active{
  background: var(--green);
  color: #fff;
  border-color: transparent;
}

.nav__right{
  display: flex;
  gap: 8px;
  justify-content: end;
  align-items: center;
}

.icon-btn{
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(15,23,42,0.12);
  background: rgba(255,255,255,0.9);
  text-decoration: none;
  flex: 0 0 auto;
}
.icon-btn svg{
  width: 18px;
  height: 18px;
  fill: rgba(15,23,42,0.9);
}

/* ====== CTA FLOAT ====== */
.cta-float{
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 1000;
  text-decoration: none;
  background: var(--green);
  color: #fff;
  padding: 12px 14px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-weight: 800;
  letter-spacing: 0.2px;
}

/* ====== APP (snap scroll tipus TikTok) ====== */
.app{
  position: fixed;
  inset: 0;
  padding-top: var(--nav-h);
  overflow-y: auto;
  overflow-x: hidden; /* evita arrastre lateral */
  overscroll-behavior-y: contain;

  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;

  /* per defecte només gest vertical */
  touch-action: pan-y;
}

/* Asegura que res empeny el layout fora de pantalla */
.nav, .section__inner, .carousel, .contact__grid {
  max-width: 100%;
}

.section{
  height: calc(100vh - var(--nav-h));
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: grid;
}

.section__inner{
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 22px 16px;
  display: grid;
  align-content: center;
  gap: 14px;
  min-width: 0;
}

.section--green{
  background: linear-gradient(180deg, var(--green), var(--green-dark));
  color: #fff;
}

.section--light{
  background: #ffffff;
  color: #0f172a;
}

.section__title{
  margin: 0;
  font-size: clamp(22px, 3.2vw, 34px);
  letter-spacing: -0.02em;
}

.section__lead{
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.section--green .section__lead{ color: rgba(255,255,255,0.85); }

.section__note{
  margin: 10px 0 0;
  color: var(--muted);
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}
.section--green .section__note{ color: rgba(255,255,255,0.85); }

/* ====== HERO ====== */
.hero{ gap: 16px; }

.hero__title{
  margin: 0;
  font-size: clamp(30px, 6vw, 54px);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.hero__subtitle{
  margin: 0;
  font-size: 16px;
  line-height: 1.6;
  color: rgba(255,255,255,0.88);
  max-width: 52ch;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.hero__actions{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.btn{
  border: 0;
  cursor: pointer;
  background: #fff;
  color: #0f172a;
  border-radius: 999px;
  padding: 12px 14px;
  font-weight: 800;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn--ghost{
  background: rgba(255,255,255,0.14);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
}

.hero__hint{
  margin-top: 18px;
  color: rgba(255,255,255,0.85);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.hero__arrow{
  display: inline-block;
  animation: bounce 900ms ease-in-out infinite alternate;
}
@keyframes bounce { to { transform: translateY(6px); } }

/* ====== CAROUSEL PRODUCTES ====== */
.carousel{
  position: relative;
  margin-top: 8px;
  max-width: 100%;
}

.carousel__track{
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 85%; /* una mica més ample en mòbil */
  gap: 12px;

  overflow-x: auto;
  overflow-y: hidden;

  padding: 4px 44px; /* espai per fletxes */
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;

  /* permet swipe horitzontal al carrusel */
  touch-action: pan-x;

  min-width: 0;
}

.carousel__track:focus{ outline: none; }

.card{
  scroll-snap-align: center;
  border: 1px solid rgba(15,23,42,0.08);
  border-radius: var(--radius);
  padding: 12px;
  background: #fff;
  box-shadow: 0 10px 20px rgba(2,6,23,0.06);
  min-width: 0; /* CRÍTIC per evitar overflow del text */
}

.card__img{
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: 14px;
  background:
    radial-gradient(circle at 30% 30%, rgba(31,122,90,0.25), transparent 60%),
    linear-gradient(135deg, rgba(15,23,42,0.05), rgba(15,23,42,0.02));
  margin-bottom: 10px;
}

.card__img--wood{
  background:
    radial-gradient(circle at 25% 25%, rgba(245,158,11,0.20), transparent 60%),
    linear-gradient(135deg, rgba(15,23,42,0.05), rgba(15,23,42,0.02));
}

.card__img--key{
  background:
    radial-gradient(circle at 25% 25%, rgba(59,130,246,0.18), transparent 60%),
    linear-gradient(135deg, rgba(15,23,42,0.05), rgba(15,23,42,0.02));
}

.card__img--tee{
  background:
    radial-gradient(circle at 25% 25%, rgba(236,72,153,0.18), transparent 60%),
    linear-gradient(135deg, rgba(15,23,42,0.05), rgba(15,23,42,0.02));
}

.card__title{
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.card__price{
  margin: 6px 0 0;
  font-weight: 700;
  color: rgba(15,23,42,0.75);
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.carousel__arrow{
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid rgba(15,23,42,0.12);
  background: rgba(255,255,255,0.95);
  cursor: pointer;
  box-shadow: 0 12px 20px rgba(2,6,23,0.10);
  z-index: 5;
}
.carousel__arrow--left{ left: 10px; }
.carousel__arrow--right{ right: 10px; }

.carousel__arrow:active{ transform: translateY(-50%) scale(0.98); }

/* ====== ABOUT ====== */
.about__text{
  margin: 0;
  line-height: 1.7;
  color: rgba(255,255,255,0.9);
  max-width: 70ch;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.about__badges{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.badge{
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.22);
  font-weight: 700;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

/* ====== CONTACTE ====== */
.contact__grid{
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
  align-items: start;
  min-width: 0;
}

.contact__subtitle{
  margin: 0 0 8px;
  font-weight: 800;
}

.contact__info p{
  margin: 8px 0;
  line-height: 1.5;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.contact__small{
  color: rgba(15,23,42,0.75);
}

.contact__map{
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(15,23,42,0.08);
  box-shadow: 0 10px 20px rgba(2,6,23,0.06);
  min-height: 260px;
  max-width: 100%;
}

.contact__map iframe{
  width: 100%;
  height: 320px;
  border: 0;
}

.footer{
  margin-top: 14px;
  color: rgba(15,23,42,0.65);
}

/* ====== RESPONSIVE (desktop) ====== */
@media (min-width: 860px){
  :root{ --nav-h: 74px; }

  .brand__name{ display: inline; }

  .nav{
    grid-template-columns: 1fr auto 1fr;
    padding: 10px 12px;
    overflow: visible;
  }

  .nav__center{
    overflow: visible;
    justify-content: center;
  }

  .nav__btn{
    font-size: 14px;
    padding: 10px 12px;
  }

  .brand__mark{
    width: 36px;
    height: 36px;
  }

  .icon-btn{
    width: 36px;
    height: 36px;
  }

  .carousel__track{
    grid-auto-columns: 38%;
  }

  .contact__grid{
    grid-template-columns: 1fr 1.2fr;
    gap: 18px;
  }

  .contact__map iframe{ height: 360px; }
}