/* ============================================================
   Derilat — "Bianco-latte del mattino"
   Concept: luminoso, arioso, editoriale, fresco.
   Palette: bianco / superficie fredda / inchiostro blu notte / acqua
   ============================================================ */

:root {
  --white:       #FFFFFF;
  --surface:     #F4F8FB;   /* superficie fredda */
  --surface-2:   #E8F1F7;
  --ink:         #10233A;   /* inchiostro blu notte */
  --ink-soft:    #3A4B60;
  --water:       #2E7FB8;   /* accento acqua */
  --water-deep:  #1F6699;
  --line:        #DDE7EF;
  --milk:        #F7FBFD;

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-text:    "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --container: 1200px;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --radius: 22px;
  --radius-lg: 34px;
  --shadow-sm: 0 2px 10px rgba(16, 35, 58, 0.06);
  --shadow:    0 24px 60px -28px rgba(16, 35, 58, 0.32);
  --shadow-lg: 0 40px 90px -40px rgba(16, 35, 58, 0.45);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Reset di base ---------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font-text);
  color: var(--ink);
  background: var(--white);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--ink);
}
h1 em, h2 em, h3 em {
  font-style: italic;
  font-weight: 400;
  color: var(--water);
}

p { margin: 0; }

::selection { background: var(--water); color: #fff; }

/* focus visibile ovunque */
:focus-visible {
  outline: 3px solid var(--water);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 1rem; top: -60px;
  background: var(--ink);
  color: #fff;
  padding: .7rem 1.1rem;
  border-radius: 10px;
  z-index: 1000;
  transition: top .2s var(--ease);
}
.skip-link:focus { top: 1rem; }

/* ---------- Layout helpers ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

.section {
  padding-block: clamp(4.5rem, 10vw, 8.5rem);
}

.eyebrow {
  font-family: var(--font-text);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--water);
  margin: 0 0 1.1rem;
  display: inline-flex;
  align-items: center;
  gap: .6rem;
}
.eyebrow::before {
  content: "";
  width: 26px; height: 2px;
  background: currentColor;
  display: inline-block;
}
.eyebrow-dark { color: var(--ink-soft); }
.eyebrow-water { color: var(--water); }

.section-head { max-width: 46rem; margin-bottom: clamp(2.5rem, 5vw, 4rem); }
.section-head.center { margin-inline: auto; text-align: center; }
.section-head.center .eyebrow { justify-content: center; }
.section-head h2 { font-size: clamp(2.1rem, 5vw, 3.4rem); }
.section-lead {
  margin-top: 1.2rem;
  font-size: clamp(1.05rem, 1.6vw, 1.2rem);
  color: var(--ink-soft);
  max-width: 42rem;
}
.section-head.center .section-lead { margin-inline: auto; }

/* ---------- Buttons ---------- */
.btn {
  --bg: var(--ink);
  --fg: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  font-family: var(--font-text);
  font-weight: 600;
  font-size: .98rem;
  line-height: 1;
  padding: 1rem 1.6rem;
  border-radius: 100px;
  border: 1.5px solid transparent;
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
  transition: transform .35s var(--ease), background .3s var(--ease), color .3s var(--ease), box-shadow .3s var(--ease);
  will-change: transform;
}
.btn:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(-1px); }

