/*
 * ============================================================================
 * BASE.CSS - UCOI/UCOIM
 * ============================================================================
 * @file: base.css
 * @description: Foundation CSS - reset, variabili globali, tipografia,
 *               layout container e Bootstrap Grid integration
 * @author: Altoprofilo Studio
 * @version: 1.5
 * @last-updated: 2025-10-01
 * @dependencies: None (file base)
 * ============================================================================
 */

/* ============================================================================
   VARIABILI GLOBALI
   Design tokens condivisi da tutti i file CSS del progetto
   ============================================================================ */

:root {
  /* Colori brand */
  --primary-color: #036;
  --primary-hover: #001a49;
  --secondary-color: #005bac;
  --secondary-hover: #004080;
  --accent-color: #f57c00;
  --accent-hover: #d35400;
  
  /* Stati interattivi */
  --focus: #036;
  --focus-ring: 0 0 0 3px rgba(0, 51, 102, 0.25);
  --active-border: 3px solid var(--primary-color);
  
  /* Background */
  --bg-light: #f5f9fc;
  
  /* Tipografia */
  --font-body: "Inter", sans-serif;
  --font-heading: "DM Serif Display", serif;
  --text-color: #222;
  --text-muted: #555;
  
  /* Layout */
  --max-width: 1200px;
  --section-inline-padding: 1rem;
  
  /* Transizioni standardizzate */
  --transition-fast: all 0.2s ease;
  --transition-normal: all 0.3s ease;
  --transition-slow: all 0.4s ease;
  
  /* Elevazioni hover */
  --hover-lift-small: translateY(-2px);
  --hover-lift-medium: translateY(-4px);
  --hover-lift-large: translateY(-6px);
  
  /* Sistema ombre progressivo */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
  
  /* Spaziature responsive */
  --section-padding-block: clamp(2rem, 5vw, 4rem);
  --section-padding-inline: clamp(1.5rem, 4vw, 2rem);
  --card-padding: clamp(1rem, 2vw, 2rem);
  --element-gap: clamp(0.5rem, 1.5vw, 1.5rem);
  
  /* Bootstrap Grid integration */
  --bs-gutter-x: 1.5rem;
  --bs-gutter-y: 0;
}

/* ============================================================================
   RESET CSS
   Normalizzazione cross-browser
   ============================================================================ */

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

html {
  -ms-text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-color);
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;
  background-color: white;
  font-family: var(--font-body);
  text-rendering: optimizeLegibility;
}

/* ----------------------------------------------------------------------------
   Liste
   ---------------------------------------------------------------------------- */

ul,
ol {
  list-style: none;
  padding-left: 0;
}

/* ----------------------------------------------------------------------------
   Media
   ---------------------------------------------------------------------------- */

img,
video {
  display: block;
  height: auto;
  max-width: 100%;
}

/* ----------------------------------------------------------------------------
   Form elements
   ---------------------------------------------------------------------------- */

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button {
  border: none;
  background: none;
  cursor: pointer;
}

fieldset {
  border: none;
  margin: 0;
  padding: 0;
}

legend {
  padding: 0;
}

/* ----------------------------------------------------------------------------
   Anchor target scroll offset
   ---------------------------------------------------------------------------- */

:target {
  scroll-margin-top: 90px;
}

/* ============================================================================
   TIPOGRAFIA
   Sistema tipografico responsive con scale fluide
   ============================================================================ */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 400;
  color: var(--primary-color);
  font-family: var(--font-heading);
  margin-bottom: 1rem;
}

/* ----------------------------------------------------------------------------
   Scale tipografica responsive
   ---------------------------------------------------------------------------- */

h1 {
  font-size: clamp(2rem, 5vw, 3rem);
}

h2 {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
}

h3 {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
}

h4 {
  font-size: clamp(1.05rem, 2.5vw, 1.25rem);
}

h5 {
  font-size: clamp(0.95rem, 2vw, 1.05rem);
}

