/* MDR Carrozzeria Tecnica — implementation of MDR Carrozzeria.dc.html */

/* Space Age by Justin Callaghan — caps only, see fonts/Space.txt */
@font-face {
  font-family: 'Space Age';
  src: url('fonts/space-age.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --accent: #57A639;
  --accent-hi: #7CC95C;
  --bg: #0E0E10;
  --bg-alt: #101013;
  --surface: #121214;
  --surface-hi: #16161A;
  --line: #1E1E22;
  --line-hi: #26262C;
  --line-soft: #3A3A40;
  --text: #EDEDEA;
  --muted: #A8A8AE;
  --muted-2: #8A8A90;
  --muted-3: #6E6E76;
  --pad-x: 48px;
}

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

html, body { margin: 0; padding: 0; background: var(--bg); }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%; /* no font inflation in iOS landscape */
}

body {
  font-family: 'Barlow', sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden; /* absorbs subpixel rounding at 320px */
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hi); }
::selection { background: var(--accent); color: var(--bg); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

h1, h2, h3 { font-weight: 400; }

/* ---------- shared ---------- */

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 var(--pad-x); }

.mono { font-family: 'Michroma', sans-serif; }

.cond {
  font-family: 'Barlow Condensed', sans-serif;
  letter-spacing: 2px;
  text-transform: uppercase;
}

section { scroll-margin-top: 72px; }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 20px;
  margin-bottom: 16px;
}

.section-head .num {
  font-family: 'Michroma', sans-serif;
  font-size: 14px;
  color: var(--accent);
}

.section-head h2 {
  font-family: 'Michroma', sans-serif;
  font-size: clamp(24px, 3.5vw, 38px);
  margin: 0;
  color: var(--text);
}

.section-intro {
  color: var(--muted);
  font-size: 16px;
  margin: 0 0 48px;
  max-width: 560px;
}

.eyebrow {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}

.btn {
  display: inline-block;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 16px 36px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}

.btn-primary { background: var(--accent); color: var(--bg); }
.btn-primary:hover { background: var(--accent-hi); color: var(--bg); }

.btn-ghost { border-color: var(--line-soft); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- nav ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px var(--pad-x);
  background: rgba(14, 14, 16, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: baseline; gap: 10px; }

.brand-mark {
  font-family: 'Space Age', 'Michroma', sans-serif;
  font-size: 30px; /* Space Age has a small cap height for its em box */
  letter-spacing: 4px;
  color: var(--accent);
}

.brand-sub {
  font-family: 'Space Age', 'Barlow Condensed', sans-serif;
  font-size: 17px; /* matches Barlow Condensed 13px optically — small cap height */
  letter-spacing: 3px;
  color: var(--muted-2);
  text-transform: uppercase;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  gap: 32px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 15px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.nav-links a { color: var(--text); transition: color .18s ease, background .18s ease; }
.nav-links a:hover { color: var(--accent); }
.nav-links a[aria-current="true"] { color: var(--accent); }

.nav-links a.nav-cta {
  color: var(--bg);
  background: var(--accent);
  padding: 6px 16px;
  margin: -6px 0;
}
.nav-links a.nav-cta:hover { background: var(--accent-hi); color: var(--bg); }
.nav-links a.nav-cta[aria-current="true"] { color: var(--bg); }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line-soft);
  color: var(--text);
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 14px;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 8px 14px;
  cursor: pointer;
}
.nav-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- hero ---------- */

.hero {
  position: relative;
  padding: 110px var(--pad-x) 90px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.hero-stripes {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(-45deg, #121214 0 26px, #0E0E10 26px 52px);
  opacity: .6;
}

.hero-rule {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent) 0%, transparent 60%);
}

.hero-inner { position: relative; max-width: 1100px; margin: 0 auto; }

.hero-kicker {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 15px;
  letter-spacing: 5px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 20px;
}

.hero h1 {
  font-family: 'Michroma', sans-serif;
  font-size: clamp(34px, 6vw, 72px);
  line-height: 1.08;
  margin: 0 0 28px;
  color: var(--text);
}