.btn-primary { --bg: var(--water); --fg: #fff; }
.btn-primary:hover { --bg: var(--water-deep); }

.btn-ghost {
  --bg: transparent;
  --fg: var(--ink);
  border-color: var(--line);
}
.btn-ghost:hover { --bg: var(--surface); box-shadow: none; }

.btn-outline {
  --bg: transparent;
  --fg: var(--ink);
  border-color: var(--ink);
}
.btn-outline:hover { --bg: var(--ink); --fg: #fff; }

.btn-block { width: 100%; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease), box-shadow .3s var(--ease), background .3s var(--ease);
}
.site-header.scrolled {
  border-bottom-color: var(--line);
  box-shadow: var(--shadow-sm);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  color: var(--water);
}
.brand-mark { width: 30px; height: 30px; transition: transform .5s var(--ease); }
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.06); }
.brand-word {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.brand-accent { color: var(--water); }

.main-nav { display: flex; align-items: center; }
.nav-list {
  display: flex;
  align-items: center;
  gap: 2rem;
  list-style: none;
  margin: 0; padding: 0;
}
.nav-list a {
  font-size: .96rem;
  font-weight: 500;
  color: var(--ink);
  position: relative;
  padding: .3rem 0;
}
.nav-list a:not(.nav-cta)::after {
  content: "";
  position: absolute;
  left: 0; bottom: -2px;
  width: 100%; height: 2px;
  background: var(--water);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .35s var(--ease);
}
.nav-list a:not(.nav-cta):hover::after { transform: scaleX(1); }
.nav-cta {
  background: var(--ink);
  color: #fff !important;
  padding: .65rem 1.2rem !important;
  border-radius: 100px;
  transition: background .3s var(--ease), transform .3s var(--ease);
}
.nav-cta:hover { background: var(--water); transform: translateY(-2px); }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 44px; height: 44px;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.nav-toggle span {
  width: 20px; height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform .3s var(--ease), opacity .3s var(--ease);
}

/* ---------- HERO ---------- */
.hero {
  position: relative;
  padding-top: clamp(2rem, 6vw, 4rem);
  overflow: hidden;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 1.15fr;
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
  padding-block: clamp(2rem, 5vw, 4rem) clamp(3rem, 6vw, 5rem);
}
.hero-copy { max-width: 34rem; }
.hero h1 {
  font-size: clamp(2.9rem, 7.2vw, 5.4rem);
  margin-bottom: 1.6rem;
}
.hero-sub {
  font-size: clamp(1.08rem, 1.7vw, 1.28rem);
  color: var(--ink-soft);
  max-width: 30rem;
  margin-bottom: 2.2rem;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: .9rem; }

.hero-media { position: relative; }
.hero-frame {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  aspect-ratio: 4 / 3.4;
  background: var(--surface);
}
.hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.08);
  transform-origin: center;
  will-change: transform;
}
.hero-badge {
  position: absolute;
  left: -18px; bottom: 26px;
  background: var(--white);
  border-radius: 18px;
  padding: 1rem 1.3rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  border: 1px solid var(--line);
}
.hero-badge-big {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 600;
  color: var(--water);
}
.hero-badge-small {
  font-size: .74rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: .2rem;
}

/* marquee strip */
.hero-strip {
  border-block: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
  padding-block: 1.1rem;
  white-space: nowrap;
}
.hero-strip-track {
  display: inline-flex;
  align-items: center;
  gap: 1.4rem;
  animation: marquee 34s linear infinite;
}
.hero-strip span {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.25rem;
  color: var(--ink);
}
.hero-strip .dot { color: var(--water); font-style: normal; }
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ============================================================
   PRODOTTI — scorrimento orizzontale (firma di movimento)
   ============================================================ */
.hscroll {
  position: relative;
  background: var(--ink);
  color: var(--milk);
}
.hscroll-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;
}
.hscroll-track {
  display: flex;
  align-items: stretch;
  gap: clamp(1.5rem, 4vw, 3rem);
  padding-inline: var(--gutter);
  will-change: transform;
}

