/* HLP SA — Design System */
:root {
  --c-bg: #ffffff;
  --c-bg-alt: #f7f7f5;
  --c-bg-dark: #0f172a;
  --c-ink: #0f172a;
  --c-ink-2: #334155;
  --c-ink-3: #64748b;
  --c-line: #e5e7eb;
  --c-line-2: #cbd5e1;
  --c-red: #dc2626;
  --c-red-dark: #b91c1c;
  --c-red-soft: #fef2f2;
  --c-accent: #0f172a;

  --font-sans: "Inter Tight", "Helvetica Neue", Arial, sans-serif;
  --font-display: "Fraunces", "Times New Roman", serif;

  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 1px rgba(15, 23, 42, 0.03);
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 24px 48px -12px rgba(15, 23, 42, 0.18);

  --container: 1200px;
  --gutter: clamp(20px, 4vw, 40px);

  --header-h: 84px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  color: var(--c-ink);
  background: var(--c-bg);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* TYPOGRAPHY */
.h-display {
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.02;
  font-size: clamp(40px, 6vw, 76px);
  margin: 0;
}
.h-display em {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  color: var(--c-red);
}
h1, .h1 { font-size: clamp(36px, 5vw, 56px); letter-spacing: -0.025em; line-height: 1.05; font-weight: 600; margin: 0; }
h2, .h2 { font-size: clamp(28px, 3.5vw, 40px); letter-spacing: -0.02em; line-height: 1.1; font-weight: 600; margin: 0; }
h3, .h3 { font-size: 20px; letter-spacing: -0.01em; line-height: 1.2; font-weight: 600; margin: 0; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 500; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--c-red);
}
.eyebrow::before {
  content: ""; width: 24px; height: 1px; background: var(--c-red);
}
.eyebrow.no-line::before { display: none; }
.lead { font-size: clamp(17px, 1.4vw, 19px); color: var(--c-ink-2); line-height: 1.55; max-width: 60ch; }
.muted { color: var(--c-ink-3); }

/* LAYOUT */
.container {
  width: 100%; max-width: var(--container);
  margin: 0 auto; padding: 0 var(--gutter);
}
.section { padding: clamp(64px, 10vw, 120px) 0; }
.section--tight { padding: clamp(48px, 7vw, 80px) 0; }
.section--dark { background: var(--c-bg-dark); color: #f8fafc; }
.section--alt { background: var(--c-bg-alt); }
.grid { display: grid; gap: 24px; }
.divider { height: 1px; background: var(--c-line); border: 0; margin: 0; }

/* HEADER */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,0.92);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--c-line);
}
.site-header__inner {
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px;
}
.site-header__logo { display: flex; align-items: center; gap: 10px; }
.site-header__logo svg { height: 40px; width: auto; }
@media (max-width: 720px) {
  .site-header__logo svg { height: 34px; }
}
.site-header__nav { display: flex; align-items: center; gap: 4px; }
.site-header__nav a, .site-header__nav button {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; font-size: 14px; font-weight: 500;
  color: var(--c-ink-2); border-radius: var(--radius);
  background: transparent; border: 0;
  transition: all .15s ease;
}
.site-header__nav a:hover, .site-header__nav button:hover { color: var(--c-ink); background: var(--c-bg-alt); }
.site-header__nav a.is-active { color: var(--c-ink); background: var(--c-bg-alt); }
.site-header__right { display: flex; align-items: center; gap: 12px; }

