/* --------------------------------------------------------------------------
   Stefano Ferraro — Design system "glass"
   Glassmorphism + bento grid · mobile-first · nessun framework
   Condiviso da: home, blender/, esame/
   Palette derivata dal logo SF (navy + gradiente viola → blu → ciano)
   -------------------------------------------------------------------------- */

:root {
  --navy: #071025;
  --violet: #8b5cf6;
  --blue: #3b5bdb;
  --cyan: #38c6e0;

  --text: #f5f7fb;
  --text-muted: #e0e5ee;   /* ≥ 4.5:1 anche con tutti i blob sovrapposti sotto una card */
  --focus: #8fe3f2;
  --cyan-text: #aeeef8;    /* ciano per testo: ≥ 4.5:1 sul vetro */

  --glass-bg: rgba(255, 255, 255, 0.10);
  --glass-bg-hover: rgba(255, 255, 255, 0.12);
  --glass-border: rgba(255, 255, 255, 0.18);
  --glass-blur: 18px;
  --radius: 24px;
  --radius-inner: 16px;
  --gap: 16px;

  --font-sans: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Outfit", var(--font-sans);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--navy);
  overflow-x: hidden;
}

img, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p { margin: 0; }
button { font: inherit; color: inherit; }

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

.skip-link {
  position: absolute;
  left: 1rem;
  top: -100px;
  z-index: 50;
  padding: 0.6rem 1rem;
  border-radius: 12px;
  background: var(--text);
  color: var(--navy);
  font-weight: 700;
}
.skip-link:focus { top: 1rem; }

/* Icone inline (SVG): stessa altezza del testo, allineate alla riga */
.icon {
  display: inline-block;
  flex: none;
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ─── Sfondo con blob ──────────────────────────────────────────────── */
.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.bg::after {                 /* velo scuro: protegge il contrasto */
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(7, 16, 37, 0.25), rgba(7, 16, 37, 0.6));
}
.blob {
  position: absolute;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.45;
  will-change: transform;
}
.blob--violet {
  background: radial-gradient(circle, var(--violet), transparent 65%);
  top: -20vmax; left: -15vmax;
  animation: drift-a 38s ease-in-out infinite alternate;
}
.blob--blue {
  background: radial-gradient(circle, var(--blue), transparent 65%);
  bottom: -25vmax; right: -20vmax;
  animation: drift-b 46s ease-in-out infinite alternate;
}
.blob--cyan {
  background: radial-gradient(circle, var(--cyan), transparent 65%);
  top: 30%; left: 40%;
  width: 40vmax; height: 40vmax;
  opacity: 0.22;
  animation: drift-c 52s ease-in-out infinite alternate;
}
@keyframes drift-a { to { transform: translate(18vw, 22vh) scale(1.1); } }
@keyframes drift-b { to { transform: translate(-20vw, -18vh) scale(0.9); } }
@keyframes drift-c { to { transform: translate(-25vw, 10vh) scale(1.15); } }

/* ─── Topbar ───────────────────────────────────────────────────────── */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "brand lang" "nav nav";
  align-items: center;
  gap: 0.5rem 1rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}
.topbar__brand {
  grid-area: brand;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  font-family: var(--font-display);
  font-weight: 600;
  text-decoration: none;
}
.topbar__brand img { width: 36px; height: 36px; border-radius: 10px; }
.topbar__nav-wrap { grid-area: nav; min-width: 0; }
.topbar__nav {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;           /* su mobile: riga scorrevole, niente hamburger */
  scrollbar-width: none;
  margin: 0 -0.25rem;
  padding: 0 0.25rem;
}
.topbar__nav::-webkit-scrollbar { display: none; }
.topbar__nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.85rem;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 500;
  gap: 0.4rem;
  white-space: nowrap;
  text-decoration: none;
  color: var(--text-muted);
  transition: background-color 0.2s, color 0.2s;
}
.topbar__nav a:hover { color: var(--text); background: var(--glass-bg); }

.lang {
  grid-area: lang;
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
}
.lang button {
  min-width: 44px;
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--text-muted);
}
.lang button[aria-pressed="true"] { background: var(--text); color: var(--navy); }

/* ─── Contenitore pagina ───────────────────────────────────────────── */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem 2rem;
}

/* ─── Card in vetro ────────────────────────────────────────────────── */
.card {
  position: relative;
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset, 0 20px 50px rgba(0, 0, 0, 0.25);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .card { background: rgba(22, 30, 58, 0.92); }
}

.card__label {
  margin-bottom: 1rem;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.card__title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.25;
}
.muted { color: var(--text-muted); }

/* Superficie interna (riquadri dentro una card) */
.tile {
  position: relative;
  display: grid;
  align-content: start;
  gap: 0.25rem;
  padding: 1rem;
  border-radius: var(--radius-inner);
  border: 1px solid rgba(255, 255, 255, 0.12);
  text-decoration: none;
  transition: border-color 0.2s, background-color 0.2s;
}
a.tile:hover { border-color: rgba(255, 255, 255, 0.32); background: rgba(255, 255, 255, 0.03); }

