/* ── BPO Custom CSS v2 — Design Editoriale ──────────────────
   Stile ispirato a money.it, pensionioggi.it, thisismoney.co.uk
   ──────────────────────────────────────────────────────────── */

/* ── NAVIGAZIONE PRINCIPALE ──────────────────────────────── */
.bpo-main-nav .wp-block-navigation__container,
.bpo-main-nav .wp-block-navigation__responsive-container-content {
  gap: 0 !important;
}

.bpo-main-nav .wp-block-navigation-item {
  margin: 0 !important;
  padding: 0 !important;
}

.bpo-main-nav .wp-block-navigation-item a,
.bpo-main-nav .wp-block-navigation-item .wp-block-navigation-item__content {
  padding: 0.7rem 1.1rem !important;
  transition: background 0.2s;
  border-right: 1px solid rgba(255,255,255,0.15);
  display: block;
  white-space: nowrap;
}

.bpo-main-nav .wp-block-navigation-item:first-child a,
.bpo-main-nav .wp-block-navigation-item:first-child .wp-block-navigation-item__content {
  border-left: 1px solid rgba(255,255,255,0.15);
}

.bpo-main-nav .wp-block-navigation-item a:hover,
.bpo-main-nav .wp-block-navigation-item .wp-block-navigation-item__content:hover {
  background: rgba(255,255,255,0.15) !important;
  text-decoration: none !important;
}

/* ── HEADER SFONDO NAVY FIX ─────────────────────────────── */
.bpo-header-main {
  background-color: #1e293b !important;
}

.bpo-header-main .wp-block-site-title,
.bpo-header-main .wp-block-site-title a {
  color: #ffffff !important;
}

/* ── AD SLOTS ──────────────────────────────────────────────── */
.bpo-ad-slot {
  text-align: center;
  overflow: hidden;
}

.bpo-ad-between-sections {
  min-height: 100px;
  contain: layout;
  background: #ffffff;
  padding: 1rem 0;
}

.bpo-ad-sidebar {
  min-height: 250px;
  contain: layout;
  position: sticky;
  top: 20px;
}

.bpo-ad-before-content,
.bpo-ad-after-content {
  min-height: 100px;
  contain: layout;
  border-top: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
  padding: 0.5rem 0;
}

.bpo-ad-slot[data-ad-slot="in-content-1"],
.bpo-ad-slot[data-ad-slot="in-content-2"] {
  min-height: 280px;
  contain: layout;
}

/* ── ARTICLE ROW (lista articoli stile news) ─────────────── */
.bpo-article-row {
  transition: background 0.15s;
}

.bpo-article-row:hover {
  background-color: #f8fafc !important;
}

.bpo-thumb-article img,
.bpo-thumb-small img {
  object-fit: cover;
  width: 100%;
  height: 100%;
}