/* DROPDOWN */
.dropdown { position: relative; }
/* Invisible bridge so the cursor doesn't lose hover between trigger and panel */
.dropdown::after {
  content: ""; position: absolute; top: 100%; left: 0; right: 0; height: 14px;
}
.dropdown__panel {
  position: absolute; top: calc(100% + 10px); left: 50%; transform: translateX(-50%) translateY(-4px);
  background: #fff; border: 1px solid var(--c-line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  min-width: 320px; padding: 8px;
  display: flex; flex-direction: column; gap: 2px;
  opacity: 0; pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  transition-delay: .35s; /* close delay so the panel doesn't disappear immediately */
}
.dropdown.is-open .dropdown__panel,
.dropdown:hover .dropdown__panel,
.dropdown:focus-within .dropdown__panel {
  opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0);
  transition-delay: 0s; /* open instantly */
}
.dropdown__item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius);
  color: var(--c-ink-2); font-size: 14px;
  width: 100%;
}
.dropdown__item:hover { background: var(--c-bg-alt); color: var(--c-ink); }
.dropdown__icon {
  width: 32px; height: 32px; flex-shrink: 0;
  border-radius: 8px; background: var(--c-bg-alt);
  display: grid; place-items: center; color: var(--c-red);
}
.dropdown__icon svg { width: 18px; height: 18px; }

/* LANG SWITCH */
.lang {
  display: inline-flex; gap: 0; padding: 3px;
  background: var(--c-bg-alt); border-radius: 999px;
  font-size: 12px; font-weight: 600;
}
.lang button {
  padding: 5px 12px; border-radius: 999px;
  background: transparent; border: 0; color: var(--c-ink-3);
  letter-spacing: 0.04em;
}
.lang button.is-active { background: #fff; color: var(--c-ink); box-shadow: var(--shadow-sm); }

/* BUTTON */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 999px;
  font-size: 14px; font-weight: 500; letter-spacing: -0.005em;
  border: 1px solid transparent; cursor: pointer;
  transition: all .15s ease; white-space: nowrap;
}
.btn--primary { background: var(--c-ink); color: #fff; }
.btn--primary:hover { background: #1f2937; transform: translateY(-1px); }
.btn--red { background: var(--c-red); color: #fff; }
.btn--red:hover { background: var(--c-red-dark); transform: translateY(-1px); }
.btn--ghost { background: transparent; color: var(--c-ink); border-color: var(--c-line-2); }
.btn--ghost:hover { background: var(--c-bg-alt); border-color: var(--c-ink-3); }
.btn--lg { padding: 14px 24px; font-size: 15px; }
.btn--sm { padding: 8px 14px; font-size: 13px; }
.btn svg { width: 16px; height: 16px; }

/* HERO */
.hero {
  position: relative; padding: clamp(72px, 10vw, 120px) 0 clamp(64px, 8vw, 96px);
  overflow: hidden;
}
.hero__grid {
  display: grid; grid-template-columns: 1.2fr 1fr; gap: clamp(32px, 5vw, 80px);
  align-items: center;
}
@media (max-width: 900px) { .hero__grid { grid-template-columns: 1fr; } }
.hero__copy .eyebrow { margin-bottom: 20px; }
.hero__copy h1 { margin-bottom: 20px; }
.hero__copy .lead { margin-bottom: 32px; }
.hero__cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero__visual {
  aspect-ratio: 4/5;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  position: relative; overflow: hidden;
  box-shadow: var(--shadow-lg);
}

/* SERVICE CARDS */
.services-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
@media (max-width: 900px) { .services-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .services-grid { grid-template-columns: 1fr; } }
.service-card {
  display: block; position: relative;
  border: 1px solid var(--c-line); border-radius: var(--radius-lg);
  background: #fff; overflow: hidden;
  transition: all .25s cubic-bezier(.2,.8,.2,1);
}
.service-card:hover {
  border-color: var(--c-ink); transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.service-card__media {
  aspect-ratio: 16/10; position: relative; overflow: hidden;
  border-bottom: 1px solid var(--c-line);
}
.service-card__body { padding: 24px; }
.service-card__num {
  font-size: 11px; font-weight: 600; letter-spacing: 0.12em;
  color: var(--c-ink-3); text-transform: uppercase; margin-bottom: 8px;
}
.service-card__title {
  font-size: 20px; font-weight: 600; letter-spacing: -0.015em;
  margin: 0 0 8px;
}
.service-card__desc { color: var(--c-ink-3); font-size: 14px; line-height: 1.5; margin: 0 0 16px; }
.service-card__arrow {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 500; color: var(--c-red);
}
.service-card:hover .service-card__arrow svg { transform: translateX(4px); }
.service-card__arrow svg { transition: transform .25s; }

/* FORM */
.form-block {
  background: #fff; border: 1px solid var(--c-line); border-radius: var(--radius-lg);
  padding: clamp(24px, 4vw, 40px);
}
.form-block--dark {
  background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.1); color: #fff;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label {
  font-size: 12px; font-weight: 500; letter-spacing: 0.04em;
  color: var(--c-ink-2); text-transform: uppercase;
}
.section--dark .field label { color: rgba(255,255,255,0.7); }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--c-line); border-radius: var(--radius);
  font: inherit; color: var(--c-ink); background: #fff;
  transition: all .15s ease;
}
.section--dark .field input,
.section--dark .field select,
.section--dark .field textarea {
  background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.15); color: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 0; border-color: var(--c-ink); box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}
