/* ═══════════════════════════════════════════════════
   Angelo Lacatena — Portfolio Vol. 03
   Registro formale · WebGL · zero framework
   ═══════════════════════════════════════════════════ */

:root {
  --bg: #07080d;
  --bg-2: #0b0d15;
  --ink: #e9eaf2;
  --muted: #8b90a6;
  --accent: #8a94ff;
  --accent-dim: rgba(138, 148, 255, 0.14);
  --line: rgba(233, 234, 242, 0.1);
  --font-display: "Clash Display", "Arial Narrow", sans-serif;
  --font-body: "Satoshi", "Helvetica Neue", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --pad: clamp(20px, 4vw, 64px);
}

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

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-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.loading { overflow: hidden; }

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

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
em { font-style: italic; }
.mono { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

/* ── Accessibilità ── */
.skip-link {
  position: fixed; top: -60px; left: var(--pad);
  background: var(--accent); color: var(--bg);
  padding: 10px 18px; z-index: 200; border-radius: 4px;
  transition: top 0.25s var(--ease);
}
.skip-link:focus { top: 12px; }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* ═══ SCENA 3D ═══ */
.gl {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}
.grain {
  position: fixed; inset: -50%;
  z-index: 1; pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 7s steps(10) infinite;
}
@keyframes grain {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-4%, 3%); }
  40% { transform: translate(3%, -4%); }
  60% { transform: translate(-2%, -2%); }
  80% { transform: translate(4%, 2%); }
}
@media (prefers-reduced-motion: reduce) { .grain { animation: none; } }

main, .nav, .contact { position: relative; z-index: 2; }

/* ═══ PRELOADER ═══ */
.loader {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 28px;
  transition: opacity 0.8s var(--ease), visibility 0.8s;
}
.loader.done { opacity: 0; visibility: hidden; }
.loader-core { text-align: center; }
.loader-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  letter-spacing: -0.02em;
}
.loader-name sup { font-size: 0.4em; color: var(--accent); }
.loader-sub { margin-top: 8px; }
.loader-track {
  width: min(280px, 60vw); height: 1px;
  background: var(--line);
  overflow: hidden;
}
.loader-bar {
  display: block; height: 100%; width: 0%;
  background: var(--accent);
  transition: width 0.2s linear;
}
.loader-count { color: var(--ink); }

/* ═══ CURSORE ═══ */
.cursor {
  position: fixed; z-index: 90;
  width: 84px; height: 84px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 0.7rem; font-weight: 500;
  letter-spacing: 0.04em;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.35s var(--ease);
  will-change: transform;
}
.cursor.on { transform: translate(-50%, -50%) scale(1); }
@media (hover: none) { .cursor { display: none; } }

/* ═══ PROGRESS ═══ */
.progress {
  position: fixed; top: 0; left: 0; right: 0;
  height: 2px; z-index: 80;
}
.progress span {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), #c3c9ff);
}

/* ═══ NAV ═══ */
.nav {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 60;
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px var(--pad);
  transition: transform 0.5s var(--ease), background 0.4s;
}
.nav.hidden { transform: translateY(-110%); }
.nav.solid {
  background: rgba(7, 8, 13, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav-brand {
  font-family: var(--font-display); font-weight: 700;
  font-size: 1.05rem; letter-spacing: 0.01em;
}
.nav-links {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex; gap: clamp(18px, 3vw, 40px);
}
@media (max-width: 640px) {
  .nav-links { position: static; transform: none; margin-left: auto; }
}
.nav-links a { font-size: 0.9rem; font-weight: 500; }
.nav-status {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 0.68rem;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line); border-radius: 100px;
  padding: 8px 14px;
  transition: border-color 0.3s, color 0.3s;
}
.nav-status:hover { border-color: var(--accent); color: var(--ink); }
.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  animation: pulse 2.2s infinite;
}
@keyframes pulse { 50% { opacity: 0.35; } }

/* ── Effetto roll sui link ── */
.roll { position: relative; display: inline-block; overflow: hidden; vertical-align: top; }
.roll span { display: inline-block; transition: transform 0.45s var(--ease); }
.roll::after {
  content: attr(data-text);
  position: absolute; left: 0; top: 100%;
  color: var(--accent);
  transition: transform 0.45s var(--ease);
}
.roll:hover span, .roll:focus-visible span { transform: translateY(-100%); }
.roll:hover::after, .roll:focus-visible::after { transform: translateY(-100%); }

