/* Work Sans served from this site (not from Google Fonts: no visitor data
   sent to Google before consent) */
@font-face {
  font-family: "Work Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/work-sans-400.woff2") format("woff2");
}

@font-face {
  font-family: "Work Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/work-sans-500.woff2") format("woff2");
}

@font-face {
  font-family: "Work Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/work-sans-600.woff2") format("woff2");
}

@font-face {
  font-family: "Work Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/work-sans-700.woff2") format("woff2");
}

/* ============================================================
   Pleom — Design system
   ============================================================ */

:root {
  --bg: #f0f0f0;
  --ink: #101010;
  --dot: #bfbfbf;
  --surface: #ffffff;
  --surface-ink: #101010;
  --dark: #101010;
  --dark-ink: #f0f0f0;
  --line: rgba(16, 16, 16, 0.1);
  --line-light: rgba(240, 240, 240, 0.16);
  --glass-bg: rgba(255, 255, 255, 0.66);
  --glass-blur: blur(14px) saturate(140%);
  --glass-border: rgba(255, 255, 255, 0.7);
  --glass-shadow: 0 8px 32px rgba(16, 16, 16, 0.06);
  --blueprint-bg: #101010;
  --blueprint-line: #f0f0f0;
  --vision-bg: #35236b;
  --vision-line: #ece6ff;
  --service-red: #0d2f66;
  --service-line: #eaf1ff;
  --sustain-green: #1d3a2c;
  --sustain-line: #eaf3ec;
  --radius: 50px;
  --radius-sm: 24px;
  --container: 90vw;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

img {
  max-width: 100%;
  display: block;
}

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

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

button {
  font-family: inherit;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 32px;
}

/* ---------- Typography ---------- */

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.08;
}

h1 {
  font-size: clamp(2.2rem, 4.2vw, 3.75rem);
  font-weight: 500;
}

h2 {
  font-size: clamp(1.9rem, 3.4vw, 3rem);
}

h3 {
  font-size: clamp(1.2rem, 1.6vw, 1.5rem);
}

p {
  margin: 0;
}

.lede {
  font-size: clamp(1.05rem, 1.4vw, 1.3rem);
  line-height: 1.55;
  color: var(--ink);
  opacity: 0.72;
  max-width: 640px;
}

/* ---------- Decor icons ---------- */

.decor-icon {
  display: block;
  width: 76px;
  height: 76px;
  flex-shrink: 0;
}

.decor-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.decor-icon--hit {
  color: var(--ink);
}

.decor-icon--miss {
  color: var(--dot);
}

/* ---------- Problema/Soluzione (scrollytelling) ---------- */

.problem-track {
  position: relative;
  height: 280vh;
  height: 280lvh;
  padding: 0;
}

.problem-cap-top {
  position: relative;
  z-index: 2;
  height: var(--radius);
  margin-top: calc(var(--radius) * -1);
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
}

.problem-pin {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100lvh;
  display: flex;
  align-items: safe center;
  justify-content: safe center;
  overflow: hidden;
  overflow: clip;
}

.problem-panel {
  width: 100vw;
  height: 100%;
  margin-left: calc(50% - 50vw);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.problem-panel {
  position: relative;
}

.problem-content {
  z-index: 1;
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 48px 32px 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: flex-start;
  text-align: left;
}

.hl {
  --hl: 100%;
  position: relative;
  display: inline-block;
  padding: 0 0.22em;
  margin: 0 -0.22em;
  font-style: normal;
}

.hl::before {
  content: "";
  position: absolute;
  top: -0.02em;
  bottom: -0.08em;
  left: 0;
  width: 100%;
  background: var(--ink);
  border-radius: 0.2em;
  /* revealed with a clip (repaint only) instead of animating the width */
  clip-path: inset(0 calc(100% - var(--hl)) 0 0 round 0.2em);
}

.hl::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  padding: 0 0.22em;
  color: var(--surface);
  white-space: normal;
  clip-path: inset(0 calc(100% - var(--hl)) 0 0);
}

.hl--inv::before {
  background: var(--surface);
}

.hl--inv::after {
  color: var(--ink);
}

.scrolly-value strong.hl {
  display: block;
  width: fit-content;
  margin: 0 -0.22em 4px;
}

.problem-content .btn {
  margin-top: 12px;
}

.problem-icon-stage {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: clamp(8px, 2vw, 24px);
  width: 100%;
  margin: 16px 0;
}

.problem-icon-stage .problem-icon {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  opacity: 0;
  transform: translateY(8px);
}

