/*
Theme Name: Webvoria
Theme URI: https://webvoria.com
Author: Webvoria
Author URI: https://webvoria.com
Description: Tema custom B2B di Webvoria. Design orientato alla conversione, Core Web Vitals ottimizzati, motore landing/lead/SEO integrato. Sostituisce Avada e assorbe il plugin webvoria-leads.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: webvoria
*/

/* =============================================
   DESIGN TOKENS
   ============================================= */
:root {
  /* Brand */
  --wv-primary: #3b82f6;
  --wv-primary-hover: #2563eb;
  --wv-accent: #0073e6;
  --wv-link: #0369a1;
  --wv-link-hover: #0284c7;

  /* Ink / surfaces */
  --wv-ink-900: #0f172a;
  --wv-ink-800: #1e293b;
  --wv-ink-700: #334155;
  --wv-ink-600: #475569;
  --wv-ink-500: #64748b;
  --wv-ink-400: #94a3b8;
  --wv-line: #e2e8f0;
  --wv-line-strong: #cbd5e1;
  --wv-surface: #ffffff;
  --wv-surface-2: #f8fafc;
  --wv-surface-3: #f3f4f6;
  --wv-hero-overlay: rgba(19, 27, 33, .85);

  /* Layout */
  --wv-container: 1140px;
  --wv-gutter: 24px;
  --wv-radius: 8px;
  --wv-radius-lg: 12px;
  --wv-shadow-sm: 0 1px 8px rgba(0, 0, 0, .06);
  --wv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, .08), 0 2px 4px -1px rgba(0, 0, 0, .04);
  --wv-shadow-lg: 0 10px 25px rgba(0, 0, 0, .1);

  /* Type */
  --wv-font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* =============================================
   RESET / BASE
   ============================================= */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--wv-font);
  color: var(--wv-ink-800);
  background: var(--wv-surface);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; }

a { color: var(--wv-link); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.2; color: var(--wv-ink-800); }

/* =============================================
   LAYOUT
   ============================================= */
.wv-container {
  width: 100%;
  max-width: var(--wv-container);
  margin: 0 auto;
  padding: 0 var(--wv-gutter);
}

.wv-section { padding: 70px 0; }
.wv-section--white { background: var(--wv-surface); }
.wv-section--gray  { background: var(--wv-surface-3); }
.wv-section--dark  { background: var(--wv-ink-800); border-top: 6px solid var(--wv-accent); }
.wv-section--cta-mid { background: #e0f2fe; padding: 44px 0; }

.wv-section__icon {
  text-align: center;
  font-size: 42px;
  color: var(--wv-accent);
  margin-bottom: 16px;
}
.wv-section__title {
  text-align: center;
  font-size: clamp(24px, 4vw, 40px);
  color: var(--wv-ink-800);
  font-weight: 700;
  margin: 0 0 24px;
}
.wv-section__subtitle {
  text-align: center;
  font-size: 18px;
  color: var(--wv-ink-600);
  max-width: 800px;
  margin: 0 auto 50px;
}

/* =============================================
   BUTTONS
   ============================================= */
.wv-btn {
  display: inline-block;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--wv-radius);
  cursor: pointer;
  transition: background .2s ease, transform .15s ease;
  text-align: center;
  line-height: 1.4;
  border: none;
}
.wv-btn--primary {
  background: var(--wv-primary);
  color: #fff !important;
  padding: 12px 28px;
  font-size: 16px;
}
.wv-btn--primary:hover {
  background: var(--wv-primary-hover);
  transform: translateY(-1px);
  color: #fff !important;
  text-decoration: none;
}
.wv-btn--lg { padding: 18px 48px; font-size: 18px; }

/* =============================================
   HEADER (sticky, site-wide)
   ============================================= */
.wv-header {
  position: sticky;
  top: 0;
  z-index: 9990;
  background: #fff;
  border-bottom: 1px solid var(--wv-line);
  box-shadow: var(--wv-shadow-sm);
}
.wv-header__inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  max-width: var(--wv-container);
  margin: 0 auto;
  padding: 12px var(--wv-gutter);
  gap: 16px;
}
.wv-header__logo { min-width: 0; display: flex; align-items: center; justify-self: start; }
.wv-header__logo img { height: 42px; max-width: 200px; width: auto; display: block; object-fit: contain; }

