/* main.css — CV Site
   Style: "pop elegante" → audace: blueprint editoriale, gradienti animati,
   tipografia gigante, reveal, tilt, cursor custom. */

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  --bg: #0B1F2A;
  --bg-elev: #10303D;
  --bg-elev-2: #143747;
  --border: rgba(244, 241, 234, 0.10);
  --text: #F4F1EA;
  --text-muted: #A9BCC6;
  --accent: #FF7A2F;
  --accent-2: #35D0BA;
  --accent-dim: rgba(255, 122, 47, 0.14);
  --accent-2-dim: rgba(53, 208, 186, 0.12);
  --grid: rgba(244, 241, 234, 0.035);

  --font-display: "Space Grotesk", sans-serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "JetBrains Mono", monospace;

  --line-height: 1.6;
  --space: 4px;
  --radius: 18px;
  --radius-sm: 12px;
  --radius-pill: 999px;

  --content: 720px;
  --hero-max: 1120px;
}

/* ── Reset / base ───────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: var(--line-height);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  cursor: none;
}

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

a {
  color: var(--accent);
  text-decoration: none;
  transition: color .18s ease;
  cursor: none;
}
a:hover {
  color: var(--accent-2);
}

img {
  display: block;
  max-width: 100%;
}

/* ── Background: blobs + blueprint grid ─────────────────── */
.bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}

.bg__grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 0%, transparent 78%);
}

.bg__blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .5;
  will-change: transform;
}
.bg__blob--a {
  width: 46vw;
  height: 46vw;
  top: -12vw;
  right: -8vw;
  background: radial-gradient(circle at 50% 50%, var(--accent) 0%, transparent 70%);
  opacity: .28;
  animation: drift-a 26s ease-in-out infinite alternate;
}
.bg__blob--b {
  width: 40vw;
  height: 40vw;
  top: 30%;
  left: -14vw;
  background: radial-gradient(circle at 50% 50%, var(--accent-2) 0%, transparent 70%);
  opacity: .22;
  animation: drift-b 32s ease-in-out infinite alternate;
}
.bg__blob--c {
  width: 30vw;
  height: 30vw;
  bottom: -10vw;
  right: 20%;
  background: radial-gradient(circle at 50% 50%, #FFB14F 0%, transparent 70%);
  opacity: .16;
  animation: drift-a 38s ease-in-out infinite alternate-reverse;
}

@keyframes drift-a {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(-6vw, 5vw) scale(1.15); }
  100% { transform: translate(4vw, -4vw) scale(0.95); }
}
@keyframes drift-b {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(6vw, -4vw) scale(1.1); }
  100% { transform: translate(-5vw, 4vw) scale(0.9); }
}

/* ── Custom cursor ──────────────────────────────────────── */
.cursor-dot,
.cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  border-radius: 50%;
  z-index: 9999;
  will-change: transform;
}
.cursor-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  transform: translate(-50%, -50%);
}
.cursor-ring {
  width: 38px;
  height: 38px;
  border: 1px solid var(--accent-2);
  transform: translate(-50%, -50%);
  transition: width .22s ease, height .22s ease, border-color .22s ease, background .22s ease;
}
body.cursor-hover .cursor-ring {
  width: 58px;
  height: 58px;
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* ── Layout shells ──────────────────────────────────────── */
.shell {
  max-width: var(--content);
  margin-inline: auto;
  padding-inline: 24px;
}
.hero-shell {
  max-width: var(--hero-max);
  margin-inline: auto;
  padding-inline: 24px;
}

/* ── Hero ───────────────────────────────────────────────── */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: clamp(32px, 6vw, 72px);
  align-items: center;
  padding-top: clamp(56px, 10vh, 110px);
  padding-bottom: clamp(64px, 10vh, 120px);
}

.hero__media {
  position: relative;
  z-index: 1;
  perspective: 900px;
}

/* ── Film negative portrait ─────────────────────────────── */
.film {
  --film-base: #0A131B;
  --film-hole: #142430;
  position: relative;
  width: 100%;
}

.film__strip {
  display: grid;
  grid-template-columns: 22px 1fr 22px;
  background: var(--film-base);
  padding-block: 26px;
  border-radius: 10px;
  box-shadow: 0 32px 70px -34px rgba(0, 0, 0, 0.8);
}

/* Edge print (arancio, come su un negativo scansionato) */
.film__edge {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--accent);
  writing-mode: vertical-rl;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
  white-space: nowrap;
}
.film__edge--left {
  transform: rotate(180deg);
}

/* Exposed frame */
.film__frame {
  position: relative;
  background: #000;
  padding: 6px;
}

.film__img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  filter: grayscale(1) contrast(1.15);
}

/* Film grain (feTurbulence) */
.film__grain {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 140px 140px;
  mix-blend-mode: overlay;
  opacity: 0.12;
  pointer-events: none;
}

