/* Luca Carboni, sito personale. Palette dal brand Marche Web Marketing (ink + orange). */

@font-face {
  font-family: "Space Grotesk";
  src: url("../fonts/space-grotesk-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 100 800;
  font-display: swap;
}

:root {
  --ink: #0a0a0b;
  --ink-2: #111114;
  --ink-3: #17171b;
  --line: #26262c;
  --line-2: #33333a;
  --fg: #f4efe6;
  --fg-dim: #a8a8ae;
  --fg-mute: #7c7c84;
  --accent: #f7771e;
  --accent-2: #ff8c3d;
  --accent-ink: #1a0d03;

  --radius: 14px;
  --radius-pill: 999px;
  --gutter: clamp(16px, 4vw, 56px);
  --maxw: 1400px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);      /* UI: entrate, feedback */
  --ease-cine: cubic-bezier(0.16, 1, 0.3, 1);      /* reveal lunghi, narrativi */

  --z-grain: 60;
  --z-nav: 50;

  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--fg);
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

img { display: block; max-width: 100%; }
::selection { background: var(--accent); color: var(--accent-ink); }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
em { font-style: italic; }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-feature-settings: "zero" 1; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.skip {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  background: var(--accent); color: var(--accent-ink); padding: 10px 16px; border-radius: var(--radius-pill);
  font-weight: 600; text-decoration: none;
}
.skip:focus { top: 16px; }

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

/* grana fissa, mai su contenitori che scorrono */
.grain {
  position: fixed; inset: 0; z-index: var(--z-grain); pointer-events: none; opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- icone (Phosphor via mask, prendono currentColor) ---------- */
.i-arrow {
  display: inline-block; width: 1.05em; height: 1.05em; flex: none;
  background: currentColor;
  -webkit-mask: url("../icons/arrow-up-right.svg") center / contain no-repeat;
          mask: url("../icons/arrow-up-right.svg") center / contain no-repeat;
  transition: transform 0.35s var(--ease-out);
}

/* ---------- bottoni: tutti pill ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  height: 52px; padding: 0 24px; border-radius: var(--radius-pill);
  font-weight: 600; font-size: 16px; white-space: nowrap; text-decoration: none;
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease, transform 0.16s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn--sm { height: 42px; padding: 0 18px; font-size: 15px; }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--ghost { border: 1px solid var(--line-2); color: var(--fg); }
@media (hover: hover) and (pointer: fine) {
  .btn--primary:hover { background: var(--accent-2); }
  .btn--primary:hover .i-arrow { transform: translate(2px, -2px); }
  .btn--ghost:hover { border-color: var(--fg-dim); }
}

/* ---------- nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: var(--z-nav);
  height: 72px; padding: 0 var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.45s var(--ease-out);
  border-bottom: 1px solid transparent;
}
.nav.is-solid {
  background: rgb(10 10 11 / 0.78);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
          backdrop-filter: blur(14px) saturate(140%);
  border-bottom-color: var(--line);
}
.nav.is-hidden { transform: translateY(-100%); }
.nav__brand { font-weight: 600; font-size: 18px; letter-spacing: -0.01em; text-decoration: none; }
.nav__links { display: flex; gap: 32px; }
.nav__links a { color: var(--fg-dim); text-decoration: none; font-size: 15px; transition: color 0.2s ease; }
.nav__links a:hover { color: var(--fg); }
@media (max-width: 767px) {
  .nav { height: 64px; }
  .nav__links { display: none; }
}

/* ---------- testo comune ---------- */
.eyebrow {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--fg-mute);
}
.h2 {
  font-size: clamp(2rem, 4.4vw, 3.6rem); line-height: 1.04; letter-spacing: -0.035em; font-weight: 500;
  max-width: 18ch;
}
.h2 em, .hero__title em { color: var(--accent); font-style: italic; }

/* ---------- hero ---------- */
.hero {
  min-height: 100dvh;
  max-width: var(--maxw); margin: 0 auto;
  padding: 96px var(--gutter) 48px;
  display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 64px);
  align-items: center;
}
.hero__copy { display: grid; gap: 28px; align-content: center; }
.hero__title {
  font-size: clamp(2.5rem, 4.8vw, 4.6rem);
  line-height: 1.02; letter-spacing: -0.045em; font-weight: 500;
}
.hero__title .line { display: block; overflow: hidden; padding-bottom: 0.08em; margin-bottom: -0.06em; }
.hero__title .line > span { display: inline-block; white-space: nowrap; }
.hero__sub { font-size: clamp(1.05rem, 1.4vw, 1.2rem); color: var(--fg-dim); max-width: 44ch; }
.hero__ctas { display: flex; flex-wrap: wrap; gap: 12px; }