/* mobile: 2 file da 5 icone, piu' grandi */
@media (max-width: 760px) {
  .problem-icon-stage {
    grid-template-columns: repeat(5, 1fr);
    gap: 14px 18px;
    max-width: 340px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .problem-track {
    height: auto;
  }
  .problem-pin {
    position: static;
    height: auto;
    overflow: visible;
  }
  .problem-panel {
    padding: 48px 0;
  }
  .problem-icon-stage .problem-icon {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ---------- Tecnologie / Progetti (scrollytelling) ---------- */

.tech-cap-top {
  position: relative;
  z-index: 2;
  height: var(--radius);
  margin-top: calc(var(--radius) * -1);
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
}

.tech-track,
.projects-track,
.cta-track {
  position: relative;
  height: 220vh;
  height: 220lvh;
  padding: 0;
}

.tech-track {
  height: 300vh;
  height: 300lvh;
}

.cta-track {
  height: 170vh;
  height: 170lvh;
}

.tech-pin,
.projects-pin,
.cta-pin {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100lvh;
  display: flex;
  align-items: safe center;
  justify-content: safe center;
  overflow: hidden;
  overflow: clip;
}

.tech-panel,
.projects-panel,
.cta-panel {
  position: relative;
  width: 100vw;
  height: 100%;
  margin-left: calc(50% - 50vw);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.projects-panel {
  background: var(--ink);
  color: var(--bg);
}

.tech-content,
.projects-content,
.cta-content {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 48px 32px 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: flex-start;
  text-align: left;
}

.problem-content,
.scrolly-content,
.tech-content,
.projects-content,
.cta-content {
  position: sticky;
  top: var(--stick, 0px);
  will-change: opacity;
}

.problem-content,
.scrolly-content,
.tech-content,
.projects-content {
  margin-bottom: -50vh;
  margin-bottom: -50lvh;
}

.cta-content {
  margin-bottom: var(--hold-gap, 0px);
}

.scrolly-content {
  will-change: transform, opacity;
}

.scrolly-panel .scrolly-content {
  margin-bottom: -50vh;
  margin-bottom: -50lvh;
}

@media (prefers-reduced-motion: reduce) {
  .problem-content,
  .scrolly-content,
  .tech-content,
  .projects-content,
  .cta-content,
  .scrolly-panel .scrolly-content {
    position: static;
    margin-bottom: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tech-track,
  .projects-track,
  .cta-track {
    height: auto;
  }
  .tech-pin,
  .projects-pin,
  .cta-pin {
    position: static;
    height: auto;
    overflow: visible;
  }
  .tech-panel,
  .projects-panel,
  .cta-panel {
    padding: 48px 0;
  }
}

/* ---------- Layout ---------- */

main {
  position: relative;
  z-index: 1;
}

section {
  position: relative;
  z-index: 1;
  padding: 120px 0;
}

@media (max-width: 768px) {
  section {
    padding: 80px 0;
  }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 30px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.35s var(--ease), background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: var(--ink);
  color: var(--bg);
}

.btn-primary:hover {
  background: #2a2a2a;
}

.btn-light {
  background: var(--bg);
  color: var(--ink);
}

.btn-light:hover {
  background: #ffffff;
}

.btn-sm {
  padding: 12px 22px;
  font-size: 0.85rem;
}

/* ---------- Navbar ---------- */

.nav-wrap {
  position: fixed;
  top: 20px;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0 20px;
}

.navbar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 12px 14px 12px 28px;
  box-shadow: 0 12px 40px rgba(16, 16, 16, 0.12);
}

.nav-logo {
  display: flex;
  align-items: center;
}

.nav-logo img {
  height: 20px;
  width: auto;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-links a {
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink);
  opacity: 0.6;
  transition: opacity 0.25s ease, background 0.25s ease;
}

.nav-links a:hover {
  opacity: 1;
}

.nav-links a.active {
  opacity: 1;
  background: rgba(16, 16, 16, 0.07);
}

.nav-cta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--ink);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.nav-toggle svg {
  width: 20px;
  height: 20px;
}

.mobile-menu {
  position: fixed;
  top: 90px;
  left: 32px;
  right: 32px;
  z-index: 99;
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 18px;
  display: none;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 12px 40px rgba(16, 16, 16, 0.16);
}

.mobile-menu a {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 500;
  opacity: 0.65;
}

.mobile-menu a.active {
  opacity: 1;
  background: rgba(16, 16, 16, 0.07);
}

.mobile-menu .btn {
  margin-top: 10px;
}

body.menu-open .mobile-menu {
  display: flex;
}

@media (max-width: 860px) {
  .nav-links {
    display: none;
  }
  .nav-cta .btn-sm.desktop-only {
    display: none;
  }
  .nav-toggle {
    display: flex;
  }
}

/* ---------- Hero ---------- */

.hero {
  padding: 0;
}

.hero-inner {
  display: flex;
  flex-direction: column;
  gap: 28px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius);
  padding: 64px;
}

@media (max-width: 620px) {
  .hero-inner {
    padding: 40px 28px;
  }
}

/* ---------- Hero split layout ---------- */

.hero-split {
  display: flex;
  align-items: center;
  gap: 48px;
}

.hero-copy {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

@media (max-width: 860px) {
  .hero-split {
    flex-direction: column;
    align-items: stretch;
    gap: 28px;
  }
}

/* ---------- Hero blueprint animation ---------- */

.hero-inner.hero-blueprint {
  position: relative;
  min-height: 100vh;
  justify-content: center;
  overflow: hidden;
  background-color: var(--blueprint-bg);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  box-shadow: none;
  border-radius: 0;
  padding: 90px 0;
}

.hero-blueprint .container {
  position: relative;
  z-index: 1;
  pointer-events: none;
}

.hero-blueprint .hero-copy {
  max-width: 780px;
  opacity: 1;
  pointer-events: auto;
}

.hero-blueprint .btn-primary {
  background: var(--surface);
  color: var(--ink);
}

.hero-blueprint .btn-primary:hover {
  background: var(--bg);
}

.hero-blueprint .btn-light {
  background: transparent;
  color: var(--dark-ink);
  border-color: var(--line-light);
}

.hero-blueprint .btn-light:hover {
  background: transparent;
  border-color: var(--dark-ink);
}

/* Grey sheet behind the footer: its corner radius is the panel radius plus the
   20px footer gutter, so both curves share the same centres. */
.hero-cap {
  position: relative;
  z-index: 2;
  height: calc(var(--radius) + 20px);
  margin: calc((var(--radius) + 20px) * -1) 0;
  background: var(--bg);
  border-radius: calc(var(--radius) + 20px) calc(var(--radius) + 20px) 0 0;
}

/* ---------- Scroll indicator ---------- */

.scroll-indicator {
  position: fixed;
  bottom: calc(var(--radius) + 24px);
  left: 50%;
  z-index: 50;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(16, 16, 16, 0.18);
  color: var(--ink);
  pointer-events: none;
  animation: scrollIndicatorPulse 2.6s ease-in-out infinite;
  transition: opacity 0.4s ease;
}

.scroll-indicator svg {
  width: 22px;
  height: 22px;
}

.scroll-indicator.is-hidden {
  opacity: 0 !important;
}

@media (max-width: 620px) {
  .scroll-indicator {
    display: none;
  }
}

@keyframes scrollIndicatorPulse {
  0%, 100% { opacity: 0.35; transform: translate(-50%, 0); }
  50% { opacity: 1; transform: translate(-50%, 6px); }
}

.hero-blueprint h1 {
  color: #ffffff;
}

.hero-blueprint .lede {
  color: var(--blueprint-line);
  opacity: 0.78;
}

/* ---------- Hero red (Servizi) ---------- */

.hero-inner.hero-red {
  position: relative;
  min-height: 100vh;
  justify-content: center;
  overflow: hidden;
  background-color: var(--service-red);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  box-shadow: none;
  border-radius: 0;
  padding: 90px 0;
}

.hero-red .container {
  position: relative;
  z-index: 1;
  pointer-events: none;
}

.hero-red .hero-copy {
  max-width: 780px;
  opacity: 1;
  pointer-events: auto;
}

.hero-red .pixel-flow {
  --dot-color: rgba(234, 241, 255, 0.16);
}

.hero-vision .pixel-flow {
  --dot-color: rgba(236, 230, 255, 0.16);
}

.hero-green .pixel-flow {
  --dot-color: rgba(234, 243, 236, 0.16);
}

.hero-red h1 {
  color: #ffffff;
}

.hero-red .lede {
  color: var(--service-line);
  opacity: 0.82;
}

/* ---------- Hero vision (pixel flow) ---------- */

.hero-inner.hero-vision {
  position: relative;
  min-height: 100vh;
  justify-content: center;
  overflow: hidden;
  background: var(--vision-bg);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  box-shadow: none;
  border-radius: 0;
  padding: 90px 0;
}

.hero-vision .container {
  position: relative;
  z-index: 1;
  pointer-events: none;
}

.hero-vision .hero-copy {
  max-width: 780px;
  opacity: 1;
  pointer-events: auto;
}

.hero-vision h1 {
  color: #ffffff;
}

.hero-vision .lede {
  color: var(--vision-line);
  opacity: 0.82;
}

.pixel-flow {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
  display: block;
  pointer-events: none;
  --px: 6px;
  background-image: radial-gradient(circle at calc(var(--px) / 2) calc(var(--px) / 2), var(--dot-color, rgba(240, 240, 240, 0.16)) 1px, transparent 1.6px);
  background-size: calc(var(--px) * 3) calc(var(--px) * 3);
  background-position: 0 0;
}

/* ---------- Hero green (Sostenibilità) ---------- */

.hero-inner.hero-green {
  position: relative;
  min-height: 100vh;
  justify-content: center;
  overflow: hidden;
  background-color: var(--sustain-green);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  box-shadow: none;
  border-radius: 0;
  padding: 90px 0;
}

.hero-green .container {
  position: relative;
  z-index: 1;
  pointer-events: none;
}

.hero-green .hero-copy {
  max-width: 780px;
  opacity: 1;
  pointer-events: auto;
}

.hero-green h1 {
  color: #ffffff;
}

.hero-green .lede {
  color: var(--sustain-line);
  opacity: 0.82;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* ---------- Project slider ---------- */

.project-slider {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
}

.project-slider-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.project-nav {
  display: flex;
  gap: 10px;
}

.project-nav-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line-light);
  background: transparent;
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  flex-shrink: 0;
}

.project-nav-btn svg {
  width: 18px;
  height: 18px;
}

.project-nav-btn:hover {
  border-color: var(--bg);
  background: rgba(240, 240, 240, 0.1);
}

.project-track {
  --edge: calc(5vw + 32px);
  display: flex;
  gap: 20px;
  width: calc(100% + 2 * var(--edge));
  margin: 0 calc(-1 * var(--edge));
  padding-left: var(--edge);
  scroll-padding-left: var(--edge);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.project-track::after {
  content: "";
  flex: 0 0 calc(var(--edge) - 20px);
}

.project-track::-webkit-scrollbar {
  display: none;
}

.project-slide {
  position: relative;
  flex: 0 0 calc((100% - var(--edge) - 40px) / 3);
  aspect-ratio: 3 / 4;
  scroll-snap-align: start;
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  background: var(--ink);
}

.project-slide img {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-slide::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0) 60%);
}

.project-slide-title {
  position: relative;
  z-index: 1;
  color: #ffffff;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.project-slide-name {
  font-weight: 600;
  font-size: 1.05rem;
}

.project-slide-client {
  font-size: 0.85rem;
  opacity: 0.75;
}

.project-slide .project-slide-name.hl {
  align-self: flex-start;
}

.project-slide .hl::before,
.tech-card .hl::before {
  width: 0;
  transition: width 0.35s var(--ease);
}

.project-slide .hl::after,
.tech-card .hl::after {
  clip-path: inset(0 100% 0 0);
  transition: clip-path 0.35s var(--ease);
}

/* .is-current: on mobile (no hover) main.js marks the card on screen */
.project-slide:hover .hl::before,
.tech-card:hover .hl::before,
.project-slide.is-current .hl::before,
.tech-card.is-current .hl::before {
  width: 100%;
}

.project-slide:hover .hl::after,
.tech-card:hover .hl::after,
.project-slide.is-current .hl::after,
.tech-card.is-current .hl::after {
  clip-path: inset(0 0 0 0);
}

.service-slide::after {
  background: linear-gradient(to top, rgba(0, 0, 0, 0.88), rgba(0, 0, 0, 0) 78%);
}

.project-slide-desc {
  margin-top: 6px;
  min-height: calc(4 * 1.45em);
  font-size: 0.85rem;
  line-height: 1.45;
  opacity: 0.8;
}

.project-slide-client em {
  font-style: italic;
}

@media (max-width: 620px) {
  .project-slide {
    flex-basis: calc((100% - var(--edge)) * 0.78);
  }
}

/* mobile: niente frecce, card un po' piu' strette della navbar (16px tra
   le card) cosi' la successiva sborda a destra */
@media (max-width: 760px) {
  .project-nav {
    display: none;
  }

  .project-track {
    gap: 16px;
    width: 100vw;
    margin: 0 0 0 calc(50% - 50vw);
    padding-left: 20px;
    scroll-padding-left: 20px;
  }

  /* + 16px di gap = 20px di margine dopo l'ultima card */
  .project-track::after {
    flex-basis: 4px;
  }

  /* not scrollable on phones (a scroller inside a pinned block turns Safari's
     toolbar solid): main.js moves the track with the finger and snaps it */
  .project-track {
    overflow: visible;
    touch-action: pan-y;
    transition: transform 0.38s cubic-bezier(0.22, 0.8, 0.3, 1);
    will-change: transform;
  }

  .project-track.is-dragging {
    transition: none;
  }

  /* on short screens the width shrinks (not the height alone), so the 4:5
     proportion is kept */
  .project-slide {
    flex-basis: min(calc(100vw - 60px), calc((100vh - 270px) * 0.75));
    flex-basis: min(calc(100vw - 60px), calc((100svh - 270px) * 0.75));
    aspect-ratio: 3 / 4;
    max-height: none;
  }
}

/* ---------- Compare grid ---------- */

.compare-scroll {
  overflow-x: auto;
}

/* ---------- Tech list ---------- */

.tech-strip {
  display: flex;
  gap: 28px;
  position: relative;
  width: calc(100% + 2 * (5vw + 32px));
  padding: 28px 0 72px calc(5vw + 32px);
  margin: -20px calc(-5vw - 32px) -72px;
  scroll-padding-left: calc(5vw + 32px);
  overflow-x: hidden;
  overflow-y: hidden;
}

.tech-strip::after {
  content: "";
  flex: 0 0 calc(5vw + 4px);
}

.tech-card {
  position: relative;
  flex: 0 0 calc((100% - 56px) / 3 * 0.8);
  /* moved by main.js while the section is pinned */
  transform: translate3d(var(--tech-x, 0px), 0, 0);
  will-change: transform;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg);
  display: flex;
  align-items: flex-end;
}

