/* ==== THEME (green-forward, modern) ==== */
:root {
  --bg: #07130d;
  --bg-alt: #0c1d14;
  --text: #ecf7f1;
  --muted: #b7d3c4;
  --accent: #55e3a6;
  --accent-2: #2ec27e;
  --card: #0f261a;
  --border: #113322;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:
    radial-gradient(1200px 600px at 10% -10%, #0e291d 0%, transparent 60%),
    radial-gradient(800px 400px at 90% 0%, #0b2319 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* Reusable layout */
.container { width: min(1120px, 92%); margin: 0 auto; }
.section { padding: 80px 0; }
.section.alt { background: linear-gradient(180deg, var(--bg-alt), #0a1b12); }
.section h2 { font-size: clamp(1.6rem, 3.6vw, 2.2rem); margin: 0 0 16px; }
.section .section-lead { color: var(--muted); margin-top: 0; }

/* ================= HEADER / NAV ================= */
.site-header {
  position: sticky; top: 0; z-index: 1000;
  background: rgba(7,19,13,.75);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.header-inner {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
}

.brand { color: var(--text); text-decoration: none; display: grid; line-height: 1.2; }
.brand__title { font-weight: 800; letter-spacing: .2px; }
.brand__subtitle { font-size: .85rem; color: var(--muted); }

/* Nav */
.nav-toggle { display: none; }
.nav-toggle-btn { display: none; cursor: pointer; padding: 8px; }
.nav-toggle-btn span { display: block; width: 26px; height: 2px; background: var(--text); margin: 6px 0; }

.site-nav { display: flex; justify-content: center; align-items: center; }

.site-nav ul {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  margin: 0;
  padding: 0;
  flex-wrap: nowrap;
}

.site-nav a {
  color: var(--text);
  text-decoration: none;
  padding: 6px 8px;
  border-radius: 10px;
  text-align: center;
  line-height: 1.15;
  display: inline-block;
  min-width: 92px;
}

.site-nav a:hover,
.site-nav a:focus { background: #143826; outline: none; }

/* ================= HERO ================= */
.hero { padding: 100px 0 40px; border-bottom: 1px solid var(--border); }

.hero__inner {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 28px;
  align-items: center;
}

.hero h1 { margin: 0 0 8px; font-size: clamp(2rem, 5vw, 3rem); }
.accent { color: var(--accent); }
.lead { color: var(--muted); font-size: 1.06rem; }

.hero__cta { margin-top: 18px; display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 700;
  text-decoration: none;
  color: #002b1a;
  background: var(--accent);
  box-shadow: var(--shadow);
  cursor: pointer;
  border: 0;
}

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

.hero__media { min-height: 200px; display: grid; place-items: center; }

.hero__shape {
  width: 240px; height: 240px; border-radius: 24px;
  background:
    radial-gradient(120px 120px at 40% 35%, var(--accent), transparent 60%),
    radial-gradient(120px 120px at 70% 65%, var(--accent-2), transparent 60%),
    #0d2419;
  filter: saturate(1.2) contrast(1.1) drop-shadow(0 12px 32px rgba(0,0,0,.4));
}

/* ================= GRID & CARDS ================= */
.grid { display: grid; gap: 22px; }
.grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }

.cards .card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.card h3 { margin-top: 0; }

/* ================= LISTS ================= */
.checklist { padding-left: 1.1rem; }
.checklist li { margin-bottom: 6px; }

.bullets { padding-left: 1.1rem; }
.bullets li { margin-bottom: 8px; }
.bullets.tight li { margin-bottom: 6px; }

.meta { color: var(--muted); font-size: .95rem; }

/* ================= PUBLICATIONS ================= */
.pub-years { display: grid; gap: 16px; }
.year-block.hidden { display: none; }
.pub-year { margin: 8px 0 4px; color: var(--accent); font-size: 1.1rem; }

.pub-titles {
  list-style: none;
  margin: 0 0 8px;
  padding: 0 0 0 1rem;
  border-left: 2px solid var(--border);
}

.pub-titles li { margin: 6px 0; }

.pub-titles a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px dashed var(--accent-2);
}

.pub-titles a:hover { color: var(--accent); border-bottom-color: transparent; }
.pub-actions { margin-top: 10px; }

/* ================= TEACHING TABLE ================= */
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 14px; }
.table { width: 100%; border-collapse: collapse; }

.table th,
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); }

.table th { text-align: left; background: #0f2a1c; }

/* ================= CONTACTS & FOOTER ================= */
.contact-list { list-style: none; padding: 0; margin: 0; }
.contact-list li { margin-bottom: 8px; }

.site-footer {
  background: #06110c;
  border-top: 1px solid var(--border);
  padding: 48px 0 16px;
}

.footer-title { margin: 0 0 10px; }
.address { font-style: normal; color: var(--muted); }

.social { list-style: none; padding: 0; margin: 14px 0 0; display: flex; gap: 12px; flex-wrap: wrap; }
.social a { color: var(--accent); text-decoration: none; }

.map-wrap { width: 100%; }

.map-sizer {
  position: relative;
  padding-top: 56.25%;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #0b1f15;
}

.map { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.footer-bottom {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.to-top { color: var(--accent); text-decoration: none; }

/* ================= HELPERS ================= */
.collapsed-hidden { display: none; }

/* Skip link */
.skip-link {
  position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden;
}
.skip-link:focus {
  left: 10px; top: 10px; width: auto; height: auto; padding: 8px 10px;
  background: var(--accent); color: #012214; border-radius: 8px; z-index: 9999;
}

/* ================= CONTACTS EXTRAS ================= */
#contacts a,
.cv-link {
  color: #00ff99;
  text-decoration: none;
  font-weight: 500;
}

#contacts a:hover,
.cv-link:hover {
  color: #66ffcc;
  text-decoration: underline;
}

/* ================= CAROUSEL (GENERIC) ================= */
.carousel {
  position: relative;
  max-width: 100%;
  margin: 20px auto;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: var(--shadow);
  background: #0b1f15;
}

.carousel-track { display: flex; transition: transform .6s ease; }

.carousel-slide {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.5);
  color: white;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 50%;
}

.carousel-btn:hover { background: rgba(0,0,0,0.7); }
.carousel-btn.prev { left: 10px; }
.carousel-btn.next { right: 10px; }

/* FOTO: riempi il container, altezza fissa */
.carousel img {
  width: 100%;
  height: 300px;
  object-fit: cover;
  border-radius: 12px;
}

/* TESTO: una slide=100% larghezza, contenuto centrato e leggibile */
.text-carousel .carousel-slide { min-width: 100%; padding: 16px; }

.text-carousel .text-slide {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
}

.text-carousel h4 { margin: 0 0 6px; }
.text-carousel p { margin: 0; }

/* ================= RESPONSIVE ================= */
@media (max-width: 1120px) {
  .site-nav ul { gap: 22px; }
  .site-nav a { min-width: 88px; }
}

@media (max-width: 980px) {
  .hero__inner { grid-template-columns: 1fr; text-align: center; }
  .hero__cta { justify-content: center; }
}

@media (max-width: 860px) {
  .nav-toggle-btn { display: block; }
  .site-nav {
    position: absolute; right: 0; left: 0; top: 60px;
    background: #07160f; border-bottom: 1px solid var(--border);
    display: none;
  }
  .site-nav ul { flex-direction: column; gap: 8px; padding: 12px; }
  .nav-toggle:checked ~ .site-nav { display: block; }
  .grid.two, .grid.three { grid-template-columns: 1fr; }
}

/* Frecce SOLO per il carosello di testo (AI Projects) */
.text-carousel { padding-bottom: 40px; /* spazio per i controlli */ }

.text-carousel .carousel-btn {
  top: auto;        /* niente centratura verticale */
  bottom: 10px;     /* spostate in basso */
  transform: none;  /* rimuove translateY(-50%) */
  font-size: 1.6rem;/* un po' più piccole */
  background: rgba(0,0,0,0.35);
  z-index: 2;
}

.text-carousel .carousel-btn.prev { left: 10px; }
.text-carousel .carousel-btn.next { right: 10px; }

.text-carousel .carousel-btn:hover { background: rgba(0,0,0,0.55); }

/* ===== CONTACT FORM ===== */
#contacts form {
  display: flex;
  flex-direction: column; /* campi uno sotto l’altro */
  gap: 15px;
  max-width: 600px;      /* larghezza massima */
  margin: 20px auto 0;   /* centrato */
}

#contacts label {
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text);
}

#contacts input,
#contacts textarea {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  color: #000;
}

