/*
  VARIANTE EDITORIALE CHIARA — per provarla, sostituisci i valori in [data-theme="light"] con questi:
  --bg: #faf8f3;
  --surface: #f2efe8;
  --surface2: #e8e4da;
  --border: #d0c9bb;
  --text: #1a1a1a;
  --muted: #5a5449;
  --nav-bg: rgba(250, 248, 243, 0.9);
  Accento verde bottiglia: --teal: #1e4d3e; --teal-light: #2d7a62; --teal-dark: #143529;
*/

:root {
  --teal: #0f7b6c;
  --teal-light: #22c4aa;
  --teal-dark: #0a5c50;
  --amber: #d4a574;
  --bg: #0a1210;
  --surface: #0f1c1a;
  --surface2: #162421;
  --border: #1a2d29;
  --text: #e2ede9;
  --muted: #7a9e97;
  --nav-bg: rgba(10, 18, 16, 0.85);
  --font: 'IBM Plex Sans', sans-serif;
  --font-display: 'JetBrains Mono', monospace;
  --mono: 'JetBrains Mono', monospace;
}

[data-theme="light"] {
  --bg: #f4faf8;
  --surface: #ffffff;
  --surface2: #eaf4f1;
  --border: #c8e0da;
  --text: #0d2420;
  --muted: #4d7a72;
  --nav-bg: rgba(244, 250, 248, 0.9);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

/* ── NAV ── */
nav {
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 100;
  backdrop-filter: blur(12px);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.nav-logo {
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--amber);
  text-decoration: none;
  letter-spacing: 0.04em;
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: color 0.2s;
}

.nav-links a:hover { color: var(--teal-light); }

.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.45rem;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, border-color 0.2s;
  flex-shrink: 0;
}

.theme-toggle:hover {
  color: var(--teal-light);
  border-color: var(--teal);
}

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

/* ── HERO ── */
#hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 6rem 2rem 4rem;
  position: relative;
  overflow: hidden;
}

#hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 70% 40%, rgba(212,165,116,0.08) 0%, transparent 70%),
    radial-gradient(ellipse 40% 40% at 20% 70%, rgba(15,123,108,0.06) 0%, transparent 60%);
  pointer-events: none;
}

.hero-inner {
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  position: relative;
  display: flex;
  align-items: center;
  gap: 4rem;
}

.hero-content {
  flex: 1;
  min-width: 0;
}

.hero-avatar {
  flex-shrink: 0;
  width: 200px;
  height: 200px;
}

.hero-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--teal);
  box-shadow: 0 0 0 6px rgba(15,123,108,0.1);
}

.hero-tag {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--amber);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.hero-tag::before {
  content: '';
  display: block;
  width: 2rem;
  height: 1px;
  background: var(--amber);
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 7vw, 5rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 1.2rem;
}

h1 span { color: var(--amber); }

.hero-subtitle {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 560px;
  margin-bottom: 2.5rem;
  line-height: 1.7;
}

.hero-ctas {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.5rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
}

.btn-primary {
  background: var(--teal);
  color: #fff;
  border: 1px solid var(--teal);
}

.btn-primary:hover {
  background: var(--teal-light);
  border-color: var(--teal-light);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--muted);
  transform: translateY(-1px);
}

/* ── SECTIONS ── */
section {
  padding: 5rem 2rem;
}

.container {
  max-width: 900px;
  margin: 0 auto;
}

.section-label {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--amber);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 0.4rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 3rem;
  letter-spacing: -0.03em;
  line-height: 1.08;
}

/* ── ABOUT ── */
#about { background: var(--surface); }

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}

.about-text p {
  color: var(--muted);
  line-height: 1.8;
  font-size: 0.95rem;
}

.about-text strong { color: var(--text); }

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.stat-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.2rem;
}

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--amber);
  font-family: var(--mono);
  line-height: 1;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── EXPERIENCE ── */
.timeline {
  position: relative;
  padding-left: 2.5rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--amber), transparent 85%);
}

.timeline-item {
  position: relative;
  margin-bottom: 3rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: calc(-2.5rem - 6px);
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--teal);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 4px rgba(15,123,108,0.2);
}

.timeline-item.current::before {
  background: var(--amber);
  width: 14px;
  height: 14px;
  left: calc(-2.5rem - 7px);
  top: 3px;
  box-shadow: 0 0 0 4px rgba(212,165,116,0.25);
  animation: pulse 3s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(212,165,116,0.25); }
  50% { box-shadow: 0 0 0 8px rgba(212,165,116,0.07); }
}

.job-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.job-role {
  font-size: 1.05rem;
  font-weight: 600;
}

.job-period {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--teal);
  background: rgba(15,123,108,0.1);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  white-space: nowrap;
}

.job-duration {
  font-size: 0.68rem;
  opacity: 0.6;
  margin-left: 0.35em;
}

.job-company {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.8rem;
}

.job-company a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: color 0.2s, border-color 0.2s;
}

.job-company a:hover {
  color: var(--text);
  border-color: var(--amber);
}