/* mobile: la striscia e' guidata dallo scroll della pagina (main.js),
   niente snap ne' swipe manuale, cosi' scorre liscia */
@media (max-width: 760px) {
  /* stesso passo dei progetti: card larghe 100vw - 72px, 16px tra le card.
     Niente fascia invisibile di 72px sotto le card (serve alle ombre su
     desktop): su iPhone finirebbe sotto la barra di Safari */
  .tech-strip {
    padding-bottom: 8px;
    margin-bottom: -8px;
    gap: 16px;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: 0;
    padding-left: 20px;
    scroll-padding-left: 20px;
  }
  .tech-strip::after {
    flex-basis: 4px;
  }
  /* square cards sized on the visible height too (svh = Safari toolbars
     shown): text + card must fit under the navbar on an iPhone 13 */
  .tech-card {
    flex-basis: min(calc(100vw - 60px), max(240px, calc(100vh - 470px)));
    flex-basis: min(calc(100vw - 60px), max(240px, calc(100svh - 470px)));
  }
}

.tech-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(16, 16, 16, 0.55), rgba(16, 16, 16, 0) 55%);
}

.tech-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tech-track--dark .tech-panel {
  background: var(--ink);
  color: var(--bg);
}

.tech-track--dark .lede {
  color: var(--bg);
}

.tech-card-label {
  position: relative;
  z-index: 1;
  padding: 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #ffffff;
}

/* ---------- Stat row ---------- */

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.stat-item {
  border-radius: var(--radius-sm);
  padding: 32px;
  background: var(--ink);
  color: var(--bg);
  border: 1px solid var(--line-light);
}

.stat-item .num {
  font-size: 2.6rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.stat-item .label {
  margin-top: 8px;
  opacity: 0.62;
  font-size: 0.95rem;
}

@media (max-width: 760px) {
  .stat-row {
    grid-template-columns: 1fr;
  }
}

/* ---------- Scrollytelling (vantaggi + confronto) ---------- */

.scrolly-track {
  position: relative;
  height: 260vh;
  height: 260lvh;
  padding: 0;
}

.scrolly-pin {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100lvh;
  display: flex;
  align-items: safe center;
  overflow: hidden;
  overflow: clip;
}

.scrolly-panel {
  width: 100vw;
  height: 100%;
  margin-left: calc(50% - 50vw);
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  background: var(--ink);
  color: var(--bg);
}

.scrolly-cap-top {
  position: relative;
  z-index: 2;
  height: var(--radius);
  margin-top: calc(var(--radius) * -1);
  background: var(--ink);
  border-radius: var(--radius) var(--radius) 0 0;
}

.scrolly-content {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 48px 32px 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.scrolly-header {
  width: 100%;
}

.scrolly-content .compare-scroll {
  width: 100%;
  margin-top: clamp(18px, 3.7vh, 48px);
}

.scrolly-table {
  width: 100%;
  min-width: 560px;
  display: flex;
  flex-direction: column;
  text-align: left;
}

.scrolly-row {
  display: grid;
  grid-template-columns: 160px 1fr 1fr;
  gap: 24px;
  align-items: center;
  padding: clamp(6px, 1.7vh, 22px) 0;
}

.scrolly-row:not(:first-child) {
  border-top: 1px solid var(--line-light);
}

.scrolly-row-head {
  padding-bottom: clamp(10px, 2vh, 26px);
}

.scrolly-row-head h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
}

.scrolly-row-label {
  font-size: 1rem;
  opacity: 0.75;
}

.scrolly-value strong {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.scrolly-value small {
  display: block;
  font-size: 0.85rem;
  font-weight: 400;
  opacity: 0.6;
}

.scrolly-stats {
  will-change: transform, opacity;
  width: 100%;
  margin-top: clamp(16px, 4.3vh, 56px);
  opacity: 0;
  transform: translateY(24px);
}

.scrolly-stats .stat-row {
  grid-template-columns: 1fr 1fr;
}

.scrolly-stats .stat-item {
  background: var(--surface);
  color: var(--ink);
  border: none;
  border-radius: var(--radius-sm);
  padding: clamp(14px, 2.6vh, 32px) clamp(16px, 2.4vw, 28px);
  text-align: left;
}

.scrolly-stats .stat-item .bars {
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 1.2vh, 10px);
  text-align: left;
}

.bars-title {
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.55;
}

.bar-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) 78px;
  align-items: center;
  gap: 12px;
}

.bar-name {
  font-size: 0.82rem;
  font-weight: 500;
}

.bar-track {
  display: block;
  height: clamp(20px, 3.8vh, 30px);
  border-radius: 999px;
  background: rgba(16, 16, 16, 0.07);
  overflow: hidden;
}

.bar {
  display: block;
  height: 100%;
  min-width: 6px;
  width: var(--w);
  border-radius: 999px;
  /* grows by sliding in from the left (compositor only, no relayout) */
  transform: translate3d(calc((var(--grow, 1) - 1) * 100%), 0, 0);
}

.bar--trad {
  background: rgba(16, 16, 16, 0.3);
}

.bar--pleom {
  background: var(--ink);
}

.bar-value {
  font-size: 0.86rem;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}

.scrolly-stats .stat-item .label {
  margin-top: clamp(8px, 1.8vh, 14px);
  opacity: 0.72;
  font-size: clamp(0.82rem, 1.4vw, 1.3rem);
  line-height: 1.4;
}

@media (prefers-reduced-motion: reduce) {
  .scrolly-track {
    height: auto;
  }
  .scrolly-pin {
    position: relative;
    top: auto;
    height: auto;
    padding: 0;
  }
  .scrolly-header {
    transform: none !important;
  }
  .scrolly-stats {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ---------- Footer ---------- */

footer {
  position: relative;
  z-index: 3;
  width: 100%;
  padding: 20px 20px 28px;
}

.footer-panel {
  --footer-gutter: 28px;
  --footer-inner-radius: calc(var(--radius) - var(--footer-gutter));
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius);
  padding: var(--footer-gutter);
  box-shadow: 0 12px 40px rgba(16, 16, 16, 0.1);
}

.footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 28px;
}

.footer-pill {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--bg);
  border-radius: var(--footer-inner-radius);
  min-height: calc(var(--footer-inner-radius) * 2);
  padding: 8px 24px;
  flex-wrap: wrap;
}

.footer-pill .h {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.45;
}

.footer-pill a {
  font-size: 0.92rem;
  opacity: 0.72;
  transition: opacity 0.2s ease;
}

.footer-pill a:hover {
  opacity: 1;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.85rem;
  opacity: 0.55;
}

.footer-bottom a {
  color: inherit;
  text-decoration: none;
}

.footer-bottom a:hover {
  text-decoration: underline;
}

/* ---------- Newsletter ---------- */

.footer-newsletter {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 32px;
  flex-wrap: wrap;
  background: var(--bg);
  border-radius: var(--footer-inner-radius);
  padding: 24px 28px;
  margin-bottom: 24px;
}

.footer-newsletter h3 {
  font-size: 1.1rem;
  margin-bottom: 6px;
}

.footer-newsletter p {
  opacity: 0.62;
  font-size: 0.92rem;
  max-width: 340px;
}

.newsletter-form {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 6px 6px 6px 22px;
  min-width: 360px;
}

.newsletter-form input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--ink);
  padding: 10px 0;
}

.newsletter-form input::placeholder {
  color: var(--ink);
  opacity: 0.4;
}

.newsletter-form button {
  flex-shrink: 0;
}

.newsletter-note {
  font-size: 0.85rem;
  opacity: 0.6;
  padding: 12px 4px;
}