.section--dark .field input:focus,
.section--dark .field select:focus,
.section--dark .field textarea:focus {
  border-color: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,0.12);
}
.field textarea { resize: vertical; min-height: 120px; }
.field--check {
  flex-direction: row; align-items: flex-start; gap: 10px; margin-bottom: 20px;
}
.field--check input { width: 18px; height: 18px; margin-top: 2px; flex-shrink: 0; }
.field--check label {
  text-transform: none; letter-spacing: 0; font-size: 13px;
  color: var(--c-ink-3); font-weight: 400; line-height: 1.5;
}
.section--dark .field--check label { color: rgba(255,255,255,0.7); }
.form-success {
  background: var(--c-red-soft); border: 1px solid #fecaca;
  color: var(--c-red-dark); padding: 14px 16px; border-radius: var(--radius);
  font-size: 14px; margin-bottom: 16px; display: none;
}
.form-success.is-visible { display: block; }
.form-error {
  background: #fef2f2; border: 1px solid #fecaca;
  color: #b91c1c; padding: 14px 16px; border-radius: var(--radius);
  font-size: 14px; margin-bottom: 16px;
}

/* FOOTER */
.site-footer {
  background: var(--c-bg-dark); color: #f8fafc;
  padding: 80px 0 32px;
}
.site-footer a { color: rgba(255,255,255,0.7); }
.site-footer a:hover { color: #fff; }
.footer-grid {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 40px;
  padding-bottom: 48px; border-bottom: 1px solid rgba(255,255,255,0.1);
}
@media (max-width: 800px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 500px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-col h4 {
  font-size: 12px; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: #fff; margin: 0 0 16px;
}
.footer-col ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.footer-col li { font-size: 14px; }
.footer-brand p { font-size: 14px; color: rgba(255,255,255,0.7); margin: 16px 0; max-width: 32ch; line-height: 1.55; }
.footer-bottom {
  padding-top: 24px; display: flex; justify-content: space-between; gap: 16px;
  font-size: 13px; color: rgba(255,255,255,0.5); flex-wrap: wrap;
}
.footer-logo svg { height: 40px; width: auto; }

/* SERVICE PAGE PIECES */
.points {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px;
  background: var(--c-line);
  border: 1px solid var(--c-line); border-radius: var(--radius-lg);
  overflow: hidden;
}
@media (max-width: 700px) { .points { grid-template-columns: 1fr; } }
.point {
  background: #fff; padding: 28px;
}
.point__num {
  font-family: var(--font-display); font-style: italic; font-size: 28px;
  color: var(--c-red); margin-bottom: 12px; line-height: 1;
}
.point__title { font-size: 17px; font-weight: 600; margin: 0 0 8px; letter-spacing: -0.01em; }
.point__desc { font-size: 14px; color: var(--c-ink-3); margin: 0; line-height: 1.55; }

/* ILLUSTRATIVE GRADIENTS (faux photo) */
.illus { position: absolute; inset: 0; overflow: hidden; }
.illus svg { width: 100%; height: 100%; }

.menu-toggle {
  display: none; background: transparent; border: 0; padding: 8px;
  color: var(--c-ink); cursor: pointer;
}
.menu-toggle svg { width: 24px; height: 24px; display: block; color: var(--c-ink); }
@media (max-width: 800px) {
  .menu-toggle { display: inline-flex !important; }
}
@media (max-width: 800px) {
  .menu-toggle { display: inline-flex; }
  /* Hide the "Richiedi un preventivo" CTA in header on mobile (Contatti is in the menu) */
  .site-header__right .btn--red { display: none; }
  /* Compact lang switcher */
  .site-header__right { gap: 8px; }
  .site-header__nav {
    position: fixed; inset: var(--header-h) 0 0 0;
    background: #fff; flex-direction: column; align-items: stretch;
    padding: 24px var(--gutter); gap: 4px;
    transform: translateX(100%); transition: transform .25s ease;
    border-top: 1px solid var(--c-line);
    z-index: 60; overflow-y: auto;
  }
  .site-header__nav.is-open { transform: translateX(0); }
  .site-header__nav a, .site-header__nav button {
    width: 100%; justify-content: flex-start; padding: 14px;
    border-bottom: 1px solid var(--c-line); border-radius: 0;
  }
  .dropdown__panel {
    position: static; transform: none; box-shadow: none; border: 0;
    min-width: 0; opacity: 1; pointer-events: auto;
    padding: 0 0 0 16px; display: none;
  }
  .dropdown.is-open .dropdown__panel { display: block; }
}

/* UTILITY */
.flex { display: flex; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; } .mt-48 { margin-top: 48px; }
.mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; } .mb-32 { margin-bottom: 32px; } .mb-48 { margin-bottom: 48px; }
.text-center { text-align: center; }
.max-prose { max-width: 65ch; }

/* PAGE TRANSITION — fade morbido entrando e uscendo */
body.page-transition {
  opacity: 0;
  animation: pageIn .55s cubic-bezier(.2,.7,.2,1) forwards;
}
body.page-transition.is-leaving {
  animation: pageOut .35s cubic-bezier(.5,.1,.7,.5) forwards;
}
@keyframes pageIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes pageOut {
  to { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  body.page-transition, body.page-transition.is-leaving {
    animation: none !important; opacity: 1 !important;
  }
}

/* SCROLL REVEAL — fade-in dall'alto al passaggio nel viewport */
.reveal {
  opacity: 0;
  transform: translateY(-18px);
  transition: opacity .8s cubic-bezier(.2,.7,.2,1), transform .8s cubic-bezier(.2,.7,.2,1);
  will-change: opacity, transform;
}
.reveal.is-in {
  opacity: 1;
  transform: translateY(0);
}
.reveal--up {
  transform: translateY(24px);
}
.reveal--up.is-in {
  transform: translateY(0);
}
/* Stagger children */
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(-14px);
  transition: opacity .7s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1);
}
.reveal-stagger.is-in > *:nth-child(1) { transition-delay: 0ms; }
.reveal-stagger.is-in > *:nth-child(2) { transition-delay: 80ms; }
.reveal-stagger.is-in > *:nth-child(3) { transition-delay: 160ms; }
.reveal-stagger.is-in > *:nth-child(4) { transition-delay: 240ms; }
.reveal-stagger.is-in > *:nth-child(5) { transition-delay: 320ms; }
.reveal-stagger.is-in > *:nth-child(6) { transition-delay: 400ms; }
.reveal-stagger.is-in > * {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal--up, .reveal-stagger > * {
    opacity: 1 !important; transform: none !important; transition: none !important;
  }
}