/* Caption */
.film__caption {
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.film__caption b {
  color: var(--accent);
  font-weight: 600;
}

.hero__kicker {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.hero__kicker::before {
  content: "";
  width: 26px;
  height: 1px;
  background: var(--accent);
}

.hero__name {
  font-family: var(--font-display);
  font-size: clamp(3.2rem, 9.5vw, 7rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.03em;
  background: linear-gradient(120deg, var(--accent) 0%, var(--accent-2) 50%, var(--accent) 100%);
  background-size: 220% 220%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gradient-shift 9s ease infinite;
}

@keyframes gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}

.hero__role {
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 2.4vw, 1.35rem);
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 20px;
  max-width: 46ch;
}
.hero__role .mark {
  color: var(--text);
}

.hero__meta {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}
.hero__meta li {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: border-color .18s ease, transform .18s ease;
}
.hero__meta li svg {
  color: var(--accent-2);
  flex: none;
}
.hero__meta li:hover {
  border-color: var(--accent-2);
  transform: translateY(-2px);
}

.hero__links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 28px;
}
.hero__links a {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--border);
  transition: border-color .18s ease, color .18s ease;
}
.hero__links a:hover {
  border-bottom-color: var(--accent);
  color: var(--text);
}
.hero__links a::before {
  content: "↗";
  font-size: 0.85em;
  color: var(--accent-2);
}

/* Language toggle */
.lang-toggle {
  display: inline-flex;
  gap: 0;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
}
.lang-toggle button {
  font: inherit;
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 6px 14px;
  border-radius: 3px;
  transition: background .18s ease, color .18s ease;
  cursor: none;
  margin: 2px;
}
.lang-toggle button:hover {
  color: var(--text);
}
.lang-toggle button.is-active {
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
  border-radius: var(--radius-pill);
}
@media (hover: none), (pointer: coarse) {
  .lang-toggle button { cursor: pointer; }
}

/* Smartphone: lang toggle adjacent to hero__kicker */
@media (max-width: 800px) {
  .lang-toggle { margin-inline: auto; }
}

/* ── Sections ───────────────────────────────────────────── */
main {
  position: relative;
  padding-top: 8px;
}

.section {
  position: relative;
  padding-block: clamp(64px, 10vh, 96px);
  border-top: 1px solid var(--border);
}

.section__head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 40px;
}
.section__head::before {
  content: "";
  flex: none;
  width: 5px;
  height: 36px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}

.section__ghost {
  position: absolute;
  top: -44px;
  right: -8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(6rem, 22vw, 13rem);
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(244, 241, 234, 0.20);
  z-index: 0;
  pointer-events: none;
  user-select: none;
  background: linear-gradient(180deg, rgba(244, 241, 234, 0.16) 0%, rgba(244, 241, 234, 0.02) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Alternate ghost tint on even sections for visual rhythm */
.section:nth-of-type(even) .section__ghost {
  -webkit-text-stroke: 1.5px rgba(53, 208, 186, 0.28);
  background: linear-gradient(180deg, rgba(53, 208, 186, 0.20) 0%, rgba(53, 208, 186, 0.02) 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

.section__index {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-2);
  background: var(--accent-2-dim);
  border: 1px solid rgba(53, 208, 186, 0.25);
  border-radius: var(--radius-pill);
  padding: 5px 14px;
  white-space: nowrap;
}

/* Alternate index chip accent on even sections */
.section:nth-of-type(even) .section__index {
  color: var(--accent);
  background: var(--accent-dim);
  border-color: rgba(255, 122, 47, 0.25);
}

.section__title {
  position: relative;
  z-index: 1;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 5vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: var(--text);
}

.section__rule {
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Prose + marker highlight ───────────────────────────── */
.prose p + p {
  margin-top: 18px;
}
.prose {
  color: var(--text-muted);
}
.prose strong {
  color: var(--text);
  font-weight: 600;
}
.mark {
  color: var(--text);
  background: linear-gradient(transparent 55%, var(--accent-dim) 55%);
  padding: 0 2px;
  border-radius: 2px;
  font-weight: 600;
}

/* Lead paragraph (Profilo) — larger display type */
.prose__lead {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2.6vw, 1.4rem);
  line-height: 1.5;
  color: var(--text);
  font-weight: 500;
  letter-spacing: -0.01em;
}

/* ── Skills (cards) ─────────────────────────────────────── */
.skill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 16px;
}

.skill-card {
  position: relative;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  overflow: hidden;
  transition: border-color .22s ease, transform .22s ease, box-shadow .22s ease;
}
.skill-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  opacity: 0;
  transition: opacity .22s ease;
}
.skill-card::after {
  content: "";
  position: absolute;
  top: -40px;
  right: -40px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-2-dim) 0%, transparent 70%);
  opacity: 0;
  transition: opacity .22s ease;
  pointer-events: none;
}
.skill-card:hover {
  border-color: rgba(255, 122, 47, 0.45);
  transform: translateY(-4px);
  box-shadow: 0 22px 46px -24px rgba(255, 122, 47, 0.4);
}
.skill-card:hover::before,
.skill-card:hover::after {
  opacity: 1;
}

