/* =========================================================
   Cristian Viola — design system
   Direzione: AI Tech Dark
   Palette: bg #0D0F12, surface #15181C, blue #4D8FFF, amber #E8A33D
   Type: Space Grotesk (display) / Inter (testo) / IBM Plex Mono (label)
   ========================================================= */

:root {
  --bg: #0D0F12;
  --surface: #15181C;
  --surface-2: #1B2026;
  --text: #EDEFEC;
  --text-muted: #8B948D;
  --blue: #4D8FFF;
  --blue-dim: rgba(77, 143, 255, .14);
  --blue-line: rgba(77, 143, 255, .35);
  --amber: #E8A33D;
  --amber-dim: rgba(232, 163, 61, .14);
  --amber-line: rgba(232, 163, 61, .35);
  --line: rgba(237, 239, 236, .08);
  --line-strong: rgba(237, 239, 236, .18);
  --radius: 16px;
  --container: 1180px;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

.wrap { max-width: var(--container); margin: 0 auto; padding: 0 32px; }

h1, h2, h3, h4 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.accent { color: var(--blue); }

.eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--blue);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: '';
  width: 18px; height: 1px;
  background: var(--blue);
  display: inline-block;
}

/* ============ Nav ============ */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: rgba(13, 15, 18, .72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { height: 26px; width: auto; }
.brand span {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600; font-size: 15px; letter-spacing: .04em;
}
.nav-links {
  display: flex; gap: 30px;
  font-family: 'IBM Plex Mono', monospace; font-size: 12px;
  letter-spacing: .08em; text-transform: uppercase;
}
.nav-links a {
  color: var(--text-muted); transition: color .2s, border-color .2s;
  padding: 4px 0 6px; border-bottom: 1px solid transparent;
}
.nav-links a:hover, .nav-links a:focus-visible,
.nav-links a[aria-current="page"] { color: var(--text); border-color: var(--blue); }

.lang-switch {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: .1em;
  border: 1px solid var(--line-strong); border-radius: 999px; padding: 5px 12px;
  margin-left: 4px;
}
.lang-switch:hover { border-color: var(--blue); color: var(--blue); }

.nav-toggle {
  display: none; width: 40px; height: 40px;
  background: none; border: 1px solid var(--line-strong);
  border-radius: 8px; color: var(--text); cursor: pointer;
  align-items: center; justify-content: center;
}
.nav-toggle span { display: block; width: 16px; height: 1px; background: var(--text); position: relative; }
.nav-toggle span::before, .nav-toggle span::after {
  content: ''; position: absolute; left: 0; width: 16px; height: 1px; background: var(--text);
}
.nav-toggle span::before { top: -5px; }
.nav-toggle span::after { top: 5px; }

@media (max-width: 860px) {
  .nav-toggle { display: flex; }
  .nav-links {
    position: fixed; top: 68px; left: 0; right: 0;
    background: var(--bg); flex-direction: column; gap: 0;
    border-bottom: 1px solid var(--line);
    max-height: 0; overflow: hidden; transition: max-height .3s ease;
  }
  .nav-links.open { max-height: 360px; }
  .nav-links a { padding: 16px 32px; border-bottom: 1px solid var(--line); border-left: 2px solid transparent; }
  .nav-links a:hover, .nav-links a[aria-current="page"] { border-left-color: var(--blue); border-bottom-color: var(--line); }
  .lang-switch { border: none; border-radius: 0; margin-left: 0; padding: 16px 32px; }
}

/* ============ Buttons ============ */
.btn {
  font-family: 'IBM Plex Mono', monospace; font-size: 12px;
  letter-spacing: .1em; text-transform: uppercase;
  padding: 14px 26px; border-radius: 999px;
  border: 1px solid var(--line-strong);
  display: inline-flex; align-items: center; gap: 8px;
  transition: all .2s;
}
.btn-primary { background: var(--blue); color: #071A33; border-color: var(--blue); }
.btn-primary:hover { background: #6FA3FF; }
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); }

/* ============ Spec strip (signature) ============ */
.spec-strip {
  margin-top: 64px;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden; padding: 18px 0;
}
.spec-track {
  display: flex; gap: 44px; white-space: nowrap; width: max-content;
  font-family: 'IBM Plex Mono', monospace; font-size: 12px;
  letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted);
  animation: scroll-left 42s linear infinite;
}
.spec-track .dot { color: var(--blue); }
@keyframes scroll-left {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) { .spec-track { animation: none; } }

