/* ============================================================
   4room — design system
   Archetipo: Swiss minimal · accento teal dal logo (#5ec3cd)
   Token in :root, tipografia fluida, griglia 12 colonne.
   Il motion è in motion.css/motion.js (attributi data-*).
   ============================================================ */
:root {
  --bg: #f5f6f4;
  --fg: #0a0a0a;
  --accent: #5ec3cd;
  --dark: #0b0b0c;
  --dark-fg: #f2f4f3;
  --font-display: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --gutter: clamp(1.25rem, 4vw, 4.5rem);
  --nav-h: 4.75rem;
  --radius: 6px;
  --line: color-mix(in srgb, currentColor 14%, transparent);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-hop: cubic-bezier(0.9, 0, 0.1, 1);
}

/* ---- Base ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: var(--font-body); font-size: clamp(1rem, 0.95rem + 0.3vw, 1.15rem); line-height: 1.55;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 700; letter-spacing: -0.03em; line-height: 1; text-wrap: balance; }
h1 { font-size: clamp(2.8rem, 8vw, 8rem); letter-spacing: -0.045em; line-height: 0.95; }
h2 { font-size: clamp(2rem, 5vw, 4.6rem); }
h3 { font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.7rem); letter-spacing: -0.02em; line-height: 1.15; }
p { margin: 0; }
p + p { margin-top: 1em; }
em { font-style: normal; text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 0.07em; text-underline-offset: 0.1em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--accent); color: #0a0a0a; }

.meta { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.65; }
.lead { font-size: clamp(1.1rem, 1rem + 0.5vw, 1.4rem); line-height: 1.45; max-width: 38ch; text-wrap: pretty; }
.muted { opacity: 0.7; }
.prose { max-width: 64ch; }
.prose p { opacity: 0.85; }
.link { font-weight: 600; border-bottom: 1px solid currentColor; padding-bottom: 0.1em; }
.link:hover { border-bottom-color: var(--accent); }
.skip { position: absolute; left: -999px; top: 0.5rem; z-index: 300; padding: 0.6rem 1rem; background: var(--accent); color: #0a0a0a; font-weight: 600; }
.skip:focus { left: 0.5rem; }

/* ---- Layout -------------------------------------------------------------- */
.wrap { padding-inline: var(--gutter); }
.section { padding-block: clamp(5rem, 11vw, 10rem); }
.section-sm { padding-block: clamp(3rem, 6vw, 5rem); }
.grid { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: var(--gutter); row-gap: 2rem; }
.g-l { grid-column: 1 / 7; }
.g-r { grid-column: 8 / 13; }
.g-1-4 { grid-column: 1 / 4; }
.g-4-11 { grid-column: 4 / 11; }
.g-1-8 { grid-column: 1 / 8; }
.g-9-13 { grid-column: 9 / 13; }
.g-2-12 { grid-column: 2 / 12; }
.g-full { grid-column: 1 / -1; }
.stack { display: grid; gap: 1.5rem; }
.stack > .meta { margin-bottom: 0.5rem; }
main { padding-top: var(--nav-h); }
hr.rule { border: 0; border-top: 1px solid var(--line); margin: 0; }

.media { overflow: hidden; border-radius: var(--radius); background: color-mix(in srgb, currentColor 6%, transparent); }
.media img { width: 100%; height: 100%; object-fit: cover; }
.r-4-5 { aspect-ratio: 4 / 5; }
.r-4-3 { aspect-ratio: 4 / 3; }
.r-16-9 { aspect-ratio: 16 / 9; }
.r-21-9 { aspect-ratio: 21 / 9; }
.r-5-2 { aspect-ratio: 5 / 2; }

