/* ==========================
   FiscoPrevidente — style.css
   Soft Pastel, mobile-first, flex-only layouts
   ========================== */

/* ===== CSS RESET & NORMALIZE ===== */
* { box-sizing: border-box; }
html, body, h1, h2, h3, h4, h5, h6, p, ul, ol, li, figure, blockquote { margin: 0; padding: 0; }
img { max-width: 100%; height: auto; display: block; }
a { text-decoration: none; color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
ul, ol { padding-left: 1.2rem; }

/* ===== THEME VARIABLES (with fallbacks) ===== */
:root {
  --brand-primary: #0E2A47;
  --brand-secondary: #2E7D32;
  --brand-accent: #F7F9FC;
  --text: #1E2A35;
  --muted: #5B6B7A;
  --white: #FFFFFF;
  --pastel-peach: #FFE7DE;
  --pastel-lavender: #F0EAFB;
  --pastel-mint: #EAF7F0;
  --pastel-sky: #EAF3FF;
  --pastel-rose: #F8EAF2;
  --shadow: 0 10px 30px rgba(14, 42, 71, 0.08);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --focus: #92B4F4; /* soft blue focus */
}

/* ===== BASE TYPOGRAPHY ===== */
body {
  font-family: Verdana, Geneva, sans-serif;
  color: var(--text);
  background: var(--brand-accent);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--brand-primary);
  line-height: 1.25;
  letter-spacing: 0.2px;
}

h1 { font-size: 32px; margin-bottom: 16px; }
h2 { font-size: 24px; margin-bottom: 16px; }
h3 { font-size: 18px; margin-bottom: 12px; }
p { margin-bottom: 14px; }
small { color: var(--muted); }

/* ===== LINKS ===== */
a { color: var(--brand-secondary); text-decoration-color: rgba(46, 125, 50, 0.4); text-underline-offset: 3px; }
a:hover { text-decoration: underline; }

/* ===== ACCESSIBILITY FOCUS ===== */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

/* ===== LAYOUT CONTAINERS ===== */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.content-wrapper {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: flex-start;
}

/* Generic sections (soft pastel rhythm) */
section { margin: 0 0 48px; padding: 28px 0; }
section.hero { margin-bottom: 56px; padding: 42px 0; background: var(--pastel-sky); }

/* ===== MANDATORY SPACING AND ALIGNMENT PATTERNS ===== */
.section { margin-bottom: 60px; padding: 40px 20px; }
.card-container { display: flex; flex-wrap: wrap; gap: 24px; }
.card { margin-bottom: 20px; position: relative; }
.content-grid { display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-between; }
.text-image-section { display: flex; align-items: center; gap: 30px; flex-wrap: wrap; }
.testimonial-card { display: flex; align-items: center; gap: 20px; padding: 20px; }
.feature-item { display: flex; flex-direction: column; align-items: flex-start; gap: 15px; }

/* ===== HEADER ===== */
header { background: var(--white); box-shadow: var(--shadow); position: sticky; top: 0; z-index: 900; }
header .content-wrapper { flex-direction: row; align-items: center; justify-content: space-between; padding: 14px 0; }
.logo img { height: 34px; }

/* Desktop nav hidden by default (mobile-first) */
.main-nav { display: none; align-items: center; gap: 16px; }
.main-nav a { color: var(--brand-primary); padding: 10px 12px; border-radius: 10px; transition: background-color .2s ease, color .2s ease; }
.main-nav a[aria-current="page"], .main-nav a:hover { background: var(--pastel-sky); color: var(--brand-primary); }

.header-ctas { display: none; align-items: center; gap: 10px; }

/* ===== BUTTONS ===== */
.btn-primary, .btn-secondary, .btn-link { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 16px; border-radius: var(--radius); border: 1px solid transparent; transition: background-color .25s ease, color .25s ease, border-color .25s ease, transform .15s ease, box-shadow .25s ease; cursor: pointer; }