@media (max-width: 760px) {
  .footer-panel {
    padding: var(--footer-gutter);
  }
  .footer-links {
    flex-direction: column;
    align-items: stretch;
  }
  .footer-newsletter {
    padding: 24px;
  }
  .newsletter-form {
    min-width: 100%;
  }
}

/* ---------- Cookie banner ---------- */

.cookie-banner {
  position: fixed;
  left: 20px;
  right: 20px;
  bottom: 20px;
  z-index: 200;
}

.cookie-banner[hidden] {
  display: none;
}

.cookie-banner-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--surface);
  color: var(--surface-ink);
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 40px rgba(16, 16, 16, 0.16);
  padding: 20px 24px;
}

.cookie-banner p {
  font-size: 0.88rem;
  line-height: 1.5;
  opacity: 0.75;
  margin: 0;
}

.cookie-banner a {
  color: var(--surface-ink);
  text-decoration: underline;
  opacity: 1;
}

.cookie-banner-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

@media (max-width: 620px) {
  .cookie-banner {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }
  .cookie-banner-inner {
    flex-direction: column;
    align-items: stretch;
    padding: 20px;
  }
  .cookie-banner-actions {
    justify-content: flex-end;
  }
}

/* ---------- Form di richiesta ---------- */

.cta-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
  width: 100%;
}

.cta-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 20px;
}

.inquiry-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--radius-sm);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.inquiry-form input[type="text"],
.inquiry-form input[type="email"],
.inquiry-form select,
.inquiry-form textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 17px 26px;
  border: 1px solid transparent;
  border-radius: 32px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  line-height: 1.4;
  outline: none;
  transition: border-color 0.2s ease;
}

.inquiry-form textarea {
  resize: none;
  min-height: 96px;
  border-radius: 26px;
}

.inquiry-form select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23101010' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 20px center;
  background-size: 16px;
  cursor: pointer;
}

.inquiry-form select:invalid {
  color: rgba(16, 16, 16, 0.5);
}

.inquiry-form ::placeholder {
  color: rgba(16, 16, 16, 0.5);
  opacity: 1;
}

.inquiry-form input:focus,
.inquiry-form select:focus,
.inquiry-form textarea:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px var(--bg);
}

.form-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px;
  font-size: 0.82rem;
  opacity: 0.85;
}

.form-check input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--surface);
  flex: 0 0 auto;
}

.form-check a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.form-actions .btn {
  flex: 0 0 auto;
}

.form-status {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.35;
}

.form-status:empty {
  display: none;
}

.form-status.is-error {
  color: #ff8a80;
}

.inquiry-form .btn-primary {
  background: var(--surface);
  color: var(--ink);
}

.inquiry-form .btn-primary:hover {
  background: var(--bg);
}

.inquiry-form.is-sending .btn {
  opacity: 0.6;
  pointer-events: none;
}

@media (max-width: 480px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* ---------- Clienti (carosello di loghi) ---------- */

/* Pill under the form: the partner logos run right to left without stopping.
   The list is in the markup twice, so moving the track by half its width
   loops seamlessly; the ends fade out inside the pill. */
.client-row {
  display: flex;
  align-items: center;
  height: 56px;
  overflow: hidden;
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius);
}

.client-marquee {
  width: 100%;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 56px, #000 calc(100% - 56px), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 56px, #000 calc(100% - 56px), transparent 100%);
}

.client-track {
  display: flex;
  align-items: center;
  width: max-content;
  animation: client-scroll 34s linear infinite;
}

.client-row:hover .client-track {
  animation-play-state: paused;
}

.client-logo {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: 0 32px;
}

.client-logo img {
  display: block;
  width: auto;
}

@keyframes client-scroll {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-50%, 0, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .client-track {
    animation: none;
  }

  .client-marquee {
    overflow-x: auto;
  }
}

@media (max-width: 760px) {
  .client-row {
    height: 52px;
  }

  .client-logo {
    padding: 0 24px;
  }
}

/* ---------- Privacy / pagine legali ---------- */

.legal-page {
  background: var(--ink);
  color: var(--bg);
}

/* Same grey outer rim as the other pages: the sheet's radius is the panel
   radius plus the 20px footer gutter, so the curves are concentric. */
.legal-page footer {
  background: var(--bg);
  border-radius: calc(var(--radius) + 20px) calc(var(--radius) + 20px) 0 0;
}

.legal {
  padding: 167px 20px 56px;
}

.legal-card {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 32px;
}

.legal .btn-primary {
  background: var(--surface);
  color: var(--ink);
}

.legal .btn-primary:hover {
  background: var(--bg);
}

.legal-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 40px;
}

.legal-head h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);
}

.legal-lede {
  max-width: 560px;
  font-size: 1.1rem;
  line-height: 1.55;
  opacity: 0.72;
}

.legal-date {
  font-size: 0.85rem;
  opacity: 0.5;
}

.legal-section {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 32px;
  padding: 32px 0;
  border-top: 1px solid var(--line-light);
}

.legal-section h2 {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.legal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 1rem;
  line-height: 1.7;
}

.legal-body p,
.legal-body ul {
  margin: 0;
  opacity: 0.78;
}