.hero h1 span { color: var(--accent); }

.hero p {
  max-width: 560px;
  font-size: 18px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0 0 40px;
}

.hero-actions { display: flex; gap: 16px; flex-wrap: wrap; }

/* ---------- servizi ---------- */

/* linee disegnate sulle card, non col gap: l'ultima riga incompleta
   (7 servizi su 3 colonne) non lascia celle vuote scure */
.services {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 0;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.service {
  background: var(--bg);
  padding: 36px 32px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  transition: background .18s ease;
}
.service:hover { background: var(--surface); }

.service .num {
  font-family: 'Michroma', sans-serif;
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 16px;
}

.service h3 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin: 0 0 12px;
  color: var(--text);
}

.service p { font-size: 15px; line-height: 1.6; color: var(--muted); margin: 0; }

/* ---------- gallery ---------- */

.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 48px;
}

.shot {
  position: relative;
  display: block;
  padding: 0;
  margin: 0;
  border: 1px solid var(--line-hi);
  background: var(--surface);
  aspect-ratio: 1 / 1;
  overflow: hidden;
  cursor: pointer;
  appearance: none;
}

.shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .35s ease, filter .35s ease;
}

.shot:hover img { transform: scale(1.04); filter: saturate(1.1); }

/* velo verde che entra dal basso all'hover */
.shot::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(87, 166, 57, .32), transparent 55%);
  opacity: 0;
  transition: opacity .35s ease;
  pointer-events: none;
}
.shot:hover::after { opacity: 1; }

/* placeholder: mostrato solo se il file manca */
.shot-ph { display: none; }

.shot.missing img { display: none; }

.shot.missing {
  cursor: default;
  background-color: var(--surface);
  background-image: repeating-linear-gradient(
    45deg,
    var(--line-hi) 0 1px,
    transparent 1px 9px
  );
}
.shot.missing::after { content: none; }

.shot.missing .shot-ph {
  display: grid;
  place-items: center;
  position: absolute;
  inset: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--muted-3);
}

/* ---------- lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 32px;
  background: rgba(8, 8, 10, .94);
  backdrop-filter: blur(6px);
}

.lightbox[hidden] { display: none; }

.lb-img {
  grid-column: 2;
  justify-self: center;
  max-width: 100%;
  max-height: 82vh;
  object-fit: contain;
  border: 1px solid var(--line-hi);
}

.lb-nav,
.lb-close {
  background: transparent;
  border: 1px solid var(--line-soft);
  color: var(--text);
  cursor: pointer;
  font-family: 'Barlow', sans-serif;
  line-height: 1;
  transition: border-color .18s ease, color .18s ease;
}

.lb-nav:hover,
.lb-close:hover { border-color: var(--accent); color: var(--accent-hi); }

.lb-nav {
  width: 48px;
  height: 64px;
  font-size: 34px;
}

.lb-close {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  font-size: 16px;
}

.lb-caption {
  grid-column: 2;
  justify-self: center;
  margin-top: 16px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 15px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted-2);
}

/* ---------- layout a due colonne ---------- */

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: start;
}

/* ---------- numeri ---------- */

.stats { display: flex; gap: 40px; flex-wrap: wrap; }

.stats-band {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--line-hi);
  border-bottom: 1px solid var(--line-hi);
}

.stats-band .stat {
  padding: 32px 0 32px 32px;
  border-left: 1px solid var(--line-hi);
}

.stats-band .stat:first-child { padding-left: 0; border-left: 0; }

.stats-band .value { font-size: 40px; }

.stat .value { font-family: 'Michroma', sans-serif; font-size: 28px; color: var(--accent); }

.stat .label {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 14px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-top: 6px;
}

/* ---------- contatti ---------- */

.contact-info {
  display: flex;
  flex-direction: column;
  gap: 22px;
  font-size: 16px;
  color: var(--muted);
}

/* tel / social links get a real touch area, not just a 19px text line */
.contact-info a {
  display: inline-block;
  min-height: 44px;
  line-height: 44px;
  padding-right: 6px;
}

