/* ============================================================
   CAMILLO DE VINCENTIS — Portfolio
   Aesthetic: engineered elegance · dark tech · kinetic type
   ============================================================ */

:root {
  /* ---- accent (overridable via Tweaks) ---- */
  --accent: oklch(0.72 0.16 262);          /* electric blue */
  --accent-ink: oklch(0.18 0.04 262);      /* text on accent */
  --accent-soft: oklch(0.72 0.16 262 / 0.12);

  /* ---- neutrals: warm-cool near-black ---- */
  --bg:        oklch(0.155 0.006 250);
  --bg-2:      oklch(0.185 0.007 250);
  --bg-3:      oklch(0.22 0.008 250);
  --line:      oklch(1 0 0 / 0.10);
  --line-2:    oklch(1 0 0 / 0.18);
  --ink:       oklch(0.96 0.004 250);
  --ink-2:     oklch(0.74 0.006 250);
  --ink-3:     oklch(0.55 0.008 250);

  --maxw: 1280px;
  --pad: clamp(20px, 5vw, 80px);

  --font-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --font-body: 'Bricolage Grotesque', system-ui, sans-serif;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-2: cubic-bezier(0.65, 0, 0.35, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  cursor: none;
}
@media (pointer: coarse) { body { cursor: auto; } }

/* grain / noise overlay */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  opacity: var(--grain-op, 0.035);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

::selection { background: var(--accent); color: var(--accent-ink); }

/* ---------- custom cursor ---------- */
.cursor-dot, .cursor-ring {
  position: fixed; top: 0; left: 0; z-index: 9999;
  pointer-events: none; border-radius: 50%;
  transform: translate(-50%, -50%);
  mix-blend-mode: difference;
}
.cursor-dot { width: 7px; height: 7px; background: #fff; }
.cursor-ring {
  width: 38px; height: 38px; border: 1px solid #fff;
  transition: width .25s var(--ease), height .25s var(--ease), background .25s var(--ease);
}
.cursor-ring.hovering { width: 64px; height: 64px; background: rgba(255,255,255,0.12); }
@media (pointer: coarse) { .cursor-dot, .cursor-ring { display: none; } }

/* ---------- layout helpers ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding-inline: var(--pad); }
section { position: relative; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--ink-3); display: inline-flex; align-items: center; gap: 10px;
}
.eyebrow::before {
  content: ""; width: 28px; height: 1px; background: var(--accent);
  display: inline-block;
}

/* ---------- reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.reveal[data-d="1"] { transition-delay: .08s; }
.reveal[data-d="2"] { transition-delay: .16s; }
.reveal[data-d="3"] { transition-delay: .24s; }
.reveal[data-d="4"] { transition-delay: .32s; }
body.no-motion .reveal { opacity: 1; transform: none; transition: none; }

/* ---------- scroll progress ---------- */
.progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0%;
  background: var(--accent); z-index: 9997;
  box-shadow: 0 0 12px var(--accent);
}

/* ---------- top nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px var(--pad);
  mix-blend-mode: difference;
}
.nav .brand { font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.05em; color: #fff; font-weight: 500; }
.nav-right { display: flex; align-items: center; gap: 26px; }
.nav .links { display: flex; gap: 26px; }
.nav .links a {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em;
  text-transform: uppercase; color: #fff; text-decoration: none; opacity: 0.7;
  transition: opacity .2s;
}
.nav .links a:hover { opacity: 1; }
@media (max-width: 720px) { .nav .links { display: none; } }
.nav .lang {
  display: inline-flex; align-items: center; gap: 6px; background: none; border: none;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; color: #fff;
  cursor: none; padding: 0;
}
.nav .lang span { opacity: 0.45; transition: opacity .2s; }
.nav .lang span.on { opacity: 1; }
.nav .lang .sep { opacity: 0.3; }
.nav .lang:hover span { opacity: 0.8; }
.nav .lang span.on { opacity: 1; }

/* ---------- buttons ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.05em;
  padding: 16px 26px; border-radius: 100px; text-decoration: none;
  border: 1px solid var(--line-2); color: var(--ink); background: transparent;
  overflow: hidden; transition: color .4s var(--ease), border-color .4s;
  cursor: none;
}
.btn span { position: relative; z-index: 1; }
.btn::before {
  content: ""; position: absolute; inset: 0; background: var(--accent);
  transform: translateY(101%); transition: transform .45s var(--ease); z-index: 0;
}
.btn:hover { color: var(--accent-ink); border-color: var(--accent); }
.btn:hover::before { transform: translateY(0); }
.btn.solid { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.solid::before { background: var(--ink); }
.btn.solid:hover { color: var(--bg); }

/* =========================================================
   HERO
   ========================================================= */
.hero { min-height: 100svh; display: flex; align-items: center; position: relative; overflow: hidden; }
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.hero .wrap { position: relative; z-index: 2; width: 100%; }
.hero-grid-fade {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(ellipse 90% 70% at 50% 50%, transparent 30%, var(--bg) 92%);
}

.hero-meta {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px;
  margin-bottom: clamp(28px, 6vh, 64px);
}
.hero-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(56px, 13vw, 200px);
  line-height: 0.86;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}
