/* ============================================================
   SMC — Shared components: site header & footer
   ============================================================ */

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface-white);
  border-bottom: 1px solid var(--border-subtle);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  min-height: 88px;
  padding-block: var(--space-3);
}

.brand {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.brand__logo {
  width: clamp(150px, 16vw, 165px);
  height: auto;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(1.25rem, 2.5vw, 2.25rem);
}

.site-nav__list {
  display: flex;
  align-items: center;
  gap: clamp(1.25rem, 2.5vw, 2.25rem);
}

.site-nav__link {
  color: var(--text-heading);
  font-weight: var(--fw-medium);
  font-size: 1rem;
  padding-block: 0.25rem;
  position: relative;
}

.site-nav__link:hover {
  text-decoration: none;
  color: var(--navy-primary);
}

.site-nav__link[aria-current="page"] {
  color: var(--navy-primary);
}

.site-nav__link[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  background: var(--navy-primary);
  border-radius: 2px;
}

/* Language switcher */
.lang {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
  background: var(--surface-white);
  color: var(--text-body);
  font-weight: var(--fw-medium);
  font-size: 0.875rem;
}

.lang:hover {
  text-decoration: none;
  border-color: var(--navy-primary);
}

.lang__flag {
  width: 24px;
  height: 16px;
  border-radius: 3px;
  display: block;
}

/* Hamburger (mobile only) */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  background: transparent;
  border: 0;
  padding: 10px;
}

.nav-toggle__bar {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text-heading);
  border-radius: 2px;
  transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}

/* Nav CTA: tighten vertical padding so the button sits proportionally
   inside the 88px header (target ~42px tall vs the generic 63px) */
.site-nav .btn {
  padding-block: 0.5rem;
}

/* ---------- Header responsive: mobile drawer ---------- */
@media (max-width: 900px) {
  .nav-toggle {
    display: flex;
  }

  .site-nav {
    position: fixed;
    inset: 0 0 0 auto;
    width: min(82vw, 340px);
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: var(--space-6);
    padding: 6rem var(--space-8) var(--space-8);
    background: var(--surface-white);
    box-shadow: -12px 0 40px rgba(15, 23, 42, 0.12);
    transform: translateX(100%);
    transition: transform 240ms var(--ease);
    overflow-y: auto;
  }

  .site-nav.is-open {
    transform: translateX(0);
  }

  .site-nav__list {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-5);
    width: 100%;
  }

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

  .site-nav .btn {
    width: 100%;
  }

  body.nav-open {
    overflow: hidden;
  }

  .nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  .nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(2) {
    opacity: 0;
  }
  .nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
}

/* Scrim behind the mobile drawer */
.nav-scrim {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  opacity: 0;
  visibility: hidden;
  transition: opacity 240ms var(--ease), visibility 240ms var(--ease);
  z-index: 40;
}

.nav-scrim.is-open {
  opacity: 1;
  visibility: visible;
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--navy-dark);
  color: var(--text-on-dark-muted);
  padding-block: clamp(3rem, 6vw, 4.5rem);
}

.site-footer__top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-14) var(--space-12);
}

.footer-brand {
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.footer-brand__home {
  display: inline-block;
  align-self: flex-start;
}

.footer-brand__logo {
  width: 170px;
  height: auto;
  display: block;
}

.footer-brand__text {
  color: var(--text-on-dark-muted);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.footer-cols {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-12) var(--space-18);
}

.footer-col__heading {
  margin: 0;
}

.footer-col__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  width: 100%;
  padding: 0;
  background: none;
  border: 0;
  color: var(--text-on-dark);
  font: inherit;
  font-weight: var(--fw-bold);
  font-size: 1rem;
  letter-spacing: 0.02em;
  text-align: left;
  cursor: default; /* desktop: static heading; becomes a toggle on mobile */
  margin-bottom: var(--space-4);
}

.footer-col__chevron {
  display: none; /* shown only as an accordion control on mobile */
}

.footer-col__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.footer-col__list a {
  color: var(--text-on-dark-muted);
  font-weight: var(--fw-medium);
  font-size: 1rem;
}

.footer-col__list a:hover {
  color: var(--text-on-dark);
}

.footer-contacts {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  font-style: normal; /* <address> defaults to italic */
}

.footer-contact {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text-on-dark-muted);
  font-size: 0.9375rem;
}

.footer-contact:hover {
  color: var(--text-on-dark);
  text-decoration: none;
}

