/* ============================================================================
   NOVA — PERSONAL PORTFOLIO (compattato + tema light/dark)
   - Griglia progetti più densa (card più piccole)
   - Navbar glass sticky
   - Toggle tema con CSS custom properties
   ========================================================================== */

/* ===================== */
/* TOKENS: LIGHT THEME   */
/* ===================== */
:root {
  --bg: #f7f8fc;
  --panel: #ffffff;
  --glass: rgba(255, 255, 255, .72);
  --glass-border: rgba(0, 0, 0, .08);
  --text: #0f172a;
  --muted: #53607a;

  --indigo: #6366f1;
  --teal: #14b8a6;
  --danger: #e11d48;

  --midnight-indigo: #c9cdee; 
  --deep-space-blue: #b5badf;  

  --card: #ffffff;
  --card-border: #e6e8ef;

  --hero-grad-1: #eef2ff;
  --hero-grad-2: #e0f2fe;
}

/* ===================== */
/* TOKENS: DARK THEME    */
/* ===================== */
body[data-theme="dark"] {
  --bg: #0f1222;
  --panel: #121632;
  --glass: rgba(18, 22, 50, .72);
  --glass-border: rgba(255, 255, 255, .08);
  --text: #e8eaf6;
  --muted: #aab0d3;

  --indigo: #6366f1;
  --teal: #2dd4bf;
  --danger: #f43f5e;

--midnight-indigo: #171a36;
  --deep-space-blue: #22264a;

  --card: #171a36;
  --card-border: #22264a;

  --hero-grad-1: #0e1328;
  --hero-grad-2: #0b1024;
}

/* ===================== */
/* BASE & RESET          */
/* ===================== */
* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Inter, Roboto, Arial, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
}

/* ===================== */
/* THEME TOGGLE          */
/* ===================== */
.theme-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  font-size: 1.15rem;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  background: transparent;
  transition: background .15s ease, transform .12s ease;
  margin-left: 16px;
  /* spazio dal gruppo link */
}

.theme-icon:hover {
  background: rgba(0, 0, 0, .05);
  transform: translateY(-1px);
}

.theme-icon:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

body[data-theme="dark"] .theme-icon:hover {
  background: rgba(255, 255, 255, .06);
}

/* ===================== */
/* NAVBAR (sticky glass) */
/* ===================== */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--glass);
  backdrop-filter: blur(10px) saturate(140%);
  border-bottom: 1px solid var(--glass-border);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 16px;

  display: flex;
  align-items: center;
  /* centra verticalmente brand, link, toggle */
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  /* centra verticalmente */
  justify-content: center;
  /* centra orizzontalmente */
  gap: 8px;
  /* spazio tra logo e testo */
  text-decoration: none;
  /* rimuove sottolineatura */
}

.brand-mark {
  height: 40px;
  /* o la dimensione che preferisci */
}

.brand span {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--text);
}

/* Links + toggle a destra */
.nav-links {
  list-style: none;
  display: flex;
  gap: 22px;
  margin: 0;
  padding: 0;
  margin-left: auto;
  /* spinge links (e quindi il toggle che viene dopo) a destra */
}

.nav-link {
  color: var(--text);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  padding-bottom: 4px;
}

.nav-link:hover,
.nav-link:focus-visible {
  border-color: var(--teal);
  outline: none;
}

/* ===================== */
/* WELCOME (100vh)       */
/* ===================== */
.welcome {
  min-height: 100vh;
  position: relative;
  overflow: clip;
  background: radial-gradient(80% 120% at 10% 10%, var(--hero-grad-1) 0%, var(--bg) 100%);
  display: grid;
  place-items: center;
}

.blob {
  position: absolute;
  filter: blur(60px);
  opacity: .35;
  z-index: -1;
  pointer-events: none;
}

.blob-a {
  width: 360px;
  height: 360px;
  border-radius: 50%;
  left: -80px;
  top: -60px;
  background: radial-gradient(circle at 30% 30%, var(--teal), transparent 60%);
}

.blob-b {
  width: 420px;
  height: 420px;
  border-radius: 50%;
  right: -120px;
  bottom: -80px;
  background: radial-gradient(circle at 70% 70%, var(--indigo), transparent 60%);
}

.welcome-inner {
  max-width: 1100px;
  width: 100%;
  padding: 42px 16px;
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 28px;
  align-items: center;
}

.welcome-copy h1 {
  margin: 0 0 6px;
  font-size: clamp(2rem, 6vw, 3rem);
}

.subtitle {
  color: var(--teal);
  margin: 0 0 10px;
  font-weight: 600;
}

.lead {
  margin: 0 0 14px;
  color: var(--muted);
  max-width: 56ch;
}

.cta-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  text-decoration: none;
  font-weight: 800;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: linear-gradient(135deg, var(--teal), var(--indigo));
  color: #06111a;
  transition: filter .2s ease, transform .15s ease;
}

.btn.ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--card-border);
}

.btn:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.welcome-figure {
  display: grid;
  place-items: center;
}

.avatar-ring {
  width: 350px;
  height: 350px;
  padding: 8px;
  border-radius: 50%;
  background: conic-gradient(from 120deg, var(--midnight-indigo), var(--deep-space-blue), var(--midnight-indigo));
  box-shadow: 0 10px 40px rgba(0, 0, 0, .18);
}