/* ---- Bottoni ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.75rem; min-height: 3rem; padding: 0.85rem 1.5rem;
  border: 1px solid currentColor; border-radius: 999px; background: transparent; color: inherit;
  font: inherit; font-size: 0.95rem; font-weight: 600; line-height: 1; cursor: pointer; white-space: nowrap;
  transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}
.btn:hover { background: var(--accent); border-color: var(--accent); color: #0a0a0a; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #0a0a0a; }
.btn-accent:hover { background: #0a0a0a; border-color: #0a0a0a; color: #fff; }
.btn-dark { background: #0a0a0a; border-color: #0a0a0a; color: #fff; }
.btn-dark:hover { background: #fff; border-color: #fff; color: #0a0a0a; }
.btn .arrow { display: inline-block; transition: transform 0.35s var(--ease-out); }
.btn:hover .arrow { transform: translateX(4px); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem 2rem; }

/* ---- Header -------------------------------------------------------------- */
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: var(--nav-h); padding-inline: var(--gutter); }
.site-header .logo { display: block; }
.site-header .logo img { height: 2.1rem; width: auto; }
.site-header .logo .light { display: none; }
.site-nav { display: flex; align-items: center; gap: 2.2rem; font-size: 0.95rem; font-weight: 500; }
.site-nav a:not(.btn) { position: relative; padding-block: 0.25rem; }
.site-nav a:not(.btn)::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: right; transition: transform 0.4s var(--ease-out);
}
.site-nav a:not(.btn):hover::after, .site-nav a.active::after { transform: scaleX(1); transform-origin: left; }
.site-nav .btn { min-height: 2.5rem; padding: 0.6rem 1.1rem; font-size: 0.85rem; }
.burger { display: none; width: 2.75rem; height: 2.75rem; padding: 0; border: 0; background: transparent; cursor: pointer; position: relative; }
.burger span { position: absolute; left: 0.6rem; right: 0.6rem; height: 2px; background: currentColor; transition: transform 0.4s var(--ease-out), top 0.4s var(--ease-out); }
.burger span:first-child { top: calc(50% - 4px); }
.burger span:last-child { top: calc(50% + 3px); }
body.menu-open .burger span:first-child { top: 50%; transform: rotate(45deg); }
body.menu-open .burger span:last-child { top: 50%; transform: rotate(-45deg); }
body.menu-open .site-header { color: var(--dark-fg); }
body.menu-open .site-header .logo .dark { display: none; }
body.menu-open .site-header .logo .light { display: block; }
body.menu-open [data-nav] { transform: none !important; background: transparent !important; backdrop-filter: none !important; }

.menu {
  position: fixed; inset: 0; z-index: 90; background: var(--dark); color: var(--dark-fg);
  display: grid; align-content: center; gap: 2rem; padding: var(--nav-h) var(--gutter) var(--gutter);
  transform: translateY(-100%); visibility: hidden; transition: transform 0.7s var(--ease-hop), visibility 0s 0.7s;
}
.menu.is-open { transform: none; visibility: visible; transition: transform 0.7s var(--ease-hop); }
.menu nav { display: grid; }
.menu nav a { font-size: clamp(2.2rem, 9vw, 4rem); font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; padding-block: 0.3rem; border-bottom: 1px solid var(--line); }
.menu nav a.accent { color: var(--accent); }
.menu .meta { opacity: 0.6; }

/* ---- Hero home ----------------------------------------------------------- */
.hero {
  min-height: calc(100svh - var(--nav-h)); display: grid; grid-template-columns: repeat(12, 1fr);
  column-gap: var(--gutter); align-items: end; padding-block: clamp(1.5rem, 4vw, 3rem) var(--gutter);
}
.hero-copy { grid-column: 1 / 8; display: grid; gap: clamp(1.25rem, 2.5vw, 2rem); padding-bottom: clamp(0rem, 3vw, 3rem); }
.hero-copy h1 { font-size: clamp(2.5rem, 5.6vw, 5.6rem); max-width: 17ch; }
.hero-copy .lead { max-width: 44ch; }
.hero-media { grid-column: 8 / 13; align-self: stretch; min-height: 60vh; border-radius: var(--radius); }
.hero-media img { width: 100%; height: 100%; object-fit: cover; }

/* ---- Statement ----------------------------------------------------------- */
.statement { display: grid; gap: 2rem; }
.statement h2 { max-width: 24ch; }

/* ---- Indice servizi ------------------------------------------------------ */
.index { border-top: 1px solid var(--line); margin-top: 2.5rem; }
.index a {
  display: grid; grid-template-columns: 3.5rem 1fr auto; grid-template-areas: "n t a" ". s a";
  column-gap: 1.25rem; row-gap: 0.35rem; align-items: baseline; padding: 1.35rem 0;
  border-bottom: 1px solid var(--line); transition: padding-left 0.45s var(--ease-out);
}
.index a:hover { padding-left: 0.75rem; }
.index .n { grid-area: n; font-family: var(--font-mono); font-size: 0.75rem; opacity: 0.55; }
.index h3 { grid-area: t; }
.index .sub { grid-area: s; opacity: 0.65; font-size: 0.95rem; max-width: 52ch; }
.index .arrow { grid-area: a; align-self: center; font-size: 1.5rem; line-height: 1; opacity: 0.35; transition: transform 0.4s var(--ease-out), opacity 0.3s; }
.index a:hover .arrow { transform: translate(4px, -4px); opacity: 1; color: var(--accent); }
.media-sticky { position: sticky; top: calc(var(--nav-h) + 1rem); align-self: start; }