/* Inline SVG icon: uses currentColor, so it inherits the link's text
   color (muted by default) and turns white on hover/focus. Inline SVG
   works identically over file:// and http:// (no mask/origin issues). */
.footer-contact__icon {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}

.site-footer__divider {
  border: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
  margin-block: var(--space-12);
}

.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4) var(--space-8);
}

.footer-legal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4) var(--space-6);
  color: var(--text-on-dark-faint);
  font-size: 0.9375rem;
}

.footer-legal a {
  color: var(--text-on-dark-faint);
  font-weight: var(--fw-medium);
}

.footer-legal a:hover {
  color: var(--text-on-dark);
}

.footer-social {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-on-dark-faint);
  font-size: 0.9375rem;
  font-weight: var(--fw-medium);
}

.footer-social:hover {
  color: var(--text-on-dark);
  text-decoration: none;
}

.footer-social__icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.footer-policies {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4) var(--space-6);
}

/* ---------- Footer: mobile (accordion columns + stacked legal) ---------- */
@media (max-width: 600px) {
  .site-footer__top {
    flex-direction: column;
    gap: 0;
  }

  .footer-brand {
    max-width: none;
    padding-bottom: var(--space-6);
  }

  /* Columns become full-width collapsible rows with divider lines */
  .footer-cols {
    flex-direction: column;
    gap: 0;
    width: 100%;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
  }

  .footer-col {
    width: 100%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  }

  .footer-col__title {
    margin-bottom: 0;
    padding: var(--space-5) 0;
    cursor: pointer;
  }

  .footer-col__chevron {
    display: block;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    color: var(--text-on-dark);
    transition: transform var(--dur) var(--ease);
  }

  .footer-col.is-open .footer-col__chevron {
    transform: rotate(180deg);
  }

  .footer-col__list {
    display: none;
    padding-bottom: var(--space-5);
  }

  .footer-col.is-open .footer-col__list {
    display: flex;
  }

  .footer-contacts {
    padding-top: var(--space-6);
  }

  /* Legal: copyright on its own line, then policy links with dot separators */
  .site-footer__bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-6);
  }

  .footer-legal {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-4);
  }

  .footer-policies {
    gap: 0;
  }

  .footer-policies a {
    white-space: nowrap; /* keep each label intact */
  }

  /* Dot belongs to the preceding link, so a wrapped link never starts
     a line with an orphaned separator. */
  .footer-policies a:not(:last-child)::after {
    content: "·";
    margin: 0 var(--space-3);
    color: var(--text-on-dark-faint);
  }
}

/* ---------- Shared CTA band ("Non hai trovato quello che cerchi?") ---------- */
.cta-band__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-6);
  text-align: center;
  background: var(--surface-tint);
  border-radius: var(--radius-lg);
  padding: clamp(2.5rem, 5vw, 4rem) clamp(1.5rem, 5vw, 5rem);
}

.cta-band__title {
  font-size: clamp(1.5rem, 1.2rem + 1.5vw, 2rem);
  font-weight: var(--fw-semibold);
  color: #39393c;
  line-height: 1.3;
}

.cta-band__text {
  max-width: 60ch;
  font-size: var(--fs-body);
  color: #454545;
}

@media (max-width: 600px) {
  .cta-band__card .btn {
    width: 100%;
  }
}

/* Desktop and up: keep the supporting text on a single line */
@media (min-width: 961px) {
  .cta-band__text {
    max-width: none;
    white-space: nowrap;
  }
}

/* ---------- Product card (shared: prodotti, applicazioni) ---------- */
.product-card {
  position: relative; /* anchor for the stretched-link overlay */
  display: flex;
  flex-direction: column;
  background: var(--surface-white);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 28px -6px rgba(18, 41, 94, 0.12);
  padding: 28px 24px;
  cursor: pointer;
  transition: transform var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}

/* Make the whole card clickable: the "Scopri" link's ::after covers it.
   Keeps a single real anchor (no nested interactive elements). */
.product-card__cta::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: 1;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px -6px rgba(18, 41, 94, 0.2);
}

.product-card__media {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 180px;
  margin-bottom: var(--space-4);
}

.product-card__media img {
  max-height: 100%;
  width: auto;
  object-fit: contain;
}

.product-card__title {
  font-size: var(--fs-h3);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-heading);
  color: var(--text-heading);
  margin-bottom: var(--space-5);
}

/* CTA pinned bottom-right so cards line up regardless of title length */
.product-card__cta {
  margin-top: auto;
  align-self: flex-end;
  color: var(--navy-dark);
  font-size: 1rem;
}