h6 {
  font-size: clamp(0.85rem, 1.8vw, 0.95rem);
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* ----------------------------------------------------------------------------
   Paragrafi
   ---------------------------------------------------------------------------- */

p {
  color: var(--text-color);
  margin-bottom: 1.2rem;
}

/* ============================================================================
   LAYOUT CONTAINER
   Sistema container compatibile con Bootstrap Grid
   ============================================================================ */

.container {
  width: 100%;
  padding-right: calc(var(--bs-gutter-x) * 0.5);
  padding-left: calc(var(--bs-gutter-x) * 0.5);
  margin-right: auto;
  margin-left: auto;
}

/* ----------------------------------------------------------------------------
   Breakpoint containers
   ---------------------------------------------------------------------------- */

@media (min-width: 576px) {
  .container {
    max-width: 540px;
  }
}

@media (min-width: 768px) {
  .container {
    max-width: 720px;
  }
}

@media (min-width: 992px) {
  .container {
    max-width: 960px;
  }
}

@media (min-width: 1200px) {
  .container {
    max-width: var(--max-width);
  }
}

@media (min-width: 1400px) {
  .container {
    max-width: var(--max-width);
  }
}

/* ----------------------------------------------------------------------------
   Container fluid
   ---------------------------------------------------------------------------- */

.container-fluid {
  width: 100%;
  padding-right: calc(var(--bs-gutter-x) * 0.5);
  padding-left: calc(var(--bs-gutter-x) * 0.5);
  margin-right: auto;
  margin-left: auto;
}

/* ----------------------------------------------------------------------------
   Section spacing
   ---------------------------------------------------------------------------- */

.section {
  padding: var(--section-padding-block) 0;
}

.section .container,
.section .container-fluid {
  padding-top: 0;
  padding-bottom: 0;
}

/* ============================================================================
   BOOTSTRAP GRID SYSTEM
   Sistema di colonne responsive compatibile Bootstrap
   ============================================================================ */

/* ----------------------------------------------------------------------------
   Row container
   ---------------------------------------------------------------------------- */

.row {
  --bs-gutter-x: 1.5rem;
  --bs-gutter-y: 1rem;
  display: flex;
  flex-wrap: wrap;
  margin-top: calc(-1 * var(--bs-gutter-y));
  margin-right: calc(-0.5 * var(--bs-gutter-x));
  margin-left: calc(-0.5 * var(--bs-gutter-x));
}

.row>* {
  box-sizing: border-box;
  flex-shrink: 0;
  width: 100%;
  max-width: 100%;
  padding-right: calc(var(--bs-gutter-x) * 0.5);
  padding-left: calc(var(--bs-gutter-x) * 0.5);
  margin-top: var(--bs-gutter-y);
}

/* ----------------------------------------------------------------------------
   Gutter utilities
   ---------------------------------------------------------------------------- */

.g-0 {
  --bs-gutter-x: 0;
  --bs-gutter-y: 0;
}

.g-1 {
  --bs-gutter-x: 0.25rem;
  --bs-gutter-y: 0.25rem;
}

.g-2 {
  --bs-gutter-x: 0.5rem;
  --bs-gutter-y: 0.5rem;
}

.g-3 {
  --bs-gutter-x: 1rem;
  --bs-gutter-y: 1rem;
}

.g-4 {
  --bs-gutter-x: 1.5rem;
  --bs-gutter-y: 1.5rem;
}

.g-5 {
  --bs-gutter-x: 3rem;
  --bs-gutter-y: 3rem;
}

/* ----------------------------------------------------------------------------
   Base columns
   ---------------------------------------------------------------------------- */

.col {
  flex: 1 0 0%;
}

.col-auto {
  flex: 0 0 auto;
  width: auto;
}

.col-1 { flex: 0 0 auto; width: 8.33333333%; }
.col-2 { flex: 0 0 auto; width: 16.66666667%; }
.col-3 { flex: 0 0 auto; width: 25%; }
.col-4 { flex: 0 0 auto; width: 33.33333333%; }
.col-5 { flex: 0 0 auto; width: 41.66666667%; }
.col-6 { flex: 0 0 auto; width: 50%; }
.col-7 { flex: 0 0 auto; width: 58.33333333%; }
.col-8 { flex: 0 0 auto; width: 66.66666667%; }
.col-9 { flex: 0 0 auto; width: 75%; }
.col-10 { flex: 0 0 auto; width: 83.33333333%; }
.col-11 { flex: 0 0 auto; width: 91.66666667%; }
.col-12 { flex: 0 0 auto; width: 100%; }

/* ----------------------------------------------------------------------------
   Small devices (≥576px)
   ---------------------------------------------------------------------------- */

@media (min-width: 576px) {
  .col-sm { flex: 1 0 0%; }
  .col-sm-auto { flex: 0 0 auto; width: auto; }
  .col-sm-1 { flex: 0 0 auto; width: 8.33333333%; }
  .col-sm-2 { flex: 0 0 auto; width: 16.66666667%; }
  .col-sm-3 { flex: 0 0 auto; width: 25%; }
  .col-sm-4 { flex: 0 0 auto; width: 33.33333333%; }
  .col-sm-5 { flex: 0 0 auto; width: 41.66666667%; }
  .col-sm-6 { flex: 0 0 auto; width: 50%; }
  .col-sm-7 { flex: 0 0 auto; width: 58.33333333%; }
  .col-sm-8 { flex: 0 0 auto; width: 66.66666667%; }
  .col-sm-9 { flex: 0 0 auto; width: 75%; }
  .col-sm-10 { flex: 0 0 auto; width: 83.33333333%; }
  .col-sm-11 { flex: 0 0 auto; width: 91.66666667%; }
  .col-sm-12 { flex: 0 0 auto; width: 100%; }
}

/* ----------------------------------------------------------------------------
   Medium devices (≥768px)
   ---------------------------------------------------------------------------- */

@media (min-width: 768px) {
  .col-md { flex: 1 0 0%; }
  .col-md-auto { flex: 0 0 auto; width: auto; }
  .col-md-1 { flex: 0 0 auto; width: 8.33333333%; }
  .col-md-2 { flex: 0 0 auto; width: 16.66666667%; }
  .col-md-3 { flex: 0 0 auto; width: 25%; }
  .col-md-4 { flex: 0 0 auto; width: 33.33333333%; }
  .col-md-5 { flex: 0 0 auto; width: 41.66666667%; }
  .col-md-6 { flex: 0 0 auto; width: 50%; }
  .col-md-7 { flex: 0 0 auto; width: 58.33333333%; }
  .col-md-8 { flex: 0 0 auto; width: 66.66666667%; }
  .col-md-9 { flex: 0 0 auto; width: 75%; }
  .col-md-10 { flex: 0 0 auto; width: 83.33333333%; }
  .col-md-11 { flex: 0 0 auto; width: 91.66666667%; }
  .col-md-12 { flex: 0 0 auto; width: 100%; }
}

/* ----------------------------------------------------------------------------
   Large devices (≥992px)
   ---------------------------------------------------------------------------- */

@media (min-width: 992px) {
  .col-lg { flex: 1 0 0%; }
  .col-lg-auto { flex: 0 0 auto; width: auto; }
  .col-lg-1 { flex: 0 0 auto; width: 8.33333333%; }
  .col-lg-2 { flex: 0 0 auto; width: 16.66666667%; }
  .col-lg-3 { flex: 0 0 auto; width: 25%; }
  .col-lg-4 { flex: 0 0 auto; width: 33.33333333%; }
  .col-lg-5 { flex: 0 0 auto; width: 41.66666667%; }
  .col-lg-6 { flex: 0 0 auto; width: 50%; }
  .col-lg-7 { flex: 0 0 auto; width: 58.33333333%; }
  .col-lg-8 { flex: 0 0 auto; width: 66.66666667%; }
  .col-lg-9 { flex: 0 0 auto; width: 75%; }
  .col-lg-10 { flex: 0 0 auto; width: 83.33333333%; }
  .col-lg-11 { flex: 0 0 auto; width: 91.66666667%; }
  .col-lg-12 { flex: 0 0 auto; width: 100%; }
}

/* ----------------------------------------------------------------------------
   Extra large devices (≥1200px)
   ---------------------------------------------------------------------------- */

@media (min-width: 1200px) {
  .col-xl { flex: 1 0 0%; }
  .col-xl-auto { flex: 0 0 auto; width: auto; }
  .col-xl-1 { flex: 0 0 auto; width: 8.33333333%; }
  .col-xl-2 { flex: 0 0 auto; width: 16.66666667%; }
  .col-xl-3 { flex: 0 0 auto; width: 25%; }
  .col-xl-4 { flex: 0 0 auto; width: 33.33333333%; }
  .col-xl-5 { flex: 0 0 auto; width: 41.66666667%; }
  .col-xl-6 { flex: 0 0 auto; width: 50%; }
  .col-xl-7 { flex: 0 0 auto; width: 58.33333333%; }
  .col-xl-8 { flex: 0 0 auto; width: 66.66666667%; }
  .col-xl-9 { flex: 0 0 auto; width: 75%; }
  .col-xl-10 { flex: 0 0 auto; width: 83.33333333%; }
  .col-xl-11 { flex: 0 0 auto; width: 91.66666667%; }
  .col-xl-12 { flex: 0 0 auto; width: 100%; }
}

/* ============================================================================
   UTILITY CLASSES
   Classi helper per layout, allineamento e spacing
   ============================================================================ */

/* ----------------------------------------------------------------------------
   Text alignment
   ---------------------------------------------------------------------------- */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

@media (min-width: 576px) {
  .text-sm-center { text-align: center; }
  .text-sm-left { text-align: left; }
  .text-sm-right { text-align: right; }
}

@media (min-width: 768px) {
  .text-md-center { text-align: center; }
  .text-md-left { text-align: left; }
  .text-md-right { text-align: right; }
}

@media (min-width: 992px) {
  .text-lg-center { text-align: center; }
  .text-lg-left { text-align: left; }
  .text-lg-right { text-align: right; }
}

/* ----------------------------------------------------------------------------
   Display & Flexbox
   ---------------------------------------------------------------------------- */

.d-flex { display: flex; }
.d-block { display: block; }
.d-none { display: none; }

.justify-content-start { justify-content: flex-start; }
.justify-content-center { justify-content: center; }
.justify-content-end { justify-content: flex-end; }
.justify-content-between { justify-content: space-between; }
.justify-content-around { justify-content: space-around; }

.align-items-start { align-items: flex-start; }
.align-items-center { align-items: center; }
.align-items-end { align-items: flex-end; }

/* ----------------------------------------------------------------------------
   Background
   ---------------------------------------------------------------------------- */

.bg-light {
  background-color: var(--bg-light);
}

/* ----------------------------------------------------------------------------
   Miscellaneous
   ---------------------------------------------------------------------------- */

.note {
  margin-top: 1rem;
  font-size: .8rem;
}

.divider {
  margin: 3rem auto;
  max-width: 800px;
  border-top: 1px solid #ddd;
}

/* ============================================================================
   SECTION ENHANCEMENTS
   Stili migliorati per contenuti section
   ============================================================================ */

.section h2+p.text-center,
.section .row h2+p.text-center {
  margin: 0 auto 3rem;
  max-width: 800px;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-muted);
}

