/*
 * Varavallo CMS — CSS Frontend Responsive
 * Percorso: assets/css/frontend.css
 * Mobile-first con classi vcms-* usate dai blocchi GrapesJS
 */

/* ─── RESET ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --color-primary:   #B03A2E;
  --color-secondary: #1A1A1A;
  --color-bg:        #FFFFFF;
  --color-accent:    #EFF0F2;
  --font-titoli:     'Gloock', serif;
  --font-corpo:      'Roboto Condensed', sans-serif;
  --header-h:        64px;
  --radius:          6px;
  --max-w:           1100px;
  --gap:             2rem;
  --gap-sm:          1.25rem;
  --section-py:      80px;
  --section-py-sm:   48px;
  --section-px:      24px;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-corpo);
  color: var(--color-secondary);
  background: var(--color-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a   { color: var(--color-primary); }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-titoli);
  font-weight: 400;
  line-height: 1.2;
}

/* ─── CONTAINER ──────────────────────────────────────────────── */
.vcms-container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--section-px);
}

/* ─── SEZIONI ────────────────────────────────────────────────── */
.vcms-section {
  padding: var(--section-py) var(--section-px);
}

.vcms-section-sm {
  padding: var(--section-py-sm) var(--section-px);
}

/* ─── GRIGLIE ────────────────────────────────────────────────── */
.vcms-grid-2,
.vcms-grid-3,
.vcms-grid-4,
.vcms-grid-auto {
  display: grid;
  gap: var(--gap);
}

/* Mobile first: tutto in colonna singola */
.vcms-grid-2    { grid-template-columns: 1fr; }
.vcms-grid-3    { grid-template-columns: 1fr; }
.vcms-grid-4    { grid-template-columns: 1fr 1fr; }
.vcms-grid-auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* Split 50/50 */
.vcms-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
  align-items: center;
}

/* Tablet → 768px */
@media (min-width: 768px) {
  .vcms-grid-2    { grid-template-columns: repeat(2, 1fr); }
  .vcms-grid-3    { grid-template-columns: repeat(2, 1fr); }
  .vcms-grid-4    { grid-template-columns: repeat(2, 1fr); }
  .vcms-split     { grid-template-columns: 1fr 1fr; }
}

/* Desktop → 1024px */
@media (min-width: 1024px) {
  .vcms-grid-3    { grid-template-columns: repeat(3, 1fr); }
  .vcms-grid-4    { grid-template-columns: repeat(4, 1fr); }
}

/* ─── TIPOGRAFIA RESPONSIVE ──────────────────────────────────── */
.vcms-h1 { font-family: var(--font-titoli); font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 400; line-height: 1.1; }
.vcms-h2 { font-family: var(--font-titoli); font-size: clamp(1.5rem, 3.5vw, 2.2rem); font-weight: 400; }
.vcms-h3 { font-family: var(--font-titoli); font-size: clamp(1.1rem, 2.5vw, 1.4rem); font-weight: 400; }
.vcms-lead { font-size: clamp(.95rem, 1.5vw, 1.15rem); line-height: 1.7; }
.vcms-eyebrow {
  font-size: .78rem; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--color-primary);
  display: block; margin-bottom: .75rem;
}

/* ─── TESTO CENTRATO / ALLINEATO ─────────────────────────────── */
.vcms-text-center { text-align: center; }
.vcms-text-left   { text-align: left; }
.vcms-section-header {
  text-align: center;
  max-width: 680px;
  margin: 0 auto 3rem;
}

/* ─── BOTTONI ────────────────────────────────────────────────── */
.vcms-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .85rem 2rem;
  border-radius: var(--radius);
  font-family: var(--font-corpo);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: .03em;
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  white-space: nowrap;
}

.vcms-btn:active { transform: scale(.97); }

.vcms-btn-primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.vcms-btn-primary:hover { opacity: .88; }

.vcms-btn-outline {
  background: transparent;
  color: #fff;
  border-color: rgba(255,255,255,.4);
}
.vcms-btn-outline:hover { border-color: #fff; }

.vcms-btn-outline-dark {
  background: transparent;
  color: var(--color-secondary);
  border-color: var(--color-secondary);
}
.vcms-btn-outline-dark:hover { background: var(--color-secondary); color: #fff; }

.vcms-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  justify-content: center;
}

@media (max-width: 480px) {
  .vcms-btn { width: 100%; }
  .vcms-btn-group { flex-direction: column; }
}

/* ─── CARD ───────────────────────────────────────────────────── */
.vcms-card {
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 8px rgba(0,0,0,.06);
  transition: transform .2s, box-shadow .2s;
}
.vcms-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 24px rgba(0,0,0,.1);
}
.vcms-card-body { padding: 1.5rem; }

