/* ============================================================
   Fabio Tagliani — Portfolio
   Apple-inspired: big type, dark canvas, restrained color.
   ============================================================ */

:root {
  --bg: #000;
  --bg-soft: #0a0a0c;
  --bg-card: #121216;
  --text: #f5f5f7;
  --text-dim: #a1a1a6;
  --text-faint: #6e6e73;
  --accent-1: #2997ff;
  --accent-2: #7b5cff;
  --accent-3: #ff5c8a;
  --grad: linear-gradient(92deg, #2997ff 0%, #7b5cff 50%, #ff5c8a 100%);
  --radius: 22px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --nav-h: 52px;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
               "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  line-height: 1.5;
}

::selection { background: rgba(123, 92, 255, 0.4); }

.container { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.center { text-align: center; }

/* ---------- gradient text ---------- */
.grad {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ============================================================
   NAV
   ============================================================ */
#nav {
  position: fixed; inset: 0 0 auto 0; z-index: 100;
  height: var(--nav-h);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  background: rgba(0, 0, 0, 0.55);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transition: background 0.4s;
}
.nav-inner {
  max-width: 1080px; margin: 0 auto; height: 100%;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
}
.nav-logo {
  font-weight: 800; font-size: 19px; letter-spacing: -0.5px;
  color: var(--text); text-decoration: none;
}
.nav-logo .dot { color: var(--accent-2); }
.nav-links { display: flex; gap: 26px; align-items: center; }
.nav-links a {
  color: var(--text-dim); text-decoration: none; font-size: 13.5px;
  transition: color 0.25s;
}
.nav-links a:hover { color: var(--text); }
.nav-cta {
  padding: 6px 14px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text) !important;
}
.nav-cta:hover { background: rgba(255, 255, 255, 0.18); }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative; min-height: 100svh;
  display: flex; align-items: center; justify-content: center;
  text-align: center; overflow: hidden;
}
#swarm { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-content { position: relative; z-index: 2; padding: 0 24px; }
.hero-eyebrow {
  font-size: 15px; color: var(--text-dim);
  letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600;
  margin-bottom: 14px;
}
.hero-title {
  font-size: clamp(64px, 13vw, 152px);
  font-weight: 800; letter-spacing: -0.045em; line-height: 1.06;
}
.hero-title > span { display: block; padding-bottom: 0.06em; }

/* letters (created by JS for the scroll-explode effect) */
.hero-title .ltr {
  display: inline-block; will-change: transform, opacity;
  padding-bottom: 0.06em;
}
.hero-title .grad .ltr {
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub {
  margin-top: 26px; font-size: clamp(19px, 2.6vw, 27px);
  color: var(--text-dim); font-weight: 500; letter-spacing: -0.01em;
}
.hero-actions {
  margin-top: 38px; display: flex; gap: 14px;
  justify-content: center; flex-wrap: wrap;
}

.btn {
  display: inline-block; padding: 13px 26px; border-radius: 999px;
  font-size: 16px; font-weight: 600; text-decoration: none;
  letter-spacing: -0.01em;
  transition: transform 0.3s var(--ease), background 0.3s, box-shadow 0.3s;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--text); color: #000;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(123, 92, 255, 0.35);
}
.btn-ghost {
  background: rgba(255, 255, 255, 0.08); color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.15); transform: translateY(-2px); }

.hero-scroll {
  position: absolute; bottom: 34px; left: 50%; transform: translateX(-50%);
  width: 26px; height: 42px; border: 2px solid rgba(255,255,255,0.25);
  border-radius: 14px; z-index: 2;
}
.hero-scroll span {
  position: absolute; top: 7px; left: 50%; width: 4px; height: 8px;
  margin-left: -2px; border-radius: 2px; background: rgba(255,255,255,0.6);
  animation: scrollhint 1.8s infinite var(--ease);
}
@keyframes scrollhint {
  0% { transform: translateY(0); opacity: 1; }
  70% { transform: translateY(14px); opacity: 0; }
  100% { transform: translateY(0); opacity: 0; }
}

/* ============================================================
   REVEALS
   ============================================================ */
.reveal {
  opacity: 0; transform: translateY(34px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}
.reveal.in { opacity: 1; transform: none; }
.d1 { transition-delay: 0.1s; }
.d2 { transition-delay: 0.2s; }
.d3 { transition-delay: 0.3s; }
.d4 { transition-delay: 0.42s; }

/* ============================================================
   SECTIONS — shared
   ============================================================ */
section { padding: 120px 0; position: relative; }
.section-title {
  font-size: clamp(38px, 6vw, 64px);
  font-weight: 800; letter-spacing: -0.035em; line-height: 1.05;
  margin-bottom: 34px;
}
.eyebrow {
  font-size: 14px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--accent-1); margin-bottom: 12px;
}