.hero-title .line { display: block; overflow: hidden; }
.hero-title .line > span { display: inline-block; transform: translateY(110%); transition: transform 1s var(--ease); }
.hero-title.in .line > span { transform: none; }
.hero-title .o { color: transparent; -webkit-text-stroke: 1.5px var(--ink-2); }
.hero-title .accent { color: var(--accent); }
body.no-motion .hero-title .line > span { transform: none; }

.hero-bottom {
  margin-top: clamp(28px, 6vh, 64px);
  display: flex; justify-content: space-between; align-items: flex-end;
  flex-wrap: wrap; gap: 28px;
}
.hero-lede { max-width: 44ch; font-size: clamp(16px, 1.5vw, 21px); color: var(--ink-2); line-height: 1.55; }
.hero-lede b { color: var(--ink); font-weight: 600; }

.scroll-cue { display: flex; align-items: center; gap: 12px; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-3); }
.scroll-cue .bar { width: 1px; height: 40px; background: var(--line-2); position: relative; overflow: hidden; }
.scroll-cue .bar::after { content:""; position:absolute; top:-100%; left:0; width:100%; height:100%; background: var(--accent); animation: scrolldown 2s var(--ease) infinite; }
@keyframes scrolldown { 0%{top:-100%} 60%,100%{top:100%} }

/* =========================================================
   MARQUEE
   ========================================================= */
.marquee { border-block: 1px solid var(--line); padding-block: 26px; overflow: hidden; white-space: nowrap; background: var(--bg-2); }
.marquee-track { display: inline-flex; align-items: center; gap: 0; animation: marq 34s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marq { to { transform: translateX(-50%); } }
body.no-motion .marquee-track { animation: none; }

/* ---------- wordmark logos ---------- */
.logo {
  font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em;
  color: var(--ink-2); white-space: nowrap; transition: color .3s var(--ease);
}
.marquee .logo {
  font-size: clamp(20px, 2.6vw, 30px); text-transform: uppercase; letter-spacing: 0.01em;
  padding-inline: clamp(28px, 4vw, 52px); position: relative; color: var(--ink-3);
}
.marquee .logo::after {
  content: ""; position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent); opacity: 0.7;
}
.marquee .logo:hover { color: var(--ink); }

/* =========================================================
   SECTION SHELL
   ========================================================= */
.sec { padding-block: clamp(80px, 12vh, 170px); }
.sec-head { display: flex; flex-direction: column; gap: 22px; margin-bottom: clamp(40px, 7vh, 90px); }
.sec-head h2 { font-family: var(--font-display); font-weight: 600; font-size: clamp(32px, 6vw, 76px); line-height: 0.98; letter-spacing: -0.03em; max-width: 18ch; }
.sec-head h2 em { font-style: normal; color: var(--accent); }
.sec-num { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); letter-spacing: 0.1em; }

/* =========================================================
   MANIFESTO
   ========================================================= */
.manifesto { padding-block: clamp(90px, 16vh, 220px); }
.manifesto p { font-family: var(--font-display); font-weight: 500; font-size: clamp(28px, 5vw, 68px); line-height: 1.08; letter-spacing: -0.025em; max-width: 18ch; }
.manifesto .word { transition: color .5s var(--ease); }
.manifesto .hl { color: var(--accent); }
.manifesto .dim { color: var(--ink-3); }

/* =========================================================
   STATS
   ========================================================= */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); }