/* ─── IMMAGINE RESPONSIVE ────────────────────────────────────── */
.vcms-img-cover {
  width: 100%;
  object-fit: cover;
  display: block;
  border-radius: var(--radius);
}

.vcms-img-placeholder {
  width: 100%;
  background: var(--color-accent);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ccc;
  font-size: 3rem;
}

/* ─── VIDEO EMBED RESPONSIVE ─────────────────────────────────── */
.vcms-video-wrap {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
  background: #000;
}
.vcms-video-wrap iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: 0;
}

/* ─── HERO ───────────────────────────────────────────────────── */
.vcms-hero {
  background: var(--color-secondary);
  color: #fff;
  padding: clamp(60px, 10vw, 120px) var(--section-px);
  text-align: center;
}

.vcms-hero-inner {
  max-width: 800px;
  margin: 0 auto;
}

.vcms-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  justify-content: center;
  margin-top: 2rem;
}

/* ─── NUMERI / STATS ─────────────────────────────────────────── */
.vcms-stat-value {
  font-family: var(--font-titoli);
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 400;
  line-height: 1;
  margin-bottom: .4rem;
}

/* ─── TESTIMONIAL ────────────────────────────────────────────── */
.vcms-quote {
  font-family: var(--font-titoli);
  font-size: clamp(1rem, 2vw, 1.2rem);
  font-weight: 400;
  font-style: italic;
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

/* ─── FORM ───────────────────────────────────────────────────── */
.vcms-form { display: flex; flex-direction: column; gap: 1rem; }

.vcms-form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .vcms-form-row { grid-template-columns: 1fr 1fr; }
}

.vcms-input,
.vcms-textarea {
  width: 100%;
  padding: .75rem 1rem;
  border: 1px solid #ddd;
  border-radius: var(--radius);
  font-family: var(--font-corpo);
  font-size: .95rem;
  color: var(--color-secondary);
  background: #fafafa;
  outline: none;
  transition: border-color .15s;
}

.vcms-input:focus,
.vcms-textarea:focus { border-color: var(--color-primary); background: #fff; }

.vcms-textarea { resize: vertical; min-height: 120px; }

/* ─── TEAM ───────────────────────────────────────────────────── */
.vcms-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 1rem;
  background: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}

/* ─── SOCIAL ICONS ───────────────────────────────────────────── */
.vcms-social-links {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  justify-content: center;
}

.vcms-social-link {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.5);
  text-decoration: none;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  transition: border-color .15s, color .15s;
}

.vcms-social-link:hover {
  border-color: rgba(255,255,255,.6);
  color: #fff;
}

/* ─── BADGE / EYEBROW ────────────────────────────────────────── */
.vcms-badge {
  display: inline-block;
  padding: .3rem .8rem;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  background: rgba(176,58,46,.1);
  color: var(--color-primary);
  margin-bottom: 1rem;
}

/* ─── FOOTER ─────────────────────────────────────────────────── */
.site-footer {
  background: var(--color-secondary);
  color: rgba(255,255,255,.4);
  padding: 3rem var(--section-px) 2rem;
}

.site-footer__inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  text-align: center;
}

@media (min-width: 640px) {
  .site-footer__inner {
    grid-template-columns: 1fr 1fr;
    text-align: left;
  }
}

@media (min-width: 900px) {
  .site-footer__inner {
    grid-template-columns: 2fr 1fr 1fr;
  }
}

.site-footer__name {
  font-family: var(--font-titoli);
  font-size: 1.3rem;
  color: rgba(255,255,255,.8);
}

.site-footer__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

@media (min-width: 640px) {
  .site-footer__nav { justify-content: flex-start; flex-direction: column; gap: .5rem; }
}

.site-footer__nav a {
  font-size: .85rem;
  color: rgba(255,255,255,.35);
  text-decoration: none;
  transition: color .15s;
}
.site-footer__nav a:hover { color: rgba(255,255,255,.7); }

.site-footer__copy {
  font-size: .75rem;
  grid-column: 1 / -1;
  border-top: 1px solid rgba(255,255,255,.07);
  padding-top: 1.5rem;
  margin-top: .5rem;
  text-align: center;
}

/* ─── HEADER ─────────────────────────────────────────────────── */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--color-bg);
  border-bottom: 1px solid rgba(0,0,0,.07);
  transition: box-shadow .25s, transform .25s;
}

.site-header.scrolled { box-shadow: 0 2px 20px rgba(0,0,0,.1); }
.site-header.hidden   { transform: translateY(-100%); }

