/* ==========================================================================
   Stile ispirato al design Apple — Pulito, essenziale, tipografico
   ========================================================================== */

:root {
  --bg: #ffffff;
  --bg-alt: #f5f5f7;
  --surface: #ffffff;
  --surface-alt: #f5f5f7;
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --border: rgba(0, 0, 0, 0.08);
  --nav-bg: rgba(255, 255, 255, 0.72);
  --pill-bg: rgba(0, 0, 0, 0.045);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.04);
  --shadow-card-hover: 0 12px 32px rgba(0, 0, 0, 0.08);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-pill: 980px;
  --max-width: 980px;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Helvetica Neue", Arial, sans-serif;
  --ease-apple: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
  --bg: #000000;
  --bg-alt: #111113;
  --surface: #1d1d1f;
  --surface-alt: #1d1d1f;
  --text: #f5f5f7;
  --text-secondary: #a1a1a6;
  --text-tertiary: #86868b;
  --accent: #2997ff;
  --accent-hover: #40a4ff;
  --border: rgba(255, 255, 255, 0.12);
  --nav-bg: rgba(29, 29, 31, 0.72);
  --pill-bg: rgba(255, 255, 255, 0.08);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.35);
  --shadow-card-hover: 0 12px 32px rgba(0, 0, 0, 0.55);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --bg-alt: #111113;
    --surface: #1d1d1f;
    --surface-alt: #1d1d1f;
    --text: #f5f5f7;
    --text-secondary: #a1a1a6;
    --text-tertiary: #86868b;
    --accent: #2997ff;
    --accent-hover: #40a4ff;
    --border: rgba(255, 255, 255, 0.12);
    --nav-bg: rgba(29, 29, 31, 0.72);
    --pill-bg: rgba(255, 255, 255, 0.08);
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.35);
    --shadow-card-hover: 0 12px 32px rgba(0, 0, 0, 0.55);
  }
}

/* Reset & Base */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.5;
  letter-spacing: -0.015em;
  color: var(--text);
  background-color: var(--bg);
  transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, p, ul {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 96px 0;
}

.section-alt {
  background-color: var(--bg-alt);
}

.eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.section-header {
  margin-bottom: 48px;
}

.section-title {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.08;
}

/* Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 52px;
  background-color: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: var(--max-width);
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav-brand {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-links a {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  transition: color 0.2s ease;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--text);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.theme-toggle:hover {
  color: var(--text);
  background-color: var(--pill-bg);
}

/* Mostra sole in dark mode, luna in light mode */
.icon-sun {
  display: none;
}

.icon-moon {
  display: block;
}

[data-theme="dark"] .icon-sun {
  display: block;
}

[data-theme="dark"] .icon-moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun {
    display: block;
  }
  :root:not([data-theme="light"]) .icon-moon {
    display: none;
  }
}

.btn-nav-pdf {
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 14px;
  border: none;
  border-radius: var(--radius-pill);
  background-color: var(--accent);
  color: #ffffff;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.15s ease;
}

.btn-nav-pdf:hover {
  background-color: var(--accent-hover);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s var(--ease-apple);
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background-color: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--accent-hover);
}

.btn-secondary {
  background-color: transparent;
  color: var(--accent);
  border-color: var(--accent);
}

.btn-secondary:hover {
  background-color: rgba(0, 113, 227, 0.08);
}

/* Hero */
.hero {
  padding: 108px 0 96px;
  text-align: center;
}

.hero-container {
  max-width: 780px;
}

.avatar-ring {
  width: 88px;
  height: 88px;
  margin: 0 auto 28px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, var(--bg-alt), var(--pill-bg));
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.hero-title {
  font-size: clamp(40px, 7vw, 68px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.05;
  margin-bottom: 24px;
}

.hero-subtitle {
  font-size: clamp(18px, 2.2vw, 22px);
  font-weight: 400;
  line-height: 1.45;
  color: var(--text-secondary);
  max-width: 640px;
  margin: 0 auto 36px;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-bottom: 28px;
}

.hero-meta {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-tertiary);
}

/* Bento Grid */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.bento-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.bento-wide {
  grid-column: span 2;
}

.bento-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  margin-bottom: 14px;
}

.bento-heading {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin-bottom: 12px;
}

.bento-stat {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 10px;
}

