/* ============================================================
   Emanuele Altieri — CV site
   Dark theme · gradient accent (ciano → viola) · zero dipendenze
   ============================================================ */

:root {
  --bg: #0b0f17;
  --bg-alt: #0e1420;
  --card: #121a2a;
  --border: rgba(255, 255, 255, .08);
  --text: #e6ebf4;
  --muted: #9aa7bd;
  --cyan: #22d3ee;
  --violet: #a78bfa;
  --grad: linear-gradient(90deg, var(--cyan), var(--violet));
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

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

html { scroll-behavior: smooth; scroll-padding-top: 76px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(1000px 500px at 85% -10%, rgba(167, 139, 250, .12), transparent 60%),
    radial-gradient(900px 450px at 5% 0%, rgba(34, 211, 238, .10), transparent 60%),
    var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img, svg { vertical-align: middle; }

a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: none; }

.container { width: min(1080px, 92%); margin-inline: auto; }
.container.narrow { width: min(760px, 92%); }

/* ---------- Skip link & focus ---------- */
.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 100;
  background: var(--card); padding: .5rem 1rem; border-radius: 8px;
}
.skip-link:focus { left: 8px; }

:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 4px; }

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

/* ---------- Navbar ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11, 15, 23, .78);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 64px; }
.brand { font-size: 1.35rem; font-weight: 800; color: var(--text); letter-spacing: .5px; }
.brand-dot { color: var(--cyan); }

.nav-menu { display: flex; align-items: center; gap: 1.25rem; list-style: none; }
.nav-link { color: var(--muted); font-size: .95rem; font-weight: 500; transition: color .2s; }
.nav-link:hover, .nav-link.active { color: var(--text); }

.nav-toggle { display: none; background: none; border: 1px solid var(--border); border-radius: 8px; padding: .45rem .55rem; cursor: pointer; }
.nav-toggle span { display: block; width: 20px; height: 2px; background: var(--text); margin: 4px 0; border-radius: 2px; transition: transform .25s, opacity .25s; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ---------- Bottoni ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .75rem 1.35rem; border-radius: 999px;
  font-weight: 600; font-size: .95rem;
  transition: transform .18s, box-shadow .18s, background .18s, border-color .18s;
}
.btn-sm { padding: .5rem 1rem; font-size: .88rem; }
.btn-primary {
  background: var(--grad); color: #08101c;
  box-shadow: 0 4px 20px rgba(34, 211, 238, .25);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(167, 139, 250, .35); }
.btn-ghost { border: 1px solid var(--border); color: var(--text); background: transparent; }
.btn-ghost:hover { border-color: var(--cyan); background: rgba(34, 211, 238, .06); transform: translateY(-2px); }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Hero ---------- */
.hero { padding: clamp(4rem, 10vw, 7.5rem) 0 clamp(3rem, 7vw, 5rem); }
.hero-inner { display: grid; grid-template-columns: 1.5fr .8fr; align-items: center; gap: 2.5rem; }
.hero-kicker { color: var(--cyan); font-weight: 600; letter-spacing: 2px; text-transform: uppercase; font-size: .85rem; }
.hero h1 { font-size: clamp(2.4rem, 6vw, 4rem); line-height: 1.1; letter-spacing: -1px; margin: .35rem 0 .5rem; }
.hero-role { font-size: clamp(1.05rem, 2.4vw, 1.35rem); color: var(--text); font-weight: 600; }
.hero-role .sep { color: var(--violet); margin-inline: .35rem; }
.hero-tagline { color: var(--muted); max-width: 56ch; margin-top: .9rem; }

.hero-pills { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.4rem; }
.hero-pills li {
  font-size: .82rem; font-weight: 600; color: var(--text);
  border: 1px solid var(--border); border-radius: 999px; padding: .32rem .8rem;
  background: rgba(255, 255, 255, .03);
}

.hero-loc {
  display: flex; align-items: center; gap: .45rem;
  color: var(--cyan); font-weight: 600; font-size: .95rem;
  margin-top: .55rem;
}
.hero-loc svg { flex-shrink: 0; }

.hero-actions { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: 1.8rem; }

.hero-art { display: grid; place-items: center; }
.photo-ring {
  width: clamp(200px, 26vw, 300px); aspect-ratio: 1; border-radius: 50%;
  display: grid; place-items: center; padding: 10px;
  background:
    linear-gradient(var(--bg), var(--bg)) padding-box,
    conic-gradient(from 120deg, var(--cyan), var(--violet), var(--cyan)) border-box;
  border: 3px solid transparent;
  box-shadow: 0 0 60px rgba(34, 211, 238, .18), 0 0 90px rgba(167, 139, 250, .12);
  animation: floaty 7s ease-in-out infinite;
}
.photo-ring img {
  width: 100%; height: 100%; object-fit: cover;
  border-radius: 50%; display: block;
}
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }

/* ---------- Sezioni ---------- */
.section { padding: clamp(3.5rem, 8vw, 5.5rem) 0; }
.alt-bg { background: var(--bg-alt); border-block: 1px solid var(--border); }

.section-title { font-size: clamp(1.7rem, 4vw, 2.3rem); margin-bottom: 2.2rem; letter-spacing: -.5px; }

.lead { color: var(--muted); font-size: 1.06rem; margin-bottom: 1rem; }
.lead strong { color: var(--text); }
.center { text-align: center; }

/* ---------- Card base ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
  box-shadow: var(--shadow);
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.card:hover {
  transform: translateY(-3px);
  border-color: rgba(34, 211, 238, .35);
  box-shadow: 0 14px 40px rgba(34, 211, 238, .10);
}

/* ---------- Timeline esperienze ---------- */
.timeline { list-style: none; position: relative; margin-left: .6rem; }
.timeline::before {
  content: ""; position: absolute; left: 0; top: 6px; bottom: 6px;
  width: 2px; background: linear-gradient(180deg, var(--cyan), var(--violet));
  border-radius: 2px; opacity: .55;
}
.timeline-item { position: relative; padding-left: 1.8rem; margin-bottom: 1.6rem; }
.timeline-item:last-child { margin-bottom: 0; }
.timeline-item::before {
  content: ""; position: absolute; left: -7px; top: 26px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--bg); border: 3px solid var(--cyan);
  box-shadow: 0 0 12px rgba(34, 211, 238, .6);
}

.exp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: .9rem; }
.exp h3 { font-size: 1.12rem; }
.exp-org { color: var(--cyan); font-weight: 600; font-size: .95rem; margin-top: .15rem; }

.chip {
  font-size: .8rem; font-weight: 600; white-space: nowrap;
  color: var(--muted); border: 1px solid var(--border);
  border-radius: 999px; padding: .3rem .8rem; background: rgba(255, 255, 255, .03);
}
.chip-accent { color: var(--cyan); border-color: rgba(34, 211, 238, .4); background: rgba(34, 211, 238, .07); }

.exp-list { list-style: none; display: grid; gap: .45rem; }
.exp-list li { color: var(--muted); padding-left: 1.2rem; position: relative; font-size: .96rem; }
.exp-list li::before {
  content: "▹"; position: absolute; left: 0; color: var(--violet); font-weight: 700;
}

/* ---------- Skills ---------- */
.skills-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; }
.skill h3 { font-size: 1rem; margin-bottom: .9rem; color: var(--text); }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: .45rem; }
.tags li {
  font-size: .8rem; color: var(--muted);
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--border);
  padding: .28rem .65rem; border-radius: 8px;
  transition: color .2s, border-color .2s;
}
.skill:hover .tags li { border-color: rgba(167, 139, 250, .25); }

/* ---------- Formazione & lingue ---------- */
.duo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; }
.edu { margin-bottom: 1rem; }
.edu h3 { font-size: 1.02rem; }
.edu-meta { color: var(--muted); font-size: .9rem; margin-top: .2rem; }

.bar { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, .07); margin-top: .8rem; overflow: hidden; }
.bar span { display: block; height: 100%; width: var(--lvl); background: var(--grad); border-radius: inherit; }

/* ---------- Contatti ---------- */
.contact-card { display: grid; gap: 1rem; margin-top: 1.6rem; padding: 1.6rem; }
.contact-row {
  display: flex; align-items: center; gap: .8rem;
  color: var(--text); font-weight: 500;
  padding: .7rem .9rem; border-radius: 10px;
  border: 1px solid var(--border); background: rgba(255, 255, 255, .02);
  transition: border-color .2s, background .2s;
}
a.contact-row:hover { border-color: var(--cyan); background: rgba(34, 211, 238, .06); }
.contact-row.static { cursor: default; }
.contact-row svg { color: var(--cyan); flex-shrink: 0; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 2.2rem 0 2.6rem; color: var(--muted); font-size: .85rem; }
.site-footer p { margin-bottom: .4rem; }
.copyright { text-align: center; margin-top: 1.2rem; color: var(--muted); }