/* MOBILE OVERRIDES — collapse all multi-column inline grids into single column */
@media (max-width: 760px) {
  /* Any inline-grid forced multi-column → single column */
  [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }
  /* Reduce huge gaps */
  .grid[style*="gap: 64px"],
  .grid[style*="gap:64px"] { gap: 32px !important; }
  /* Hero copy + headings: tighten on small screens */
  .h-display { font-size: clamp(34px, 9vw, 48px) !important; }
  h1, .h1 { font-size: clamp(30px, 8vw, 40px) !important; }
  h2, .h2 { font-size: clamp(24px, 6.5vw, 32px) !important; }
  /* About-teaser big paragraph too tight on phones */
  section.section--tight p[style*="clamp(22px"] {
    font-size: clamp(20px, 5.5vw, 26px) !important;
    max-width: none !important;
  }
  /* Eyebrow on alone column was being its own row label — give some space */
  section.section--tight .grid > div:first-child .eyebrow { margin-bottom: 8px; }
  /* CTA button row: full-width buttons stack better */
  .hero__cta { gap: 10px; }
  .hero__cta .btn { flex: 1 1 100%; justify-content: center; }
  /* Buttons in general */
  .btn--lg { padding: 14px 22px; font-size: 14px; }
  /* Hero visual: cap height so it doesn't dominate the screen */
  .hero__visual { aspect-ratio: 4/3; max-height: 320px; }
  /* Section padding compression */
  .section { padding: 56px 0; }
  .section--tight { padding: 40px 0; }
  /* Service cards: tighten body */
  .service-card__body { padding: 20px; }
  .service-card__title { font-size: 18px; }
  /* Form-block padding compress */
  .form-block { padding: 24px 20px; }
  /* Manifesto/about hard-coded grids on chi-siamo */
  section.section--dark .grid > div:first-child { margin-bottom: 8px; }
  /* Footer grid: ensure logo + tagline stack cleanly */
  .footer-grid { gap: 32px; }
  .footer-brand p { max-width: none; }
  /* Service page header (eyebrow + title + back link) */
  div[style*="display:flex"][style*="align-items:end"] { align-items: flex-start !important; }
  /* Tables on legal pages already handled */
  /* Container gutters tightened slightly via existing clamp */
}