/* ---- Come funziona (sezione pinnata) ------------------------------------- */
.how-inner { width: 100%; display: grid; grid-template-columns: repeat(12, 1fr); column-gap: var(--gutter); row-gap: 2rem; align-items: center; padding-inline: var(--gutter); }
.how-text { grid-column: 1 / 7; display: grid; gap: 1.5rem; }
.how-text .lead { max-width: 40ch; }
.how-media { grid-column: 8 / 12; aspect-ratio: 1; display: grid; place-items: center; }
.how-media img { width: 100%; height: 100%; object-fit: contain; }
.how-steps { display: none; }

/* ---- Numeri e prodotti (capitolo scuro) ---------------------------------- */
.chapter { display: grid; gap: 2rem; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gutter); margin-top: 2rem; padding-top: 2rem; border-top: 1px solid var(--line); }
.stats strong {
  display: block; font-family: var(--font-display); font-weight: 800; letter-spacing: -0.05em; line-height: 1;
  font-size: clamp(3rem, 6.5vw, 6rem); color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.stats span { display: block; margin-top: 0.85rem; opacity: 0.7; max-width: 22ch; font-size: 0.95rem; text-wrap: pretty; }
.products { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--gutter); margin-top: clamp(3rem, 8vw, 6rem); }
.product { grid-column: span 6; display: grid; gap: 1rem; align-content: start; }
.product .media { background: #17181a; }
.product p { opacity: 0.7; max-width: 46ch; }

/* ---- Realizzazioni ------------------------------------------------------- */
.works { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: var(--gutter); row-gap: clamp(3rem, 6vw, 5rem); margin-top: 3rem; }
.work { display: grid; gap: 1rem; border-top: 1px solid var(--line); padding-top: 1.25rem; align-content: start; }
.work:nth-child(odd) { grid-column: 1 / 7; }
.work:nth-child(even) { grid-column: 8 / 13; margin-top: clamp(2rem, 8vw, 8rem); }
.work .kwp { font-family: var(--font-display); font-weight: 800; letter-spacing: -0.04em; font-size: clamp(2.5rem, 5vw, 4.5rem); line-height: 1; }
.work:hover h3 { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 0.12em; text-decoration-thickness: 0.06em; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }

/* ---- CTA (capitolo teal) ------------------------------------------------- */
.cta { display: grid; gap: 2rem; }
.cta h2 { max-width: 16ch; font-size: clamp(2.6rem, 7vw, 7rem); letter-spacing: -0.04em; }

/* ---- Pagine interne ------------------------------------------------------ */
.page-hero { display: grid; gap: 1.5rem; padding-block: clamp(3rem, 8vw, 7rem) clamp(2rem, 5vw, 4rem); border-bottom: 1px solid var(--line); }
.page-hero h1 { font-size: clamp(2.6rem, 6.5vw, 6rem); max-width: 16ch; }
.service { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: var(--gutter); row-gap: 1.25rem; padding-block: clamp(2.5rem, 5vw, 4rem); border-bottom: 1px solid var(--line); scroll-margin-top: var(--nav-h); }
.service .n { grid-column: 1 / 3; }
.service .body { grid-column: 3 / 10; display: grid; gap: 1.25rem; }
.service h2 { font-size: clamp(1.8rem, 3.5vw, 3rem); }
.values { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gutter); margin-top: 2rem; padding-top: 2rem; border-top: 1px solid var(--line); }
.values strong { display: block; font-size: clamp(1.3rem, 2vw, 1.8rem); font-weight: 700; letter-spacing: -0.02em; }
.values span { display: block; margin-top: 0.5rem; opacity: 0.7; font-size: 0.95rem; }
.square { display: inline-block; width: 0.6em; height: 0.6em; background: var(--accent); border-radius: 0.12em; vertical-align: middle; margin-right: 0.5em; }

/* FAQ */
.faq { border-top: 1px solid var(--line); margin-top: 2rem; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 1rem; padding: 1.35rem 0; font-weight: 600; font-size: clamp(1.05rem, 1rem + 0.4vw, 1.3rem); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--font-mono); font-size: 1.4rem; opacity: 0.5; transition: transform 0.35s var(--ease-out); }
.faq details[open] summary::after { transform: rotate(45deg); color: var(--accent); opacity: 1; }
.faq details p { padding-bottom: 1.5rem; opacity: 0.8; max-width: 62ch; }

