/* Lorenzo Gravina — site styles */
/* Layout: bianco pieno, inchiostro blu notte, lime solo come superficie d'azione (mai come colore del testo). */
:root {
  --paper: #FFFFFF;
  --mist: #F1F4EE;
  --mist-strong: #E3E9DC;
  --ink: #0C1E2F;
  --slate: #4A5764;
  --lime: #82E631;
  --lime-soft: #EAF9DC;
  --lime-ink: #0C1E2F;
  --line: rgba(12, 30, 47, .16);
  --focus: #0C1E2F;

  --font-display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;

  --gutter: clamp(16px, 4vw, 48px);
  --max: 1360px;
  --radius-lg: 28px;
  --radius-sm: 12px;
  --ease: cubic-bezier(.2, .7, .1, 1);
}


*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 96px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: clamp(16px, 0.35vw + 15px, 18px);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 16px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
.site-header.is-scrolled { border-bottom-color: var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 72px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 600; }
.brand img { width: 40px; height: 40px; border-radius: 10px; }
.nav { display: flex; align-items: center; gap: clamp(12px, 2.4vw, 32px); }
.nav a { text-decoration: none; font-weight: 500; }
.nav a:not(.btn):hover { text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 2px; }
@media (max-width: 640px) { .nav .nav-hide { display: none; } .brand span { display: none; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 22px; border-radius: 999px;
  font: 600 1rem/1 var(--font-body); text-decoration: none; cursor: pointer;
  border: 1.5px solid var(--ink); background: transparent; color: var(--ink);
  transition: background .25s var(--ease), color .25s var(--ease), transform .25s var(--ease);
}
.btn svg { width: 18px; height: 18px; transition: transform .3s var(--ease); }
.btn:hover svg { transform: translateX(3px); }
.btn.download:hover svg { transform: translateY(3px); }
.btn.primary { background: var(--lime); border-color: var(--lime); color: var(--lime-ink); }
.btn.primary:hover { background: #95F04A; }
.btn:focus-visible { outline-offset: 4px; }
.btn:not(.primary):hover { background: var(--ink); color: var(--paper); }
.btn.small { padding: 10px 16px; font-size: .94rem; }

/* ---------- Hero ---------- */
.hero { padding: clamp(48px, 9vw, 120px) 0 clamp(40px, 6vw, 80px); position: relative; }
.hero-intro { display: flex; align-items: center; gap: 16px; margin-bottom: clamp(24px, 4vw, 40px); }
.hero-intro img { width: 64px; height: 64px; border-radius: 50%; background: var(--lime); object-fit: cover; }
.hero-intro p { margin: 0; line-height: 1.35; }
.hero-intro strong { display: block; font-weight: 600; }
.status { color: var(--slate); display: inline-flex; align-items: center; gap: 8px; }
.status::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 0 rgba(130,230,49,.6); animation: pulse 2.4s 3; }
@keyframes pulse { 70% { box-shadow: 0 0 0 9px rgba(130,230,49,0); } 100% { box-shadow: 0 0 0 0 rgba(130,230,49,0); } }

.hero h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.5rem, 8.4vw, 8.4rem);
  line-height: .95;
  letter-spacing: -0.04em;
  margin: 0;
  font-variation-settings: "wdth" 88;
}
.hero h1 .line { display: block; white-space: nowrap; overflow: hidden; padding-bottom: .06em; }
.hero h1 .line > span { display: inline-block; }
.hero h1 .word { will-change: transform; }
.hero-lede { max-width: 54ch; color: var(--slate); font-size: clamp(1.05rem, 1vw + .8rem, 1.3rem); margin: clamp(24px, 3vw, 36px) 0 32px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.clients { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 22px 0; }
.clients .wrap { display: flex; flex-wrap: wrap; gap: 10px 36px; align-items: baseline; }
.clients h2 { font: 500 .95rem/1.4 var(--font-body); color: var(--slate); margin: 0 12px 0 0; }
.clients ul { display: contents; list-style: none; }
.clients li { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.05rem, 1.3vw, 1.35rem); letter-spacing: -0.01em; }

/* ---------- Section heads ---------- */
.section { padding: clamp(64px, 10vw, 140px) 0; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: clamp(28px, 4vw, 56px); flex-wrap: wrap; }
.section-head h2 { font-family: var(--font-display); font-weight: 700; font-size: clamp(2rem, 4.4vw, 4rem); line-height: 1; letter-spacing: -0.03em; margin: 0; }
.section-head p { margin: 0; color: var(--slate); max-width: 40ch; }