.avatar-ring img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

/* ===================== */
/* PROJECTS (nuovo stile) */
/* ===================== */

.projects {
  padding: 40px 0 60px;
  background: rgba(0, 0, 0, .03);
}

body[data-theme="dark"] .projects {
  background: #0d1125;
}

.section-title {
  text-align: center;
  margin: 4px 0 24px;
  font-weight: 800;
  letter-spacing: .3px;
  margin-top: 20px;
}

.projects-grid {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.project-tile {
  text-decoration: none;
  color: inherit;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .15);
}

/* FIGURE: occupa tutta l'altezza della card */
.card figure {
  display: flex;
  flex-direction: column;
  margin: 0;
  height: 100%;
}

/* IMG: prende lo spazio variabile (riempie il “vuoto”) */
.card img {
  width: 100%;
  display: block;
  object-fit: cover;
  flex: 1 1 200px;
  /* cresce/si riduce per assorbire lo spazio */
  min-height: 180px;
  /* evita immagini troppo basse */
}

/* BANNER: resta in basso, altezza stabile */
.card figcaption {
  background: linear-gradient(135deg, var(--teal), var(--indigo));
  color: #06111a;
  padding: 10px 12px;
  font-weight: 800;
  font-size: 1rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 0 0 auto;
  /* non si allunga, resta compatto */
  min-height: 70px;
  /* fascia costante */
}

/* (opzionale) limita a 2 righe la descrizione per evitare righe troppo alte */
.card figcaption small {
  font-weight: 500;
  font-size: .85rem;
  line-height: 1.3;
  opacity: .85;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* responsive */
@media (max-width: 760px) {
  .card img {
    min-height: 150px;
  }

  .card figcaption {
    font-size: .95rem;
    padding: 8px 10px;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }
}

/* =============== */
/* PROJECTS ACCORDION */
/* =============== */

.projects-accordion {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.projects-group {
  background: var(--panel);
  border: 1px solid rgba(0,0,0,.04);
  border-radius: 12px;
  overflow: hidden;
}

body[data-theme="dark"] .projects-group {
  border-color: rgba(255,255,255,.05);
}

.projects-group__header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  background: transparent;
  border: none;
  padding: 14px 14px 12px;
  cursor: pointer;
  color: inherit;
  font-weight: 600;
}

.projects-group__title {
  flex: 1 1 auto;
  text-align: left;
}

.projects-group__badge {
  background: rgba(99,102,241,.15);
  color: var(--text);
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 3px 10px;
}

body[data-theme="dark"] .projects-group__badge {
  background: rgba(99,102,241,.3);
}

.projects-group__chevron {
  transition: transform .15s ease-out;
  opacity: .6;
}

/* pannello */
.projects-group__panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height .2s ease-out;
}

/* stato aperto */
.projects-group.is-open .projects-group__panel {
  max-height: 2200px; /* abbastanza grande per tutti i progetti */
}

.projects-group.is-open .projects-group__chevron {
  transform: rotate(180deg);
}

/* responsive (riusiamo già le tue regole per .projects-grid) */
@media (max-width: 760px) {
  .projects-group__header {
    gap: 6px;
  }
}



/* ===================== */
/* PROJECTS CTA BUTTON   */
/* ===================== */

.projects-cta {
  text-align: center;
  margin: 4px 0 24px;
  font-weight: 800;
  letter-spacing: .3px;
  margin-top: 50px;
}


/* variante scura per tema dark */
body[data-theme="dark"] .projects-btn {
  color: #fff;
}

/* responsive */
@media (max-width: 760px) {
  .projects-btn {
    font-size: .95rem;
    padding: 10px 18px;
  }
}


/* ===================== */
/* CONTACT               */
/* ===================== */
.contact {
  padding: 48px 16px;
  background: var(--panel);
}

.contact-inner {
  text-align: center;
  max-width: 820px;
  margin: 0 auto;
}

.contact h2 {
  margin: 0 0 6px;
  font-size: clamp(1.6rem, 4vw, 2rem);
}

.muted {
  color: var(--muted);
  margin: 0 0 14px;
}

.links {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}

.links a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  padding-bottom: 2px;
}

.links a:hover,
.links a:focus-visible {
  border-color: var(--indigo);
  outline: none;
}

/* ===================== */
/* FOOTER                */
/* ===================== */
.footer {
  background: var(--panel);
  border-top: 1px solid var(--card-border);
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 16px;
  color: var(--muted);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

/* ===================== */
/* MEDIA QUERIES         */
/* ===================== */
@media (max-width: 1024px) {
  .projects-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .card.wide {
    grid-column: span 4;
  }
}

@media (max-width: 760px) {
  .welcome-inner {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .welcome-figure {
    order: -1;
    margin-bottom: 6px;
  }

  .avatar-ring {
    width: 220px;
    height: 220px;
  }

  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 130px;
    /* ▼ ancora più compatto su mobile */
  }

  .card,
  .card.wide {
    grid-column: span 2;
  }

  /* navbar responsive */
  .nav-inner {
    padding: 8px 12px;
  }

  .nav-links {
    gap: 14px;
  }

  .theme-icon {
    width: 36px;
    height: 36px;
    font-size: 1rem;
    margin-left: 12px;
  }
}