/* ---------- Reveal on scroll (solo con JS attivo) ---------- */
.js .reveal { opacity: 0; transform: translateY(22px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.visible { opacity: 1; transform: none; }
.js .delay-1 { transition-delay: .12s; }
.js .delay-2 { transition-delay: .24s; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; text-align: center; }
  .hero-text { order: 2; }
  .hero-art { order: 1; }
  .hero-pills, .hero-actions { justify-content: center; }
  .skills-grid { grid-template-columns: repeat(2, 1fr); }
  .duo-grid { grid-template-columns: 1fr; gap: 1.5rem; }

  /* menu mobile: senza JS resta visibile e in linea (degradazione graceful) */
  .nav-toggle { display: none; }          /* niente hamburger senza JS */
  .js .nav-toggle { display: block; }
  .nav-menu {
    position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: rgba(11, 15, 23, .97);
    border-bottom: 1px solid var(--border);
    padding: .6rem 4%;
    display: flex;
  }
  .js .nav-menu { display: none; }
  .js .nav-menu.open { display: flex; }
  .nav-menu li { padding: .55rem 0; }
  .nav-link { display: block; font-size: 1.02rem; }
  .nav-cta-item { border-top: 1px solid var(--border); padding-top: .9rem !important; }
}

@media (max-width: 560px) {
  .skills-grid { grid-template-columns: 1fr; }
  .exp-head { flex-direction: column; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .photo-ring { animation: none; }
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ---------- Progetti ---------- */
.projects-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; }
.project { display: flex; flex-direction: column; gap: .7rem; }
.project-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .6rem; }
.project h3 { font-size: 1rem; line-height: 1.35; }
.project h3 a { color: var(--text); transition: color .2s; }
.project h3 a:hover { color: var(--cyan); }
.project p { color: var(--muted); font-size: .92rem; flex-grow: 1; }
.project-meta { display: flex; gap: .45rem; flex-wrap: wrap; align-items: center; }
.tag-lang, .tag-cat {
  font-size: .78rem; font-weight: 600;
  padding: .22rem .6rem; border-radius: 999px;
}
.tag-lang { color: var(--cyan); border: 1px solid rgba(34, 211, 238, .4); background: rgba(34, 211, 238, .07); }
.tag-cat { color: var(--muted); border: 1px solid var(--border); background: rgba(255, 255, 255, .03); }
.star { color: #facc15; font-size: .85rem; font-weight: 700; white-space: nowrap; }
.projects-more { margin-top: 1.8rem; text-align: center; }
.projects-more a { font-weight: 600; }
.projects-more a:hover { text-decoration: underline; }

@media (max-width: 900px) {
  .projects-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .projects-grid { grid-template-columns: 1fr; }
}

/* ---------- Attivita GitHub (widget commit) ---------- */
.gh-activity { margin-top: 2.2rem; }
.gh-title { font-size: 1.15rem; margin-bottom: 1rem; }
.gh-commits { list-style: none; display: grid; gap: .55rem; }
.gh-commit {
  display: flex; align-items: baseline; gap: .7rem; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: .6rem .9rem;
  transition: border-color .2s;
}
.gh-commit:hover { border-color: rgba(34, 211, 238, .3); }
.gh-repo { color: var(--cyan); font-weight: 600; font-size: .88rem; white-space: nowrap; }
.gh-repo:hover { text-decoration: underline; }
.gh-msg { color: var(--muted); font-size: .9rem; flex-grow: 1; min-width: 12rem; }
.gh-time { color: var(--muted); font-size: .8rem; white-space: nowrap; opacity: .8; }
.gh-loading { color: var(--muted); font-size: .9rem; }
.chip-fork {
  font-size: .68rem; color: var(--violet);
  border: 1px solid rgba(167, 139, 250, .45); background: rgba(167, 139, 250, .08);
  border-radius: 999px; padding: .1rem .5rem;
  vertical-align: middle; margin-left: .3rem; font-weight: 600;
}


/* ---------- Language switcher ---------- */
.lang-switch { display: flex; gap: .35rem; align-items: center; margin-left: .4rem; }
.lang-btn {
  background: transparent; border: 1px solid var(--border);
  color: var(--muted); padding: .28rem .62rem;
  border-radius: 999px; font-size: .78rem; font-weight: 700;
  cursor: pointer; transition: background .2s, color .2s, border-color .2s;
}
.lang-btn:hover { border-color: rgba(34, 211, 238, .4); color: var(--text); }
.lang-btn.active, .lang-btn[aria-pressed="true"] {
  background: var(--grad); color: #08101c; border-color: transparent;
  box-shadow: 0 2px 10px rgba(34, 211, 238, .25);
}
@media (max-width: 900px) {
  .lang-switch { margin: .6rem 0 0; justify-content: center; }
}
