/* ============================================================
   CV + Portfolio — tema chiaro (crema + oro) e scuro (nero + oro)
   Palette Guild Wars 2 · Font: Inter (Google Fonts)

   Il tema si commuta con data-theme="dark" su <html> (bottone +
   localStorage). Qui sotto: :root = chiaro (default),
   [data-theme="dark"] = scuro. Tutti i componenti leggono le
   variabili, così entrambi i temi "girano" senza regole extra.

   Contrasto (verificato):
     Chiaro su crema  #F7F3EA  → inchiostro ≈15:1 · 2° ≈6.8:1 · oro-testo #8A5300 ≈5.7:1
     Scuro su nero    #000000  → bianco ≈21:1    · 2° ≈11:1    · oro-testo #E0952A ≈8.5:1
   L'oro puro #C37600 si usa solo per decori/filetti/titoli grandi.
   ============================================================ */

:root {
  /* --- chiaro (default): crema + oro --- */
  --bg:        #f7f3ea;  /* sfondo dominante */
  --bg-2:      #f1ebdd;  /* sfondo alternato */
  --surface:   #fffdf8;  /* pannelli */
  --ink:       #1a1613;  /* testo principale */
  --ink-2:     #5a5348;  /* testo secondario */
  --ink-3:     #8a8172;  /* bordi, etichette deboli */
  --oro:       #c37600;  /* GW2 Golden Lion: decori, filetti, titoli grandi */
  --oro-testo: #8a5300;  /* oro scurito: link/etichette (regge 4.5:1) */
  --oro-hover: #a86400;
  --bordo-oro:    rgba(195, 118, 0, 0.45);
  --filetto-oro:  rgba(195, 118, 0, 0.28);
  --bordo-neutro: rgba(120, 110, 90, 0.32);
  --sel-fg:    #1a1613;
  --ombra-1: 0 1px 2px rgba(26, 22, 19, 0.05), 0 6px 20px rgba(26, 22, 19, 0.06);
  --ombra-2: 0 2px 6px rgba(26, 22, 19, 0.08), 0 14px 34px rgba(195, 118, 0, 0.10);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  /* --- scuro: nero + oro --- */
  --bg:        #000000;
  --bg-2:      #0b0b0e;
  --surface:   #15151a;
  --ink:       #ffffff;
  --ink-2:     #b9bec8;
  --ink-3:     #6f7684;
  --oro:       #c37600;
  --oro-testo: #e0952a;  /* su nero l'oro può essere chiaro */
  --oro-hover: #f0a53a;
  --bordo-oro:    rgba(195, 118, 0, 0.55);
  --filetto-oro:  rgba(195, 118, 0, 0.34);
  --bordo-neutro: rgba(111, 118, 132, 0.34);
  --sel-fg:    #0b0b0e;
  --ombra-1: 0 10px 30px rgba(0, 0, 0, 0.55);
  --ombra-2: 0 2px 8px rgba(0, 0, 0, 0.6), 0 0 22px rgba(195, 118, 0, 0.18);
}

/* ------------------------------------------------------------
   Base
   ------------------------------------------------------------ */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--ink);
  background-color: var(--bg);
  /* due bagliori d'oro appena accennati: caldi su crema, vivi su nero */
  background-image:
    radial-gradient(1000px 460px at 50% -12%, rgba(195, 118, 0, 0.07), transparent 70%),
    radial-gradient(820px 520px at 92% 112%, rgba(195, 118, 0, 0.05), transparent 70%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

a {
  color: var(--oro-testo);
}
a:hover {
  color: var(--oro-hover);
}

:focus-visible {
  outline: 2px solid var(--oro);
  outline-offset: 2px;
}

::selection {
  background: var(--oro);
  color: var(--sel-fg);
}

/* scrollbar, in tinta col tema */
::-webkit-scrollbar {
  width: 11px;
}
::-webkit-scrollbar-track {
  background: var(--bg-2);
}
::-webkit-scrollbar-thumb {
  background: #d8cdb6;
  border: 2px solid var(--bg-2);
  border-radius: 7px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--oro);
}
[data-theme="dark"] ::-webkit-scrollbar-track {
  background: #0b0b0e;
}
[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: #34343c;
  border-color: #0b0b0e;
}