.hero__visual {
  position: relative; margin: 0; align-self: stretch;
  min-height: 520px; height: calc(100dvh - 160px); max-height: 760px;
  border-radius: var(--radius); overflow: hidden;
  background: var(--ink-2);
  border: 1px solid var(--line);
}
.hero__visual::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(110% 70% at 50% 115%, rgb(247 119 30 / 0.16), transparent 60%);
}
#signal { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero__caption {
  position: absolute; left: 20px; right: 20px; bottom: 18px;
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 13px; color: var(--fg-mute);
}
.hero__caption-val { color: var(--accent); font-size: 15px; font-variant-numeric: tabular-nums; }

@media (max-width: 899px) {
  .hero { grid-template-columns: 1fr; padding-top: 104px; align-content: start; }
  .hero__visual { height: 58vw; min-height: 300px; max-height: 460px; }
}

/* ---------- numeri ---------- */
.stats { max-width: var(--maxw); margin: 0 auto; padding: clamp(64px, 10vw, 140px) var(--gutter); }
.stats__grid {
  display: grid; grid-template-columns: 1fr 1fr 1.35fr 1fr; gap: clamp(20px, 3vw, 48px);
  border-top: 1px solid var(--line); padding-top: 40px;
}
.stat__num {
  font-size: clamp(2.4rem, 4.6vw, 4.4rem); line-height: 1; letter-spacing: -0.04em; font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.stat--accent .stat__num { color: var(--accent); font-size: clamp(3rem, 6.2vw, 6rem); }
.stat__label { margin-top: 14px; color: var(--fg-dim); font-size: 15px; max-width: 26ch; }
@media (max-width: 899px) {
  .stats__grid { grid-template-columns: 1fr 1fr; row-gap: 44px; }
  .stat--accent { grid-column: 1 / -1; order: -1; }
}

/* ---------- sistemi: pan orizzontale ---------- */
.systems { position: relative; }
.systems__pin {
  min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; gap: 48px;
  padding: 96px 0 64px; overflow: hidden;
}
.systems__head { padding: 0 var(--gutter); max-width: var(--maxw); width: 100%; margin: 0 auto; display: grid; gap: 18px; }
/* avanzamento del pan: stato, non decorazione. Visibile solo quando il pin è attivo */
.systems__progress { display: none; height: 2px; width: min(240px, 40vw); margin-top: 8px; }
.systems.is-pinned .systems__progress { display: block; }
.systems__progress span { display: block; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; border-radius: 2px; }

/* spotlight sul bordo delle schede: segue il cursore, solo con mouse */
.sys::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 1;
  padding: 1px; opacity: 0; transition: opacity 0.3s ease;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), rgb(247 119 30 / 0.55), transparent 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.sys--lead::after { background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), rgb(26 13 3 / 0.45), transparent 70%); }
