/**
 * Lista articoli home — tutto scoped sotto #posts-grid
 * per evitare conflitti con altre pagine / script (.post-card, ecc.).
 */

@keyframes home6dFadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Allinea il bordo sinistro delle card con la hero:
   timeline (28px) + gap md (0.75rem) = 2.5rem. Serve width > 100% e margin negativo;
   max-width: 100% (es. Tailwind max-w-full) annullerebbe l’allargamento e la colonna destra
   resterebbe rientrata rispetto alla hero. */
@media (min-width: 768px) {
  #posts-grid {
    max-width: none;
    margin-left: -2.5rem;
    width: calc(100% + 2.5rem);
    box-sizing: border-box;
  }
}

/* In layout a 2 colonne (lista + sidebar), non “allargare” #posts-grid oltre la colonna,
   altrimenti la sidebar può finire sotto. */
@media (min-width: 768px) {
  .home-two-col #posts-grid {
    margin-left: 0;
    width: 100%;
    max-width: 100%;
  }
}

/* Layout home: lista + widget sidebar affiancati (non dipende da Tailwind breakpoints). */
.home-two-col .home-homecols {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  min-width: 0;
  max-width: 100%;
}
.home-two-col .home-homecols__main {
  flex: 1 1 auto;
  min-width: 0;
}
.home-two-col .home-homecols__side {
  flex: 0 0 250px;
  width: 250px;
  min-width: 0;
  display: block;
}

/* Widget categorie: icona senza chip (solo colore categoria) */
.home-two-col .home-wcat-ic svg {
  width: 18px;
  height: 18px;
}
.home-two-col .home-wcat-ic .cat-icon-emoji {
  font-size: 14px;
  line-height: 1;
}
@media (max-width: 899px) {
  .home-two-col .home-homecols {
    display: block;
  }
  .home-two-col .home-homecols__side {
    width: 100%;
    max-width: 100%;
    flex: 1 1 auto;
    margin-top: 1rem;
  }

  /* Sidebar sotto la lista: niente sticky/float “da desktop” */
  .home-two-col .home-homecols__side .sticky {
    position: static !important;
    top: auto !important;
  }
  .home-two-col .home-homecols__side .home-sidebar-sticky-rail {
    display: block !important;
    min-height: 0 !important;
    flex: none !important;
  }
}

/* --- Home: accordion widget su schermi piccoli (<900px) --- */
.home-widgets-acc {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(10, 10, 15, 0.55);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.home-widgets-acc__summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  color: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.home-widgets-acc__summary::-webkit-details-marker {
  display: none;
}

.home-widgets-acc__title {
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.home-widgets-acc__hint {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.55);
  white-space: nowrap;
}

.home-widgets-acc__panel {
  padding: 0 0.75rem 0.85rem;
}

@media (min-width: 900px) {
  .home-widgets-acc {
    border: 0;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    overflow: visible;
  }

  .home-widgets-acc__summary {
    display: none;
  }

  .home-widgets-acc__panel {
    padding: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-widgets-acc {
    scroll-behavior: auto;
  }
}

/* Sticky widget home: allinea altezza colonne (come colonna articolo + sponsor) */
@media (min-width: 900px) {
  .home-two-col--sticky-widget .home-homecols {
    align-items: stretch;
  }
  .home-two-col--sticky-widget .home-homecols__main {
    min-height: 0;
  }
}

#posts-grid .home-6d-row {
  opacity: 0;
  animation: home6dFadeInUp 0.35s ease-out forwards;
  overflow: visible;
}

/* Pulsante "Leggi": pill orizzontale compatto (non “torre” alta come la card) */
#posts-grid .home-6d-cta {
  align-self: center;
  height: auto;
  max-height: none;
  background: color-mix(in srgb, var(--hl-cat, #a78bfa) 16%, rgba(8, 8, 10, 0.45));
  border: 1px solid color-mix(in srgb, var(--hl-cat, #a78bfa) 28%, rgba(255,255,255,0.10));
  box-shadow:
    0 10px 24px rgba(0,0,0,0.35),
    0 0 0 1px rgba(0,0,0,0.25) inset,
    0 0 22px color-mix(in srgb, var(--hl-cat, #a78bfa) 18%, transparent);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  text-shadow: 0 1px 0 rgba(0,0,0,0.35);
}

#posts-grid a.home-list-cat-link:hover .home-6d-cta {
  background: color-mix(in srgb, var(--hl-cat, #a78bfa) 22%, rgba(12, 12, 16, 0.35));
  border-color: color-mix(in srgb, var(--hl-cat, #a78bfa) 42%, rgba(255,255,255,0.12));
  box-shadow:
    0 12px 30px rgba(0,0,0,0.42),
    0 0 0 1px rgba(0,0,0,0.20) inset,
    0 0 30px color-mix(in srgb, var(--hl-cat, #a78bfa) 26%, transparent);
}

/* icone categoria — blocco sinistro 6-D (come anteprima) */
#posts-grid .cat-icon-block {
  flex-shrink: 0;
  width: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  position: relative;
  overflow: hidden;
}

#posts-grid .cat-icon-block::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.55;
}

#posts-grid .cat-icon-block svg {
  position: relative;
  z-index: 1;
}

#posts-grid .cat-icon-block .cat-icon-emoji {
  position: relative;
  z-index: 1;
}

/* Hover card / titolo: stesso colore categoria (--hl-cat sul link, vedi home_timeline_card) */
#posts-grid a.home-list-cat-link {
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

#posts-grid a.home-list-cat-link:hover {
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

/* Mobile: niente fade scaglionato (30 righe = repaint a ondate) né blur costoso su ogni card */
@media (max-width: 767px) {
  #posts-grid .home-6d-row {
    animation: none !important;
    opacity: 1 !important;
  }
  #posts-grid .home-6d-cta {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

#posts-grid a.home-list-cat-link .home-6d-card-title {
  transition: color 0.15s ease;
}

#posts-grid a.home-list-cat-link:hover .home-6d-card-title {
  color: color-mix(in srgb, var(--hl-cat) 48%, #f8fafc);
}

#posts-grid .cat-preset {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--cat-accent) 14%, transparent),
    transparent
  );
}
#posts-grid .cat-preset::before {
  background: radial-gradient(
    ellipse at 30% 50%,
    color-mix(in srgb, var(--cat-accent) 22%, transparent),
    transparent 70%
  );
}

#posts-grid .cat-emoji {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--cat-accent) 14%, transparent),
    transparent
  );
}
#posts-grid .cat-emoji::before {
  background: radial-gradient(
    ellipse at 30% 50%,
    color-mix(in srgb, var(--cat-accent) 22%, transparent),
    transparent 70%
  );
}