.wrap {
  max-width: 880px;
  margin-inline: auto;
  padding: clamp(1.2rem, 3.5vw, 2.2rem) clamp(0.9rem, 4vw, 2.4rem) 0;
}

main,
.footer {
  position: relative;
  z-index: 1;
}

/* ------------------------------------------------------------
   Cornice di pagina: doppio filetto d'oro, sobrio
   ------------------------------------------------------------ */
.frame {
  position: fixed;
  inset: 10px;
  border: 1px solid var(--filetto-oro);
  pointer-events: none;
  z-index: 5;
}
.frame::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid var(--filetto-oro);
}
@media (max-width: 700px) {
  .frame {
    display: none;
  }
}

/* ------------------------------------------------------------
   Navigazione: brand · pagine · lingua · toggle tema
   ------------------------------------------------------------ */
.site-nav {
  position: relative;
  max-width: 880px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem 1.2rem;
  flex-wrap: wrap;
  padding: 0.9rem clamp(0.9rem, 4vw, 2.4rem);
}
.site-nav::after {
  content: "";
  position: absolute;
  left: clamp(0.9rem, 4vw, 2.4rem);
  right: clamp(0.9rem, 4vw, 2.4rem);
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--filetto-oro) 20%, var(--filetto-oro) 80%, transparent);
}

.brand {
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.brand:hover {
  color: var(--oro-testo);
}

.nav-links {
  display: flex;
  gap: 0.3rem 1rem;
  margin-left: auto;
}
.nav-links a {
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
  text-decoration: none;
  padding: 0.35rem 0.1rem;
  border-bottom: 2px solid transparent;
  transition: color 0.18s, border-color 0.18s;
}
.nav-links a:hover {
  color: var(--oro-testo);
}
.nav-links a.is-active {
  color: var(--oro-testo);
  border-bottom-color: var(--oro);
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: 0.1rem;
}
.lang-switch a,
.lang-switch .is-unavailable {
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  text-decoration: none;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  transition: color 0.18s, background 0.18s;
}
.lang-switch a:hover {
  color: var(--oro-testo);
  background: var(--bg-2);
}
.lang-switch a.is-active {
  color: var(--oro-testo);
  background: rgba(195, 118, 0, 0.12);
}
.lang-switch .is-unavailable {
  cursor: not-allowed;
  opacity: 0.6;
}

/* switcher tema: chiaro / scuro / sistema (sole · luna · schermo) */
.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--bordo-neutro);
  background: var(--surface);
  border-radius: 10px;
  padding: 2px;
}
.theme-opt {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ink-3);
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.18s, background 0.18s;
}
.theme-opt svg {
  width: 16px;
  height: 16px;
}
.theme-opt:hover {
  color: var(--oro-testo);
}
.theme-opt[aria-pressed="true"] {
  background: rgba(195, 118, 0, 0.14);
  color: var(--oro);
}

/* ------------------------------------------------------------
   Hero — compatta, senza cornice "cartolina": solo testo centrato
   ------------------------------------------------------------ */
.hero {
  text-align: center;
  padding: clamp(1.5rem, 4vw, 2.3rem) 1rem 1.5rem;
  animation: reveal 0.5s ease-out both;
}

.kicker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  margin: 0;
  color: var(--ink-2);
  font-weight: 600;
  font-size: 0.76rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.kicker [aria-hidden] {
  color: var(--oro);
}
.kicker::before,
.kicker::after {
  content: "";
  width: 40px;
  height: 1px;
}
.kicker::before {
  background: linear-gradient(90deg, transparent, var(--bordo-oro));
}
.kicker::after {
  background: linear-gradient(90deg, var(--bordo-oro), transparent);
}