.site-header__inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--section-px);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.site-logo { text-decoration: none; flex-shrink: 0; display: flex; align-items: center; }
.site-logo__img  { max-height: 40px; width: auto; }
.site-logo__text { font-family: var(--font-titoli); font-size: 1.3rem; color: var(--color-secondary); }

/* Nav desktop */
.site-nav {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.site-nav__link {
  font-size: .9rem;
  color: var(--color-secondary);
  text-decoration: none;
  letter-spacing: .03em;
  position: relative;
  padding-bottom: .15rem;
  transition: color .15s;
}

.site-nav__link::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0;
  width: 0; height: 2px;
  background: var(--color-primary);
  transition: width .2s;
}

.site-nav__link:hover,
.site-nav__link.active { color: var(--color-primary); }
.site-nav__link:hover::after,
.site-nav__link.active::after { width: 100%; }

/* Hamburger */
.site-nav__toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: .4rem;
}

.site-nav__toggle span {
  display: block;
  width: 22px; height: 2px;
  background: var(--color-secondary);
  border-radius: 2px;
  transition: transform .25s, opacity .25s;
}

.site-nav__toggle.open span:nth-child(1) { transform: rotate(45deg) translate(5px,5px); }
.site-nav__toggle.open span:nth-child(2) { opacity: 0; }
.site-nav__toggle.open span:nth-child(3) { transform: rotate(-45deg) translate(5px,-5px); }

/* ─── MOBILE NAV ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .site-nav__toggle { display: flex; }

  .site-nav {
    position: fixed;
    top: var(--header-h);
    left: 0; right: 0;
    background: var(--color-bg);
    flex-direction: column;
    align-items: flex-start;
    padding: 1.5rem var(--section-px);
    gap: 1.25rem;
    border-top: 1px solid rgba(0,0,0,.07);
    box-shadow: 0 8px 24px rgba(0,0,0,.1);
    transform: translateY(-110%);
    opacity: 0;
    transition: transform .25s, opacity .25s;
    pointer-events: none;
  }

  .site-nav.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .site-nav__link { font-size: 1.05rem; }
}

/* ─── PAGINA CONTENT ─────────────────────────────────────────── */
.page-content { min-height: 60vh; }

/* ─── UTILITIES ──────────────────────────────────────────────── */
.vcms-hidden-mobile  { display: block; }
.vcms-hidden-desktop { display: none; }

@media (max-width: 768px) {
  .vcms-hidden-mobile  { display: none; }
  .vcms-hidden-desktop { display: block; }
  .vcms-section   { padding: var(--section-py-sm) var(--section-px); }
  .vcms-grid-4    { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .vcms-grid-4 { grid-template-columns: 1fr; }
  :root { --section-px: 16px; --gap: 1.25rem; }
}

/* ─── FORMS FRONTEND ─────────────────────────────────────────── */
form input[type=text],
form input[type=email],
form input[type=tel],
form textarea,
form select {
  width: 100%;
  padding: .75rem 1rem;
  border: 1px solid #ddd;
  border-radius: var(--radius);
  font-family: var(--font-corpo);
  font-size: .95rem;
  color: var(--color-secondary);
  margin-bottom: 1rem;
  outline: none;
  transition: border-color .15s;
  background: #fafafa;
}

form input:focus, form textarea:focus { border-color: var(--color-primary); background: #fff; }
form button[type=submit], .vcms-btn-submit {
  width: 100%;
  padding: .9rem;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-corpo);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
}
form button[type=submit]:hover { opacity: .88; }

/* ─── BLOG ───────────────────────────────────────────────────── */
.article-body { font-size: 1.05rem; line-height: 1.8; color: #333; }
.article-body h2 { font-family: var(--font-titoli); font-size: 1.6rem; margin: 2.5rem 0 1rem; color: var(--color-secondary); }
.article-body h3 { font-family: var(--font-titoli); font-size: 1.25rem; margin: 2rem 0 .75rem; }
.article-body p  { margin-bottom: 1.25rem; }
.article-body img { border-radius: var(--radius); margin: 1.5rem 0; max-width: 100%; }
.article-body ul, .article-body ol { padding-left: 1.5rem; margin-bottom: 1.25rem; }
.article-body li { margin-bottom: .4rem; }
.article-body blockquote {
  border-left: 3px solid var(--color-primary);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  background: var(--color-accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  color: #555;
}
.article-body a { color: var(--color-primary); }
.article-body code {
  background: var(--color-accent);
  padding: .15rem .4rem;
  border-radius: 3px;
  font-size: .88em;
}
