/* ════════════════════════════════════════════════════
   ED.I.CO.M. S.r.l. — style.css  v4.0
   Typography: Oswald (headings) + Source Serif 4 (body)
   Self-hosted fonts. font-display: optional (no CLS).
   External file — cached 1 year. Bump ?v= on change.
════════════════════════════════════════════════════ */

/* ── 0. Self-hosted fonts ────────────────────────── */
/* font-display: optional — browser uses custom font if available     */
/* within a short window; otherwise uses system fallback permanently. */
/* No mid-render swap flash. CLS = 0 on repeat visits (cached fonts). */
@font-face {
  font-family: 'Oswald';
  src: url('/assets/fonts/Oswald-Regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: optional;
}
@font-face {
  font-family: 'Oswald';
  src: url('/assets/fonts/Oswald-SemiBold.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: optional;
}
@font-face {
  font-family: 'Oswald';
  src: url('/assets/fonts/Oswald-Bold.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: optional;
}
@font-face {
  font-family: 'Inter';
  src: url('/assets/fonts/Inter-Regular.ttf') format('truetype');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/assets/fonts/Inter-SemiBold.ttf') format('truetype');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/assets/fonts/Inter-Bold.ttf') format('truetype');
  font-weight: 700; font-style: normal; font-display: swap;
}

/* ── 1. Variables ────────────────────────────────── */
:root {
  --c-primary:         #1B5D8F;
  --c-primary-dk:      #112840;
  --c-accent:          #FFDFB0;
  --c-accent-lt:       #FFF1DB;
  --c-bg:              #F7F4EF;
  --c-surface:         #FFFFFF;
  --c-text:            #1B1B1B;
  --c-text-on-primary: #FFFFFF;
  --c-text-on-accent:  #1B1B1B;
  --c-muted:           #4A5568;
  --radius:            10px;
  --max-width:         1100px;
  --font-heading:      'Oswald', 'Arial Narrow', sans-serif;
  --font-body:         'Inter', system-ui, -apple-system, sans-serif;
  --header-h:          4.5rem;
}

/* ── 2. Reset & base ─────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html  { scroll-behavior: smooth; font-size: 16px; }
body  { font-family: var(--font-body); background: var(--c-bg);
        color: var(--c-text); line-height: 1.7; }
a     { color: var(--c-primary); }
a:hover { text-decoration: underline; }

.section-wrap {
  padding: 5rem 1.5rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

/* ── 3. Images — global responsive + rounded ─────── */
img {
  max-width: 100%; height: auto; display: block;
  border-radius: var(--radius);
}
.logo-link img,
.cert-card img,
.sovvenzioni-inner img { border-radius: 0; }

.logo-link img {
  width: 140px;
  height: auto;
}

/* .hero-section override removed for consistent spacing */
.hero-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.hero-text-box {
  background: var(--c-primary);
  color: white;
  padding: 2rem;
  border-radius: 20px;
  z-index: 5;
}
.hero-text-box h2,
.hero-text-box h3 {
  color: white !important;
  margin-bottom: 1.5rem;
  text-transform: none;
}
.hero-text-box h2 {
  font-size: 2.2rem !important;
}
.hero-text-box h3 {
  font-size: 1.6rem !important;
  margin-top: 2rem;
}
.hero-text-box p {
  line-height: 1.65;
  font-size: 1.1rem;
}
.hero-text-box p + p {
  margin-top: 1.5rem;
}
.hero-image-wrap { width: 100%; position: relative; }
.hero-bg {
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 20px;
}

@media (min-width: 1024px) {
  .hero-container {
    display: flex;
    flex-direction: row; /* Ensure horizontal layout on desktop */
    align-items: stretch; /* Force same height */
    position: relative;
    gap: 0;
  }
  .hero-text-box {
    position: relative;
    z-index: 10;
    width: 45%;
    margin-right: -5rem; /* Overlap image */
    background: rgba(27, 93, 143, 0.9);
    backdrop-filter: blur(10px);
    padding: 3rem; /* Slightly more compact */
    box-shadow: 0 15px 40px rgba(0,0,0,0.25);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .hero-image-wrap {
    width: 65%;
    flex-grow: 1;
    margin-left: 0;
    display: flex;
  }
  .hero-bg {
    height: 100%;
    width: 100%;
    object-fit: cover;
  }
  .hero-container.hero-reverse {
    flex-direction: row-reverse;
  }
  .hero-container.hero-reverse .hero-text-box {
    margin-right: 0;
    margin-left: -5rem;
  }
  .hero-container.hero-reverse .hero-image-wrap {
    margin-right: 0;
  }
}

.section-divider {
  border: 0;
  border-top: 2px solid rgba(27, 93, 143, 0.35);
  margin: 5rem auto;
  max-width: var(--max-width);
}

/* ── 4. Sticky header ────────────────────────────── */
.site-header-wrapper {
  position: sticky; top: 0; z-index: 1000;
  background: none;
  transition: box-shadow 0.3s ease;
}
.site-header-wrapper.scrolled {
  box-shadow: 0 2px 16px rgba(0,0,0,0.45);
}

/* ── 5. Topbar ───────────────────────────────────── */
.topbar {
  background: #1B5D8F;
  color: var(--c-text-on-primary);
  display: flex; justify-content: center;
  align-items: center; padding: 0.35rem 2rem;
  font-size: 0.82rem; font-family: var(--font-heading);
  font-weight: 400; letter-spacing: 0.04em;
}
.topbar-inner {
  width: 100%;
  max-width: var(--max-width);
  display: flex;
  gap: 2.5rem;
  justify-content: flex-start;
}
.topbar-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.topbar-item svg {
  opacity: 0.8;
  flex-shrink: 0;
}
.topbar span { opacity: 0.85; }

/* ── 6. Main header & nav ────────────────────────── */
.site-header {
  background: var(--c-bg);
  max-width: 100%;
  margin: 0 auto;
  padding: 0.75rem 2rem;
  display: flex; align-items: center; justify-content: space-between;
}
.site-header > * {
  max-width: var(--max-width);
}
/* Re-applying max-width constraint correctly for the inner contents */
.site-header {
  justify-content: center; /* Center the wrapper content */
}
.site-header-inner {
  width: 100%;
  max-width: var(--max-width);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.main-nav ul { list-style: none; display: flex; gap: 1.5rem; flex-wrap: wrap; }
.main-nav a {
  font-family: var(--font-heading); font-weight: 500; font-size: 1rem;
  color: var(--c-primary); text-decoration: none;
  letter-spacing: 0.06em; padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.main-nav a:hover {
  color: var(--c-accent); border-bottom-color: var(--c-accent);
  text-decoration: none;
}
.nav-toggle {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: none; cursor: pointer; padding: 6px;
}
.nav-toggle span {
  display: block; width: 24px; height: 2px;
  background: var(--c-primary); border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}

/* ── 7. Sections — shared ────────────────────────── */
.section-wrap {
  max-width: var(--max-width); margin: 0 auto;
  padding: 5rem 2rem;
}
.section-wrap + .section-wrap { border-top: 1px solid #E2D9CC; }
.section-wrap h2 {
  font-family: var(--font-heading); font-weight: 700;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  color: var(--c-primary); margin-bottom: 1.5rem;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.section-wrap h3 {
  font-family: var(--font-heading); font-weight: 500;
  font-size: 1.35rem; color: var(--c-primary-dk);
  margin: 2rem 0 0.75rem; letter-spacing: 0.04em;
}

/* ── 8. Intro images ─────────────────────────────── */
.intro-images {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 1.5rem; margin-top: 2rem;
}
.intro-images img { width: 100%; cursor: zoom-in; }

/* ── 9. Carousel ─────────────────────────────────── */
#realizzazioni p {
  margin-bottom: 2.5rem;
}
.carousel { position: relative; padding: 0 3rem; overflow: hidden; }
.carousel-track {
  display: flex; gap: 1.5rem;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.carousel-slide {
  flex: 0 0 calc(33.333% - 1rem); min-width: 0;
}
.carousel-slide img {
  width: 100%; height: 240px; object-fit: cover;
  cursor: zoom-in;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.carousel-slide img:hover {
  transform: scale(1.03);
  box-shadow: 0 8px 24px rgba(0,0,0,0.22);
}
.carousel-slide figcaption {
  margin-top: 0.6rem; font-size: 0.875rem;
  color: var(--c-muted); font-style: italic;
}
.carousel-prev,
.carousel-next {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 2.5rem; height: 2.5rem; border-radius: 50%;
  background: var(--c-primary); color: var(--c-text-on-primary);
  border: none; font-size: 1rem; cursor: pointer; z-index: 5;
  transition: background 0.2s;
}
.carousel-prev:hover,
.carousel-next:hover { background: var(--c-primary-dk); }
.carousel-prev { left: 0; }
.carousel-next { right: 0; }
.carousel-dots {
  display: flex; justify-content: center;
  gap: 0.5rem; margin-top: 1.25rem;
}
.carousel-dot {
  width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid var(--c-primary); background: transparent;
  cursor: pointer; transition: background 0.2s;
}
.carousel-dot.active { background: var(--c-primary); }

/* ── 10. Lightbox ────────────────────────────────── */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(17, 40, 64, 0.93);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000;
}
.lightbox[hidden] { display: none; }
.lightbox figure { text-align: center; max-width: 90vw; }
.lightbox img {
  max-height: 80vh; width: auto; max-width: 90vw;
  border-radius: var(--radius);
}
.lightbox figcaption {
  color: var(--c-accent); margin-top: 1rem;
  font-size: 0.95rem; font-style: italic;
}
.lightbox-close {
  position: absolute; top: 1.5rem; right: 2rem;
  background: none; border: none;
  color: var(--c-text-on-primary);
  font-size: 2.2rem; cursor: pointer; line-height: 1;
}
.lightbox-close:hover { color: var(--c-accent); }

/* ── 11. Certification cards ─────────────────────── */
.cert-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 1.75rem; margin-top: 2rem;
}
.cert-card {
  background: var(--c-surface); border-radius: var(--radius);
  padding: 1.75rem 1.5rem; text-align: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.07);
  border-top: 4px solid var(--c-accent);
}
.cert-card img { width: 3.5rem; margin: 0 auto 1rem; }
.cert-card strong {
  display: block; font-family: var(--font-heading);
  font-weight: 500; font-size: 1.05rem;
  color: var(--c-primary); margin-bottom: 0.5rem;
  letter-spacing: 0.04em;
}
.cert-card p { font-size: 0.875rem; color: var(--c-muted); }

/* ── 12. Office / contact cards ──────────────────── */
.offices-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 1.75rem; margin-top: 2rem;
}
.office-card {
  background: var(--c-accent-lt); border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
  border-left: 4px solid var(--c-primary);
}
.office-card h3 {
  font-family: var(--font-heading); font-size: 1.1rem; font-weight: 500;
  color: var(--c-primary-dk); margin-bottom: 0.75rem;
  letter-spacing: 0.04em;
}
.office-card address { font-style: normal; }
.contact-line {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}
.contact-line svg {
  color: var(--c-primary);
  opacity: 0.7;
  flex-shrink: 0;
}
.office-card p { margin-bottom: 0.35rem; font-size: 0.9rem; }
/* enc-data spans are plain text — no pointer cursor */
.enc-data { cursor: text; user-select: text; }

/* ── 13. Sovvenzioni ─────────────────────────────── */
.sovvenzioni-card {
  background: var(--c-surface);
  border-radius: var(--radius);
  padding: 3rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  margin-top: 2rem;
}
.sov-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 3rem;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  padding-bottom: 2rem;
  margin-bottom: 2rem;
}
.sov-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--c-primary);
  line-height: 1.4;
}
.sov-logo img {
  max-width: 340px;
  height: auto;
  border-radius: 0 !important;
}
.sov-details p {
  font-size: 1rem;
  color: var(--c-muted);
  line-height: 1.6;
}
.download-line {
  margin-top: 1.5rem;
  font-weight: 600;
}

@media (max-width: 768px) {
  .sov-header-row {
    flex-direction: column;
    text-align: center;
    gap: 2rem;
  }
  .sov-logo img {
    max-width: 200px;
  }
}

/* ── 14. Text pages (Markdown output) ───────────── */
.section-text { max-width: 800px; }
.section-text h1 {
  font-family: var(--font-heading); font-weight: 700;
  font-size: clamp(2rem, 5vw, 3rem);
  color: var(--c-primary); margin-bottom: 2rem;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.section-text h2 {
  font-family: var(--font-heading); font-weight: 700;
  font-size: 1.75rem; margin: 2.5rem 0 1rem;
  color: var(--c-primary); letter-spacing: 0.05em;
  text-transform: uppercase;
}
.section-text h3 {
  font-family: var(--font-heading); font-weight: 500;
  font-size: 1.2rem; color: var(--c-primary-dk);
  margin: 1.75rem 0 0.5rem; letter-spacing: 0.04em;
}
.section-text p  { margin-bottom: 1.25rem; }
.section-text strong { color: var(--c-primary-dk); }
.section-text hr {
  border: none; border-top: 1px solid #E2D9CC; margin: 2.5rem 0;
}
.section-text ul { padding-left: 1.5rem; margin-bottom: 1rem; }
.section-text li { margin-bottom: 0.4rem; }

.section-text table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.95rem;
}
.section-text th, .section-text td {
  padding: 0.75rem 1rem;
  border: 1px solid #E2D9CC;
  text-align: left;
}
.section-text th {
  background: var(--c-accent-lt);
  font-family: var(--font-heading);
  font-weight: 500;
  color: var(--c-primary);
}
.section-text tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.4);
}