.job-bullets {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.job-bullets li {
  font-size: 0.875rem;
  color: var(--muted);
  padding-left: 1rem;
  position: relative;
  line-height: 1.6;
}

.job-bullets li::before {
  content: '›';
  position: absolute;
  left: 0;
  color: var(--amber);
}

/* ── SKILLS ── */
#skills { background: var(--surface); }

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.2rem;
}

.skill-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.2rem 1.4rem;
  transition: border-color 0.2s, transform 0.2s;
}

.skill-card:hover {
  border-color: var(--teal);
  transform: translateY(-2px);
}

.skill-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--teal-light);
  background: rgba(15,123,108,0.1);
  border: 1px solid rgba(15,123,108,0.2);
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
}

/* ── EDUCATION ── */
.edu-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.8rem;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.5rem;
  align-items: start;
}

.edu-icon {
  width: 44px;
  height: 44px;
  background: rgba(15,123,108,0.12);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.edu-school {
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.edu-degree {
  font-size: 0.85rem;
  color: var(--amber);
  margin-bottom: 0.2rem;
}

.edu-period {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.8rem;
}

.edu-text {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.7;
}

/* ── CERTS ── */
.certs-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}

.cert-badge {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.8rem 1.2rem;
  text-decoration: none;
  transition: border-color 0.2s;
}

.cert-badge:hover { border-color: var(--teal); }

.cert-badge-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.cert-badge-issuer {
  font-size: 0.75rem;
  color: var(--muted);
}

/* ── EXTRA ── */
#extra { background: var(--surface); }

.extra-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1.5rem;
}

.extra-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.4rem;
}

.extra-card-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--amber);
  margin-bottom: 0.8rem;
  font-family: var(--mono);
}

.extra-items {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.extra-item {
  font-size: 0.875rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.extra-item::before {
  content: '·';
  color: var(--amber);
  font-size: 1.2rem;
  line-height: 1;
}

/* ── FOOTER ── */
footer {
  border-top: 1px solid var(--border);
  padding: 2rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  font-family: var(--mono);
}

.footer-now {
  max-width: 520px;
  margin: 0 auto 2rem;
  padding: 1.4rem 1.6rem 1.6rem;
  border-top: 1px solid var(--border);
  text-align: left;
}

.footer-now-title {
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 0.9rem;
}

.footer-now p {
  font-size: 0.82rem;
  line-height: 1.75;
  color: var(--muted);
  font-family: var(--font);
  opacity: 0.85;
}

footer a {
  color: var(--teal);
  text-decoration: none;
}

/* ── CONTACT ── */
#contact { background: var(--bg); }

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.7fr;
  gap: 3rem;
  align-items: start;
}

.contact-info {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.contact-info p {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.8;
}

.contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--mono);
}

.form-group input,
.form-group textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  resize: vertical;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--muted);
  opacity: 0.5;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15,123,108,0.1);
}

.form-group input[aria-invalid="true"],
.form-group textarea[aria-invalid="true"] {
  border-color: #e05252;
}

.form-group textarea {
  min-height: 130px;
}

.fs-field-error:not(:empty) {
  font-size: 0.75rem;
  color: #e05252;
  font-family: var(--mono);
}

[data-fs-error]:not(:empty) {
  background: rgba(224,82,82,0.08);
  border: 1px solid rgba(224,82,82,0.25);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  color: #e05252;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

[data-fs-success][data-fs-active] {
  display: block !important;
  background: rgba(15,123,108,0.1) !important;
  border: 1px solid rgba(15,123,108,0.3) !important;
  border-radius: 8px !important;
  padding: 1rem 1.2rem !important;
  color: var(--teal-light) !important;
  font-size: 0.9rem !important;
  margin-bottom: 1rem;
  font-family: var(--mono);
}

[data-fs-success][data-fs-active] ~ form {
  display: none;
}

[data-fs-submit-btn]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.cert-badge--featured {
  border-color: rgba(15,123,108,0.35);
  background: rgba(15,123,108,0.06);
}

.certs-row--secondary {
  margin-top: 0.6rem;
}

.cert-badge--secondary {
  padding: 0.5rem 0.9rem;
  opacity: 0.65;
}

.cert-badge--secondary .cert-badge-title {
  font-size: 0.78rem;
}

.cert-badge--secondary .cert-badge-issuer {
  font-size: 0.68rem;
}

.cert-wip {
  font-size: 0.65rem;
  color: var(--teal);
  background: rgba(15,123,108,0.1);
  border: 1px solid rgba(15,123,108,0.2);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-family: var(--mono);
  vertical-align: middle;
  margin-left: 0.3rem;
}

.footer-update {
  margin-top: 0.5rem;
  font-size: 0.7rem;
  opacity: 0.5;
}

/* ── RESPONSIVE ── */
@media (max-width: 700px) {
  .about-grid { grid-template-columns: 1fr; }
  .extra-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  nav .nav-links { display: none; }
  .edu-card { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .hero-inner { flex-direction: column-reverse; gap: 2rem; text-align: center; }
  .hero-avatar { width: 140px; height: 140px; }
  .hero-tag { justify-content: center; }
  .hero-ctas { justify-content: center; }
}