#posts-grid .cat-icon-emoji {
  font-size: 1.5rem;
  line-height: 1;
}

#posts-grid .cat-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 4px;
}

#posts-grid .timeline-line {
  width: 28px;
  flex-shrink: 0;
  position: relative;
  display: none;
}

@media (min-width: 768px) {
  #posts-grid .timeline-line {
    display: block;
  }
}

#posts-grid .timeline-line::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  background: #1f2937;
}

#posts-grid .timeline-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  border-radius: 9999px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  box-shadow: 0 0 0 3px #080b12;
  z-index: 1;
}

/* --- Widget Meteo: effetti atmosferici (layer sopra sfondo, sotto testo) --- */
.home-meteo-card {
  isolation: isolate;
}

.home-meteo-summary {
  align-items: flex-start;
}
.home-meteo-tempblock {
  padding-top: 0.1rem;
}
.home-meteo-side .home-meteo-desc {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}
.home-meteo-geo-hint {
  border-radius: 0.65rem;
  border: 1px solid rgba(251, 191, 36, 0.22);
  background: rgba(251, 191, 36, 0.08);
  color: rgba(254, 243, 199, 0.92);
  padding: 0.35rem 0.45rem;
}
.home-meteo-fx {
  border-radius: inherit;
}
.home-meteo-fx::before,
.home-meteo-fx::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  opacity: 0;
}
.home-meteo-fx--reduced::before,
.home-meteo-fx--reduced::after {
  display: none !important;
}

@keyframes homeMeteoShimmer {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}
.home-meteo-fx--fx-clear::before {
  opacity: 0.4;
  background: linear-gradient(
    125deg,
    transparent 38%,
    rgba(255, 255, 255, 0.08) 50%,
    transparent 62%
  );
  background-size: 220% 220%;
  animation: homeMeteoShimmer 16s ease-in-out infinite;
}

.home-meteo-fx--fx-cloud::before {
  opacity: 0.65;
  background:
    radial-gradient(ellipse 130% 85% at 50% -25%, rgba(30, 41, 59, 0.65), transparent 58%),
    radial-gradient(ellipse 90% 55% at 85% 15%, rgba(15, 23, 42, 0.4), transparent 52%);
}