/* ============ Sections shared ============ */
section { padding: 96px 0; }
.section-head { margin-bottom: 48px; }
.section-head h2 { font-size: clamp(30px, 5vw, 46px); margin-top: 16px; max-width: 720px; }

/* ============ Page hero (per pagine interne) ============ */
.page-hero { padding: 156px 0 64px; border-bottom: 1px solid var(--line); }
.page-hero h1 { font-size: clamp(36px, 6vw, 64px); margin-top: 16px; }
.page-hero p { color: var(--text-muted); max-width: 620px; margin-top: 18px; font-size: 17px; }
.page-hero .back {
  font-family: 'IBM Plex Mono', monospace; font-size: 12px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-muted); display: inline-flex; gap: 8px; align-items: center;
  margin-bottom: 18px; transition: color .2s;
}
.page-hero .back:hover { color: var(--blue); }

/* ============ Line / category sections (Packaging, Retail) ============ */
.line-section { padding: 64px 0; border-top: 1px solid var(--line); }
.line-section:first-of-type { border-top: none; padding-top: 56px; }
.line-head { max-width: 760px; }
.line-head .num { font-family: 'IBM Plex Mono', monospace; font-size: 12px; letter-spacing: .14em; color: var(--amber); text-transform: uppercase; }
.line-head h2 { font-size: clamp(26px, 4.2vw, 40px); margin-top: 10px; }
.line-head p { color: var(--text-muted); margin-top: 12px; font-size: 16px; max-width: 640px; }

/* ============ Gallery + lightbox ============ */
.gallery {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px; margin-top: 28px;
}
.gallery img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px;
  cursor: zoom-in; border: 1px solid var(--line);
  transition: border-color .2s, transform .35s ease;
}
.gallery.square img { aspect-ratio: 1 / 1; }
.gallery img:hover { border-color: var(--blue-line); transform: scale(1.015); }

.lightbox {
  position: fixed; inset: 0; z-index: 200; background: rgba(13,15,18,.96);
  display: none; align-items: center; justify-content: center; padding: 60px;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: 86vh; border-radius: 8px; }
.lightbox .close, .lightbox .lb-nav {
  position: fixed; background: var(--surface); border: 1px solid var(--line-strong);
  color: var(--text); border-radius: 999px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-family: 'IBM Plex Mono', monospace; font-size: 16px; transition: border-color .2s, color .2s;
}
.lightbox .close { top: 24px; right: 24px; width: 44px; height: 44px; }
.lightbox .lb-nav { top: 50%; transform: translateY(-50%); width: 48px; height: 48px; }
.lightbox .prev { left: 16px; }
.lightbox .next { right: 16px; }
.lightbox .close:hover, .lightbox .lb-nav:hover { border-color: var(--blue); color: var(--blue); }
@media (max-width: 640px) {
  .lightbox { padding: 16px; }
  .lightbox .lb-nav { width: 40px; height: 40px; }
}

/* ============ Shared link / tool frame ============ */
.go {
  font-family: 'IBM Plex Mono', monospace; font-size: 12px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--blue); display: inline-flex; gap: 8px; align-items: center;
  margin-top: 18px; transition: gap .2s;
}
.go:hover { gap: 12px; }

.tool-frame {
  margin-top: 28px; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; height: 620px; background: #f5f5f5;
}
.tool-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
@media (max-width: 640px) { .tool-frame { height: 480px; } }


.cv-block { padding: 56px 0; border-top: 1px solid var(--line); }
.cv-block:first-of-type { border-top: none; }
.cv-block h2 { font-size: clamp(24px, 3.6vw, 32px); margin-bottom: 24px; }
.cv-item { margin-bottom: 28px; }
.cv-item .role { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 18px; }
.cv-item .org { color: var(--blue); font-family: 'IBM Plex Mono', monospace; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; display: block; margin: 4px 0 10px; }
.cv-item p { color: var(--text-muted); max-width: 680px; }
.skills { display: flex; flex-wrap: wrap; gap: 8px; }
.skill {
  font-family: 'IBM Plex Mono', monospace; font-size: 12px; letter-spacing: .06em;
  padding: 7px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
}