/* ============================================================
   STATS
   ============================================================ */
.stats { padding: 90px 0; background: var(--bg); }
.stats-grid {
  max-width: 1080px; margin: 0 auto; padding: 0 24px;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px;
}
.stat { text-align: center; padding: 34px 10px; border-radius: var(--radius);
  background: var(--bg-card); border: 1px solid rgba(255,255,255,0.05); }
.stat-num {
  font-size: clamp(38px, 5vw, 58px); font-weight: 800; letter-spacing: -0.03em;
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.stat-label { margin-top: 8px; color: var(--text-dim); font-size: 14px; line-height: 1.45; }

/* ============================================================
   ABOUT
   ============================================================ */
.about { background: var(--bg-soft); }
.split {
  display: grid; grid-template-columns: 1fr 1.5fr; gap: 70px; align-items: center;
}
.split.rev { grid-template-columns: 1.5fr 1fr; }
.about-photo { display: flex; justify-content: center; }
.photo-ring {
  width: 240px; height: 240px; border-radius: 50%; padding: 5px;
  background: var(--grad);
  animation: ringspin 9s linear infinite;
}
@keyframes ringspin { to { filter: hue-rotate(360deg); } }
.photo-ring img {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover;
  border: 5px solid var(--bg-soft); display: block;
}
.about-text p { color: var(--text-dim); font-size: 18px; margin-bottom: 18px; max-width: 60ch; }
.about-text strong { color: var(--text); }
.about-quote {
  font-style: italic; color: var(--text-faint) !important;
  font-size: 16px !important;
}

/* ============================================================
   TIMELINE
   ============================================================ */
.work { background: var(--bg); }
.timeline { position: relative; margin-top: 20px; }
.timeline::before {
  content: ""; position: absolute; left: 130px; top: 8px; bottom: 8px;
  width: 2px; background: linear-gradient(180deg, var(--accent-1), var(--accent-2), transparent);
  opacity: 0.5;
}
.t-item { display: grid; grid-template-columns: 108px 1fr; gap: 46px; margin-bottom: 34px; }
.t-when {
  color: var(--text-faint); font-weight: 700; font-size: 14px;
  text-align: right; padding-top: 26px; letter-spacing: 0.02em;
}
.t-card {
  background: var(--bg-card); border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius); padding: 26px 30px;
  transition: transform 0.4s var(--ease), border-color 0.4s, box-shadow 0.4s;
}
.t-card:hover {
  transform: translateY(-4px);
  border-color: rgba(123, 92, 255, 0.35);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.t-card h3 { font-size: 18px; font-weight: 700; letter-spacing: -0.015em; margin-bottom: 10px; }
.t-card p { color: var(--text-dim); font-size: 15.5px; }
.t-card strong { color: var(--text); }

/* ---------- tags ---------- */
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.tags span {
  font-size: 12.5px; font-weight: 600; padding: 5px 12px; border-radius: 999px;
  background: rgba(41, 151, 255, 0.12); color: #7cc0ff;
  border: 1px solid rgba(41, 151, 255, 0.2);
}
.tags.lg span { font-size: 14px; padding: 8px 16px; }

/* ============================================================
   FEATURES (SAHARA / POLYCOPY)
   ============================================================ */
.feature { background: var(--bg-soft); }
.feature.alt { background: var(--bg); }
.feature-text p { color: var(--text-dim); font-size: 18px; margin-bottom: 16px; max-width: 55ch; }
.feature-text strong { color: var(--text); }
.feature-list { list-style: none; margin-top: 8px; }
.feature-list li {
  padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.07);
  color: var(--text-dim); font-size: 17px;
}
.feature-list strong { color: var(--text); font-size: 20px; margin-right: 6px; }