/* Form */
.form { display: grid; gap: 1.75rem; margin-top: 2rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.75rem var(--gutter); }
.field label { display: block; font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.7; margin-bottom: 0.35rem; }
.field input, .field select, .field textarea {
  width: 100%; background: transparent; border: 0; border-bottom: 1px solid color-mix(in srgb, currentColor 35%, transparent);
  border-radius: 0; padding: 0.7rem 0; font: inherit; color: inherit; transition: border-color 0.3s;
}
.field textarea { min-height: 8rem; resize: vertical; }
.field select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - 12px) 55%, calc(100% - 6px) 55%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 1.5rem; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-bottom-color: var(--accent); box-shadow: 0 1px 0 0 var(--accent); }
.field .error { display: block; margin-top: 0.4rem; font-size: 0.85rem; color: #b42318; }
.field.check { display: grid; grid-template-columns: auto 1fr; gap: 0.75rem; align-items: start; }
.field.check input { width: 1.1rem; height: 1.1rem; margin-top: 0.25rem; accent-color: var(--accent); }
.field.check label { font-family: var(--font-body); font-size: 0.95rem; letter-spacing: 0; text-transform: none; opacity: 0.85; margin: 0; }
.field.check label a { text-decoration: underline; text-underline-offset: 0.15em; }
.hp { position: absolute; left: -9999px; opacity: 0; height: 0; overflow: hidden; }
.alert { padding: 1rem 1.25rem; border-left: 3px solid var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.alert-err { border-left-color: #b42318; background: color-mix(in srgb, #b42318 10%, transparent); }
.contact-aside { display: grid; gap: 1.75rem; align-content: start; }
.contact-aside p { margin: 0; }
.contact-aside .big { font-size: clamp(1.2rem, 1.1rem + 0.6vw, 1.6rem); font-weight: 600; letter-spacing: -0.01em; }

/* ---- Footer -------------------------------------------------------------- */
.site-footer { padding: clamp(4rem, 8vw, 7rem) var(--gutter) 1.5rem; background: var(--dark); color: var(--dark-fg); overflow: hidden; }
.wordmark { display: flex; align-items: center; gap: 0.08em; font-weight: 800; font-size: clamp(5rem, 19vw, 21rem); letter-spacing: -0.06em; line-height: 0.85; }
.wordmark .four { display: inline-grid; place-items: center; width: 0.92em; height: 0.92em; background: var(--accent); color: #fff; border-radius: 0.18em; font-size: 0.78em; font-weight: 700; letter-spacing: -0.04em; line-height: 1; }
.foot-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--gutter); margin-top: clamp(2.5rem, 5vw, 4rem); padding-top: 2rem; border-top: 1px solid var(--line); font-size: 0.92rem; }
.foot-grid > div { grid-column: span 3; display: grid; gap: 0.75rem; align-content: start; }
.foot-grid > div:first-child { grid-column: span 4; }
.foot-grid > div:last-child { grid-column: span 2; }
.foot-grid .meta { opacity: 0.5; }
.foot-grid a:hover { color: var(--accent); }
.foot-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.foot-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.foot-bottom .meta { opacity: 0.7; }

/* ---- Responsive ---------------------------------------------------------- */
@media (max-width: 1023px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .values { grid-template-columns: repeat(2, 1fr); }
  .foot-grid > div, .foot-grid > div:first-child, .foot-grid > div:last-child { grid-column: span 6; }
}
@media (max-width: 767px) {
  .site-nav { display: none; }
  .burger { display: block; }
  .grid > *, .hero-copy, .hero-media, .how-text, .how-media, .product, .work:nth-child(odd), .work:nth-child(even), .service .n, .service .body, .foot-grid > div, .foot-grid > div:first-child, .foot-grid > div:last-child { grid-column: 1 / -1; }
  .hero { min-height: 0; align-content: start; row-gap: 1.5rem; }
  .hero-copy { padding-bottom: 0; }
  .hero-media { min-height: 0; aspect-ratio: 4 / 3; }
  .media-sticky { position: static; }
  .index a { grid-template-columns: 2.5rem 1fr auto; }
  .how-inner { padding-block: 3rem; }
  .how-media { aspect-ratio: 1; max-width: 62%; margin-inline: auto; }
  .work:nth-child(even) { margin-top: 0; }
  .form-row { grid-template-columns: 1fr; }
  .stats strong { font-size: clamp(2.6rem, 12vw, 4rem); }
}

/* ---- Tabelle (cookie policy) --------------------------------------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; min-width: 640px; }
.table th, .table td { text-align: left; vertical-align: top; padding: 0.8rem 0.9rem 0.8rem 0; border-bottom: 1px solid var(--line); }
.table th { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.6; font-weight: 400; }
.table code { font-family: var(--font-mono); font-size: 0.85em; }
.foot-links a:hover { color: var(--accent); }

/* Pulsante che sembra un link (es. Preferenze cookie) */
.linklike { background: none; border: 0; padding: 0; margin: 0; font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; cursor: pointer; }
.linklike:hover { color: var(--accent); }
main:focus { outline: none; }