/* ============ Footer ============ */
footer { border-top: 1px solid var(--line); padding: 40px 0; }
footer .wrap {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--text-muted);
}
footer .links {
  display: flex; gap: 24px;
  font-family: 'IBM Plex Mono', monospace; font-size: 12px;
  letter-spacing: .08em; text-transform: uppercase;
}
footer a:hover { color: var(--blue); }

/* ============ Language switch ============ */
.lang-switch {
  border: 1px solid var(--line-strong) !important; border-radius: 999px;
  padding: 4px 12px !important; margin-left: 8px;
}
.lang-switch:hover { border-color: var(--blue) !important; color: var(--blue) !important; }
@media (max-width: 860px) {
  .nav-links a.lang-switch {
    border-radius: 0; margin-left: 0; padding: 16px 32px !important;
    border: none !important; border-bottom: 1px solid var(--line) !important;
  }
}

/* ============ Home: hero ============ */
.hero { padding: 152px 0 0; }
.hero .wrap {
  display: grid; grid-template-columns: 1.15fr .85fr; gap: 56px; align-items: center;
  padding-bottom: 28px;
}
.hero h1 { font-size: clamp(40px, 6.8vw, 78px); margin: 18px 0 22px; }
.hero .lead { color: var(--text-muted); font-size: 17px; max-width: 460px; margin-bottom: 36px; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }

.hero-photo { position: relative; max-width: 380px; margin: 0 auto; }
.hero-photo img { position: relative; border-radius: var(--radius); }

@media (max-width: 860px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .hero-photo { order: -1; max-width: 260px; margin: 0 auto 12px; }
}

/* ============ Home: work grid ============ */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.card {
  position: relative; border-radius: var(--radius); overflow: hidden;
  min-height: 380px; border: 1px solid var(--line); background: var(--surface);
  display: flex; flex-direction: column; justify-content: flex-end;
}
.card img.bg {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: .5; transition: opacity .35s ease, transform .6s ease;
}
.card:hover img.bg { opacity: .7; transform: scale(1.04); }
.card::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(13,15,18,.96) 14%, rgba(13,15,18,.2) 75%);
}
.card-content { position: relative; z-index: 2; padding: 30px; }
.tag {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: .12em; text-transform: uppercase;
  padding: 5px 12px; border-radius: 999px; margin-bottom: 16px;
}
.tag.amber { background: var(--amber-dim); color: var(--amber); border: 1px solid var(--amber-line); }
.tag.blue { background: var(--blue-dim); color: var(--blue); border: 1px solid var(--blue-line); }
.card h3 { font-size: 26px; margin-bottom: 8px; }
.card p { color: var(--text-muted); font-size: 14px; max-width: 360px; }
.card .go {
  margin-top: 16px; color: var(--text);
  text-transform: none; letter-spacing: 0; font-size: 12px;
}
.card:hover .go { color: var(--blue); }

/* AI Lab terminal card */
.card.terminal { justify-content: flex-start; padding-top: 30px; background: var(--surface); }
.card.terminal::after { background: none; }
.term {
  font-family: 'IBM Plex Mono', monospace; font-size: 13px;
  color: var(--text-muted); line-height: 2; margin-bottom: 28px;
}
.term .prompt { color: var(--blue); }
.term .out { color: var(--text); }
.cursor {
  display: inline-block; width: 8px; height: 14px; background: var(--blue);
  margin-left: 4px; vertical-align: -2px; animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cursor { animation: none; } }

@media (max-width: 860px) {
  .grid { grid-template-columns: 1fr; }
  .card { min-height: 300px; }
}

/* ============ Home: about teaser ============ */
.about-teaser { border-top: 1px solid var(--line); }
.about-teaser .wrap { display: grid; grid-template-columns: auto 1fr auto; gap: 48px; align-items: center; }
.about-teaser .avatar {
  width: 120px; height: 120px; border-radius: 50%; overflow: hidden;
  border: 1px solid var(--line-strong); background: var(--surface);
}
.about-teaser .avatar img { width: 100%; height: 100%; object-fit: cover; }
.about-teaser p { color: var(--text-muted); max-width: 540px; }
.about-teaser p strong { color: var(--text); font-weight: 500; }
.about-teaser .go { white-space: nowrap; }
@media (max-width: 860px) {
  .about-teaser .wrap { grid-template-columns: 1fr; text-align: center; }
  .about-teaser .avatar { margin: 0 auto; }
}

/* ============ Reveal animation hook ============ */
.reveal { opacity: 0; transform: translateY(18px); }