.legal-body ul {
  list-style: disc;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.legal-body a {
  opacity: 1;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.legal-contact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
  margin-top: 8px;
  padding: 32px;
  background: rgba(240, 240, 240, 0.07);
  border-radius: var(--radius-sm);
}

.legal-contact h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.legal-contact p {
  margin: 0;
  opacity: 0.68;
}

@media (max-width: 760px) {
  .legal {
    padding: 147px 12px 12px;
  }
  .legal-card {
    padding: 0 12px;
  }
  .legal-section {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 24px 0;
  }
  .legal-contact {
    padding: 24px;
  }
}

/* ---------- Homepage: pulsanti pieni e senza bordo ---------- */

/* on black: white buttons */
.home .hero-blueprint .btn-light {
  background: var(--surface);
  color: var(--ink);
  border-color: transparent;
}

.home .hero-blueprint .btn-light:hover {
  background: var(--bg);
  border-color: transparent;
}

.home .project-nav-btn {
  background: var(--surface);
  border-color: transparent;
  color: var(--ink);
}

.home .project-nav-btn:hover {
  background: var(--bg);
  border-color: transparent;
}

/* on white: black buttons */
.home .cookie-banner .btn-light {
  background: var(--ink);
  color: var(--bg);
}

.home .cookie-banner .btn-light:hover {
  background: #2a2a2a;
}

/* ---------- Mobile / schermi stretti ---------- */

@media (max-width: 760px) {

  .problem-icon-stage {
    margin-top: 8px;
  }

  .project-slider {
    gap: 12px;
  }

  .scrolly-content .compare-scroll {
    margin-top: 12px;
    /* the table fits on phones: no inner scroller inside the pinned block */
    overflow: visible;
  }

  /* hero: i due pulsanti uno sotto l'altro, larghi uguali */
  .hero-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .hero-actions .btn {
    width: 100%;
  }

  /* banner cookie compatto: testo piccolo, pulsanti affiancati a meta' */
  .cookie-banner {
    left: 10px;
    right: 10px;
    bottom: 10px;
  }

  .cookie-banner-inner {
    gap: 10px;
    padding: 12px 14px 14px;
  }

  .cookie-banner p {
    font-size: 0.76rem;
    line-height: 1.4;
  }

  .cookie-banner-actions .btn {
    flex: 1;
    padding: 9px 14px;
  }

  /* footer: le due pillole diventano due colonne con i link in elenco */
  .footer-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .footer-links .footer-pill {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    border-radius: var(--radius-sm);
    padding: 14px 18px 16px;
  }

  .footer-pill .h {
    margin-bottom: 2px;
  }

  /* navbar bianca a tutta larghezza, attaccata al bordo alto e arrotondata
     solo sotto: Safari (iOS 26+) ne prolunga il bianco nella barra di stato */
  .nav-wrap {
    top: 0;
    padding: 0;
  }

  .navbar {
    /* stesso raccordo della pillola (alta 64px -> raggio 32px) */
    border-radius: 0 0 32px 32px;
    padding-left: 32px;
    padding-right: 22px;
  }

  .mobile-menu {
    top: 76px;
  }

  /* testi grigi piu' compatti: lasciano spazio alle immagini */
  .lede,
  .legal-lede,
  .project-slide-desc,
  .scrolly-stats .stat-item .label {
    line-height: 1.38;
  }

  .legal-body {
    line-height: 1.55;
    font-size: 0.94rem;
  }

  /* testi grigi un filo piu' piccoli (minimo ~14px, sempre leggibili) */
  .lede {
    font-size: 0.94rem;
  }

  .legal-lede {
    font-size: 1rem;
  }

  /* confronto: tabella impilata invece che su tre colonne */
  .scrolly-table {
    min-width: 0;
  }

  .scrolly-row {
    grid-template-columns: 1fr 1fr;
    gap: 4px 16px;
    align-items: start;
    padding: 9px 0;
  }

  /* the gap above the pinned blocks is a margin, not padding: the sticky
     box itself then starts below the navbar, clear of the top edge */
  .scrolly-content,
  .problem-content,
  .tech-content,
  .projects-content,
  .cta-content {
    padding-top: 0;
    margin-top: 48px;
  }

  .scrolly-stats {
    margin-top: 14px;
  }

  .scrolly-stats .stat-item {
    padding: 12px 14px;
  }

  .scrolly-value small {
    display: none;
  }

  .scrolly-row-head > span {
    display: none;
  }

  .scrolly-row-head h3 {
    font-size: 0.95rem;
  }

  .scrolly-row-label {
    grid-column: 1 / -1;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .scrolly-value strong {
    font-size: 1.05rem;
  }

  .scrolly-value small {
    font-size: 0.78rem;
  }

  /* the two bar cards side by side: the comparison fits a phone screen
     with Safari's toolbars shown */
  .scrolly-stats .stat-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .scrolly-stats .stat-item {
    padding: 12px 12px 14px;
  }

  .scrolly-stats .bars-title {
    font-size: 0.62rem;
    letter-spacing: 0.04em;
  }

  .scrolly-stats .bar-track {
    height: 14px;
  }

  /* grafici: nome e valore sulla prima riga, barra a tutta larghezza sotto */
  .bar-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "name value"
      "track track";
    gap: 6px 10px;
  }

  .bar-name {
    grid-area: name;
  }

  .bar-value {
    grid-area: value;
  }

  .bar-track {
    grid-area: track;
  }

  .scrolly-stats .stat-item .bars {
    gap: 12px;
  }

  .newsletter-form {
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
  }

  .newsletter-form input {
    min-width: 0;
  }

  /* highlighted phrases may wrap on narrow screens: the clipped copy wraps the same way */
  .hl::after {
    white-space: normal;
  }

  .bar-name {
    font-size: 0.76rem;
  }

  .bar-value {
    font-size: 0.78rem;
  }

  /* the footer sheet overlaps the last 70px of the page: leave room for it */
  .cta-panel {
    padding-bottom: 110px;
  }

  .footer-pill {
    gap: 4px 16px;
    padding: 10px 20px;
  }

  .inquiry-form {
    padding: 18px;
  }

  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .form-actions .btn {
    width: 100%;
  }
}

/* ---------- Finestre basse (non a schermo intero) ---------- */

/* Cards keep their proportions from the width, so on short windows the pinned
   content would be taller than the screen: cap their height with the viewport. */
@media (min-width: 761px) and (max-height: 820px) {
  .project-slide {
    max-height: calc(100vh - 250px);
  }

  .tech-card {
    max-height: calc(100vh - 360px);
  }

  .inquiry-form {
    gap: 10px;
    padding: 18px;
  }

  .inquiry-form .form-row {
    gap: 10px;
  }

  .inquiry-form input[type="text"],
  .inquiry-form input[type="email"],
  .inquiry-form select {
    padding-top: 13px;
    padding-bottom: 13px;
  }

  .inquiry-form textarea {
    min-height: 64px;
    padding-top: 13px;
    padding-bottom: 13px;
  }
}

@media (min-width: 761px) and (max-height: 640px) {
  .project-slide {
    max-height: calc(100vh - 230px);
  }

  .tech-card {
    max-height: calc(100vh - 320px);
  }
}

/* ---------- Scroll-driven animations ---------- */

/* Where supported (Safari 26+, Chrome 115+) the movements tied to scroll run
   in the browser's own scrolling, not in main.js: on iPhone the JS version
   arrives a frame late and lags visibly on fast flicks. main.js skips these
   writes when the browser supports animation-timeline. Ranges mirror the JS:
   "contain 0" = track top at the top of the screen. */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .scrolly-track {
      view-timeline-name: --scrolly;
      view-timeline-axis: block;
    }

    .tech-track {
      view-timeline-name: --tech;
      view-timeline-axis: block;
    }

    /* table slides up while the stat cards appear (JS: animProgress 0.3 -> 0.6) */
    .scrolly-content {
      animation: sd-scrolly-content linear both;
      animation-timeline: --scrolly;
      animation-range: contain 30lvh contain 60lvh;
    }

    .scrolly-stats {
      animation: sd-scrolly-stats linear both;
      animation-timeline: --scrolly;
      animation-range: contain 30lvh contain 60lvh;
    }

    .scrolly-stats .bar {
      animation: sd-bar linear both;
      animation-timeline: --scrolly;
      animation-range: contain 30lvh contain 60lvh;
    }

    /* tech cards travel left over the first 60% of the pinned range */
    .tech-card {
      animation: sd-tech linear both;
      animation-timeline: --tech;
      animation-range: contain 0% contain 60%;
    }
  }
}

@keyframes sd-scrolly-content {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(0, var(--scrolly-delta, 0px), 0); }
}

