/* ============================================================
   SECCIÓN: BITÁCORA (blog + newsletter)
   ============================================================ */


/* CONTENEDOR GENERAL */
.bitacora__inner {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 30px;
    padding: 24px 32px;
    margin: auto;
}

.bitacora__inner::before {
  content: "";
  position: absolute;

  top: 20%;
  left: 0;
  right: 0;

  height: 600px;

  background-image: url("../../public/ondas-curvas.webp");
  background-repeat: no-repeat;
  background-size: cover;

  opacity: 1;
  pointer-events: none;
  z-index: -1;
}

.categories-list-mobile{
  display: flex;
  /*gap: 16px;*/
  gap: clamp(16px, 4vw, 80px);
  padding: 0 24px;
  flex-wrap: wrap;
  justify-content: center;
}

.filter {
  font-family: var(--font-family-pangolin);
}

/* Trigger */
.filter__trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 16px;
  background: var(--color-surface-teal);
  border-radius: 16px;
  border: none;
  cursor: pointer;
}

.filter__icon {
  width: 64px;
  height: 20px;
}

.filter__label {
  flex: 1;
  font-size: 24px;
  color: var(--color-accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.filter__chevron {
  width: 24px;
  transition: transform 0.2s ease;
}

.filter.is-open .filter__chevron {
  transform: rotate(180deg);
}

/* Dropdown */
.filter__dropdown {
  display: none;
}

.filter.is-open .filter__dropdown {
  display: grid;
  margin-top: 6px;
  gap: 6px;
  padding: 0;
  list-style: none;
  grid-template-columns: 1fr;
}

.filter__group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

/* Option base */
.filter__option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 6px 16px;
  border-radius: 16px;
  border: none;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.filter__option img {
  width: 40px;
  height: 35px;
}

/* Estados */
.filter__option.is-active {
  outline: 2px solid #00000020;
}

/* Variantes de color */
.filter__option--agua { background: var(--color-surface-blue); color: var(--color-blue); }
.filter__option--rio { background: var(--color-blue); color: var(--color-surface-blue); }
.filter__option--mar { background: var(--color-accent); color: #fff; }
.filter__option--mar img { width: 64px; height: 20px; }
.filter__option--oceano { background: var(--color-primary); color: #9ce0e3; }

.filter__option--brillo { background: #e5d5f2; color: #9545d4; }
.filter__option--brisa { background: #f2f1f7; color: #b1b9cc; }
.filter__option--brisa img { width: 42px; height: 20px; }
.filter__option--arena { background: #efe8de; color: #ac9671; }
.filter__option--caracola { background: #ffb6a6; color: #f55432; }

/* ENCABEZADO */
.blog-header {
    text-align: center;
}

.blog-title {
    font-family: var(--font-family-simonetta);
    font-size: 34px;
    font-weight: var(--font-weight-regular);
    color: var(--color-primary);
}

.blog-description {
    font-family: var(--font-family-poppins);
    font-size: 24px;
    font-weight: var(--font-weight-regular);
    color: var(--color-text-muted);
    line-height: 36px;
    padding: 16px 0px;
}

/* CATEGORÍAS */
.blog-categories {
    text-align: center;
}

.categories-title {
    font-family: var(--font-family-pangolin);
    color: var(--color-accent);
    font-weight: var(--font-weight-regular);
    font-size: 32px;
    padding-bottom: 16px;
}

/* ARTÍCULOS (carrusel) */
.articles-carousel {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Fila de flechas sobre la pista. Oculta si no sobran artículos (la clase
   is-scrollable la pone blog.js) */
.articles-nav {
    display: none;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 8px;
}

.articles-carousel.is-scrollable .articles-nav {
    display: flex;
}

/* Pista con desplazamiento propio y anclaje: el gesto táctil y el trackpad
   funcionan de forma nativa y las tarjetas nunca quedan a medias.
   El ancho de tarjeta lo calcula blog.js (mismo reparto que la rejilla
   anterior: tantas como caban con un mínimo de 318px). */
.articles-list {
    display: flex;
    gap: 24px;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    padding-block: 12px; /* aire para el realce al pasar el ratón */
    /* La navegación es con gesto o flechas; la barra rompería el diseño */
    scrollbar-width: none;
}

.articles-list::-webkit-scrollbar {
    display: none;
}

.articles-arrow {
    display: grid;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    padding: 0;
    place-items: center;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    background-color: var(--color-surface-teal);
    color: var(--color-primary);
    transition: opacity 0.2s ease, background-color 0.2s ease;
}

.articles-arrow svg {
    width: 20px;
    height: 20px;
}

.articles-arrow:disabled {
    opacity: 0.3;
    cursor: default;
}

.articles-arrow:not(:disabled):hover {
    background-color: var(--color-surface-blue);
}

/* Mensajes de estado de la carga de artículos (los genera blog.js) */
.articles-status {
    flex: 1;
    font-family: var(--font-family-poppins);
    font-size: 20px;
    color: var(--color-text-muted);
    text-align: center;
    padding: 24px 0;
}

.article-card {
  flex: 0 0 var(--article-card-width, 318px);
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: white;
  border-radius: 20px;
  overflow: hidden;

  transition:
    transform .25s ease,
    box-shadow .25s ease;

  cursor: pointer;
}

.article-card:hover {
  transform: translateY(-4px);

  box-shadow:
    0 10px 30px rgba(0,0,0,.08);
}

.article-link{
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.article-content{
    display:flex;
    flex-direction:column;
    gap:14px;
    padding:16px;
    background:var(--color-surface-teal);
    /* Absorbe el alto sobrante cuando otra tarjeta es más alta: así la banda
       llega siempre al borde inferior y hereda su redondeo. Sin esto, el hueco
       quedaba debajo en blanco y las esquinas de la banda parecían cuadradas */
    flex: 1;
}

/* Es un <img> con loading="lazy": solo se descargan las que se van viendo */
.article-image {
    aspect-ratio: 16 / 10;
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 16px 16px 0 0;
    background-color: var(--color-surface-teal); /* hueco mientras carga */
}

.article-title {
    font-family: var(--font-family-figtree);
    font-weight: var(--font-weight-bold);
    color: var(--color-primary);
    font-size: 20px;
    line-height: 24px;
}

.article-tags {
    display: flex;
    gap: 10px;
}

.tag {
    background-color: var(--color-surface-blue);
    padding: 2px 10px;
    border-radius: 20px;
    font-family: var(--font-family-figtree);
    font-weight: var(--font-weight-medium);
    font-size: 12px;
}

.article-date {
    font-family: var(--font-family-pangolin);
    font-size: 12px;
    color: var(--color-blue);
}

/* BOTÓN VER TODO */
.view-all-wrapper { 
  text-align: center;
}

.view-all-btn {
    background: var(--color-primary);
    color: #fff;
    padding: 16px 60px;
    border-radius: 32px;
    font-family: var(--font-family-outfit);
    font-weight: var(--font-weight-medium);
    font-size: 22px;
    line-height: 50px;
    white-space: nowrap;
}

/* NEWSLETTER */
/* Oculta temporalmente vía atributo hidden en el HTML (decisión D-004);
   necesario porque el display:flex de .newsletter anularía el hidden nativo */
.newsletter[hidden] {
    display: none;
}

.newsletter {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    padding: 0px 10px;
}

.newsletter-texts {
  display: flex;
  flex-direction: column;
  text-align: center;
  gap: 12px;
}

.newsletter-title {
    font-family: var(--font-family-pangolin);
    font-size: 28px;
    color: var(--color-accent);
}

.newsletter-description {
    font-family: var(--font-family-figtree);
    font-weight: var(--font-weight-semibold);
    font-style: italic;
    font-size: 20px;
    color: var(--color-primary);
    padding: 0px 16px;
}

.newsletter-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 900px;
}

.newsletter-input {
    flex: 1;
    padding: 14px;
    border-radius: 16px;
    background: #30cace0d;

    width: 100%;
    border: none;

    font-size: 16px; /* 🔥 evita zoom en iOS */
    line-height: 1.4;

    /* evita roturas */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;

}

.newsletter-submit {
    background: var(--color-cta);
    padding: 14px 20px;
    border-radius: 20px;
    font-family: var(--font-family-figtree);
    font-weight: var(--font-weight-medium);
    font-size: 16px;
}

/* Visibilidad responsive */
.categories-list, .bitacora__inner::before {
  display: none;
}

@media (min-width: 768px) {

  .categories-list-mobile {
    display: none;
  }

  .categories-list, .bitacora__inner::before {
    display: flex;
  }

  /* =====================
   BITACORA
  ===================== */
  .blog-title {
    font-size: 48px;
  }

  .categories-list{
    display: flex;
    /*gap: 16px;*/
    gap: clamp(16px, 4vw, 80px);
    padding: 0 24px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .category-item {
      display: flex;
      flex-direction: column;
      align-items: center;
      width: 150px;
      gap: 8px;
  }

  .category-item-background {
    display: flex;
    justify-content: center; /* centro horizontal */
    align-items: center;     /* centro vertical (si quieres) */
    width: 100%;
    border-radius: 24px;
    width: 143px;
    height: 87px;
  }

  .category-item-background-agua {
    background-color: var(--color-surface-blue);
  }

  .category-img-agua {
      width: 31px;
      height: 51px;
  }

  .category-item-background-rio {
    background-color: var(--color-blue);
  }

  .category-img-rio {
      width: 78px;
      height: 37px;
  }

  .category-item-background-mar {
    background-color: var(--color-accent);
  }

  .category-img-mar {
      width: 78px;
      height: 25px;
  }

  .category-item-background-oceano {
    background-color: var(--color-primary);
  }

  .category-img-agua-oceano {
      width: 52px;
      height: 32px;
  }

  .category-item-background-brisa {
    background-color: #F2F1F7;
  }

  .category-img-agua-brisa {
      width: 68px;
      height: 32px;
      transform: rotate(-24deg);
  }

  .category-item-background-arena {
    background-color: #EFE8DE;
  }

  .category-img-arena {
      width: 52px;
      height: 63px;
      transform: rotate(-43deg);
  }

  .category-item-background-brillo {
    background-color: #E5D5F2;
  }

  .category-img-brillo {
      width: 52px;
      height: 46px;
  }

  .category-item-background-caracola {
    background-color: #FFB6A6;
  }

  .category-img-caracola {
      width: 58px;
      height: 38px;
      transform: rotate(27deg);
  }

  .category-name {
      font-family: "Pangolin", Helvetica;
      font-size: 16px;
      text-align: center;
  }

  .newsletter-form {
    flex-direction: row;
  }
}

@media (min-width: 1030px) {

  /* =====================
   BITACORA
  ===================== */
  /* CONTENEDOR GENERAL */
  .bitacora__inner {
      padding: 72px 48px;
  }

  .blog-title {
    font-size: 48px;
  }

  .blog-description {
    font-size: 20px;
    line-height: 1.6;
  }

  .newsletter {
    padding: 24px 96px;
  }

  .newsletter-title {
    font-size: 32px;
  }

  .category-item-background {
    width: 143px;
    height: 87px;
  }
}