/* ---------- mock windows ---------- */
.mock-terminal, .mock-dash {
  background: #0c0c10; border: 1px solid rgba(255,255,255,0.09);
  border-radius: 16px; overflow: hidden;
  box-shadow: 0 30px 90px rgba(0,0,0,0.6);
  transition: transform 0.5s var(--ease);
}
.mock-terminal:hover, .mock-dash:hover { transform: translateY(-6px) scale(1.01); }
.mock-bar {
  display: flex; align-items: center; gap: 7px; padding: 11px 14px;
  background: rgba(255,255,255,0.04); border-bottom: 1px solid rgba(255,255,255,0.06);
}
.mock-bar i { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; }
.mock-bar i:nth-child(2) { background: #febc2e; }
.mock-bar i:nth-child(3) { background: #28c840; }
.mock-bar em {
  margin-left: 10px; font-style: normal; color: var(--text-faint);
  font-size: 12px; font-family: "SF Mono", ui-monospace, Menlo, monospace;
}
.mock-terminal pre {
  padding: 18px; font-family: "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 12.5px; line-height: 1.75; color: #9fe8a8;
  min-height: 230px; white-space: pre-wrap;
}
.mock-terminal pre .dim { color: var(--text-faint); }
.mock-terminal pre .hl { color: #7cc0ff; }

.dash-body { padding: 18px; }
.dash-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 13.5px; color: var(--text-dim);
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
}
.dash-row span:nth-child(2) { flex: 1; }
.dash-val { color: #9fe8a8; font-weight: 600; }
.blink { animation: blink 1.6s infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.pill {
  font-size: 10.5px; font-weight: 800; padding: 3px 9px; border-radius: 999px;
  letter-spacing: 0.04em;
}
.pill.green { background: rgba(40, 200, 64, 0.15); color: #6ee787; }
.pill.blue { background: rgba(41, 151, 255, 0.15); color: #7cc0ff; }
.pill.violet { background: rgba(123, 92, 255, 0.18); color: #b3a0ff; }
.dash-chart { padding-top: 16px; }
.dash-chart svg { width: 100%; height: 70px; }
.dash-chart polyline { stroke: url(#sparkgrad); stroke: #7b5cff; }

/* ============================================================
   PROJECTS GRID
   ============================================================ */
.projects { background: var(--bg-soft); }
.grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
}
.card {
  position: relative;
  display: block; background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06); border-radius: var(--radius);
  padding: 28px 26px; text-decoration: none; color: var(--text);
  transition: transform 0.45s var(--ease), border-color 0.45s, box-shadow 0.45s;
  overflow: hidden;
}
.card::after {
  content: ""; position: absolute; inset: 0; opacity: 0;
  background: radial-gradient(600px circle at var(--mx, 50%) var(--my, 50%),
              rgba(123, 92, 255, 0.12), transparent 45%);
  transition: opacity 0.4s; pointer-events: none;
}
.card:hover { transform: translateY(-6px); border-color: rgba(123,92,255,0.35);
  box-shadow: 0 24px 70px rgba(0,0,0,0.55); }
.card:hover::after { opacity: 1; }
.card-icon { font-size: 30px; margin-bottom: 14px; }
.card h3 { font-size: 18px; font-weight: 700; letter-spacing: -0.015em; margin-bottom: 8px; }
.card p { color: var(--text-dim); font-size: 14.5px; line-height: 1.55; }

.lock {
  position: absolute; top: 16px; right: 16px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.03em;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(255, 188, 46, 0.12); color: #ffd60a;
  border: 1px solid rgba(255, 188, 46, 0.25);
}
.is-private { cursor: default; }

/* ============================================================
   SKILLS
   ============================================================ */
.skills { background: var(--bg); }
.skill-rows { display: flex; flex-direction: column; gap: 30px; }
.skill-row h4 {
  font-size: 14px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-faint); margin-bottom: 12px; font-weight: 700;
}

/* ============================================================
   EDUCATION
   ============================================================ */
.education { background: var(--bg-soft); }
.edu-grid { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 20px; }
.edu-card {
  background: var(--bg-card); border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius); padding: 28px;
}
.edu-card h3 { font-size: 17px; font-weight: 700; margin-bottom: 8px; letter-spacing: -0.01em; }
.edu-where { color: var(--text-dim); font-size: 14px; margin-bottom: 12px; }
.edu-grade {
  font-size: 24px; font-weight: 800;
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.edu-list { list-style: none; }
.edu-list li {
  color: var(--text-dim); font-size: 13.5px; padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.edu-list li:last-child { border-bottom: none; }

/* ============================================================
   CONTACT
   ============================================================ */
.contact { padding: 160px 0; background: var(--bg); }
.contact-title {
  font-size: clamp(52px, 9vw, 104px); font-weight: 800;
  letter-spacing: -0.04em; line-height: 1.0; margin-bottom: 22px;
}
.contact-sub { color: var(--text-dim); font-size: 19px; margin-bottom: 36px; }
.socials { margin-top: 30px; color: var(--text-faint); font-size: 15px; }
.socials a { color: var(--text-dim); text-decoration: none; margin: 0 10px; transition: color 0.25s; }
.socials a:hover { color: var(--text); }

footer {
  padding: 40px 24px; text-align: center;
  color: var(--text-faint); font-size: 13px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .split, .split.rev { grid-template-columns: 1fr; gap: 44px; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .edu-grid { grid-template-columns: 1fr; }
  .timeline::before { left: 0; display: none; }
  .t-item { grid-template-columns: 1fr; gap: 8px; }
  .t-when { text-align: left; padding-top: 0; }
  section { padding: 84px 0; }
}
@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }
  .nav-links a:not(.nav-cta) { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
}

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