@media (max-width: 880px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { padding: 40px clamp(18px, 2.4vw, 36px); border-bottom: 1px solid var(--line); }
.stat:not(:last-child) { border-right: 1px solid var(--line); }
.stat:first-child { padding-left: 0; }
.stat:last-child { padding-right: 0; }
.stat .n { font-family: var(--font-display); font-weight: 700; font-size: clamp(44px, 7vw, 96px); line-height: 1; letter-spacing: -0.04em; }
.stat .n .suf { color: var(--accent); }
.stat .l { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin-top: 14px; max-width: 22ch; }

/* =========================================================
   WORK
   ========================================================= */
.work-list { display: flex; flex-direction: column; }
.work-item {
  display: grid; grid-template-columns: 1fr; gap: 0;
  border-top: 1px solid var(--line); padding: 0; position: relative;
  text-decoration: none; color: inherit;
}
.work-item:last-child { border-bottom: 1px solid var(--line); }
.work-row {
  display: grid; grid-template-columns: 70px 1fr auto; align-items: center; gap: 28px;
  padding: clamp(26px, 4vh, 46px) 0; transition: padding .5s var(--ease);
}
.work-item .idx { font-family: var(--font-mono); font-size: 13px; color: var(--ink-3); }
.work-item .title { font-family: var(--font-display); font-weight: 600; font-size: clamp(26px, 4.4vw, 58px); line-height: 1; letter-spacing: -0.03em; transition: transform .5s var(--ease), color .4s; }
.work-item .client { font-family: var(--font-mono); font-size: 12px; color: var(--accent); letter-spacing: 0.06em; text-transform: uppercase; margin-top: 12px; display: block; }
.work-item .tags { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; max-width: 320px; }
.work-item .tag { font-family: var(--font-mono); font-size: 11px; color: var(--ink-2); border: 1px solid var(--line); border-radius: 100px; padding: 6px 12px; white-space: nowrap; }
.work-item:hover .title { color: var(--accent); transform: translateX(14px); }
@media (max-width: 720px) {
  .work-row { grid-template-columns: 1fr; gap: 10px; }
  .work-item .tags { justify-content: flex-start; margin-top: 14px; }
}

/* expanding visual on hover */
.work-viz {
  height: 0; overflow: hidden; transition: height .55s var(--ease);
  border-radius: 14px;
}
.work-item:hover .work-viz { height: 220px; }
.work-viz-inner {
  height: 220px; margin-bottom: 28px; border-radius: 14px; overflow: hidden; position: relative;
  background: var(--bg-2); border: 1px solid var(--line);
}
@media (max-width: 720px) { .work-item:hover .work-viz { height: 150px; } .work-viz-inner { height: 150px; } }

/* placeholder visual */
.ph {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background-image: repeating-linear-gradient(135deg, transparent 0 14px, var(--accent-soft) 14px 15px);
}
.ph .ph-label { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); letter-spacing: 0.1em; background: var(--bg); padding: 6px 12px; border: 1px solid var(--line); border-radius: 100px; }

/* =========================================================
   TIMELINE
   ========================================================= */
.tl { display: flex; flex-direction: column; }
.tl-item {
  display: grid; grid-template-columns: 160px 1fr; gap: clamp(20px, 5vw, 80px);
  padding: clamp(28px, 4vh, 48px) 0; border-top: 1px solid var(--line);
  position: relative; transition: background .4s;
}
.tl-item:last-child { border-bottom: 1px solid var(--line); }
.tl-item:hover { background: var(--bg-2); }
.tl-item .yr { font-family: var(--font-mono); font-size: 14px; color: var(--ink-2); padding-left: 8px; }
.tl-item.now .yr { color: var(--accent); }
.tl-item .role { font-family: var(--font-display); font-weight: 600; font-size: clamp(22px, 3vw, 34px); letter-spacing: -0.02em; }
.tl-item .co { font-family: var(--font-mono); font-size: 13px; color: var(--accent); margin-top: 6px; }
.tl-item .co .co-logo { font-family: var(--font-display); font-size: clamp(17px, 2vw, 22px); color: var(--ink); letter-spacing: -0.01em; }
.tl-item:hover .co .co-logo { color: var(--accent); }
.client-logos { margin-top: 22px; display: flex; flex-direction: column; gap: 12px; }
.client-logos .cl-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-3); }
.client-logos .cl-row { display: flex; flex-wrap: wrap; gap: 10px; }
.client-logos .cl-row .logo {
  font-size: 14px; color: var(--ink-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 14px; background: var(--bg); transition: all .3s var(--ease);
  filter: grayscale(1); opacity: 0.85;
}
.client-logos .cl-row .logo:hover { color: var(--ink); border-color: var(--line-2); opacity: 1; transform: translateY(-2px); }
.tl-item .desc { color: var(--ink-2); margin-top: 14px; max-width: 60ch; font-size: 15px; line-height: 1.6; }
.tl-item .badge { display: inline-block; margin-left: 12px; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-ink); background: var(--accent); padding: 3px 9px; border-radius: 100px; vertical-align: middle; }
@media (max-width: 640px) { .tl-item { grid-template-columns: 1fr; gap: 10px; } }

/* =========================================================
   SKILLS
   ========================================================= */