/* Pastel default with strong hover for clear hierarchy */
.btn-primary { background: #D6E9FF; color: var(--brand-primary); border-color: #C2DAF8; box-shadow: 0 6px 16px rgba(14,42,71,0.06); }
.btn-primary:hover { background: var(--brand-primary); color: var(--white); border-color: var(--brand-primary); transform: translateY(-1px); box-shadow: 0 10px 24px rgba(14,42,71,0.18); }

.btn-secondary { background: #E6F6EA; color: var(--brand-secondary); border-color: #CFEBD7; box-shadow: 0 6px 16px rgba(46,125,50,0.06); }
.btn-secondary:hover { background: var(--brand-secondary); color: var(--white); border-color: var(--brand-secondary); transform: translateY(-1px); box-shadow: 0 10px 24px rgba(46,125,50,0.18); }

.btn-link { background: transparent; color: var(--brand-secondary); padding: 8px 0; border-radius: 8px; text-decoration: underline; text-underline-offset: 3px; }
.btn-link:hover { color: #1f5a21; }

/* ===== HERO ===== */
.hero h1 { font-size: 32px; }
.hero .subheadline { font-size: 16px; color: var(--muted); max-width: 70ch; }
.hero-ctas { display: flex; flex-wrap: wrap; gap: 12px; }

/* ===== TEXT BLOCKS ===== */
.text-section { display: flex; flex-direction: column; gap: 12px; background: var(--white); border: 1px solid rgba(14,42,71,0.06); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.text-section ul, .text-section ol { margin-left: 16px; }
.text-section li { margin: 6px 0; }
.text-section p:last-child { margin-bottom: 0; }

/* Trust badges */
.trust-badges ul { list-style: none; display: flex; flex-wrap: wrap; gap: 14px; padding: 0; }
.trust-badges li { display: flex; align-items: center; gap: 8px; background: var(--white); padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid rgba(14,42,71,0.06); box-shadow: 0 4px 12px rgba(14,42,71,0.05); color: var(--brand-primary); }
.trust-badges img { width: 18px; height: 18px; }

/* ===== CARDS ===== */
.card { background: var(--white); border: 1px solid rgba(14,42,71,0.08); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .25s ease; }
.card:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(14,42,71,0.15); }

/* ===== TESTIMONIALS (high contrast on light background) ===== */
.testimonial-card { background: var(--pastel-rose); border: 1px solid rgba(14,42,71,0.12); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); }
.testimonial-card p { margin: 0; }
.testimonial-card p + p { color: var(--brand-primary); }

/* ===== LISTS & ICON ROWS ===== */
.text-section li img, li img { width: 18px; height: 18px; vertical-align: middle; margin-right: 6px; }

/* ===== FOOTER ===== */
footer { background: var(--pastel-lavender); border-top: 1px solid rgba(14,42,71,0.08); }
footer .text-section { background: transparent; border: none; box-shadow: none; padding: 0; }
footer a { color: var(--brand-primary); }

/* ===== NAVIGATION: MOBILE MENU ===== */
.mobile-menu-toggle { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid rgba(14,42,71,0.12); background: var(--white); color: var(--brand-primary); cursor: pointer; box-shadow: 0 4px 12px rgba(14,42,71,0.06); transition: background-color .2s ease, transform .1s ease; }
.mobile-menu-toggle:hover { background: var(--pastel-sky); }
.mobile-menu-toggle:active { transform: scale(0.98); }

.mobile-menu { position: fixed; top: 0; right: 0; bottom: 0; width: 100%; max-width: 360px; background: var(--white); box-shadow: -10px 0 30px rgba(14,42,71,0.18); transform: translateX(100%); transition: transform .35s ease; z-index: 1000; display: flex; flex-direction: column; }
/* Support multiple open flags */
.mobile-menu.open, .mobile-menu.is-open, .mobile-menu.active, body.menu-open .mobile-menu { transform: translateX(0); }

.mobile-menu-close { align-self: flex-end; margin: 12px; width: 40px; height: 40px; border-radius: 10px; border: 1px solid rgba(14,42,71,0.12); background: var(--white); color: var(--brand-primary); cursor: pointer; box-shadow: 0 4px 12px rgba(14,42,71,0.06); }

.mobile-nav { display: flex; flex-direction: column; gap: 6px; padding: 10px 16px 24px; overflow-y: auto; }
.mobile-nav a { padding: 12px 12px; border-radius: 12px; color: var(--brand-primary); background: transparent; border: 1px solid transparent; }
.mobile-nav a:hover { background: var(--pastel-sky); }
.mobile-nav a[aria-current="page"] { background: #D6E9FF; border-color: #C2DAF8; }

/* Optional page overlay when menu open */
body.menu-open::after { content: ""; position: fixed; inset: 0; background: rgba(14,42,71,0.32); z-index: 999; }

/* ===== COOKIE CONSENT ===== */
.cookie-banner { position: fixed; left: 12px; right: 12px; bottom: 12px; background: var(--white); border: 1px solid rgba(14,42,71,0.12); border-radius: var(--radius-lg); box-shadow: 0 20px 40px rgba(14,42,71,0.18); z-index: 1100; padding: 14px; display: flex; flex-direction: column; gap: 12px; transform: translateY(140%); opacity: 0; transition: transform .35s ease, opacity .35s ease; }
.cookie-banner.show { transform: translateY(0); opacity: 1; }
.cookie-banner-content { display: flex; flex-direction: column; gap: 10px; }
.cookie-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.cookie-actions .btn-primary { background: #D6E9FF; color: var(--brand-primary); border-color: #C2DAF8; }
.cookie-actions .btn-primary:hover { background: var(--brand-primary); color: var(--white); }
.cookie-actions .btn-secondary { background: #FFEFEA; color: #7A2F1B; border-color: #FFD8CC; }
.cookie-actions .btn-secondary:hover { background: #E25A2E; color: var(--white); border-color: #E25A2E; }
.cookie-actions .btn-link { color: var(--brand-primary); }

/* Cookie settings modal */
.cookie-modal { position: fixed; inset: 0; background: rgba(14,42,71,0.4); z-index: 1200; display: none; align-items: center; justify-content: center; padding: 20px; }
.cookie-modal.open { display: flex; }
.cookie-modal-content { background: var(--white); border-radius: var(--radius-lg); width: 100%; max-width: 680px; padding: 18px; box-shadow: 0 30px 60px rgba(14,42,71,0.28); display: flex; flex-direction: column; gap: 16px; border: 1px solid rgba(14,42,71,0.12); }
.cookie-categories { display: flex; flex-direction: column; gap: 12px; }
.cookie-category { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--brand-accent); border-radius: var(--radius); padding: 12px; }

/* Toggle switch (pure CSS skin) */
.toggle { display: inline-flex; align-items: center; gap: 8px; }
.toggle input { appearance: none; width: 42px; height: 24px; background: #CBD6E2; border-radius: 999px; position: relative; outline: none; transition: background .2s ease; }
.toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; background: var(--white); border-radius: 50%; box-shadow: 0 2px 6px rgba(0,0,0,0.15); transition: transform .2s ease; }
.toggle input:checked { background: #A6D9B4; }
.toggle input:checked::after { transform: translateX(18px); }

/* ===== UTILITIES ===== */
.muted { color: var(--muted); }
.bg-mint { background: var(--pastel-mint); }
.bg-rose { background: var(--pastel-rose); }
.bg-peach { background: var(--pastel-peach); }
.bg-sky { background: var(--pastel-sky); }
.bg-lavender { background: var(--pastel-lavender); }
.rounded { border-radius: var(--radius); }
.shadow { box-shadow: var(--shadow); }

/* ===== RESPONSIVE (Flex only) ===== */
@media (min-width: 576px) {
  .hero h1 { font-size: 36px; }
}

@media (min-width: 768px) {
  h1 { font-size: 40px; }
  h2 { font-size: 28px; }
  h3 { font-size: 20px; }

  .content-wrapper { gap: 24px; }

  /* Desktop nav visible */
  .main-nav { display: flex; }
  .header-ctas { display: flex; }
  .mobile-menu-toggle { display: none; }

  /* Text-image sections horizontal */
  .text-image-section { flex-direction: row; align-items: center; }

  /* Cookie banner in row layout */
  .cookie-banner { flex-direction: row; align-items: center; }
  .cookie-banner-content { flex: 1; }
}

@media (min-width: 1024px) {
  h1 { font-size: 48px; }
}

/* ===== PAGE-SPECIFIC REFINEMENTS ===== */
/* Hero variants across pages keep dreamy pastel tone */
body.index .hero { background: var(--pastel-sky); }
body.guide-fiscali .hero, body[page="guide-fiscali"] .hero { background: var(--pastel-mint); }
body.pensioni-previdenza .hero, body[page="pensioni-previdenza"] .hero { background: var(--pastel-rose); }
body.calcolatori .hero, body[page="calcolatori"] .hero { background: var(--pastel-lavender); }
body.aggiornamenti .hero, body[page="aggiornamenti"] .hero { background: var(--pastel-peach); }

/* Not all pages set body classes; defaults already applied */

/* ===== CONTENT GRID HELPERS (flex-only) ===== */
/* Use these to compose columns responsively with flex-wrap */
.row { display: flex; flex-wrap: wrap; gap: 20px; }
.col { flex: 1 1 260px; min-width: 240px; }

/* ===== ARIA-CURRENT FOR ANY NAV ===== */
[aria-current="page"] { font-weight: bold; }

/* ===== ADDITIONAL COMPONENT STYLES ===== */
.hero .text-section { background: var(--white); }

/* Link clusters in footers and lists */
footer ul { display: flex; flex-direction: column; gap: 8px; }

/* Contact list rows */
.text-section ul li { display: flex; align-items: center; gap: 8px; }

/* ===== PREVENT OVERLAPS & Z-INDEX SAFETY ===== */
header, .mobile-menu, .cookie-banner, .cookie-modal { isolation: isolate; }

/* ===== PRINT BASICS ===== */
@media print {
  header, .mobile-menu, .cookie-banner, .cookie-modal { display: none !important; }
  a { text-decoration: underline; color: #000; }
}

/* ===== NOTES: All layouts use flexbox only. No CSS grid or columns used. ===== */