.skill-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.skill-card__label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-2);
}

.skill-card__count {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(255, 122, 47, 0.25);
  border-radius: var(--radius-pill);
  padding: 2px 10px;
  flex: none;
}

.skill-card__list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text);
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 7px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: border-color .18s ease, background .18s ease, transform .18s ease, box-shadow .18s ease;
}
.skill::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-2);
  transition: background .18s ease, box-shadow .18s ease;
}
.skill:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px -12px var(--accent);
}
.skill:hover::before {
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

/* Soft skills: full-width card with 2-column checklist grid */
.skill-card--soft {
  grid-column: 1 / -1;
}
.skill-card--soft .skill-card__count {
  color: var(--accent-2);
  background: var(--accent-2-dim);
  border-color: rgba(53, 208, 186, 0.25);
}
.skill-card__list--soft {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}
.skill--soft {
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  gap: 12px;
  align-items: flex-start;
}
.skill--soft::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 7px;
  border-radius: 2px;
  background: transparent;
  border: 2px solid var(--accent-2);
  transform: rotate(45deg);
}
.skill--soft:hover {
  color: var(--text);
  border-color: var(--accent-2);
  background: var(--accent-2-dim);
  transform: none;
  box-shadow: none;
}
.skill--soft:hover::before {
  background: var(--accent-2);
  border-color: var(--accent-2);
  box-shadow: none;
}

/* ── Timeline ───────────────────────────────────────────── */
.timeline {
  position: relative;
}

.entry {
  position: relative;
  padding-left: 28px;
  padding-bottom: 44px;
}
.entry:last-child {
  padding-bottom: 0;
}

.entry::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px var(--accent-dim), 0 0 18px var(--accent);
}

.entry::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 20px;
  bottom: 0;
  width: 1px;
  background: linear-gradient(var(--border), transparent);
}
.entry:last-child::after {
  display: none;
}

.entry__role {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.entry__org {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent-2);
  margin-top: 4px;
}

.entry__meta {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 8px;
}

.entry__desc {
  color: var(--text-muted);
  margin-top: 12px;
  max-width: 62ch;
}

.entry__note {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-muted);
}

.entry__sub {
  margin-top: 20px;
  padding: 20px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transform-style: preserve-3d;
  transition: border-color .2s ease, transform .2s ease;
}
.entry__sub:hover {
  border-color: rgba(255, 122, 47, 0.35);
}

.entry__sub-title {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 8px;
}
.entry__sub p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ── Languages ──────────────────────────────────────────── */
.langs {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.lang {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-family: var(--font-mono);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 22px;
  transition: border-color .18s ease, transform .18s ease;
}
.lang:hover {
  border-color: var(--accent-2);
  transform: translateY(-3px);
}
.lang__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.lang__name {
  color: var(--text);
}
.lang__level {
  color: var(--accent-2);
}
.lang__bar {
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--bg-elev-2);
  overflow: hidden;
}
.lang__bar span {
  display: block;
  height: 100%;
  width: var(--lvl, 0%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

/* ── Interests ──────────────────────────────────────────── */
.interests {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 36px;
}
.interests li {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--text);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 9px 18px;
  transition: border-color .18s ease, transform .18s ease;
}
.interests li:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.interests li::before {
  content: "✦";
  color: var(--accent-2);
  margin-right: 8px;
  font-size: 0.8em;
}

/* ── Footer ─────────────────────────────────────────────── */
.footer {
  position: relative;
  border-top: 1px solid var(--border);
  padding-block: 40px;
  margin-top: 32px;
}
.footer p {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}
.footer .accent {
  color: var(--accent);
}

/* ── Reveal on scroll ───────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .7s cubic-bezier(.22,.61,.36,1), transform .7s cubic-bezier(.22,.61,.36,1);
  will-change: opacity, transform;
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ── Tilt ───────────────────────────────────────────────── */
.tilt {
  will-change: transform;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 800px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 40px;
    padding-top: 48px;
  }
  .hero__media {
    max-width: 300px;
    margin-inline: auto;
  }
  .hero__body {
    text-align: center;
  }
  .hero__kicker {
    justify-content: center;
  }
  .hero__role {
    margin-inline: auto;
  }
  .hero__meta,
  .hero__links {
    justify-content: center;
  }
  .section__ghost {
    right: 0;
    font-size: clamp(4rem, 28vw, 8rem);
    top: -18px;
  }
}

/* ── Touch / reduced motion ─────────────────────────────── */
@media (hover: none), (pointer: coarse) {
  body { cursor: auto; }
  a { cursor: pointer; }
  .cursor-dot, .cursor-ring { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .bg__blob { animation: none; }
  .hero__name { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
}