.hero-name {
  font-family: var(--font);
  font-weight: 700;
  font-size: clamp(1.7rem, 5.2vw, 2.6rem);
  letter-spacing: 0.01em;
  line-height: 1.12;
  color: var(--ink);
  margin: 0.8rem 0 0.8rem;
  /* alone d'oro tenue: "lucida" il nome senza colorarlo */
  text-shadow: 0 2px 26px rgba(195, 118, 0, 0.18);
}

.hero-tagline {
  max-width: 60ch;
  margin: 0 auto;
  color: var(--ink-2);
  font-size: 0.98rem;
}

/* contatti: placche con bordo neutro, oro solo all'hover */
.contact {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.7rem;
  justify-content: center;
  padding: 0;
  margin: 1.4rem 0 0;
}
.contact a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid var(--bordo-neutro);
  background: var(--surface);
  padding: 0.4rem 0.95rem;
  border-radius: 999px;
  transition: color 0.18s, border-color 0.18s, box-shadow 0.18s;
}
.contact a:hover {
  color: var(--oro-testo);
  border-color: var(--bordo-oro);
  box-shadow: 0 4px 14px rgba(195, 118, 0, 0.16);
}

/* ------------------------------------------------------------
   Sezioni: titolo oro-scuro con filetti d'oro ai lati
   ------------------------------------------------------------ */
.section {
  margin: clamp(2.4rem, 6vw, 3.4rem) 0;
}
.section-title {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0 0 1.6rem;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--oro-texto);
}
.section-title .orn {
  color: var(--oro);
  font-size: 0.62em;
}
.section-title::before,
.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
}
.section-title::before {
  background: linear-gradient(90deg, transparent, var(--filetto-oro));
}
.section-title::after {
  background: linear-gradient(90deg, var(--filetto-oro), transparent);
}

/* ------------------------------------------------------------
   Esperienza: timeline con filo d'oro e piombini a losanga
   ------------------------------------------------------------ */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 2px;
  background: linear-gradient(180deg, var(--bordo-oro), var(--filetto-oro) 60%, transparent);
}
.xp {
  position: relative;
  padding: 0 0 2.1rem 2rem;
}
.xp:last-child {
  padding-bottom: 0;
}
/* piombino a losanga: centrato sul filo, ben distanziato dal titolo */
.xp::before {
  content: "";
  position: absolute;
  left: 2.5px;
  top: 0.5rem;
  width: 13px;
  height: 13px;
  transform: rotate(45deg);
  background: var(--bg);
  border: 2px solid var(--oro);
  box-shadow: 0 0 0 3px var(--bg), 0 0 10px rgba(195, 118, 0, 0.3);
}
.xp-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem 1.2rem;
  flex-wrap: wrap;
}
.xp-role {
  margin: 0 0 0.2rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--ink);
}
.xp-company {
  margin: 0;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink-2);
}
.xp-period {
  font-weight: 700;
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  color: var(--oro-texto);
  border: 1px solid var(--filetto-oro);
  background: rgba(195, 118, 0, 0.08);
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  white-space: nowrap;
}
.xp-bullets {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
}
.xp-bullets li {
  position: relative;
  padding-left: 1.4rem;
  margin: 0.5rem 0;
  color: var(--ink-2);
}
.xp-bullets li::before {
  content: "✦";
  position: absolute;
  left: 0;
  top: 0.15rem;
  color: var(--oro);
  font-size: 0.72rem;
}

/* ------------------------------------------------------------
   Skill: etichette oro + chip su placche
   ------------------------------------------------------------ */