/* ---------- Work index: the signature moment ---------- */
.work-index { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 64px); align-items: start; }
.work-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.work-item { border-bottom: 1px solid var(--line); }
.work-item a {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; align-items: center;
  padding: clamp(18px, 2.4vw, 28px) 0; text-decoration: none; position: relative;
}
.work-item h3 {
  font-family: var(--font-display); font-weight: 700; margin: 0;
  font-size: clamp(1.9rem, 4.2vw, 3.9rem); line-height: 1.02; letter-spacing: -0.03em;
  transition: transform .45s var(--ease), color .3s;
  font-variation-settings: "wdth" 85;
}
.work-item .meta { grid-column: 1; color: var(--slate); font-size: .98rem; display: flex; gap: 14px; flex-wrap: wrap; }
.tag { display: inline-block; font-size: .8rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--mist); color: var(--ink); line-height: 1.5; }
.tag.live { background: var(--lime); color: var(--lime-ink); }
.work-item .arrow {
  grid-row: 1 / span 2; grid-column: 2;
  width: 52px; height: 52px; border-radius: 50%; border: 1.5px solid var(--line);
  display: grid; place-items: center; transition: background .3s, border-color .3s, transform .45s var(--ease);
}
.work-item .arrow svg { width: 20px; height: 20px; }
.work-item a:hover h3, .work-item a:focus-visible h3, .work-item.is-active h3 { transform: translateX(14px); }
.work-item a:hover .arrow, .work-item.is-active .arrow { background: var(--lime); border-color: var(--lime); color: var(--lime-ink); transform: rotate(-45deg); }
.work-item .thumb { display: none; }

.work-preview {
  position: sticky; top: 104px;
  aspect-ratio: 4 / 3; border-radius: var(--radius-lg); overflow: hidden;
  background: var(--mist);
}
.work-preview figure { position: absolute; inset: 0; margin: 0; opacity: 0; transform: scale(1.04); transition: opacity .5s var(--ease), transform .8s var(--ease); background: var(--accent, var(--mist)); }
.work-preview figure.is-active { opacity: 1; transform: none; }
.work-preview img { width: 100%; height: 100%; object-fit: cover; }
.work-preview figcaption { position: absolute; left: 16px; bottom: 16px; background: var(--paper); color: var(--ink); padding: 8px 14px; border-radius: 999px; font-size: .92rem; font-weight: 500; max-width: calc(100% - 32px); }

@media (max-width: 900px) {
  .work-index { grid-template-columns: 1fr; }
  .work-preview { display: none; }
  .work-item a { grid-template-columns: 1fr auto; }
  .work-item .thumb { display: block; grid-column: 1 / -1; grid-row: 1; margin-bottom: 14px; border-radius: 18px; overflow: hidden; aspect-ratio: 4 / 3; background: var(--accent, var(--mist)); }
  .work-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
  .work-item h3 { grid-row: 2; }
  .work-item .meta { grid-row: 3; }
  .work-item .arrow { grid-row: 2 / span 2; }
}