@keyframes sd-scrolly-stats {
  from { opacity: 0; transform: translate3d(0, 24px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes sd-bar {
  from { transform: translate3d(-100%, 0, 0); }
  to { transform: translate3d(0, 0, 0); }
}

@keyframes sd-tech {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(calc(-1 * var(--tech-max, 0px)), 0, 0); }
}

/* ---------- 404 ---------- */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.page-404 {
  background: var(--ink);
}

/* footer like the other pages: grey sheet (.hero-cap) with rounded top over
   the black stage, grey around the panel below it */
.page-404 footer {
  background: linear-gradient(transparent calc(var(--radius) + 20px), var(--bg) 0);
}

.nf-stage {
  position: relative;
  /* full screen plus the band the footer sheet (.hero-cap) overlaps */
  height: calc(100vh + var(--radius) + 20px);
  height: calc(100svh + var(--radius) + 20px);
  min-height: 480px;
  overflow: hidden;
  color: var(--bg);
  /* horizontal swipes move the pixels, vertical ones still scroll */
  touch-action: pan-y;
}

.nf-canvas {
  pointer-events: none;
}

/* "404" is drawn on the canvas (pixel-404.js), which centres number +
   caption between the navbar and the bottom of the screen and sets
   --nf-bottom to where the number ends */
.nf-caption {
  position: absolute;
  top: calc(var(--nf-bottom, 60%) + 28px);
  left: 0;
  right: 0;
  z-index: 1;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.nf-title {
  margin: 0;
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  font-weight: 500;
}

.nf-shake {
  margin-top: 16px;
  padding: 6px 10px;
  border: 0;
  background: none;
  color: var(--bg);
  font: inherit;
  font-size: 0.82rem;
  opacity: 0.55;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.nf-shake:disabled {
  text-decoration: none;
  cursor: default;
}

.nf-lede {
  margin: 10px 0 22px;
  opacity: 0.6;
  font-size: 0.95rem;
}

/* ---------- Pinned sections vs Safari's toolbar ---------- */

/* Safari (iOS 26+) turns its top/bottom bars into solid blocks, and keeps
   them, as soon as a sticky element touches an edge of the screen: a
   full-screen sticky panel (top: 0) always does. Tested on iPhone: only a
   sticky box that stays clear of both edges keeps the bars transparent.
   So on phones nothing full-screen is sticky: the panel just spans the whole
   track (its colour is on the track too, set by main.js) and only the content
   block is sticky (top: var(--stick), below the navbar). The content now
   leaves with the end of the track, after it has faded out. */
@media (max-width: 760px) {
  .problem-pin,
  .scrolly-pin,
  .tech-pin,
  .projects-pin,
  .cta-pin {
    position: relative;
    top: auto;
    height: 100%;
    overflow: visible;
    overflow-x: clip;
  }

  .problem-panel,
  .scrolly-panel,
  .tech-panel,
  .projects-panel,
  .cta-panel {
    height: 100%;
  }

  .problem-content,
  .scrolly-content,
  .tech-content,
  .projects-content,
  .scrolly-panel .scrolly-content {
    margin-bottom: 0;
  }

  /* sticky only while pinned (main.js toggles .is-stuck), a plain block
     while the section enters and leaves */
  .problem-content,
  .scrolly-content,
  .tech-content,
  .projects-content,
  .cta-content {
    position: relative;
    top: auto;
  }

  .problem-content.is-stuck,
  .scrolly-content.is-stuck,
  .tech-content.is-stuck,
  .projects-content.is-stuck,
  .cta-content.is-stuck {
    position: sticky;
    top: var(--stick, 0px);
  }
}

/* ---------- Pinned sections too tall for the screen ---------- */

/* main.js adds .is-tall when the content doesn't fit the visible height
   (short phones, or very short windows): the section drops the pin and
   scrolls like a normal block, so all of it is reachable. */
.is-tall {
  height: auto !important;
}

.is-tall .problem-pin,
.is-tall .scrolly-pin,
.is-tall .tech-pin,
.is-tall .projects-pin,
.is-tall .cta-pin {
  position: relative;
  top: auto;
  height: auto;
  overflow: visible;
}

.is-tall .problem-panel,
.is-tall .scrolly-panel,
.is-tall .tech-panel,
.is-tall .projects-panel,
.is-tall .cta-panel {
  height: auto;
  padding-top: 56px;
  padding-bottom: 56px;
}

.is-tall.cta-track .cta-panel {
  padding-bottom: 110px;
}

.is-tall .problem-content,
.is-tall .scrolly-content,
.is-tall .tech-content,
.is-tall .projects-content,
.is-tall .cta-content {
  position: static;
  margin-bottom: 0;
  opacity: 1;
}

.is-tall .scrolly-content,
.is-tall .scrolly-stats,
.is-tall .scrolly-stats .bar,
.is-tall .tech-card {
  animation: none !important;
}

.is-tall .scrolly-content {
  transform: none !important;
}

.is-tall .scrolly-stats {
  opacity: 1 !important;
  transform: none !important;
}

.is-tall .scrolly-stats .bar {
  transform: none !important;
}

/* not moved by the scroll any more: swipe it instead */
.is-tall .tech-strip {
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.is-tall .tech-strip::-webkit-scrollbar {
  display: none;
}

.is-tall .tech-card {
  transform: none !important;
  scroll-snap-align: start;
}

/* ---------- Mobile: icone, evidenziazione, confronto ---------- */

.br-m,
.bars-legend {
  display: none;
}

/* highlight split into lines (main.js, phones): each line is its own .hl */
.hl.hl-lines {
  padding: 0;
  margin: 0;
}

.hl.hl-lines::before,
.hl.hl-lines::after {
  display: none;
}

.hl-lines .hl-line {
  display: block;
  width: fit-content;
}

@media (max-width: 760px) {

  /* icone dei prodotti un po' piu' grandi */
  .problem-icon-stage {
    gap: 10px 10px;
    max-width: none;
  }

  /* tabella: "Lancio con / Pleom" su due righe come "Lancio / tradizionale",
     solo "MOQ" per restare su una riga */
  .br-m {
    display: inline;
  }

  .hide-m {
    display: none;
  }

  /* le due card con le barre diventano una sola, con legenda in alto:
     ogni dato ha la sua etichetta, le due barre e i valori a destra */
  .scrolly-stats .stat-row {
    display: block;
    background: var(--surface);
    color: var(--ink);
    border-radius: var(--radius-sm);
    padding: 14px 16px 16px;
  }

  .scrolly-stats .stat-item {
    background: none;
    padding: 0;
    border-radius: 0;
  }

  .scrolly-stats .stat-item + .stat-item {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(16, 16, 16, 0.08);
  }

  .bars-legend {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
    font-size: 0.72rem;
    font-weight: 600;
  }

  .bars-legend .lg {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  .bars-legend .lg::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 3px;
  }

  .bars-legend .lg--trad::before {
    background: rgba(16, 16, 16, 0.3);
  }

  .bars-legend .lg--pleom::before {
    background: var(--ink);
  }

  .scrolly-stats .stat-item .bars {
    gap: 6px;
  }

  .scrolly-stats .bars-title {
    font-size: 0.68rem;
    margin-bottom: 2px;
  }

  .scrolly-stats .bar-name {
    display: none;
  }

  .scrolly-stats .bar-row {
    grid-template-columns: 1fr 74px;
    grid-template-areas: "track value";
    align-items: center;
    gap: 10px;
  }

  .scrolly-stats .bar-track {
    height: 10px;
  }

  .scrolly-stats .bar-value {
    font-size: 0.8rem;
    font-weight: 600;
    text-align: right;
  }
}

/* ---------- Mobile: statistiche a numero al posto dei grafici ---------- */

.stat-num {
  display: none;
}

@media (max-width: 760px) {
  .scrolly-stats .stat-item .bars,
  .bars-legend {
    display: none;
  }

  .scrolly-stats .stat-num {
    display: block;
  }

  /* back to two cards side by side (overrides the single-card layout) */
  .scrolly-stats .stat-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    background: none;
    padding: 0;
    border-radius: 0;
  }

  .scrolly-stats .stat-item,
  .scrolly-stats .stat-item + .stat-item {
    margin: 0;
    border-top: 0;
    background: var(--surface);
    color: var(--ink);
    border-radius: var(--radius-sm);
    padding: 16px 16px 18px;
  }

  /* number + label centred in the card */
  .scrolly-stats .stat-item {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .scrolly-stats .stat-num {
    text-align: center;
  }

  .scrolly-stats .stat-num .num {
    font-size: 1.9rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.1;
  }

  .scrolly-stats .stat-num .label {
    margin-top: 6px;
    font-size: 0.74rem;
    line-height: 1.35;
    opacity: 0.62;
  }
}

/* ---------- Mobile: "Swipe" hint on the hand-driven carousels ---------- */

.swipe-hint {
  display: none;
}

@media (max-width: 760px) {
  /* under the photos, left-aligned with the first card (20px from the edge) */
  .swipe-hint {
    align-self: flex-start;
    margin-left: calc(50% - 50vw + 20px);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 11px 6px 13px;
    border: 0;
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    transition: opacity 0.5s ease;
  }

  .swipe-hint svg {
    width: 14px;
    height: 14px;
    animation: swipe-nudge 1.8s ease-in-out infinite alternate;
  }

  /* gone once the visitor has swiped */
  .project-slider.is-swiped .swipe-hint {
    opacity: 0;
  }
}

@keyframes swipe-nudge {
  from { transform: translateX(-2px); }
  to { transform: translateX(4px); }
}

@media (prefers-reduced-motion: reduce) {
  .swipe-hint svg {
    animation: none;
  }
}

/* ---------- Filled buttons (all screens) ---------- */

.project-nav-btn {
  background: var(--surface);
  color: var(--ink);
  border-color: transparent;
}

.project-nav-btn:hover {
  background: #e6e6e6;
  border-color: transparent;
}

/* ---------- Mobile: margini laterali ridotti ---------- */

/* text was inset 20px (page) + 32px (container) = 52px: on phones it is now
   20px + 12px = 32px from the edge */
@media (max-width: 760px) {
  .container,
  .problem-content,
  .scrolly-content,
  .tech-content,
  .projects-content,
  .cta-content {
    padding-left: 12px;
    padding-right: 12px;
  }

  .footer-panel {
    --footer-gutter: 20px;
  }

  .footer-newsletter {
    padding: 20px;
  }

  /* with the wider column both table headers fit on one line */
  .scrolly-row-head .br-m {
    display: none;
  }

  /* keep the product icons around 52px in the wider column, centred in it
     on every phone width */
  .problem-icon-stage {
    max-width: 300px;
    align-self: center;
    margin-left: auto;
    margin-right: auto;
  }
}

/* ---------- Footer a due strati (tutti gli schermi) ---------- */

/* grey sheet + white cards: the white panel in between is gone */
.footer-panel {
  background: transparent;
  box-shadow: none;
}

.footer-pill,
.footer-newsletter {
  background: var(--surface);
}

/* the email field now sits on white: grey field */
.newsletter-form {
  background: var(--bg);
}

.footer-bottom {
  padding: 0 4px;
}

@media (max-width: 760px) {
  /* footer cards 32px from the screen edge, like the text, and 32px below
     the top of the grey sheet: with the sheet's 70px corners, 70 - 32 = 38px
     inner corners make the curves concentric */
  .footer-panel {
    padding: 12px 12px 0;
  }

  .footer-links .footer-pill,
  .footer-newsletter {
    border-radius: 38px;
  }

  /* same 10px gap between the two top cards and below them */
  .footer-links {
    padding-bottom: 0;
    margin-bottom: 10px;
  }
}

/* ---------- Footer mobile: contenuti centrati nelle card ---------- */

@media (max-width: 760px) {
  /* centred both ways: "Contatti" has fewer links than "Sito" */
  .footer-links .footer-pill {
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 8px;
    padding: 25px 16px;
  }

  .footer-pill .h {
    margin-bottom: 4px;
  }

  .footer-newsletter {
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
    text-align: center;
    padding: 28px 22px 22px;
  }

  .footer-newsletter p {
    max-width: none;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
    padding: 6px 0 0;
  }
}

/* ---------- Footer mobile: una sola card per Sito e Contatti ---------- */

/* the two link cards become one white card with two left-aligned rows:
   the label on top, the links on one line under it */
@media (max-width: 760px) {
  .footer-links {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: var(--surface);
    border-radius: 38px;
    padding: 12px 26px;
  }

  .footer-links .footer-pill {
    flex-direction: row;
    flex-wrap: wrap;
    /* both rows run the full width of the card: "Contatti" ends where "Sito"
       ends */
    justify-content: space-between;
    align-items: baseline;
    text-align: left;
    gap: 6px 14px;
    background: none;
    border-radius: 0;
    min-height: 0;
    padding: 18px 0;
  }

  .footer-links .footer-pill + .footer-pill {
    padding-top: 0;
  }

  .footer-links .footer-pill .h {
    flex-basis: 100%;
    margin-bottom: 2px;
  }
}

/* ---------- Home desktop: card tecnologie larghe come i progetti ---------- */

@media (min-width: 761px) {
  /* as wide as the project cards (3 per row, 20px gap), square, capped by
     the window height so the pinned section still fits (text above +
     navbar ~440px) */
  .home .tech-card {
    flex-basis: min(calc((100% - 5vw - 32px - 40px) / 3), calc(100vh - 440px));
    max-height: none;
  }
}

/* ---------- Righe di lunghezza simile (tutti gli schermi) ---------- */

/* long text: no single-word last line */
p,
li {
  text-wrap: pretty;
}

/* headings and short/medium texts: lines of similar length (the browser
   balances up to a few lines; longer texts fall back to "pretty") */
h1,
h2,
h3,
.lede,
.legal-lede,
.nf-lede,
.footer-newsletter p,
.project-slide-desc,
.scrolly-value small,
.stat-num .label,
.cookie-banner p {
  text-wrap: balance;
}

/* ---------- Mobile: menu inside the navbar ---------- */

/* the white navbar grows downwards and the page links appear inside it;
   logo and burger stay where they are. The menu panel always sits behind the
   navbar, as tall as the navbar when closed, and carries the shadow: opening
   changes its height (set by main.js), so the bottom edge and its shadow
   move together. */
@media (max-width: 760px) {
  .navbar,
  body.menu-open .navbar {
    box-shadow: none;
  }

  .mobile-menu {
    display: flex;
    top: 0;
    left: 0;
    right: 0;
    box-sizing: border-box;
    height: 64px;
    overflow: hidden;
    padding: 0 14px;
    border-radius: 0 0 32px 32px;
    box-shadow: 0 12px 40px rgba(16, 16, 16, 0.12);
    pointer-events: none;
    transition: height 0.4s cubic-bezier(0.22, 0.8, 0.3, 1);
  }

  body.menu-open .mobile-menu {
    pointer-events: auto;
  }

  /* spacing as margins, so the closed panel can be exactly 64px tall */
  .mobile-menu > :first-child {
    margin-top: 76px;
  }

  .mobile-menu > :last-child {
    margin-bottom: 22px;
  }

  /* links fade in once the panel has started opening */
  .mobile-menu a {
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
  }

  body.menu-open .mobile-menu a {
    opacity: 0.65;
    transform: none;
    transition: opacity 0.3s ease 0.12s, transform 0.3s ease 0.12s;
  }

  body.menu-open .mobile-menu a.active,
  body.menu-open .mobile-menu .btn {
    opacity: 1;
  }
}

/* ---------- Mobile: ritocchi (form, footer, swipe, dati, menu) ---------- */

@media (max-width: 760px) {
  /* "Raccontaci la tua idea": lower fields and tighter gaps so the whole
     section fits the screen */
  .cta-grid {
    gap: 16px;
  }

  .inquiry-form {
    gap: 8px;
    padding: 14px;
  }

  .inquiry-form .form-row {
    gap: 8px;
  }

  .inquiry-form input[type="text"],
  .inquiry-form input[type="email"],
  .inquiry-form select,
  .inquiry-form textarea {
    padding: 11px 20px;
  }

  .inquiry-form select {
    padding-right: 40px;
    background-position: right 18px center;
  }

  .inquiry-form textarea {
    min-height: 68px;
    border-radius: 22px;
  }

  .form-actions {
    gap: 8px;
  }

  .form-check {
    padding: 2px 6px;
  }

  .inquiry-form .btn-primary {
    padding-top: 13px;
    padding-bottom: 13px;
  }

  .form-status:empty {
    display: none;
  }

  /* footer: text left-aligned like the rest of the site, except the
     copyright line at the bottom */
  .footer-links .footer-pill {
    justify-content: flex-start;
    gap: 6px 14px;
  }

  /* text on the same left edge as the links card above */
  .footer-newsletter {
    text-align: left;
    padding-left: 26px;
    padding-right: 26px;
  }

  /* "Swipe" pill as far from the photos as the photos are from each other
     (16px: 12px slider gap + 4px) */
  .swipe-hint {
    margin-top: 4px;
  }

  /* more room between the comparison table and the data cards */
  .scrolly-stats {
    margin-top: 30px;
  }

  /* "Contattaci" in the open menu: a true pill (height = 2 x radius) with
     the same 14px gap on the sides and below, so its corners are concentric
     with the panel's (24 + 14 = 38px) */
  .mobile-menu {
    transition: height 0.4s cubic-bezier(0.22, 0.8, 0.3, 1), border-radius 0.4s cubic-bezier(0.22, 0.8, 0.3, 1);
  }

  body.menu-open .mobile-menu {
    border-radius: 0 0 38px 38px;
  }

  .mobile-menu .btn {
    box-sizing: border-box;
    height: 48px;
    padding-top: 0;
    padding-bottom: 0;
    border-radius: 24px;
  }

  .mobile-menu > .btn:last-child {
    margin-bottom: 14px;
  }

  /* the panel's height is animated: its items must keep their own size */
  .mobile-menu > * {
    flex-shrink: 0;
  }
}

/* ---------- Mobile: blocco delle sezioni senza sticky ---------- */

/* Phones with scroll-driven animations: the pinned block is never sticky.
   It stays in the flow and this animation moves it down exactly as much as
   the page scrolls between --pin-start and --pin-end (px from "contain 0",
   set by main.js), so it holds still on screen. The browser applies it in
   the same pass as the scroll: no overshoot-and-snap on fast flicks, and no
   sticky box for Safari's toolbar to react to. */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) and (max-width: 760px) {
    .problem-track {
      view-timeline-name: --problem;
      view-timeline-axis: block;
    }

    .projects-track {
      view-timeline-name: --projects;
      view-timeline-axis: block;
    }

    .cta-track {
      view-timeline-name: --cta;
      view-timeline-axis: block;
    }

    .sd-pin {
      animation: sd-pin linear both;
      animation-range: contain var(--pin-start, 0px) contain var(--pin-end, 0px);
    }

    .problem-content.sd-pin { animation-timeline: --problem; }
    .tech-content.sd-pin { animation-timeline: --tech; }
    .projects-content.sd-pin { animation-timeline: --projects; }
    .cta-content.sd-pin { animation-timeline: --cta; }

    /* the table already has its own scroll-driven slide: run both */
    .scrolly-content.sd-pin {
      animation: sd-scrolly-content linear both, sd-pin linear both;
      animation-timeline: --scrolly, --scrolly;
      animation-range: contain 30lvh contain 60lvh, contain var(--pin-start, 0px) contain var(--pin-end, 0px);
    }
  }
}

/* main.js: probe that reads the view-timeline offset of the browser */
@supports (animation-timeline: view()) {
  .pin-probe {
    animation: sd-probe linear both;
    animation-timeline: --pin-probe;
    animation-range: contain -100000px contain 100000px;
  }
}

@keyframes sd-probe {
  from { translate: 0 -100000px; }
  to { translate: 0 100000px; }
}

@keyframes sd-pin {
  from { translate: 0 0; }
  to { translate: 0 var(--pin-len, 0px); }
}

/* ---------- Mobile: raggio delle sezioni come la navbar ---------- */

/* the rounded top of each scroll section matches the navbar's bottom
   corners (32px) */
@media (max-width: 760px) {
  .problem-cap-top,
  .scrolly-cap-top,
  .tech-cap-top {
    border-radius: 32px 32px 0 0;
  }
}

/* ---------- Desktop: card tecnologie come quelle dei progetti ---------- */

/* same 20px gap as the project cards; on the home page also the same width
   (square, so a bit lower), still capped by the window height */
@media (min-width: 761px) {
  .tech-strip {
    gap: 20px;
  }

  /* trailing space after the last card stays 5vw + 32px (gap + spacer) */
  .tech-strip::after {
    flex-basis: calc(5vw + 12px);
  }
}

/* ---------- Desktop: footer come quello mobile ---------- */

/* one white card for the site and contact links (label above, links on a
   line under it, the two groups side by side), then the newsletter card,
   then the copyright line centred */
@media (min-width: 761px) {
  .footer-links {
    flex-wrap: nowrap;
    gap: 72px;
    background: var(--surface);
    border-radius: var(--footer-inner-radius);
    padding: 24px 28px;
    margin-bottom: 16px;
  }

  .footer-links .footer-pill {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 20px;
    background: none;
    border-radius: 0;
    min-height: 0;
    padding: 0;
  }

  .footer-links .footer-pill .h {
    flex-basis: 100%;
    margin-bottom: 2px;
  }

  .footer-bottom {
    justify-content: center;
    text-align: center;
  }
}

/* ---------- Desktop: card piu' piccole ---------- */

/* tech and project cards 15% narrower than a third of the row, and capped
   by the window height so cards + text sit comfortably on a 14" laptop
   (~1512x860 viewport); gaps unchanged (20px) */
@media (min-width: 761px) {
  .project-slide {
    flex-basis: min(calc((100% - var(--edge) - 40px) / 3 * 0.85), calc((100vh - 360px) * 0.75));
  }

  .tech-card {
    flex-basis: min(calc((100% - 56px) / 3 * 0.8), calc(100vh - 520px));
  }

  .home .tech-card {
    flex-basis: min(calc((100% - 5vw - 32px - 40px) / 3 * 0.85), calc(100vh - 520px));
  }
}

/* ---------- Icone pixellate trascinabili ---------- */

/* pixel-flow.js: hand over a sprite that can be picked up and thrown */
.is-grabbable {
  cursor: grab;
}

.is-grabbing,
.is-grabbing * {
  cursor: grabbing;
  user-select: none;
  -webkit-user-select: none;
}

/* ---------- Form contatti: campi neri su sfondo bianco ---------- */

/* no dark card around the form any more: the fields sit on the white
   section, full width, black like the other filled elements of the site */
.inquiry-form {
  padding: 0;
  background: none;
  color: var(--ink);
  border-radius: 0;
}

.inquiry-form input[type="text"],
.inquiry-form input[type="email"],
.inquiry-form select,
.inquiry-form textarea {
  background-color: var(--ink);
  color: var(--surface);
}

.inquiry-form ::placeholder,
.inquiry-form select:invalid {
  color: rgba(255, 255, 255, 0.55);
}

.inquiry-form select option {
  color: var(--ink);
}

.inquiry-form select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

.inquiry-form input:focus,
.inquiry-form select:focus,
.inquiry-form textarea:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(16, 16, 16, 0.18);
}

/* browser autofill keeps the black field */
.inquiry-form input:-webkit-autofill {
  -webkit-text-fill-color: var(--surface);
  box-shadow: 0 0 0 100px var(--ink) inset;
  caret-color: var(--surface);
}

.form-check input {
  accent-color: var(--ink);
}

.inquiry-form .btn-primary {
  background: var(--ink);
  color: var(--surface);
}

.inquiry-form .btn-primary:hover {
  background: #2a2a2a;
}

.form-status.is-error {
  color: #c62828;
}

/* the partners pill stays visible on white */
.inquiry-form .client-row {
  background: var(--bg);
}

/* ---------- Mobile: niente zoom sui campi, nessuna fessura sotto i raccordi ---------- */

/* iOS zooms the page in on any field whose text is under 16px */
@media (max-width: 760px) {
  .inquiry-form input[type="text"],
  .inquiry-form input[type="email"],
  .inquiry-form select,
  .inquiry-form textarea,
  .newsletter-form input {
    font-size: 16px;
  }
}

/* The rounded caps overlap the next section by 1px (same layout: 1px taller,
   1px negative margin), so no hairline of the section behind shows through
   where the curve ends, at any zoom level. */
.problem-cap-top,
.scrolly-cap-top,
.tech-cap-top {
  height: calc(var(--radius) + 1px);
  margin-bottom: -1px;
}

.hero-cap {
  height: calc(var(--radius) + 21px);
  margin-bottom: calc((var(--radius) + 21px) * -1);
}

/* ---------- Mobile: campi del form piu' larghi e alti ---------- */

/* fields as wide as the photo cards (20px from the screen edge, the content
   column has 12px more padding), a bit taller, 10px apart like the other
   cards of the site (stat cards, footer cards) */
@media (max-width: 760px) {
  .inquiry-form {
    gap: 10px;
    width: calc(100vw - 40px);
    margin-left: calc(50% - 50vw + 20px);
  }

  .inquiry-form .form-row {
    gap: 10px;
  }

  .inquiry-form input[type="text"],
  .inquiry-form input[type="email"],
  .inquiry-form select,
  .inquiry-form textarea {
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .inquiry-form .btn-primary {
    padding-top: 15px;
    padding-bottom: 15px;
  }

  /* checkbox text in line with the text inside the fields */
  .form-check {
    padding: 4px 20px;
  }
}

/* ---------- Sostenibilità: card "Il nostro impegno" che si girano ---------- */

/* all four cards on one row (2 x 2 on phones); they appear one at a time while scrolling
   (main.js adds .is-in) and flip on click to a white back with the text */
.impact-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  width: 100%;
  margin-top: 28px;
}

.impact-card {
  position: relative;
  display: block;
  aspect-ratio: 3 / 4;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  perspective: 1400px;
  -webkit-tap-highlight-color: transparent;
  opacity: 0;
  transform: translate3d(0, 28px, 0);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

.impact-card.is-in {
  opacity: 1;
  transform: none;
}

.impact-card-inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.7s cubic-bezier(0.3, 0.7, 0.2, 1);
}

.impact-card.is-flipped .impact-card-inner {
  transform: rotateY(180deg);
}

.impact-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-sm);
  overflow: hidden;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.impact-front {
  justify-content: flex-end;
  padding: 18px;
  background: #262626;
}

.impact-front img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.impact-front::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0) 45%);
}