.wv-nav { display: flex; align-items: center; gap: 22px; justify-self: center; }
.wv-nav__menu { display: flex; align-items: center; gap: 2px; list-style: none; margin: 0; padding: 0; }
.wv-nav__menu li { position: relative; }
.wv-nav__menu > li > a {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--wv-ink-700); font-size: 15px; font-weight: 500;
  padding: 9px 14px; border-radius: 8px;
  transition: color .15s ease, background .15s ease;
}
.wv-nav__menu > li > a:hover { color: var(--wv-primary); background: #f1f5f9; text-decoration: none; }
.wv-nav__menu > li.current-menu-item > a,
.wv-nav__menu > li.current-menu-parent > a,
.wv-nav__menu > li.current-menu-ancestor > a,
.wv-nav__menu > li.current_page_item > a { color: var(--wv-primary); }

/* Caret per le voci con sottomenu */
.wv-nav__menu .menu-item-has-children > a::after {
  content: '\f107'; font-family: 'Font Awesome 6 Free'; font-weight: 900;
  font-size: 12px; color: var(--wv-ink-400); transition: transform .15s ease;
}
.wv-nav__menu .menu-item-has-children:hover > a::after { transform: rotate(180deg); color: var(--wv-primary); }

/* Dropdown */
.wv-nav__menu .sub-menu {
  position: absolute; top: calc(100% + 6px); left: 0;
  min-width: 240px;
  background: #fff; border: 1px solid var(--wv-line); border-radius: 10px;
  box-shadow: var(--wv-shadow-lg);
  padding: 8px; margin: 0; list-style: none;
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity .15s ease, transform .15s ease, visibility .15s;
  z-index: 9991;
}
.wv-nav__menu li:hover > .sub-menu,
.wv-nav__menu li:focus-within > .sub-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.wv-nav__menu .sub-menu a {
  display: block; padding: 9px 12px; border-radius: 6px;
  font-size: 14.5px; color: var(--wv-ink-700); font-weight: 500;
}
.wv-nav__menu .sub-menu a:hover { background: #eff6ff; color: var(--wv-primary); text-decoration: none; }

.wv-header__cta { flex-shrink: 0; white-space: nowrap; justify-self: end; }

.wv-nav__toggle {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--wv-ink-800);
  cursor: pointer;
  padding: 6px;
}

/* Backdrop + bottone chiusura: nascosti su desktop, attivi nel drawer mobile */
.wv-nav__backdrop,
.wv-nav__close { display: none; }
body.wv-nav-open { overflow: hidden; }

/* =============================================
   FOOTER (site-wide)
   ============================================= */
.wv-footer { background: var(--wv-ink-900); color: var(--wv-ink-400); padding: 60px 0 0; }
.wv-footer__grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}
.wv-footer__logo { height: 36px; width: auto; margin-bottom: 16px; }
.wv-footer__tagline { font-size: 14px; line-height: 1.6; margin: 0; color: var(--wv-ink-500); }
.wv-footer__heading {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin: 0 0 16px;
}
.wv-footer__list { list-style: none; padding: 0; margin: 0; }
.wv-footer__list li { margin-bottom: 8px; }
.wv-footer__list a { color: var(--wv-ink-400); text-decoration: none; font-size: 14px; transition: color .2s ease; }
.wv-footer__list a:hover { color: #fff; }
.wv-footer__bottom {
  border-top: 1px solid var(--wv-ink-800);
  padding: 20px 0;
  text-align: center;
  font-size: 13px;
  color: var(--wv-ink-500);
}
.wv-footer__bottom p { margin: 0; }
.wv-footer__bottom a { color: var(--wv-ink-400); }

/* =============================================
   RESPONSIVE (global)
   ============================================= */
@media (max-width: 960px) {
  .wv-section { padding: 55px 0; }
  .wv-footer__grid { grid-template-columns: 1fr 1fr; gap: 30px; }
}

@media (max-width: 860px) {
  .wv-nav__menu {
    position: fixed;
    top: 0; right: 0;
    height: 100vh;
    width: min(82vw, 340px);
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    background: #fff;
    box-shadow: -4px 0 24px rgba(0,0,0,.12);
    padding: 80px 22px 28px;
    transform: translateX(100%);
    transition: transform .25s ease;
    z-index: 9995;
    overflow-y: auto;
  }
  .wv-nav__menu.is-open { transform: translateX(0); }
  .wv-nav__menu li { width: 100%; }
  .wv-nav__menu > li > a { font-size: 17px; padding: 12px 10px; width: 100%; }
  .wv-nav__menu > li + li { border-top: 1px solid var(--wv-surface-3); }
  /* Sottomenu statici e indentati nel drawer */
  .wv-nav__menu .sub-menu {
    position: static; opacity: 1; visibility: visible; transform: none;
    box-shadow: none; border: none; border-radius: 0;
    min-width: 0; padding: 0 0 6px 14px; margin: 0;
  }
  .wv-nav__menu .sub-menu a { font-size: 15px; padding: 8px 10px; color: var(--wv-ink-600); }
  .wv-nav__menu .menu-item-has-children > a::after { margin-left: auto; }
  .wv-nav__toggle { display: inline-flex; order: 3; }
  .wv-header__cta { display: none; }
  /* Su mobile torna a flex: logo a sinistra, hamburger a destra. */
  .wv-header__inner { display: flex; justify-content: space-between; }
  .wv-nav { justify-self: auto; margin-left: auto; }

  /* Backdrop scuro dietro al drawer */
  .wv-nav__backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .5);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s;
    z-index: 9994;
  }
  .wv-nav__backdrop.is-visible { opacity: 1; visibility: visible; }

  /* Bottone X di chiusura, sopra al drawer (sempre tappabile) */
  .wv-nav__close {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 14px;
    right: 16px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid var(--wv-line);
    color: var(--wv-ink-800);
    font-size: 19px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: scale(.9);
    transition: opacity .2s ease, transform .2s ease, visibility .2s;
    z-index: 9996;
  }
  .wv-nav__close.is-visible { opacity: 1; visibility: visible; transform: scale(1); }
}