#contacts textarea { min-height: 120px; resize: vertical; }

#contacts button {
  align-self: flex-start; /* bottone allineato a sinistra */
  padding: 10px 20px;
  font-size: 1rem;
  border: none;
  border-radius: 6px;
  background-color: #00cc88;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s ease-in-out;
}

#contacts button:hover { background-color: #00aa77; }

/* Teaching table: links */
.table a {
  color: #00ff99;        /* verde come i contatti */
  text-decoration: none;
  font-weight: 500;
}

.table a:hover {
  color: #66ffcc;        /* verde più chiaro al passaggio */
  text-decoration: underline;
}

.hero__photo {
  width: 240px;
  height: 240px;
  object-fit: cover;      /* adatta la foto senza deformarla */
  border-radius: 24px;    /* stesso stile stondato */
  box-shadow: 0 12px 32px rgba(0,0,0,.4); /* effetto ombra */
  filter: saturate(1.1) contrast(1.05);   /* leggero boost colori */
}

.teaching-hidden { display: none; }

/* About video */
.video-wrap {
  margin: 28px auto 0;
  max-width: 720px;
}
.video-embed {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0b1f15;
  border-radius: 12px;
  box-shadow: var(--shadow);
  display: block;
}
.video-caption {
  color: var(--muted);
  text-align: center;
  margin-top: 8px;
  font-size: .95rem;
}