.bento-text {
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* Timeline / Esperienza */
.timeline {
  display: flex;
  flex-direction: column;
}

.timeline-item {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 32px;
  padding: 36px 0;
  border-top: 1px solid var(--border);
}

.timeline-item:last-child {
  border-bottom: 1px solid var(--border);
}

.timeline-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.timeline-date {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.timeline-location {
  font-size: 14px;
  color: var(--text-tertiary);
}

.timeline-role {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.timeline-company {
  font-size: 16px;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 14px;
}

.timeline-desc {
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.timeline-list {
  padding-left: 18px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 15px;
}

/* Skills */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.skill-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-card);
}

.skill-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.skill-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background-color: var(--pill-bg);
  color: var(--text);
}

/* Projects */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.project-card {
  background-color: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  transition: transform 0.35s var(--ease-apple), box-shadow 0.35s var(--ease-apple);
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
}

.project-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  margin-bottom: 10px;
}

.project-title {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.025em;
  margin-bottom: 12px;
}

.project-desc {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.project-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.project-stack {
  font-size: 13px;
  color: var(--text-tertiary);
}

.project-link {
  font-size: 15px;
  font-weight: 500;
  color: var(--accent);
  white-space: nowrap;
}

.project-link:hover {
  text-decoration: underline;
}

/* Education & Languages */
.edu-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.edu-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-card);
}

.edu-degree {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 10px;
  margin-bottom: 6px;
}

.edu-school {
  font-size: 16px;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 12px;
}

.edu-note {
  font-size: 15px;
  color: var(--text-secondary);
}

.lang-list {
  list-style: none;
  padding: 0;
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lang-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
}

.lang-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.lang-level {
  color: var(--text-secondary);
  font-size: 14px;
}

/* Passioni e Interessi */
.interests-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.interest-card {
  background-color: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: transform 0.35s var(--ease-apple), box-shadow 0.35s var(--ease-apple);
}

.interest-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
}

.interest-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}

.interest-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.interest-desc {
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* Contact */
.contact-section {
  text-align: center;
}

.contact-container {
  max-width: 640px;
}

.contact-title {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.08;
  margin-bottom: 16px;
}

.contact-subtitle {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

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

.copy-feedback {
  min-height: 22px;
  margin-top: 14px;
  font-size: 14px;
  color: var(--accent);
}

.social-links {
  margin-top: 20px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  color: var(--text-secondary);
}

.social-links a:hover {
  color: var(--text);
  text-decoration: underline;
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  font-size: 13px;
  color: var(--text-tertiary);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.back-to-top:hover {
  color: var(--text);
}

/* Scroll Reveal */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease-apple), transform 0.7s var(--ease-apple);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

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

/* Responsive */
@media (max-width: 900px) {
  .bento-grid,
  .interests-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .skills-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .nav-links {
    display: none;
  }
  .section {
    padding: 68px 0;
  }
  .hero {
    padding: 76px 0 64px;
  }
  .bento-grid,
  .projects-grid,
  .edu-grid,
  .interests-grid {
    grid-template-columns: 1fr;
  }
  .bento-wide {
    grid-column: span 1;
  }
  .timeline-item {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 28px 0;
  }
  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
}

/* Stampa / Esportazione PDF pulita */
@media print {
  :root,
  [data-theme="dark"] {
    --bg: #ffffff;
    --bg-alt: #ffffff;
    --surface: #ffffff;
    --surface-alt: #ffffff;
    --text: #111111;
    --text-secondary: #444444;
    --text-tertiary: #666666;
    --border: #dddddd;
    --pill-bg: #f2f2f2;
    --shadow-card: none;
  }

  .navbar,
  .hero-cta,
  .contact-actions,
  .copy-feedback,
  .back-to-top {
    display: none !important;
  }

  body {
    font-size: 11pt;
  }

  .section {
    padding: 20pt 0;
  }

  .hero {
    padding: 12pt 0 20pt;
    text-align: left;
  }

  .avatar-ring {
    display: none;
  }

  .hero-subtitle,
  .hero-meta {
    margin-left: 0;
    justify-content: flex-start;
  }

  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }

  .bento-card,
  .skill-card,
  .project-card,
  .edu-card,
  .interest-card {
    box-shadow: none;
    break-inside: avoid;
  }

  .timeline-item {
    break-inside: avoid;
    padding: 14pt 0;
  }
}