@media (hover: hover) and (pointer: fine) { .sys:hover::after { opacity: 1; } }
.systems__track {
  display: flex; gap: 20px; padding: 0 var(--gutter);
  width: max-content; will-change: transform;
}
.sys {
  position: relative; isolation: isolate; overflow: hidden;
  width: clamp(300px, 30vw, 420px); min-height: 440px;
  padding: 32px; border-radius: var(--radius);
  background: var(--ink-2); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 18px;
}
.sys--lead { width: clamp(320px, 40vw, 560px); background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.sys--lead .sys__body { color: rgb(26 13 3 / 0.82); }
.sys--lead .sys__tags li { border-color: rgb(26 13 3 / 0.28); color: var(--accent-ink); }
.sys--lead .sys__metric { border-color: rgb(26 13 3 / 0.22); }
.sys--grid::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0.55;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 75%);
          mask-image: linear-gradient(to bottom, #000 0%, transparent 75%);
}
.sys--glow { background: radial-gradient(90% 70% at 100% 100%, rgb(247 119 30 / 0.22), transparent 70%), var(--ink-2); }
.sys--lines::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0.5;
  background: repeating-linear-gradient(135deg, transparent 0 14px, var(--line) 14px 15px);
  -webkit-mask-image: linear-gradient(to top, #000, transparent 70%);
          mask-image: linear-gradient(to top, #000, transparent 70%);
}
.sys__title { font-size: clamp(1.6rem, 2.2vw, 2.1rem); letter-spacing: -0.03em; font-weight: 500; line-height: 1.08; }
.sys__body { color: var(--fg-dim); max-width: 40ch; }
.sys__tags { list-style: none; padding: 0; margin: auto 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.sys__tags li {
  font-size: 12.5px; padding: 6px 12px; border-radius: var(--radius-pill);
  border: 1px solid var(--line-2); color: var(--fg-dim);
}
.sys__metric { padding-top: 16px; border-top: 1px solid var(--line-2); font-size: 15px; }
.sys__metric .mono { font-size: 1.6em; font-weight: 600; letter-spacing: -0.03em; margin-right: 6px; }

/* senza pin (mobile o motion ridotto): scroll-snap nativo */
.systems:not(.is-pinned) .systems__track {
  width: auto; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  scrollbar-width: none; padding-bottom: 8px;
}
.systems:not(.is-pinned) .systems__track::-webkit-scrollbar { display: none; }
.systems:not(.is-pinned) .sys { flex: none; scroll-snap-align: start; scroll-margin-left: var(--gutter); }
@media (max-width: 767px) {
  .systems__pin { min-height: 0; padding: 72px 0; }
  .sys, .sys--lead { width: 84vw; min-height: 400px; padding: 26px; }
}

/* ---------- marquee stack ---------- */
.stack { padding: clamp(32px, 6vw, 72px) 0; border-block: 1px solid var(--line); overflow: hidden; }
.marquee { display: flex; width: max-content; }
.marquee__row { display: flex; align-items: center; gap: clamp(48px, 6vw, 88px); padding-right: clamp(48px, 6vw, 88px); flex: none; }
.marquee__row img { width: 40px; height: 40px; opacity: 0.75; }
@media (prefers-reduced-motion: no-preference) {
  .marquee { animation: marquee 48s linear infinite; }
  .stack:hover .marquee { animation-play-state: paused; }
}
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- manifesto ---------- */
.manifesto { max-width: var(--maxw); margin: 0 auto; padding: clamp(96px, 16vw, 220px) var(--gutter); }
.manifesto__text {
  font-size: clamp(1.9rem, 4.4vw, 4.1rem); line-height: 1.12; letter-spacing: -0.035em; font-weight: 500;
  max-width: 22ch;
}
.manifesto__text .w { opacity: 0.16; }
.manifesto__text .w.is-key { color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .manifesto__text .w { opacity: 1; } }

/* ---------- principi ---------- */
.principles { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter) clamp(96px, 14vw, 180px); }
.principles__grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 0 clamp(32px, 6vw, 96px); }
.pr { padding: 36px 0; border-top: 1px solid var(--line); display: grid; gap: 12px; }
.pr:nth-child(3) { grid-column: 1; }
.pr--wide .pr__title { font-size: clamp(1.7rem, 2.8vw, 2.5rem); }
.pr__title { font-size: clamp(1.35rem, 2vw, 1.75rem); letter-spacing: -0.025em; font-weight: 500; line-height: 1.12; }
.pr__body { color: var(--fg-dim); max-width: 46ch; }
@media (max-width: 767px) { .principles__grid { grid-template-columns: 1fr; } .pr:nth-child(3) { grid-column: auto; } }

/* ---------- agenzia ---------- */
.agency { padding: 0 var(--gutter) clamp(96px, 12vw, 160px); }
.agency__inner {
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(32px, 5vw, 72px); border-radius: var(--radius);
  background: radial-gradient(70% 90% at 0% 0%, rgb(247 119 30 / 0.12), transparent 60%), var(--ink-2);
  border: 1px solid var(--line);
  display: grid; grid-template-columns: 1.2fr 1fr; gap: clamp(32px, 5vw, 80px); align-items: center;
}
.agency__copy { display: grid; gap: 24px; justify-items: start; }
.agency__logo { height: 36px; width: auto; }
.agency__body { color: var(--fg-dim); max-width: 44ch; }
.agency__ctas { display: flex; flex-wrap: wrap; gap: 12px; }
.agency__certs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.agency__certs li {
  aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: #fff;
  display: grid; place-items: center; padding: 4%;
}
.agency__certs img { width: 100%; height: 100%; object-fit: contain; }
@media (max-width: 899px) { .agency__inner { grid-template-columns: 1fr; } }

/* ---------- footer ---------- */
.footer { padding: 0 var(--gutter) 40px; max-width: var(--maxw); margin: 0 auto; }
.footer__big { border-top: 1px solid var(--line); padding-top: clamp(40px, 6vw, 80px); }
.footer__big a {
  display: inline-flex; align-items: center; gap: 0.25em;
  font-size: clamp(2rem, 7.4vw, 7rem); letter-spacing: -0.05em; font-weight: 500; line-height: 1.05;
  text-decoration: none; transition: color 0.3s ease;
}
.footer__big .i-arrow { width: 0.6em; height: 0.6em; color: var(--accent); }
@media (hover: hover) and (pointer: fine) {
  .footer__big a:hover { color: var(--accent); }
  .footer__big a:hover .i-arrow { transform: translate(6px, -6px); }
}
.footer__meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 24px; margin-top: 48px; color: var(--fg-mute); font-size: 14px; }

/* ---------- reveal (gestito da JS; senza JS resta visibile) ---------- */
.js [data-reveal] { opacity: 0; transform: translateY(28px); }
.js [data-hero-in] { opacity: 0; transform: translateY(16px); }
.js [data-hero-line] { transform: translateY(105%); }
.js .hero__visual { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  .js [data-reveal], .js [data-hero-in], .js [data-hero-line], .js .hero__visual { opacity: 1; transform: none; }
}