/* ============================================================================
   RESPONSIVE OVERRIDES
   Aggiustamenti specifici per breakpoint mobile
   ============================================================================ */

@media (max-width: 575.98px) {
  .container,
  .container-fluid {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .row {
    --bs-gutter-x: 1rem;
    margin-left: -0.5rem;
    margin-right: -0.5rem;
  }

  .section h2+p.text-center {
    margin-bottom: 2.5rem;
    font-size: 0.95rem;
  }
}

@media (min-width: 576px) and (max-width: 767.98px) {
  .container {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
}

@media (min-width: 768px) and (max-width: 991.98px) {
  .container {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

@media (max-width: 480px) {
  :root {
    --section-padding-inline: 1rem;
  }
}

/* ============================================================================
   LEGACY COMPATIBILITY
   Supporto per codice esistente
   ============================================================================ */

.column {
  max-width: 100%;
}

@media (max-width: 768px) {
  .column {
    max-width: 100%;
  }
}

/* ============================================================================
   BACK TO TOP BUTTON
   Pulsante floating per ritorno a inizio pagina
   ============================================================================ */

.back-to-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid white;
  background: var(--primary-color);
  color: #fff;
  font-size: 1rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .15);
  z-index: 999;
  transition: background .3s ease, transform .3s ease;
}

.back-to-top:hover {
  background: var(--accent-color);
  transform: translateY(-3px);
}

.back-to-top:focus-visible {
  outline: 3px solid var(--accent-color);
  outline-offset: 2px;
}

@media (max-width: 575.98px) {
  .back-to-top {
    width: 40px;
    height: 40px;
    font-size: 1rem;
    bottom: 1rem;
    right: 1rem;
  }
}

/* ============================================================================
   FOOTER UTILITIES
   Helper classes per footer layout
   ============================================================================ */

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-bottom-left {
  flex: 1;
}

.footer-bottom-right {
  margin-left: auto;
}

.footer-bottom .credits {
  font-size: 0.80rem;
  color: #bbb !important;
}

.footer-bottom {
  text-align: center;      /* centrato su mobile */
  font-size: 0.85rem;      /* più piccolo e sobrio */
  line-height: 1.4;
}
.footer-bottom p {
  margin: 0.25rem 0;
}
.footer-bottom small {
  color: #ccc;             /* testo attenuato */
}

/* ==========================================================================
   FOOTER CSS - Utility Class for Heading Styles
   Per usare h2 con stile visivo di h4 mantenendo il font delle intestazioni
   ========================================================================== */

/* Utility class per applicare stile h4 a qualsiasi heading */
.h4,
h2.h4,
h3.h4 {
  font-family: 'DM Serif Display', serif; /* Font delle intestazioni */
  font-size: 1.125rem; /* 18px */
  font-weight: 600;
  line-height: 1.4;
  margin: 0 0 1rem;
  color: inherit;
}

/* Footer headings specifici */
.global-footer .footer-column .h4 {
  font-family: 'DM Serif Display', serif; /* Font delle intestazioni */
  font-size: 1.125rem;
  font-weight: 600;
  color: #fff!important;
  margin: 0 0 1.25rem;
  letter-spacing: -0.01em; /* Miglior leggibilità per serif */
}

/* Footer headings - variante elegante (opzionale) */
.global-footer .footer-column .h4.serif-elegant {
  font-weight: 400; /* Più leggero per DM Serif Display */
  font-size: 1.25rem;
}

/* Dark mode support (opzionale) */
@media (prefers-color-scheme: dark) {
  .global-footer .footer-column .h4 {
    color: #f9fafb;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .h4,
  h2.h4,
  h3.h4 {
    font-size: 1rem;
  }
  
  .global-footer .footer-column .h4 {
    font-size: 1rem;
    margin-bottom: 1rem;
  }
}

/* Assicurati che tutti gli heading mantengano la gerarchia semantica 
   anche se hanno stili diversi - SEMPRE con font delle intestazioni */
h1.h2 { 
  font-family: 'DM Serif Display', serif;
  font-size: 2.25rem; 
}

h1.h3 { 
  font-family: 'DM Serif Display', serif;
  font-size: 1.875rem; 
}

h1.h4 { 
  font-family: 'DM Serif Display', serif;
  font-size: 1.125rem; 
}

h2.h3 { 
  font-family: 'DM Serif Display', serif;
  font-size: 1.875rem; 
}

h2.h4 { 
  font-family: 'DM Serif Display', serif;
  font-size: 1.125rem; 
}

h3.h4 { 
  font-family: 'DM Serif Display', serif;
  font-size: 1.125rem; 
}

/* Print styles - mantieni il font serif */
@media print {
  .h4,
  h2.h4,
  h3.h4 {
    font-family: 'DM Serif Display', Georgia, serif;
  }
}

/* High contrast mode - assicura buona leggibilità */
@media (prefers-contrast: high) {
  .global-footer .footer-column .h4 {
    font-weight: 700; /* Più peso in high contrast */
  }
}

/* Variante alternativa: se vuoi stile h4 ma con font body (Inter)
   usa questa classe invece di .h4 */
.h4-body {
  font-family: 'Inter', sans-serif;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.4;
  margin: 0 0 1rem;
  color: inherit;
}

/* Note per l'implementazione:
   
   DEFAULT comportamento:
   - Tutti gli h1, h2, h3, h4, h5, h6 → 'DM Serif Display'
   - Classe .h4 → 'DM Serif Display' (stile h4, font heading)
   - Classe .h4-body → 'Inter' (stile h4, font body) - se necessario
   
   Esempio HTML:
   <h2 class="h4">Titolo Footer</h2> → DM Serif Display, 18px
   <h2 class="h4-body">Titolo</h2> → Inter, 18px (raro)
*/