.home-meteo-fx--fx-fog::after {
  opacity: 0.9;
  background: linear-gradient(180deg, rgba(226, 232, 240, 0.18), rgba(100, 116, 139, 0.32));
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

@keyframes homeMeteoDrizzle {
  from {
    transform: translateY(-12%) translateX(-4%);
  }
  to {
    transform: translateY(12%) translateX(4%);
  }
}
.home-meteo-fx--fx-drizzle::before {
  opacity: 0.42;
  inset: -35% -12%;
  background: repeating-linear-gradient(
    104deg,
    transparent,
    transparent 6px,
    rgba(186, 230, 253, 0.2) 6px,
    rgba(186, 230, 253, 0.2) 7px
  );
  animation: homeMeteoDrizzle 1.35s linear infinite;
}

@keyframes homeMeteoRain {
  from {
    transform: translateY(-18%) translateX(-6%) skewX(-6deg);
  }
  to {
    transform: translateY(22%) translateX(8%) skewX(-6deg);
  }
}
.home-meteo-fx--fx-rain::before {
  opacity: 0.48;
  inset: -45% -15%;
  background: repeating-linear-gradient(
    99deg,
    transparent,
    transparent 3px,
    rgba(147, 197, 253, 0.28) 3px,
    rgba(147, 197, 253, 0.28) 4px
  );
  animation: homeMeteoRain 0.55s linear infinite;
}
.home-meteo-fx--fx-rain.home-meteo-fx--fx-rain-heavy::before {
  opacity: 0.58;
  animation-duration: 0.38s;
  background: repeating-linear-gradient(
    99deg,
    transparent,
    transparent 2px,
    rgba(191, 219, 254, 0.35) 2px,
    rgba(191, 219, 254, 0.35) 3px
  );
}

@keyframes homeMeteoSnow {
  from {
    transform: translateY(-14%) translateX(-2%);
  }
  to {
    transform: translateY(18%) translateX(3%);
  }
}
.home-meteo-fx--fx-snow::before {
  opacity: 0.5;
  inset: -40% -10%;
  background-image: radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.9) 0.5px, transparent 1px),
    radial-gradient(circle at 70% 55%, rgba(255, 255, 255, 0.75) 0.5px, transparent 1px),
    radial-gradient(circle at 40% 80%, rgba(255, 255, 255, 0.85) 0.5px, transparent 1px);
  background-size: 28px 36px, 34px 40px, 22px 30px;
  animation: homeMeteoSnow 2.8s linear infinite;
}

.home-meteo-fx--fx-thunder::after {
  opacity: 0.55;
  background: radial-gradient(ellipse 100% 90% at 50% 0%, rgba(15, 23, 42, 0.75), transparent 62%),
    linear-gradient(180deg, rgba(30, 27, 75, 0.35), transparent 55%);
}

.home-meteo-fx--wind.home-meteo-fx--fx-rain::before,
.home-meteo-fx--wind.home-meteo-fx--fx-drizzle::before,
.home-meteo-fx--wind.home-meteo-fx--fx-snow::before {
  animation-duration: 0.42s;
}
.home-meteo-fx--wind-strong.home-meteo-fx--fx-rain::before,
.home-meteo-fx--wind-strong.home-meteo-fx--fx-drizzle::before,
.home-meteo-fx--wind-strong.home-meteo-fx--fx-snow::before {
  animation-duration: 0.32s;
}
.home-meteo-fx--wind.home-meteo-fx--fx-rain::before {
  animation-name: homeMeteoRainWind;
}
@keyframes homeMeteoRainWind {
  from {
    transform: translateY(-18%) translateX(-14%) skewX(-14deg);
  }
  to {
    transform: translateY(22%) translateX(18%) skewX(-14deg);
  }
}
.home-meteo-fx--wind-strong.home-meteo-fx--fx-rain::before {
  animation-name: homeMeteoRainWindStrong;
}
@keyframes homeMeteoRainWindStrong {
  from {
    transform: translateY(-18%) translateX(-22%) skewX(-18deg);
  }
  to {
    transform: translateY(22%) translateX(26%) skewX(-18deg);
  }
}

.home-meteo-card.home-meteo--flash::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 25;
  pointer-events: none;
  border-radius: inherit;
  background: rgba(248, 250, 252, 0.55);
  animation: homeMeteoFlash 0.14s ease-out forwards;
}
@keyframes homeMeteoFlash {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* --- Meteo: griglia settimana + frase del giorno --- */
.home-meteo-week-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.15rem;
  width: 100%;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}
.home-meteo-week-scroll::-webkit-scrollbar {
  height: 6px;
}
.home-meteo-week-scroll::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.35);
  border-radius: 999px;
}
.home-meteo-week-grid {
  display: flex;
  flex-direction: row;
  gap: 0.45rem;
  width: max-content;
  padding: 0 0.15rem;
  min-height: 74px;
}
.home-meteo-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  flex: 0 0 auto;
  min-width: 46px;
  padding: 0.45rem 0.35rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.home-meteo-day__dow {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: none;
  color: rgba(226, 232, 240, 0.95);
}
.home-meteo-day__ico {
  font-size: 20px;
  line-height: 1;
  margin-top: 0.2rem;
  filter: saturate(1.05);
}
.home-meteo-day__max {
  text-align: right;
  font-size: 11px;
  color: rgba(148, 163, 184, 0.92);
  line-height: 1.1;
  margin-top: 0.25rem;
  width: 100%;
  text-align: center;
  font-weight: 700;
}
.home-meteo-day__max--muted {
  font-weight: 600;
  opacity: 0.65;
}