.hpanel {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* pannello introduzione */
.hpanel-intro {
  width: min(80vw, 460px);
  padding-right: 1rem;
}
.hpanel-intro h2 {
  color: var(--white);
  font-size: clamp(2.2rem, 4.5vw, 3.6rem);
  margin-bottom: 1.3rem;
}
.hpanel-intro h2 em { color: #8FC6EC; }
.hpanel-lead {
  color: rgba(247, 251, 253, 0.72);
  font-size: 1.12rem;
  max-width: 26rem;
}
.hscroll-hint {
  margin-top: 2.4rem;
  font-size: .82rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: #8FC6EC;
  display: flex;
  align-items: center;
  gap: .6rem;
}
.hscroll-hint .arrow {
  font-size: 1.1rem;
  animation: nudge 1.4s var(--ease) infinite;
}
@keyframes nudge {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(7px); }
}

/* card prodotto */
.hproduct {
  width: min(86vw, 540px);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform .5s var(--ease), border-color .5s var(--ease);
}
.hproduct:hover {
  transform: translateY(-6px);
  border-color: rgba(143, 198, 236, 0.5);
}
.hproduct-media {
  aspect-ratio: 4 / 3;
  overflow: hidden;
}
.hproduct-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .8s var(--ease);
}
.hproduct:hover .hproduct-media img { transform: scale(1.06); }
.hproduct-body {
  padding: clamp(1.6rem, 3vw, 2.4rem);
  position: relative;
}
.hproduct-index {
  font-family: var(--font-display);
  font-size: .95rem;
  color: #8FC6EC;
  letter-spacing: .1em;
}
.hproduct-body h3 {
  color: var(--white);
  font-size: clamp(1.8rem, 3.2vw, 2.5rem);
  margin: .3rem 0 .8rem;
}
.hproduct-body p {
  color: rgba(247, 251, 253, 0.75);
  font-size: 1.02rem;
  max-width: 30rem;
}

/* pannello outro / CTA */
.hpanel-outro {
  width: min(78vw, 400px);
  align-items: flex-start;
  padding-right: var(--gutter);
}
.hpanel-outro h3 {
  color: var(--white);
  font-size: clamp(2rem, 4vw, 3rem);
  margin-bottom: 1.8rem;
}

/* ---------- LAVORAZIONE ---------- */
.lavorazione { background: var(--white); }
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
}
.split-media {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.split-media img {
  width: 100%;
  aspect-ratio: 3 / 3.4;
  object-fit: cover;
}
.split-tag {
  position: absolute;
  left: 18px; bottom: 18px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: .55rem 1rem;
  border-radius: 100px;
  backdrop-filter: blur(6px);
}
.split-text h2 { font-size: clamp(2rem, 4.5vw, 3.2rem); margin-bottom: 1.2rem; }
.split-text > p { color: var(--ink-soft); font-size: 1.08rem; margin-bottom: 2.2rem; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.4rem; }
.steps li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.2rem;
  align-items: start;
  padding-bottom: 1.4rem;
  border-bottom: 1px solid var(--line);
}
.steps li:last-child { border-bottom: none; padding-bottom: 0; }
.step-n {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--water);
  min-width: 2ch;
}
.steps strong { display: block; margin-bottom: .2rem; font-size: 1.1rem; }
.steps div { color: var(--ink-soft); }

/* ---------- AZIENDA ---------- */
.azienda { background: var(--surface); }
.values {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(1.2rem, 2.5vw, 2rem);
}
.value {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.8rem 1.6rem;
  transition: transform .4s var(--ease), box-shadow .4s var(--ease);
}
.value:hover { transform: translateY(-6px); box-shadow: var(--shadow); }
.value-n {
  font-family: var(--font-display);
  font-size: .9rem;
  color: var(--water);
  letter-spacing: .1em;
}
.value h3 { font-size: 1.4rem; margin: .6rem 0 .7rem; }
.value p { color: var(--ink-soft); font-size: .98rem; }

/* ---------- CONTATTI ---------- */
.contatti { background: var(--white); }
.contatti-split { align-items: start; }
.contatti-info h2 { font-size: clamp(2rem, 4.5vw, 3.2rem); }
.contatti-info .section-lead { margin-bottom: 2rem; }