.impact-title {
  position: relative;
  z-index: 1;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
  text-wrap: balance;
}

.impact-back {
  justify-content: flex-end;
  gap: 10px;
  padding: 22px 20px;
  background: var(--surface);
  color: var(--ink);
  transform: rotateY(180deg);
}

.impact-back-title {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
  text-wrap: balance;
}

.impact-back-desc {
  font-size: 0.9rem;
  line-height: 1.45;
  opacity: 0.72;
  text-wrap: pretty;
}

/* round "+" in the corner: tells the card can be turned (it becomes an "x") */
.impact-flip {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
}

.impact-back .impact-flip {
  background: var(--ink);
  color: var(--surface);
  transform: rotate(45deg);
}

.impact-flip svg {
  width: 16px;
  height: 16px;
}

.impact-card:focus-visible {
  outline: 2px solid var(--surface);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}

@media (prefers-reduced-motion: reduce) {
  .impact-card {
    opacity: 1;
    transform: none;
  }

  .impact-card-inner {
    transition: none;
  }
}

@media (max-width: 760px) {
  /* 2 x 2, as wide as the photo cards (20px from the screen edge) */
  .impact-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    width: calc(100vw - 40px);
    max-width: none;
    margin-left: calc(50% - 50vw + 20px);
    margin-top: 22px;
  }

  .impact-card {
    aspect-ratio: 1 / 1;
  }

  .impact-front {
    padding: 12px;
  }

  .impact-title {
    font-size: 0.8rem;
  }

  .impact-back {
    gap: 6px;
    padding: 14px;
  }

  .impact-back-title {
    font-size: 0.86rem;
  }

  .impact-back-desc {
    font-size: 0.76rem;
    line-height: 1.38;
  }

  .impact-flip {
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
  }

  .impact-flip svg {
    width: 13px;
    height: 13px;
  }
}