/* Titolo di pagina per le sottopagine */
.page-head { display: grid; gap: 0.75rem; }
.page-head__title {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 6vw, 3rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.page-head__lead { color: var(--text-muted); max-width: 62ch; }

.eyebrow { font-size: 0.9rem; font-weight: 500; color: var(--text-muted); }

/* ─── Bottoni ──────────────────────────────────────────────────────── */
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.65rem 1.25rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s var(--ease), background-color 0.2s;
}
.btn--primary { background: var(--text); color: var(--navy); }   /* 17.6:1 */
.btn--primary:hover { background: #fff; transform: translateY(-1px); }
.btn--ghost { border-color: var(--glass-border); background: var(--glass-bg); color: var(--text); }
.btn--ghost:hover { background: var(--glass-bg-hover); }
.btn--sm { min-height: 40px; padding: 0.45rem 1rem; font-size: 0.9rem; }
.btn--disabled,
.btn[aria-disabled="true"] {
  border-color: var(--glass-border);
  background: transparent;
  color: var(--text-muted);
  cursor: not-allowed;
  transform: none;
}

/* Pillola di stato */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  justify-self: start;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  font-size: 0.8rem;
  font-weight: 600;
}
.pill::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--cyan);
}
.pill--wip::before { background: #ffd27a; }

/* ─── Chip ─────────────────────────────────────────────────────────── */
.chips { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.chips li {
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.86rem;
  font-weight: 500;
}

/* ─── Footer ───────────────────────────────────────────────────────── */
.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1rem 2rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.footer a { text-underline-offset: 3px; }

/* ==========================================================================
   HOME — bento
   ========================================================================== */
.bento {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
}

/* Chi sono */
.bento .card--about { display: grid; gap: 1.25rem; padding: 1.25rem; }
.about__photo {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  object-position: 50% 25%;
  border-radius: var(--radius-inner);
}
.about__body { display: grid; gap: 0.9rem; align-content: center; }
.about__title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 5vw, 2.6rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.about__lead { color: var(--text-muted); max-width: 54ch; }

/* Esperienza */
.timeline { display: grid; gap: 1.25rem; }
.timeline__item {
  display: grid;
  gap: 0.2rem;
  padding-left: 1rem;
  border-left: 2px solid var(--glass-border);
}
.timeline__item--current { border-left-color: var(--cyan); }
.timeline__when { font-size: 0.82rem; font-weight: 500; color: var(--text-muted); }
.timeline__org { font-size: 0.92rem; color: var(--text-muted); }
.timeline__desc { font-size: 0.92rem; margin-top: 0.2rem; }

/* Progetti */
.projects { display: grid; gap: 0.75rem; }
.project { padding-right: 2.75rem; }
.project__cat { font-size: 0.8rem; color: var(--text-muted); }
.project__desc { font-size: 0.92rem; color: var(--text-muted); }
.project__arrow {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 1.1rem;
  line-height: 1;
  transition: transform 0.2s var(--ease);
}
.project:hover .project__arrow { transform: translate(2px, -2px); }

/* Competenze */
.skill-groups { display: grid; gap: 1rem; }
.skill-group__title { font-size: 0.9rem; font-weight: 600; margin-bottom: 0.5rem; }

/* Formazione */
.edu { display: grid; gap: 1.25rem; }
.edu__degree { display: grid; gap: 0.2rem; }
.edu__meta { font-size: 0.9rem; color: var(--text-muted); }
.certs { display: grid; gap: 0.5rem; }
.certs li {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  font-size: 0.95rem;
}
.certs li::before {
  content: "";
  flex: none;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--violet);
  transform: translateY(-2px);
}

/* Contatti (condiviso: home ed esame/) */
.contact-list { display: grid; gap: 0.75rem; }
.contact { gap: 0.2rem; }
.contact__name {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
}
.contact__value { font-size: 0.92rem; overflow-wrap: anywhere; }

/* CV */
.bento .card--cv { display: grid; gap: 0.9rem; align-content: start; }
.bento .card--cv .card__label { margin-bottom: 0; }

/* ─── Tablet: 2 colonne ────────────────────────────────────────────── */
@media (min-width: 640px) {
  .topbar {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "brand nav lang";
    padding: 1.25rem 1.5rem;
  }
  .topbar__nav { justify-content: flex-end; }
  .page { padding: 0 1.5rem 2rem; }
  .bento {
    gap: 20px;
    grid-template-columns: repeat(2, 1fr);
    grid-template-areas:
      "about   about"
      "exp     exp"
      "proj    proj"
      "skills  edu"
      "contact cv";
  }
  .bento .card--about    { grid-area: about; grid-template-columns: 2fr 3fr; padding: 1.5rem; gap: 1.75rem; }
  .bento .card--exp      { grid-area: exp; }
  .bento .card--projects { grid-area: proj; }
  .bento .card--skills   { grid-area: skills; }
  .bento .card--edu      { grid-area: edu; }
  .bento .card--contact  { grid-area: contact; }
  .bento .card--cv       { grid-area: cv; }
  .about__photo { aspect-ratio: 4 / 5; height: 100%; }
  .bento .card--exp .timeline { grid-template-columns: 1fr 1fr; }
  .projects { grid-template-columns: repeat(2, 1fr); }
}

/* ─── Desktop: bento a 6 colonne, nessun buco ──────────────────────── */
@media (min-width: 1024px) {
  .bento {
    grid-template-columns: repeat(6, 1fr);
    grid-template-areas:
      "about   about   about   about   exp exp"
      "proj    proj    proj    proj    proj proj"
      "skills  skills  skills  edu     edu  edu"
      "contact contact contact contact cv   cv";
  }
  .bento .card--about { grid-template-columns: 1fr 1.5fr; padding: 1.75rem; }
  .bento .card--exp .timeline { grid-template-columns: 1fr; }
  .projects { grid-template-columns: repeat(4, 1fr); }
  .bento .contact-list { grid-template-columns: repeat(3, 1fr); }
}

/* ─── Movimento ridotto ────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
