/*
  Overrides per a la skin Terres + estils comuns dels overlays.
*/

/* Fons blanc per ambdues skins. */
.mega-menu-costa,
.mega-menu-terres {
  background-color: #fff;
  color: var(--mega-menu-costa-blue, rgb(0 48 86));
}

/* Sobreescriu el padding/display de .mega-menu > div per Terres. */
.mega-menu-terres > div {
  max-width: 1280px;
  padding: 2rem 1.5rem 2rem; /* coincideix amb px-6 pb-8 + pt-8 visual */
}

@media (min-width: 1024px) {
  .mega-menu-terres > div {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

/* Quan hi ha sidebar (skin terres), el cards-grid usa la mateixa graella 4-col
   que .cards-grid-pane però ocupant només l'espai del flex-1 (no el sidebar). */
.mega-menu-terres #cards-grid {
  display: flex;
  height: 100%;
}

.mega-menu-terres #cards-grid .cards-grid-pane {
  flex: 1;
  min-width: 0;
}

/* === Tabs sidebar Terres === */
.mega-menu-terres #categories-tabs .tab-link {
  padding: 0.25rem 0;
  position: relative;
}

.mega-menu-terres #categories-tabs .tab-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 2px;
  background-color: rgb(var(--brand-accent));
  transition: width 0.3s ease;
}

.mega-menu-terres #categories-tabs .tab-link:hover::after,
.mega-menu-terres #categories-tabs .tab-link.active::after {
  width: 1.5rem;
}

/* === Cards Terres: rounded-3xl, overlay gradient, hover title olive === */
.mega-menu-terres #cards-grid .cards-grid-pane a.cards-grid-card {
  border-radius: 1.5rem;
  background-color: rgb(var(--brand-primary, 0 48 86));
  animation: terresSlideInRight 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  opacity: 0;
}

.mega-menu-terres #cards-grid .cards-grid-pane a.cards-grid-card .cards-grid-card-img-wrap {
  height: 100%;
}

.mega-menu-terres #cards-grid .cards-grid-pane a.cards-grid-card .cards-grid-card-img {
  object-fit: cover;
  opacity: 0.8;
  transition: transform 0.7s, opacity 0.7s;
}

.mega-menu-terres #cards-grid .cards-grid-pane a.cards-grid-card:hover .cards-grid-card-img {
  transform: scale(1.05);
  opacity: 1;
}

.mega-menu-terres #cards-grid .cards-grid-pane a.cards-grid-card .cards-grid-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(var(--brand-primary, 0 48 86), 0.9), transparent);
  display: flex;
  align-items: flex-end;
  padding: 1rem;
}

.mega-menu-terres #cards-grid .cards-grid-pane a.cards-grid-card .cards-grid-card-title {
  color: #fff;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.875rem;
  line-height: 1.15;
  transition: color 0.2s;
}

@media (min-width: 768px) {
  .mega-menu-terres #cards-grid .cards-grid-pane a.cards-grid-card .cards-grid-card-title {
    font-size: 1rem;
  }
}

.mega-menu-terres #cards-grid .cards-grid-pane a.cards-grid-card:hover .cards-grid-card-title {
  color: rgb(var(--brand-accent, 168 167 99));
}

/* === Veure tot card Terres === */
.mega-menu-terres #cards-grid .cards-grid-pane a.cards-grid-ver-todo--terres {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  border: 1px solid rgb(var(--neutral-border, 229 231 235));
  border-radius: 1.5rem;
  background-color: rgb(var(--neutral-bg-light, 247 247 245));
  color: rgb(var(--brand-primary, 0 48 86));
  text-decoration: none;
  transition: border-color 0.3s, background-color 0.3s, color 0.3s;
  animation: terresSlideInRight 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  opacity: 0;
  animation-delay: 0.35s;
}

.mega-menu-terres #cards-grid .cards-grid-pane a.cards-grid-ver-todo--terres:hover {
  border-color: rgb(var(--brand-accent, 168 167 99));
  color: rgb(var(--brand-accent, 168 167 99));
}

.mega-menu-terres #cards-grid .cards-grid-pane a.cards-grid-ver-todo--terres .cards-grid-ver-todo-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border: 1px solid rgb(var(--neutral-border, 229 231 235));
  border-radius: 9999px;
  margin-bottom: 0.75rem;
  transition: background-color 0.3s, border-color 0.3s, color 0.3s;
}

.mega-menu-terres #cards-grid .cards-grid-pane a.cards-grid-ver-todo--terres .cards-grid-ver-todo-circle svg {
  width: 1.25rem;
  height: 1.25rem;
}

.mega-menu-terres #cards-grid .cards-grid-pane a.cards-grid-ver-todo--terres:hover .cards-grid-ver-todo-circle {
  background-color: rgb(var(--brand-accent, 168 167 99));
  border-color: rgb(var(--brand-accent, 168 167 99));
  color: #fff;
}

.mega-menu-terres #cards-grid .cards-grid-pane a.cards-grid-ver-todo--terres .cards-grid-ver-todo-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* === Animació stagger cards Terres === */
@keyframes terresSlideInRight {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.mega-menu-terres #cards-grid .cards-grid-pane > a:nth-child(1) { animation-delay: 0s; }
.mega-menu-terres #cards-grid .cards-grid-pane > a:nth-child(2) { animation-delay: 0.05s; }
.mega-menu-terres #cards-grid .cards-grid-pane > a:nth-child(3) { animation-delay: 0.1s; }
.mega-menu-terres #cards-grid .cards-grid-pane > a:nth-child(4) { animation-delay: 0.15s; }
.mega-menu-terres #cards-grid .cards-grid-pane > a:nth-child(5) { animation-delay: 0.2s; }
.mega-menu-terres #cards-grid .cards-grid-pane > a:nth-child(6) { animation-delay: 0.25s; }
.mega-menu-terres #cards-grid .cards-grid-pane > a:nth-child(7) { animation-delay: 0.3s; }
.mega-menu-terres #cards-grid .cards-grid-pane > a:nth-child(8) { animation-delay: 0.35s; }