.contact-list { list-style: none; margin: 0 0 2rem; padding: 0; display: grid; gap: 1.3rem; }
.contact-list li {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 1rem;
  align-items: baseline;
  padding-bottom: 1.3rem;
  border-bottom: 1px solid var(--line);
}
.c-label {
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.contact-list a { color: var(--ink); font-weight: 500; transition: color .25s var(--ease); }
.contact-list a:hover { color: var(--water); }

.contatti-form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(1.6rem, 3.5vw, 2.6rem);
}
.field { margin-bottom: 1.2rem; }
.field label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  letter-spacing: .04em;
  margin-bottom: .5rem;
  color: var(--ink);
}
.field input, .field textarea {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--white);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: .9rem 1rem;
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease);
}
.field textarea { resize: vertical; min-height: 120px; }
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--water);
  box-shadow: 0 0 0 4px rgba(46, 127, 184, 0.14);
}
.field input.invalid, .field textarea.invalid {
  border-color: #C0392B;
  box-shadow: 0 0 0 4px rgba(192, 57, 43, 0.1);
}
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.form-note { min-height: 1.2rem; font-size: .92rem; margin-bottom: .6rem; }
.form-note.ok { color: var(--water-deep); font-weight: 600; }
.form-note.err { color: #C0392B; font-weight: 600; }

/* ---------- FOOTER ---------- */
.site-footer {
  background: var(--ink);
  color: rgba(247, 251, 253, 0.7);
  padding-block: clamp(3rem, 6vw, 4.5rem) 2rem;
}
.footer-inner {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: 2.5rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.footer-brand .brand { color: #8FC6EC; margin-bottom: 1rem; }
.footer-brand .brand-word { color: #fff; }
.footer-brand .brand-accent { color: #8FC6EC; }
.footer-brand p { max-width: 22rem; }
.footer-col h4 {
  font-family: var(--font-text);
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #fff;
  margin-bottom: 1rem;
}
.footer-col a { transition: color .25s var(--ease); }
.footer-col a:hover { color: #8FC6EC; }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .6rem;
  padding-top: 2rem;
  font-size: .86rem;
}
.footer-bottom .credit { color: rgba(247, 251, 253, 0.5); }

/* ============================================================
   Reveal on scroll
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .8s var(--ease), transform .8s var(--ease);
}
.reveal.in { opacity: 1; transform: none; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-media { order: -1; }
  .hero-frame { aspect-ratio: 16 / 11; }
  .hero-badge { left: 12px; }

  .split { grid-template-columns: 1fr; }
  .split-media { order: -1; }
  .split-media img { aspect-ratio: 16 / 11; }

  .values { grid-template-columns: repeat(2, 1fr); }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  .nav-toggle { display: flex; }
  .main-nav { position: relative; }
  .nav-list {
    position: absolute;
    top: calc(100% + 14px);
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: .3rem;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: .8rem;
    min-width: 220px;
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity .25s var(--ease), transform .25s var(--ease), visibility .25s;
  }
  .nav-list.open { opacity: 1; visibility: visible; transform: none; }
  .nav-list a { padding: .7rem .8rem; border-radius: 12px; }
  .nav-list a:not(.nav-cta):hover { background: var(--surface); }
  .nav-list a:not(.nav-cta)::after { display: none; }
  .nav-cta { text-align: center; }

  .values { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; }
  .contact-list li { grid-template-columns: 1fr; gap: .2rem; }
}

/* ---------- Fallback / mobile per lo scroll orizzontale ---------- */
/* Su schermi piccoli: carosello swipe con scroll-snap */
@media (max-width: 860px) {
  .hscroll-sticky {
    position: static;
    height: auto;
    display: block;
    padding-block: clamp(3.5rem, 9vw, 6rem);
    overflow: visible;
  }
  .hscroll-track {
    transform: none !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-block: .5rem 1.5rem;
    scrollbar-width: none;
  }
  .hscroll-track::-webkit-scrollbar { display: none; }
  .hpanel { scroll-snap-align: center; }
  .hproduct { width: min(82vw, 420px); }
  .hpanel-intro { width: 82vw; scroll-snap-align: start; }
  .hpanel-outro { width: 78vw; }
  .hscroll-hint { display: none; }
}

/* ============================================================
   prefers-reduced-motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .hero-img { transform: scale(1); }
  .hero-strip-track { animation: none; }

  /* niente pin: lo scroll orizzontale diventa un carosello swipe */
  .hscroll-sticky {
    position: static;
    height: auto;
    display: block;
    overflow: visible;
    padding-block: clamp(3.5rem, 9vw, 6rem);
  }
  .hscroll-track {
    transform: none !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
  }
  .hpanel { scroll-snap-align: center; }
}