/* Touch targets */
@media (max-width: 760px) {
  .btn { min-height: 44px; }
  .lang button { min-height: 32px; padding: 6px 14px; font-size: 13px; }
  .site-header__nav a, .site-header__nav button { min-height: 44px; }
}

/* Prevent horizontal scroll from any overflow */
html, body { overflow-x: hidden; }

/* LEGAL PAGES */
.legal-content {
  font-size: 15px;
  line-height: 1.7;
  color: var(--c-ink-2);
}
.legal-content h2 {
  font-family: var(--font-sans);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--c-ink);
  margin: 40px 0 12px;
  padding-top: 8px;
  border-top: 1px solid var(--c-line);
}
.legal-content h2:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.legal-content h3 {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  color: var(--c-ink);
  margin: 24px 0 8px;
}
.legal-content p { margin: 0 0 14px; }
.legal-content ul {
  margin: 0 0 14px;
  padding-left: 22px;
}
.legal-content ul li { margin-bottom: 6px; }
.legal-content a {
  color: var(--c-red);
  border-bottom: 1px solid currentColor;
  transition: opacity .2s;
}
.legal-content a:hover { opacity: 0.7; }
.legal-content strong { color: var(--c-ink); font-weight: 600; }
.legal-content .muted {
  color: var(--c-ink-3);
  font-size: 13px;
  font-style: italic;
}
.legal-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 24px;
  font-size: 14px;
}
.legal-table th,
.legal-table td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--c-line);
  vertical-align: top;
}
.legal-table th {
  width: 200px;
  font-weight: 500;
  color: var(--c-ink-3);
  background: var(--c-bg-alt);
}
.legal-table td { color: var(--c-ink); font-weight: 500; }
.legal-table tr:last-child th,
.legal-table tr:last-child td { border-bottom: 0; }
@media (max-width: 640px) {
  .legal-table th, .legal-table td { padding: 10px 12px; display: block; width: auto; }
  .legal-table th { border-bottom: 0; padding-bottom: 0; font-size: 12px; }
}

/* FOOTER LEGAL LINKS */
.footer-legal-links a {
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.footer-legal-links a:hover { border-bottom-color: currentColor; }
.footer-uid { opacity: 0.6; }
.footer-bottom {
  flex-wrap: wrap;
  gap: 12px 20px;
}
@media (max-width: 720px) {
  .footer-bottom { flex-direction: column; align-items: flex-start; }
  .footer-legal-links { line-height: 1.9; }
}