/* ── FEATURED CARD ────────────────────────────────────────── */
.bpo-featured-card {
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* ── ARTICLE CONTAINER ────────────────────────────────────── */
.bpo-article-container {
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.bpo-article-meta {
  font-size: 0.78rem;
}

/* ── SEZIONE HEADER (titoli sezioni stile editoriale) ────── */
/* Usato nelle sidebar e sezioni homepage */

/* ── READING TIME BADGE ──────────────────────────────────── */
.bpo-reading-time {
  font-size: 0.8rem;
  color: #6b7280;
  padding: 0.5rem 1rem;
  background: #f1f5f9;
  border-left: 3px solid #1a56db;
  margin-bottom: 1.5rem;
  display: inline-block;
}

/* ── BREADCRUMBS ─────────────────────────────────────────── */
.bpo-breadcrumbs {
  font-size: 0.72rem;
  color: #94a3b8;
  padding: 0.5rem 0;
  margin-bottom: 0.5rem;
}

.bpo-breadcrumbs a {
  color: #1a56db;
  text-decoration: none;
}

.bpo-breadcrumbs a:hover {
  text-decoration: underline;
}

/* ── DISCLAIMER & AVVISI ─────────────────────────────────── */
.disclaimer-box {
  background: #f1f5f9 !important;
  border-left: 4px solid #dc2626 !important;
  padding: 1rem 1.2rem !important;
  margin: 1.5rem 0 !important;
  border-radius: 0 !important;
  font-size: 0.85rem;
}

.avviso-importi {
  background: #fffbeb !important;
  border: 1px solid #f59e0b !important;
  padding: 1rem 1.2rem !important;
  border-radius: 0 !important;
  font-size: 0.85rem;
  margin: 1.5rem 0 !important;
}

.last-updated {
  color: #6b7280 !important;
  font-size: 0.78rem !important;
}

.verified-by {
  color: #059669 !important;
  font-size: 0.78rem !important;
  font-style: italic !important;
  border-top: 1px solid #e2e8f0;
  padding-top: 0.8rem !important;
  margin-top: 1rem !important;
}

/* ── AUTHOR BOX ──────────────────────────────────────────── */
.bpo-author-box .wp-block-post-author {
  border: none;
  padding: 0;
  background: transparent;
}

.bpo-author-box .wp-block-post-author__avatar img {
  border-radius: 50% !important;
}

/* ── FOOTER LINKS ────────────────────────────────────────── */
.footer-links {
  list-style: none !important;
  padding-left: 0 !important;
}

.footer-links li {
  margin-bottom: 0.4rem;
}

.footer-links a {
  color: #94a3b8 !important;
  text-decoration: none;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: #ffffff !important;
  text-decoration: none;
}

/* ── NEWSLETTER BOX ──────────────────────────────────────── */
.bpo-newsletter-box input[type="email"] {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.bpo-newsletter-box input[type="email"]::placeholder {
  color: rgba(255,255,255,0.5);
}

.bpo-newsletter-box button {
  width: 100%;
  padding: 0.6rem;
  background: #1a56db;
  color: #fff;
  border: none;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}

.bpo-newsletter-box button:hover {
  background: #1e40af;
}

/* ── MOBILE OPTIMIZATIONS ────────────────────────────────── */
@media (max-width: 768px) {
  /* Colonne stack su mobile */
  .wp-block-columns {
    flex-direction: column !important;
  }

  .wp-block-column {
    flex-basis: 100% !important;
  }

  /* Griglia a colonna singola */
  .wp-block-post-template.is-layout-grid {
    grid-template-columns: 1fr !important;
  }

  /* Touch targets grandi (50-75 anni) */
  .wp-block-navigation a,
  .bpo-main-nav .wp-block-navigation-item a {
    padding: 0.8rem 1rem !important;
    min-height: 44px;
  }

  /* Article row: stack su mobile */
  .bpo-article-row {
    flex-direction: column !important;
  }

  .bpo-article-row .wp-block-post-featured-image {
    flex-basis: auto !important;
    width: 100% !important;
    height: 180px !important;
  }

  /* Breadcrumbs scrollabili */
  .bpo-breadcrumbs {
    white-space: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Ad slot full width mobile */
  .bpo-ad-between-sections {
    margin-left: -1rem;
    margin-right: -1rem;
  }

  /* Article container padding ridotto */
  .bpo-article-container {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  /* Sidebar newsletter nascosta su mobile (mostrata sotto) */
  .bpo-ad-sidebar {
    position: static;
  }

  /* Header: ricerca nascosta, menu hamburger */
  .wp-block-search {
    max-width: 200px;
  }
}

/* ── TABLET ──────────────────────────────────────────────── */
@media (min-width: 769px) and (max-width: 1024px) {
  .wp-block-post-template.is-layout-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* ── PRINT ───────────────────────────────────────────────── */
@media print {
  .site-header,
  .main-nav,
  .site-footer,
  .bpo-ad-slot,
  .bpo-mobile-nav,
  .bpo-font-toggle,
  .wp-block-search,
  .wp-block-navigation {
    display: none !important;
  }

  body {
    font-size: 12pt;
    color: #000;
  }

  a::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }
}

/* ── ACCESSIBILITY ───────────────────────────────────────── */
:focus-visible {
  outline: 3px solid #1a56db;
  outline-offset: 2px;
}

.skip-to-content {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: #1a56db;
  color: #fff;
  padding: 0.8rem 1.5rem;
  z-index: 1000;
  font-weight: 600;
}

.skip-to-content:focus {
  top: 0;
}

/* ── FONT SIZE TOGGLE (A-/A+) ────────────────────────────── */
.bpo-font-toggle {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-right: none;
  border-radius: 4px 0 0 4px;
  box-shadow: -2px 2px 8px rgba(0,0,0,.08);
  overflow: hidden;
}

.bpo-font-toggle button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: none;
  background: #fff;
  color: #1f2937;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background .2s;
  font-family: inherit;
}

.bpo-font-toggle button:hover {
  background: #dbeafe;
  color: #1a56db;
}

#bpo-font-reset {
  background: #f1f5f9;
  font-size: 0.7rem;
  color: #6b7280;
}

/* ── MOBILE BOTTOM NAVIGATION ────────────────────────────── */
.bpo-mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: #fff;
  border-top: 1px solid #e2e8f0;
  box-shadow: 0 -2px 8px rgba(0,0,0,.06);
  justify-content: space-around;
  align-items: center;
  padding: 0.4rem 0 env(safe-area-inset-bottom, 0.2rem);
}

.bpo-mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.12rem;
  padding: 0.4rem 0.6rem;
  color: #6b7280;
  text-decoration: none;
  font-size: 0.62rem;
  font-weight: 600;
  min-width: 60px;
  min-height: 48px;
  justify-content: center;
  transition: color .2s;
}

.bpo-mobile-nav-item:hover,
.bpo-mobile-nav-item:active {
  color: #1a56db;
  text-decoration: none;
}

.bpo-mobile-nav-item svg {
  width: 22px;
  height: 22px;
}

@media (max-width: 768px) {
  .bpo-mobile-nav {
    display: flex;
  }

  body {
    padding-bottom: 70px;
  }

  .bpo-font-toggle {
    bottom: 80px;
    top: auto;
    transform: none;
    right: 0;
  }

  .bpo-font-toggle button {
    width: 34px;
    height: 34px;
    font-size: 0.72rem;
  }
}