@media (max-width: 640px) {
  .wv-header__inner {
    padding: 10px max(18px, env(safe-area-inset-right)) 10px max(18px, env(safe-area-inset-left));
    gap: 10px;
  }
  .wv-header__logo img { height: 28px; max-width: 130px; }
  .wv-section { padding: 40px 0; }
  .wv-section--cta-mid { padding: 30px 0; }
  .wv-container {
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
  }
  .wv-btn--lg { padding: 14px 28px; font-size: 16px; width: 100%; max-width: 320px; }
  .wv-footer { padding-top: 48px; }
  .wv-footer__grid { grid-template-columns: 1fr; gap: 26px; }
}

@media (max-width: 400px) {
  .wv-header__logo img { height: 24px; max-width: 100px; }
}

/* =============================================
   CONTENUTI: blog / archivio / articolo / pagina
   ============================================= */
.wv-container--narrow { max-width: 800px; }

.screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}

/* Page hero (blog index / archivi / 404) */
.wv-page-hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
  color: #fff;
  padding: 64px 0;
  text-align: center;
}
.wv-page-hero__title { color: #fff; font-size: clamp(28px, 4vw, 42px); font-weight: 800; margin: 0 0 12px; }
.wv-page-hero__sub { color: #cbd5e1; font-size: 18px; max-width: 720px; margin: 0 auto; }

/* Griglia post */
.wv-post-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}
.wv-post-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--wv-line);
  border-radius: var(--wv-radius-lg);
  overflow: hidden;
  transition: box-shadow .2s ease, transform .2s ease;
}
.wv-post-card:hover { box-shadow: var(--wv-shadow-lg); transform: translateY(-3px); }
.wv-post-card__media { display: block; aspect-ratio: 16 / 9; background: #eef2f7; overflow: hidden; }
.wv-post-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wv-post-card__placeholder { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 38px; color: #b6c2d2; }
.wv-post-card__body { padding: 22px 22px 24px; display: flex; flex-direction: column; flex: 1; }
.wv-post-card__cat {
  align-self: flex-start;
  background: #eff6ff; color: var(--wv-primary);
  font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 20px; margin-bottom: 12px;
  text-transform: uppercase; letter-spacing: .3px;
}
.wv-post-card__title { font-size: 19px; font-weight: 700; line-height: 1.3; margin: 0 0 10px; }
.wv-post-card__title a { color: var(--wv-ink-800); }
.wv-post-card__title a:hover { color: var(--wv-primary); text-decoration: none; }
.wv-post-card__excerpt { font-size: 14.5px; color: var(--wv-ink-600); line-height: 1.6; margin: 0 0 18px; }
.wv-post-card__footer { margin-top: auto; display: flex; align-items: center; justify-content: space-between; }
.wv-post-card__date { font-size: 13px; color: var(--wv-ink-500); }
.wv-post-card__more { font-size: 14px; font-weight: 600; color: var(--wv-primary); }

.wv-pagination { margin-top: 48px; text-align: center; }
.wv-pagination .page-numbers {
  display: inline-block; padding: 8px 14px; margin: 0 3px;
  border: 1px solid var(--wv-line); border-radius: 6px;
  color: var(--wv-ink-700); text-decoration: none; font-size: 14px;
}
.wv-pagination .page-numbers.current { background: var(--wv-primary); color: #fff; border-color: var(--wv-primary); }
.wv-pagination .page-numbers:hover:not(.current) { border-color: var(--wv-primary); }
.wv-empty { text-align: center; color: var(--wv-ink-500); font-size: 17px; padding: 40px 0; }

/* Articolo singolo */
.wv-article__hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
  color: #fff;
  padding: 56px 0 48px;
}
.wv-article__breadcrumb { font-size: 13px; color: #94a3b8; margin-bottom: 18px; }
.wv-article__breadcrumb a { color: #bae6fd; }
.wv-article__title { color: #fff; font-size: clamp(28px, 4vw, 44px); font-weight: 800; line-height: 1.2; margin: 0 0 18px; }
.wv-article__meta { display: flex; flex-wrap: wrap; gap: 20px; font-size: 14px; color: #cbd5e1; }
.wv-article__meta i { color: var(--wv-primary); margin-right: 6px; }
.wv-article__featured { margin: -32px 0 0; border-radius: var(--wv-radius-lg); overflow: hidden; box-shadow: var(--wv-shadow-lg); }
.wv-article__featured img { width: 100%; height: auto; display: block; }
.wv-article__body { padding: 48px 0; font-size: 17px; line-height: 1.8; color: var(--wv-ink-700); }
.wv-article__body h2 { font-size: 26px; font-weight: 700; margin: 40px 0 16px; color: var(--wv-ink-900); }
.wv-article__body h3 { font-size: 20px; font-weight: 700; margin: 28px 0 12px; color: var(--wv-ink-800); }
.wv-article__body p { margin: 0 0 18px; }
.wv-article__body ul, .wv-article__body ol { margin: 0 0 18px; padding-left: 24px; }
.wv-article__body li { margin-bottom: 8px; }
.wv-article__body a { color: var(--wv-primary); text-decoration: underline; }
.wv-article__body img { border-radius: var(--wv-radius); height: auto; }
.wv-article__body table { width: 100%; border-collapse: collapse; margin: 24px 0; }
.wv-article__tags { display: flex; flex-wrap: wrap; gap: 10px; padding-bottom: 32px; }
.wv-tag { background: var(--wv-surface-3); color: var(--wv-ink-600); font-size: 13px; padding: 5px 12px; border-radius: 6px; }
.wv-tag:hover { background: #e2e8f0; text-decoration: none; }

@media (max-width: 860px) {
  .wv-post-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .wv-post-grid { grid-template-columns: 1fr; }
  .wv-article__body { font-size: 16px; padding: 32px 0; }
  .wv-article__featured { margin-top: 0; }
}