/* Safari keeps showing children that get their own layer (the highlighted
   title) through a hidden backface: hide them too, push the front a hair
   forward, and switch the face that turns away off halfway through the
   flip, so nothing shows mirrored on the other side. */
.impact-face,
.impact-face * {
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.impact-front {
  transform: rotateY(0deg) translateZ(1px);
  transition: visibility 0s linear 0.35s;
}

.impact-back {
  transform: rotateY(180deg) translateZ(1px);
  visibility: hidden;
  transition: visibility 0s linear 0.35s;
}

.impact-card.is-flipped .impact-front {
  visibility: hidden;
}

.impact-card.is-flipped .impact-back {
  visibility: visible;
}

/* the row spans the whole content column (same margin left and right); on
   short windows the cards get lower instead of narrower, so the pinned
   section still fits */
@media (min-width: 761px) {
  .impact-card {
    width: 100%;
    max-height: calc(100vh - 490px);
    max-height: calc(100svh - 490px);
  }
}

/* ---------- Distanza paragrafo -> card uguale a titolo -> paragrafo (20px) ---------- */

.lede + .impact-grid {
  margin-top: 0;
}

/* the strip keeps its 28px top padding (room for the cards' hover lift):
   pull it up so the cards start 20px under the text */
.lede + .tech-strip {
  margin-top: -28px;
}

/* Sostenibilità: square cards */
.impact-card {
  aspect-ratio: 1 / 1;
}

/* Impact cards: the title highlight sweeps in on hover like the other photo
   cards (tech, projects); on touch screens (no hover) once the card is shown */
.impact-card .hl::before {
  width: 0;
  transition: width 0.35s var(--ease);
}

.impact-card .hl::after {
  clip-path: inset(0 100% 0 0);
  transition: clip-path 0.35s var(--ease);
}

@media (hover: hover) {
  .impact-card:hover .hl::before {
    width: 100%;
  }

  .impact-card:hover .hl::after {
    clip-path: inset(0 0 0 0);
  }
}

@media (hover: none) {
  .impact-card.is-in .hl::before {
    width: 100%;
    transition-delay: 0.4s;
  }

  .impact-card.is-in .hl::after {
    clip-path: inset(0 0 0 0);
    transition-delay: 0.4s;
  }
}

/* ---------- Senza eyebrow ---------- */

/* the first element of each block now starts right at its top */
.problem-content > :first-child,
.scrolly-header > :first-child,
.tech-content > :first-child,
.projects-content > :first-child,
.cta-content > :first-child {
  margin-top: 0;
}

/* carousel head: only the arrows are left (on the right); on phones, where
   the arrows are hidden, the empty head goes too */
.project-slider-head {
  justify-content: flex-end;
}

@media (max-width: 760px) {
  .project-slider-head {
    display: none;
  }
}