/* ═══ HERO ═══ */
.hero {
  min-height: 100svh;
  display: flex; flex-direction: column;
  justify-content: flex-end;
  padding: calc(var(--pad) + 60px) var(--pad) var(--pad);
  position: relative;
}
.hero-meta {
  position: absolute;
  top: calc(var(--pad) + 72px);
  left: var(--pad); right: var(--pad);
  display: flex; justify-content: space-between; gap: 16px;
  flex-wrap: wrap;
}
.hero-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(3.4rem, 13.5vw, 12.5rem);
  line-height: 0.92;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  margin-bottom: clamp(24px, 4vh, 48px);
  color: #f4f5fc;
  text-shadow: 0 0 90px rgba(138, 148, 255, 0.28);
}
.hero-title sup { font-size: 0.22em; color: var(--accent); }
.hero-title .line { display: block; overflow: hidden; }
.hero-title .line > span { display: block; }
body.loading .hero-title .line { overflow: hidden; }
body.entering .hero-title .line { overflow: hidden; }
body.entering .hero-title .line > span {
  transform: translateY(110%);
  animation: rise 1.1s var(--ease) forwards;
  animation-delay: var(--d, 0s);
}
@keyframes rise { to { transform: translateY(0); } }

.hero-base {
  display: flex; align-items: flex-end;
  justify-content: space-between;
  gap: 40px; flex-wrap: wrap;
}
.hero-sub {
  max-width: 46ch;
  color: var(--muted);
  font-size: clamp(0.98rem, 1.4vw, 1.15rem);
}
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }

body.entering .line-reveal {
  opacity: 0;
  transform: translateY(24px);
  animation: fadeUp 1s var(--ease) forwards;
  animation-delay: var(--d, 0s);
}
@keyframes fadeUp { to { opacity: 1; transform: translateY(0); } }

.hero-scroll {
  position: absolute;
  right: var(--pad); bottom: var(--pad);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  writing-mode: vertical-rl;
}
.scroll-line {
  width: 1px; height: 56px;
  background: linear-gradient(180deg, var(--accent), transparent);
  animation: drop 2.2s var(--ease) infinite;
}
@keyframes drop {
  0% { transform: scaleY(0); transform-origin: top; }
  45% { transform: scaleY(1); transform-origin: top; }
  55% { transform: scaleY(1); transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}
@media (max-width: 760px) { .hero-scroll { display: none; } }

@media (prefers-reduced-motion: reduce) {
  .line-reveal, .hero-title .line > span { animation: none; opacity: 1; transform: none; }
  .scroll-line, .dot { animation: none; }
}

/* ═══ REVEAL ALLO SCROLL ═══ */
.reveal {
  opacity: 0;
  transform: translateY(36px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}
.reveal.in { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ═══ DICHIARAZIONE ═══ */
.statement {
  padding: clamp(90px, 14vh, 180px) var(--pad);
  max-width: 1100px;
}
.statement-text {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.5rem, 3.4vw, 2.7rem);
  line-height: 1.28;
  letter-spacing: -0.01em;
}
.statement-text em { color: var(--accent); }
.statement-figures {
  margin-top: clamp(48px, 7vh, 80px);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  border-top: 1px solid var(--line);
  padding-top: 32px;
}
.figure-n {
  font-size: clamp(2rem, 4.5vw, 3.4rem);
  color: var(--ink);
  letter-spacing: 0;
  line-height: 1;
}
.figure-l { margin-top: 8px; color: var(--muted); font-size: 0.85rem; }
@media (max-width: 640px) {
  .statement-figures { grid-template-columns: 1fr; gap: 28px; }
}

/* ═══ PROGETTI ═══ */
.works { padding: 0 var(--pad) clamp(80px, 12vh, 160px); }
.works-head {
  max-width: 760px;
  margin-bottom: clamp(64px, 9vh, 120px);
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
}
.works-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.4rem, 6vw, 4.6rem);
  letter-spacing: -0.02em;
  line-height: 1.02;
}
.works-title em { color: var(--accent); font-style: italic; }
.works-intro { margin-top: 20px; color: var(--muted); max-width: 54ch; }

.work {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(28px, 4vw, 64px);
  align-items: center;
  padding: clamp(48px, 7vh, 90px) 0;
  border-top: 1px solid var(--line);
}
.work-flip .work-media { order: 2; }
.work-flip .work-info { order: 1; }

.work-media {
  display: block;
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-2);
  transform-style: preserve-3d;
  will-change: transform;
}
.work-media img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  transition: transform 0.8s var(--ease), filter 0.6s;
  filter: saturate(0.85) brightness(0.92);
}
.work-media:hover img { transform: scale(1.05); filter: saturate(1) brightness(1); }
.tilt-glare {
  position: absolute; inset: 0;
  background: radial-gradient(220px circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 255, 255, 0.14), transparent 60%);
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}
.work-media:hover .tilt-glare { opacity: 1; }