.socials { display: flex; gap: 12px; margin-top: 6px; }

.socials a {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  min-height: 0;
  line-height: 0;
  padding: 0;
  border: 1px solid var(--line-soft);
  color: var(--muted);
  transition: color .18s ease, border-color .18s ease, background .18s ease;
}

.socials a:hover {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
}

.map {
  margin-top: 32px;
  aspect-ratio: 16 / 9;
  width: 100%;
  border: 1px solid var(--line-hi);
  display: block;
  /* filtro: mappa Google chiara → scura, in linea col resto */
  filter: invert(0.9) hue-rotate(180deg) saturate(0.7) contrast(0.9);
}

.map-link {
  display: inline-block;
  margin-top: 14px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 14px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
}

.form-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 24px;
}

.form { display: flex; flex-direction: column; gap: 14px; }

.form input,
.form textarea {
  background: var(--surface);
  border: 1px solid var(--line-hi);
  color: var(--text);
  padding: 14px 16px;
  font-family: 'Barlow', sans-serif;
  font-size: 15px;
  outline: none;
  transition: border-color .18s ease;
  width: 100%;
}

.form textarea { resize: vertical; min-height: 110px; }

.form input:focus,
.form textarea:focus { border-color: var(--accent); }

.form input::placeholder,
.form textarea::placeholder { color: var(--muted-3); }

.form input[aria-invalid="true"],
.form textarea[aria-invalid="true"] { border-color: #C0492F; }

.form button { width: 100%; padding: 16px; }
.form button:disabled { cursor: default; opacity: .85; }

.form-note {
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted-3);
  margin: 0;
  min-height: 20px;
}

.form-note.error { color: #E0755B; }
.form-note.ok { color: var(--accent); }

/* ---------- footer ---------- */

.footer {
  border-top: 1px solid var(--line);
  padding: 28px var(--pad-x);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.footer .brand-mark { font-size: 15px; }
.footer .brand-sub { font-size: 16px; letter-spacing: 2px; color: var(--muted-3); }
.footer .legal { font-size: 13px; color: var(--muted-3); }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  :root { --pad-x: 28px; }

  .two-col { grid-template-columns: 1fr; gap: 48px; }

  .nav-toggle { display: block; }

  .nav { flex-wrap: wrap; }

  .nav-links {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    gap: 0;
    font-size: 17px;
    border-top: 1px solid var(--line);
    margin-top: 14px;
    padding-top: 6px;
  }

  .nav-links.open { display: flex; }

  .nav-links a { padding: 14px 0; border-bottom: 1px solid var(--line); }

  .nav-links a.nav-cta {
    margin: 12px 0 6px;
    padding: 12px 16px;
    border-bottom: none;
    text-align: center;
  }

  .hero { padding: 72px var(--pad-x) 64px; }
  .hero-kicker { letter-spacing: 3px; }

  /* 16px minimum stops iOS Safari zooming in on focus */
  .form input,
  .form textarea { font-size: 16px; }

  .brand { min-height: 44px; align-items: center; }

  .lightbox { padding: 72px 12px 24px; gap: 4px; }
  .lb-nav { width: 36px; height: 56px; font-size: 26px; }
  .lb-img { max-height: 72vh; }
  .lb-close { top: 16px; right: 16px; }
}

@media (max-width: 560px) {
  :root { --pad-x: 20px; }

  .brand-sub { display: none; }
  .hero-actions .btn { flex: 1 1 100%; text-align: center; }
  .stats { gap: 28px; }
  .gallery { grid-template-columns: repeat(2, 1fr); gap: 8px; }

  .stats-band { grid-template-columns: 1fr; }
  .stats-band .stat {
    padding: 24px 0;
    border-left: 0;
    border-top: 1px solid var(--line-hi);
  }
  .stats-band .stat:first-child { border-top: 0; padding-top: 0; }
  .stats-band .stat:last-child { padding-bottom: 0; }
  .stats-band .value { font-size: 32px; }
  .service { padding: 28px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