.skills {
  margin: 0;
  display: grid;
  gap: 1.1rem;
}
.skill-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem;
  align-items: start;
}
.skill-row dt {
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--oro-texto);
}
.skill-row dd {
  margin: 0;
}
.chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0;
  margin: 0;
}
.chips li {
  font-size: 0.9rem;
  color: var(--ink);
  border: 1px solid var(--bordo-neutro);
  background: var(--surface);
  padding: 0.32rem 0.85rem;
  border-radius: 999px;
}
@media (min-width: 560px) {
  .skill-row {
    grid-template-columns: 11rem 1fr;
    gap: 1rem;
  }
  .skill-row dt {
    padding-top: 0.35rem;
  }
}

/* ------------------------------------------------------------
   Progetti: carte con angoli in oro battuto
   ------------------------------------------------------------ */
.portfolio-intro {
  margin: -0.4rem 0 1.8rem;
  max-width: 60ch;
  color: var(--ink-2);
  font-size: 1rem;
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.2rem;
}
.cards.showcase {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.4rem;
}
.card {
  position: relative;
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--filetto-oro);
  padding: 1.6rem 1.7rem;
  box-shadow: var(--ombra-1);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.card::before,
.card::after {
  content: "";
  position: absolute;
  width: 15px;
  height: 15px;
  border-color: var(--oro);
  border-style: solid;
}
.card::before {
  top: -1px;
  left: -1px;
  border-width: 2px 0 0 2px;
}
.card::after {
  bottom: -1px;
  right: -1px;
  border-width: 0 2px 2px 0;
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--bordo-oro);
  box-shadow: var(--ombra-2);
}
.card h3 {
  margin: 0 0 0.6rem;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.card p {
  margin: 0;
  font-size: 0.97rem;
  color: var(--ink-2);
}

/* ------------------------------------------------------------
   Lingue parlate (la Formazione usa ora la timeline condivisa)
   ------------------------------------------------------------ */

.spoken {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 2.4rem;
}
.spoken li {
  display: flex;
  align-items: baseline;
  gap: 0.85rem;
}
.spoken-name {
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
}
.spoken-level {
  font-size: 0.92rem;
  color: var(--ink-2);
  border-left: 2px solid var(--filetto-oro);
  padding-left: 0.85rem;
}

/* ------------------------------------------------------------
   Footer
   ------------------------------------------------------------ */
.footer {
  text-align: center;
  padding: 3rem 1rem 3.4rem;
  color: var(--ink-3);
}
.footer .flame {
  color: var(--oro);
  letter-spacing: 0.6em;
  font-size: 0.8rem;
}
.footer p {
  margin: 0.6rem 0 0;
  font-weight: 600;
  color: var(--ink-2);
}

/* ------------------------------------------------------------
   Movimento: un ingresso morbido + hover brevi
   ------------------------------------------------------------ */
@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  body,
  .hero {
    animation: none;
    transition: none;
  }
  .card,
  .contact a,
  .nav-links a,
  .lang-switch a,
  .theme-opt {
    transition: none;
  }
}

/* ------------------------------------------------------------
   Stampa: nero su bianco, decorazioni e toggle rimossi
   ------------------------------------------------------------ */
@media print {
  body {
    background: #fff !important;
    color: #000;
  }
  .frame,
  .site-nav,
  .footer .flame {
    display: none !important;
  }
  .hero-name {
    color: #000;
    text-shadow: none;
  }
  .kicker,
  .section-title,
  .skill-row dt,
  .xp-bullets li::before,
  a {
    color: #000 !important;
  }
  .hero-tagline,
  .xp-role,
  .xp-company,
  .xp-bullets li,
  .card h3,
  .card p,
  .spoken-name,
  .spoken-level,
  .chips li,
  .contact a,
  .portfolio-intro {
    color: #1a1a1a;
    background: none;
    border-color: #999;
  }
  .xp-period {
    color: #333;
    border-color: #999;
    background: none;
  }
  .card,
  .card::before,
  .card::after {
    background: none;
    border-color: #999;
    box-shadow: none;
  }
}