.work-index { color: var(--accent); margin-bottom: 14px; }
.work-kind { margin-bottom: 10px; color: var(--muted); }
.work-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.8rem, 3.6vw, 3rem);
  letter-spacing: -0.015em;
  margin-bottom: 16px;
}
.work-desc { color: var(--muted); max-width: 52ch; margin-bottom: 20px; }
.work-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
.work-tags span {
  font-family: var(--font-mono);
  font-size: 0.66rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 6px 12px;
}
.tag-live { color: var(--accent) !important; border-color: var(--accent-dim) !important; background: var(--accent-dim); }
.tag-wip { color: #e6c07b !important; border-color: rgba(230, 192, 123, 0.25) !important; }
.work-link { font-weight: 600; font-size: 0.95rem; }

@media (max-width: 900px) {
  .work { grid-template-columns: 1fr; align-items: start; }
  .work-flip .work-media { order: 0; }
  .work-flip .work-info { order: 1; }
}

/* ═══ PULSANTI ═══ */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 15px 30px;
  border-radius: 100px;
  font-weight: 600; font-size: 0.92rem;
  overflow: hidden;
  transition: transform 0.35s var(--ease), color 0.35s, border-color 0.35s;
  will-change: transform;
}
.btn-fill { background: var(--ink); color: var(--bg); }
.btn-fill::before {
  content: "";
  position: absolute; inset: 0;
  background: var(--accent);
  transform: translateY(101%);
  transition: transform 0.45s var(--ease);
  border-radius: inherit;
}
.btn-fill:hover::before { transform: translateY(0); }
.btn-line { border: 1px solid var(--line); color: var(--ink); }
.btn-line:hover { border-color: var(--accent); color: var(--accent); }
.btn-label { position: relative; z-index: 1; }

/* ═══ PROFILO ═══ */
.about {
  padding: clamp(80px, 12vh, 160px) var(--pad);
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, transparent, rgba(11, 13, 21, 0.6));
}
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(36px, 6vw, 90px);
  align-items: start;
}
.about-photo {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  transform-style: preserve-3d;
}
.about-photo img { width: 100%; filter: saturate(0.9); }
.about-visual { display: block; width: 100%; height: auto; }
.about-photo figcaption {
  position: absolute; left: 14px; bottom: 12px;
  background: rgba(7, 8, 13, 0.7);
  backdrop-filter: blur(8px);
  padding: 6px 12px; border-radius: 100px;
  color: var(--ink);
}
.about-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.2rem, 5vw, 4rem);
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin-bottom: 26px;
}
.about-title em { color: var(--accent); }
.about-text p { color: var(--muted); max-width: 62ch; }
.about-text strong { color: var(--ink); font-weight: 600; }
.about-stack { margin-top: 36px; border-top: 1px solid var(--line); }
.stack-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 18px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
}
.stack-label { align-self: center; }
.about-cta { margin-top: 36px; }
@media (max-width: 900px) {
  .about-grid { grid-template-columns: 1fr; }
  .about-media { max-width: 420px; }
  .stack-row { grid-template-columns: 1fr; gap: 4px; }
}

/* ═══ CONTATTI ═══ */
.contact {
  padding: clamp(90px, 14vh, 180px) var(--pad) 40px;
  text-align: center;
  border-top: 1px solid var(--line);
}
.contact-giant {
  display: inline-block;
  max-width: 100%;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.2rem, 12vw, 11rem);
  line-height: 1;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  margin: 8px 0 24px;
  transition: color 0.4s, text-shadow 0.4s;
}
.giant-line { display: inline-block; white-space: nowrap; }
.contact-giant em { color: var(--accent); font-style: italic; }
.contact-giant:hover { color: var(--accent); text-shadow: 0 0 60px rgba(138, 148, 255, 0.45); }
.contact-giant:hover em { color: var(--ink); }
.contact-sub { color: var(--muted); max-width: 52ch; margin: 0 auto 40px; }
.contact-links {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  margin-bottom: clamp(64px, 10vh, 120px);
}
.big-roll { font-size: clamp(1rem, 2.2vw, 1.4rem); font-weight: 500; }
.contact-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding-top: 24px;
  text-align: left;
}
.foot-socials { display: flex; gap: 24px; font-size: 0.9rem; }

/* ═══ VARIE ═══ */
@media (max-width: 760px) {
  .nav-status { display: none; }
  .hero-meta span:nth-child(2) { display: none; }
}