/* ── 15. Back-to-top ─────────────────────────────── */
#back-to-top {
  position: fixed; bottom: 2rem; right: 2rem;
  width: 3rem; height: 3rem; border-radius: 50%;
  background: var(--c-primary); color: var(--c-text-on-primary);
  font-size: 1.4rem; border: 2px solid var(--c-accent);
  cursor: pointer; opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease, transform 0.2s ease;
  z-index: 999;
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
}
#back-to-top.visible { opacity: 1; pointer-events: auto; }
#back-to-top:hover   { transform: translateY(-3px); background: var(--c-primary-dk); }

/* ── 16. Footer ──────────────────────────────────── */
.site-footer {
  background: #1B5D8F; color: var(--c-text-on-primary);
  text-align: center; padding: 2rem;
  font-size: 0.875rem; margin-top: 4rem;
}

/* ── 17. Gallery page ────────────────────────────── */
.section-gallery-page {
  max-width: var(--max-width); margin: 0 auto;
  padding: 5rem 2rem;
}
.section-gallery-page h1 {
  font-family: var(--font-heading); font-weight: 700;
  font-size: clamp(2rem, 5vw, 3rem);
  color: var(--c-primary); margin-bottom: 1rem;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.section-gallery-page > p {
  color: var(--c-muted); margin-bottom: 2.5rem;
  font-size: 1.05rem;
}

/* ── 18. Responsive breakpoints ──────────────────── */
/* ── 18. Responsive breakpoints ──────────────────── */
@media (max-width: 1200px) {
  .logo-link img { width: 120px !important; }
  .site-header { padding: 0.5rem 1.5rem; }
  
  .nav-toggle { display: flex; }
  .main-nav {
    display: none; position: absolute;
    top: 100%; left: 0; right: 0;
    background: var(--c-primary-dk);
    padding: 1.5rem; z-index: 999;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  }
  .main-nav.open     { display: block; }
  .main-nav ul       { flex-direction: column; gap: 1.25rem; }
  .main-nav a {
    color: white !important; font-size: 1.1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 0.5rem; display: block;
  }
  .main-nav a:hover { border-bottom-color: var(--c-accent); }

  .topbar { 
    padding: 0.5rem 1.25rem;
    font-size: 0.75rem;
  }
  .topbar-inner {
    display: grid !important;
    grid-template-columns: auto 1fr !important;
    gap: 0.25rem 2rem;
    align-items: center;
  }
  .topbar-item { justify-content: flex-start !important; gap: 0.4rem; white-space: nowrap; }
  .topbar-item:nth-child(1) { grid-column: 1; grid-row: 1; }
  .topbar-item:nth-child(3) { grid-column: 1; grid-row: 2; }
  .topbar-item:nth-child(2) { 
    grid-column: 2; grid-row: 1 / span 2; 
    justify-content: flex-end !important; 
    text-align: right;
  }
  .topbar-item svg { width: 12px; height: 12px; opacity: 0.8; }

  .cert-grid,
  .offices-grid      { grid-template-columns: 1fr 1fr; }
  .carousel-slide    { flex: 0 0 calc(50% - 0.75rem); }
  .carousel          { padding: 0 2.5rem; }
  .section-wrap      { padding: 3rem 1.5rem; }
}

@media (max-width: 768px) {
  .cert-grid,
  .offices-grid,
  .intro-images      { grid-template-columns: 1fr; }
  .carousel-slide    { flex: 0 0 100%; }
  .sov-header-row    { flex-direction: column; text-align: center; gap: 1.5rem; }
  .sov-logo img      { max-width: 240px; }
  .section-wrap      { padding: 3rem 1.25rem; }
}

/* ── 16. Privacy Popup ────────────────────────────── */
.privacy-popup-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(17, 40, 64, 0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 3000; opacity: 0; visibility: hidden; transition: 0.4s ease;
  backdrop-filter: blur(8px);
}
.privacy-popup-overlay.show { opacity: 1; visibility: visible; }

.privacy-popup {
  background: #1B5D8F; color: white; padding: 2.5rem; border-radius: 20px;
  max-width: 520px; width: 90%; text-align: left;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.privacy-popup-content { display: flex; gap: 1.5rem; margin-bottom: 2rem; align-items: flex-start; }
.privacy-popup svg { width: 48px; height: 48px; flex-shrink: 0; fill: #F7F4EF !important; }
.privacy-popup p { line-height: 1.6; font-size: 1rem; margin: 0; }
.privacy-popup a { 
  color: #F7F4EF !important; 
  text-decoration: underline !important; 
  font-weight: 800 !important; 
}
.privacy-popup-btn {
  display: block !important;
  width: 100% !important;
  background-color: #F7F4EF !important; /* Solid beige from screenshot */
  color: #1B5D8F !important; /* Corporate blue */
  border: none !important;
  padding: 1.25rem !important;
  border-radius: 12px !important;
  font-weight: 900 !important;
  cursor: pointer !important;
  font-size: 1.1rem !important;
  text-transform: uppercase !important;
  letter-spacing: 0.1em !important;
  text-align: center !important;
  opacity: 1 !important;
}
.privacy-popup-btn:hover { 
  background-color: #FFFFFF !important; 
  color: #1B5D8F !important;
}
}

/* ── 19. Project Collages ────────────────────────── */
.project-item {
  margin-bottom: 5rem;
  text-align: center;
}
.projects-list .section-divider:first-child {
  display: none;
}
.project-item h2 {
  color: var(--c-primary);
  margin-bottom: 0.5rem;
  font-size: 1.8rem;
  font-family: var(--font-heading);
  text-transform: uppercase;
}
.project-item .subtitle {
  color: var(--c-muted);
  margin-bottom: 2.5rem;
  font-size: 1.1rem;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}
.project-collage {
  display: flex;
  height: 500px;
  gap: 4px;
  cursor: pointer;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 15px 45px rgba(0,0,0,0.15);
  transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  background: #eee;
}
.project-collage:hover {
  transform: translateY(-8px);
}
.collage-slice {
  flex: 1;
  height: 100%;
  transition: flex 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
  border-right: 1px solid rgba(255,255,255,0.1);
}
.collage-slice:last-child { border-right: none; }

.collage-slice img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0 !important; /* Override global rounded corners */
}
.project-collage:hover .collage-slice:hover {
  flex: 1.5;
}

/* ── 20. Lightbox Navigation ──────────────────────── */
.lb-prev, .lb-next {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,0.1); color: white;
  border: 1px solid rgba(255,255,255,0.2); 
  width: 4.5rem; height: 4.5rem; border-radius: 50%;
  font-size: 1.8rem; cursor: pointer; transition: 0.3s;
  display: flex; align-items: center; justify-content: center;
  z-index: 2010;
}
.lb-prev { left: 2rem; }
.lb-next { right: 2rem; }
.lb-prev:hover, .lb-next:hover { 
  background: var(--c-accent); 
  color: var(--c-primary-dk);
  border-color: var(--c-accent);
}

@media (max-width: 960px) {
  .project-collage { height: 400px; }
}
@media (max-width: 640px) {
  .project-collage { height: 300px; border-radius: 12px; }
  .lb-prev, .lb-next { width: 3.5rem; height: 3.5rem; font-size: 1.4rem; }
  .lb-prev { left: 1rem; }
  .lb-next { right: 1rem; }
  .collage-slice:nth-child(n+4) { display: none; } /* Show only 3 slices on tiny screens */
}