.skills-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
@media (max-width: 760px) { .skills-grid { grid-template-columns: 1fr; } }
.skill-cell { background: var(--bg); padding: clamp(28px, 4vw, 48px); transition: background .4s; }
.skill-cell:hover { background: var(--bg-2); }
.skill-cell .k { font-family: var(--font-mono); font-size: 12px; color: var(--accent); letter-spacing: 0.1em; text-transform: uppercase; }
.skill-cell h3 { font-family: var(--font-display); font-weight: 600; font-size: clamp(22px, 2.6vw, 30px); margin-top: 16px; letter-spacing: -0.02em; }
.skill-cell p { color: var(--ink-2); margin-top: 12px; font-size: 15px; line-height: 1.6; }
.skill-cell .chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.skill-cell .chip { font-family: var(--font-mono); font-size: 11px; color: var(--ink); border: 1px solid var(--line-2); border-radius: 6px; padding: 6px 10px; }

/* =========================================================
   ABOUT
   ========================================================= */
.about { display: grid; grid-template-columns: 1.2fr 1fr; gap: clamp(40px, 6vw, 90px); align-items: start; }
@media (max-width: 860px) { .about { grid-template-columns: 1fr; } }
.about-lead { font-family: var(--font-display); font-weight: 500; font-size: clamp(24px, 3.2vw, 40px); line-height: 1.18; letter-spacing: -0.02em; }
.about-lead .accent { color: var(--accent); }
.about-body p { color: var(--ink-2); font-size: 16px; line-height: 1.7; margin-bottom: 18px; }
.about-facts { display: flex; flex-direction: column; gap: 0; margin-top: 8px; border-top: 1px solid var(--line); }
.about-facts .row { display: flex; justify-content: space-between; gap: 20px; padding: 16px 0; border-bottom: 1px solid var(--line); font-family: var(--font-mono); font-size: 13px; }
.about-facts .row .k { color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.08em; }
.about-facts .row .v { color: var(--ink); text-align: right; }

/* =========================================================
   CONTACT
   ========================================================= */
.contact { padding-block: clamp(90px, 16vh, 220px); text-align: center; position: relative; }
.contact .big {
  font-family: var(--font-display); font-weight: 700; text-transform: uppercase;
  font-size: clamp(48px, 12vw, 180px); line-height: 0.9; letter-spacing: -0.04em;
}
.contact .big a { color: inherit; text-decoration: none; transition: color .3s; display: inline-block; }
.contact .big a:hover { color: var(--accent); }
.contact-sub { color: var(--ink-2); font-size: clamp(16px, 2vw, 20px); margin: 28px auto 40px; max-width: 40ch; }
.contact-row { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.contact-links { display: flex; gap: 28px; justify-content: center; flex-wrap: wrap; margin-top: 56px; }
.contact-links a { font-family: var(--font-mono); font-size: 13px; color: var(--ink-2); text-decoration: none; letter-spacing: 0.05em; transition: color .2s; cursor: none; }
.contact-links a:hover { color: var(--accent); }

/* footer */
.foot { border-top: 1px solid var(--line); padding: 28px var(--pad); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); }

/* utility */
.muted { color: var(--ink-3); }

/* =========================================================
   MOBILE FIXES
   ========================================================= */
@media (max-width: 880px) {
  /* stats 2x2: left column flush-left, right column flush-right,
     gutter only around the central divider — and drop the divider
     that would otherwise hang off the right column */
  .stat { padding-block: 28px; }
  .stat:nth-child(odd) { padding-left: 0; padding-right: clamp(16px, 4vw, 28px); }
  .stat:nth-child(even) { padding-left: clamp(16px, 4vw, 28px); padding-right: 0; border-right: none; }
}

@media (max-width: 720px) {
  /* hero: riduci margine bottom per non spingere lo scroll cue fuori schermo */
  .hero-bottom { gap: 20px; }
  .scroll-cue { display: none; }

  /* work: i tag non escono dal wrap */
  .work-item .tags { max-width: 100%; }
  .work-row { padding-block: clamp(20px, 3vh, 32px); }
}

@media (max-width: 640px) {
  /* timeline: anno sopra, contenuto sotto, con spaziatura */
  .tl-item { padding-inline: 4px; }
  .tl-item .yr { font-size: 12px; margin-bottom: 4px; }

  /* contact: il testo grande non esce dai bordi */
  .contact .big { font-size: clamp(40px, 11vw, 120px); }

  /* footer: stack verticale */
  .foot { flex-direction: column; gap: 6px; }
  .foot span:not(:first-child) { display: none; }
}

@media (max-width: 480px) {
  /* manifesto: un po' più piccolo su schermi tiny */
  .manifesto p { font-size: clamp(22px, 7vw, 40px); }

  /* skills chip: evita overflow */
  .skill-cell .chips { gap: 6px; }
  .skill-cell .chip { font-size: 10px; padding: 5px 8px; }
}