/* ---------- Profile ---------- */
.profile { background: var(--mist); border-radius: var(--radius-lg); padding: clamp(28px, 5vw, 72px); display: grid; grid-template-columns: 1.15fr 1fr; gap: clamp(32px, 5vw, 80px); }
.profile .about p { font-size: clamp(1.15rem, 1.1vw + .8rem, 1.55rem); line-height: 1.45; margin: 0 0 1em; max-width: 34ch; font-family: var(--font-display); font-weight: 500; letter-spacing: -0.01em; }
.profile .about p.small { font-family: var(--font-body); font-size: 1rem; font-weight: 400; color: var(--slate); max-width: 52ch; letter-spacing: 0; }
.profile h3 { font: 600 1rem/1.3 var(--font-body); color: var(--slate); margin: 0 0 12px; }
.timeline { list-style: none; margin: 0 0 40px; padding: 0; }
.timeline li { display: grid; grid-template-columns: 7.5rem 1fr; gap: 16px; padding: 16px 0; border-top: 1px solid var(--line); }
.timeline time { color: var(--slate); font-variant-numeric: tabular-nums; }
.timeline strong { display: block; font-weight: 600; }
.timeline span { color: var(--slate); font-size: .95rem; }
.skills { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.skills li { border: 1.5px solid var(--ink); border-radius: 999px; padding: 6px 14px; font-weight: 500; }
@media (max-width: 900px) { .profile { grid-template-columns: 1fr; } .timeline li { grid-template-columns: 1fr; gap: 2px; } }

.recognition { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.recognition a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 22px 24px; border-radius: 20px; background: var(--paper); text-decoration: none; font-weight: 600; transition: background .3s; }
.recognition a:hover { background: var(--lime); color: var(--lime-ink); }
.recognition small { display: block; color: var(--slate); font-weight: 400; }
.recognition a:hover small { color: inherit; }
.recognition svg { width: 20px; height: 20px; flex: none; }
@media (max-width: 640px) { .recognition { grid-template-columns: 1fr; } }

/* ---------- Contact ---------- */
.contact { background: var(--lime); color: var(--ink); border-radius: var(--radius-lg); padding: clamp(32px, 7vw, 104px) clamp(24px, 6vw, 88px); position: relative; overflow: hidden; isolation: isolate; }
.contact::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(34rem circle at var(--mx, 85%) var(--my, 15%), rgba(255,255,255,.55), transparent 60%); }
.contact h2 { font-family: var(--font-display); font-weight: 700; font-size: clamp(2.2rem, 6vw, 5.6rem); line-height: 1; letter-spacing: -0.035em; margin: 0 0 24px; max-width: 14ch; text-wrap: balance; }
.contact p { max-width: 46ch; margin: 0 0 28px; }
.mail-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; max-width: none !important; margin-bottom: 36px !important; }
.contact .mail { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.4rem, 3.6vw, 3rem); letter-spacing: -0.02em; text-decoration: underline; text-underline-offset: .18em; text-decoration-thickness: 3px; overflow-wrap: anywhere; }
.contact .mail:hover { text-decoration-thickness: 5px; }
.copy { font: 600 .95rem/1 var(--font-body); color: var(--ink); background: rgba(255,255,255,.6); border: 1.5px solid var(--ink); border-radius: 999px; padding: 10px 16px; cursor: pointer; }
.copy:hover { background: #fff; }
.copy-status { font-weight: 600; }
.contact .btn { border-color: var(--ink); color: var(--ink); }
.contact .btn.primary { background: var(--ink); color: #fff; }
.contact .btn.primary:hover { background: #1B3550; }
.contact .btn:not(.primary):hover { background: var(--ink); color: #fff; }
.contact :focus-visible { outline-color: var(--ink); }

/* ---------- Footer ---------- */
.site-footer { padding: 40px 0 48px; color: var(--slate); font-size: .95rem; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px 32px; flex-wrap: wrap; }
.site-footer ul { list-style: none; display: flex; gap: 24px; margin: 0; padding: 0; }
.site-footer a { color: var(--ink); font-weight: 600; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; text-underline-offset: 5px; }

/* ---------- Case study ---------- */
.cs-hero { padding: clamp(40px, 7vw, 96px) 0 clamp(28px, 4vw, 48px); }
.cs-back { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 600; margin-bottom: clamp(28px, 5vw, 56px); }
.cs-back svg { width: 18px; height: 18px; transform: rotate(180deg); transition: transform .3s var(--ease); }
.cs-back:hover svg { transform: rotate(180deg) translateX(4px); }
.cs-hero h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(3rem, 10vw, 9.5rem); line-height: .92; letter-spacing: -0.045em; margin: 0 0 20px; font-variation-settings: "wdth" 82; }
.cs-hero .summary { font-size: clamp(1.15rem, 1.4vw + .7rem, 1.7rem); max-width: 32ch; margin: 0; font-family: var(--font-display); font-weight: 500; line-height: 1.3; letter-spacing: -0.01em; }
.cs-facts { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; margin: clamp(32px, 5vw, 56px) 0 0; border-top: 1px solid var(--line); }
.cs-facts div { padding: 18px 16px 0 0; }
.cs-facts dt { color: var(--slate); font-size: .9rem; }
.cs-facts dd { margin: 4px 0 0; font-weight: 600; }
@media (max-width: 720px) { .cs-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.cs-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.cs-cover { border-radius: var(--radius-lg); overflow: hidden; background: var(--accent, var(--mist)); transform-origin: 50% 0; }
.cs-cover img { width: 100%; }
.cs-body { display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: 24px clamp(24px, 5vw, 80px); padding: clamp(48px, 8vw, 112px) 0; max-width: 1080px; }
.cs-body h2 { font: 600 1rem/1.4 var(--font-body); color: var(--slate); margin: 6px 0 0; }
.cs-body p { margin: 0; font-size: clamp(1.1rem, .8vw + .85rem, 1.4rem); line-height: 1.55; max-width: 60ch; }
@media (max-width: 720px) { .cs-body { grid-template-columns: 1fr; gap: 8px; } .cs-body p { margin-bottom: 24px; } }
.gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(12px, 1.6vw, 24px); }
.gallery figure { margin: 0; background: var(--mist); border-radius: 20px; overflow: hidden; padding: clamp(16px, 3vw, 40px); display: grid; place-items: center; }
.gallery figure img { border-radius: 14px;  }
.gallery figure.wide { grid-column: 1 / -1; padding: 0; background: none; }
.gallery figure.wide img, .gallery figure.wide video { border-radius: 20px; box-shadow: none; width: 100%; }
@media (max-width: 720px) { .gallery { grid-template-columns: 1fr 1fr; } }
.next { display: block; text-decoration: none; padding: clamp(48px, 8vw, 104px) 0; border-top: 1px solid var(--line); margin-top: clamp(48px, 8vw, 112px); }
.next span { color: var(--slate); font-weight: 500; }
.next strong { display: flex; align-items: center; gap: .3em; font-family: var(--font-display); font-size: clamp(2.4rem, 8vw, 7rem); line-height: 1; letter-spacing: -0.04em; font-variation-settings: "wdth" 85; transition: transform .45s var(--ease); }
.next strong svg { width: .6em; height: .6em; flex: none; transition: transform .45s var(--ease); }
.next:hover strong { transform: translateX(14px); }
.next strong svg { background: var(--lime); border-radius: 50%; padding: .12em; box-sizing: content-box; width: .5em; height: .5em; }
.next:hover strong svg { transform: rotate(-45deg); }

/* ---------- Motion: one orchestrated entrance ---------- */
.js .reveal-line > span { transform: translateY(105%); }
.js.is-ready .reveal-line > span { transform: none; transition: transform 1s var(--ease); transition-delay: calc(var(--i, 0) * 60ms); }
.js .reveal-fade { opacity: 0; transform: translateY(12px); }
.js.is-ready .reveal-fade { opacity: 1; transform: none; transition: opacity .8s var(--ease) .45s, transform .8s var(--ease) .45s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .js .reveal-line > span, .js .reveal-fade { transform: none; opacity: 1; }
}

#contatti { padding-top: 0; }
@media (max-width: 640px) { .hero h1 .line { white-space: normal; } }
/* Phone mockups already carry their own backdrop */
.gallery figure:not(.wide) { padding: 0; background: none; }
.gallery figure:not(.wide) img { box-shadow: none; border-radius: 20px; }
@media (max-width: 900px) {
  .work-item.is-active h3 { transform: none; }
  .work-item.is-active .arrow { background: none; border-color: var(--line); color: inherit; transform: none; }
}

/* ---------- Motion (js/motion.min.js) ----------
   Se la libreria è presente, le animazioni le gestisce site.js:
   le transizioni CSS di riserva si spengono per non sovrapporsi. */
.has-motion.is-ready .reveal-line > span { transform: translateY(105%); transition: none; }
.has-motion .work-preview figure { transition: none; }
.work-preview { perspective: 1200px; }
.work-preview .tilt { position: absolute; inset: 0; transform-style: preserve-3d; }

/* ---------- Transizione tra pagine (View Transitions native) ----------
   Il titolo del progetto nella lista diventa il titolo del case study,
   l'anteprima diventa la copertina. Browser senza supporto: navigazione normale. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-group(*) { animation-duration: .6s; animation-timing-function: cubic-bezier(.2, .7, .1, 1); }
  ::view-transition-old(root) { animation: vt-out .35s cubic-bezier(.4, 0, 1, 1) both; }
  ::view-transition-new(root) { animation: vt-in .5s cubic-bezier(.2, .7, .1, 1) .1s both; }
}
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(16px); } }
