/* ==========================================================================
   Pietro Calabrese — Personal website
   Foglio di stile condiviso da index.html e teaching.html
   ========================================================================== */

:root {
  --unipi-blue: #04477B;
  --light-gray: #f6f7f8;
  --text-color: #222;
  --accent: #2A70A3;
  --content-width: 1000px;
}

/* Reset & base */
* {
  box-sizing: border-box
}

body {
  margin: 0;
  font-family: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  background: var(--light-gray);
  /* Questo sarà sovrascritto dal background XAI */
  color: var(--text-color);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;

  /* --- NUOVO: Background XAI per tutto il BODY --- */
  background-image: url('../img/tei6rytei6rytei6.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  /* L'immagine rimane fissa mentre la pagina scorre */
  background-repeat: no-repeat;
  /* Overlay per ammorbidire l'immagine e migliorare la leggibilità */
  background-color: rgba(246, 247, 248, 0.92);
  /* Usa light-gray con opacità */
  background-blend-mode: overlay;
  /* Miscela l'immagine con il colore di sfondo opaco */
  /* --- FINE NUOVO BACKGROUND BODY --- */
}

/* NAVBAR */
nav {
  position: sticky;
  top: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  background: var(--unipi-blue);
  color: white;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

.logo {
  font-weight: 700;
  letter-spacing: .4px
}

.nav-links {
  display: flex;
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: white;
  text-decoration: none;
  font-weight: 600;
  opacity: 0.98;
}

.nav-links a:hover {
  opacity: 0.85
}

.menu-toggle {
  display: none;
  background: none;
  border: 0;
  color: white;
  font-size: 1.25rem;
}

/* HERO HEADER (full-width background image) */
header {
  margin-bottom: 100px;
  position: relative;
  height: 62vh;
  min-height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: white;
  /* use local optimized header image if present, otherwise fall back to Unsplash */
  background:
    linear-gradient(rgba(4, 71, 123, 0.55), rgba(4, 71, 123, 0.55)),
    url('../img/ai_header.png') center/cover no-repeat;
}

/* Fallback remote (keeps behavior if ai_header.png missing) */
@supports (background-image: url('../img/ai_header.png')) {
  /* nothing - modern browsers will use local file first */
}

/* If you want a remote fallback (optional), uncomment the line below and remove the @supports above:
header{ background:
  linear-gradient(rgba(4,71,123,0.55), rgba(4,71,123,0.55)),
  url('https://images.unsplash.com/photo-1504384308090-c894fdcc538d?auto=format&fit=crop&w=1600&q=80') center/cover no-repeat; }
*/

.hero-content {
  max-width: var(--content-width);
  padding: 0 1rem
}

.hero-content h1 {
  font-size: 2.4rem;
  margin: 0 0 .3rem;
  color: #fff
}

.hero-content p {
  margin: 0;
  font-weight: 300;
  max-width: 820px;
  margin-left: auto;
  margin-right: auto;
  color: rgba(255, 255, 255, 0.95)
}

/* MAIN LAYOUT */
main {
  max-width: var(--content-width);
  margin: -3.5rem auto 3rem;
  padding: 0 1rem
}

section {
  background: #fff;
  border-radius: 12px;
  padding: 1.8rem 2rem;
  margin-bottom: 1.6rem;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.06);
  opacity: 1;
}

h2 {
  margin: 0 0 1rem 0;
  color: var(--unipi-blue);
  font-size: 1.25rem;
}

/* --- INIZIO MODIFICHE SEZIONE ABOUT --- */

/* Nuovo div per il background dell'header di 'About' */
.about-header-background {
  /* Stesso background dell'header */
  background:
    linear-gradient(rgba(4, 71, 123, 0.55), rgba(4, 71, 123, 0.55)),
    url('../img/ai_header.png') center/cover no-repeat;
  color: white;
  /* Testo bianco su sfondo scuro */

  /* Margini negativi per "rompere" il padding della .section */
  margin: -1.8rem -2rem 0 -2rem;

  /* Padding per ricreare lo spazio interno */
  padding: 1.8rem 2rem 1.8rem 2rem;

  /* Arrotonda solo gli angoli superiori per combaciare */
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;

  /* Spazio tra questo blocco e i paragrafi <p> sottostanti */
  margin-bottom: 1.8rem;
}

/* Assicura che l'H2 dentro questo blocco sia bianco e centrato */
.about-header-background h2 {
  color: white;
  text-align: center;
}

/* Stile per gli elementi centrati (immagine e tag) */
#about .about-centered {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

/* Modifica il bordo e l'ombra dell'immagine per lo sfondo scuro */
.about-header-background .about-centered img {
  width: 170px;
  height: 170px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  border: 4px solid rgba(255, 255, 255, 0.2);
}

/* Modifica il tag accademico per lo sfondo scuro */
.about-header-background .academic-tag {
  display: inline-block;
  margin-top: .35rem;
  padding: .3rem .6rem;
  border-radius: 8px;
  font-weight: 600;
  color: white;
  /* Testo bianco */
  background: rgba(255, 255, 255, 0.15);
  /* Sfondo traslucido */
  font-size: .9rem;
}

/* I paragrafi <p> rimangono con lo stile originale (su sfondo bianco) */
#about p {
  max-width: 820px;
  margin: 0.8rem auto;
  color: #333;
  font-size: 1.02rem;
  line-height: 1.7;
  text-align: justify;
}

/* --- FINE MODIFICHE SEZIONE ABOUT --- */


/* PROJECTS (cards) */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.2rem;
  align-items: start;
}

.project {
  background: linear-gradient(180deg, #fff, #fcfcff);
  border-radius: 10px;
  overflow: hidden;
  transition: transform .28s ease, box-shadow .28s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.project img {
  width: 100%;
  /*height: 170px;*/
  object-fit: contain;
  transition: transform .36s ease
}

.project:hover {
  transform: translateY(-6px);
  box-shadow: 0 14px 30px rgba(4, 71, 123, 0.12)
}

.project:hover img {
  transform: scale(1.04)
}

.project-content {
  padding: 0.95rem 1rem 1.1rem;
  flex: 1
}

.project-content h3 {
  margin: 0;
  color: var(--unipi-blue);
  font-size: 1.05rem
}

.project-content p {
  margin: .55rem 0 0;
  color: #444;
  font-size: .95rem
}

/* PUBLICATIONS */
.publication {
  margin-bottom: 1.1rem
}

.pub-link {
  display: inline-block;
  margin-top: .6rem;
  color: var(--unipi-blue);
  font-weight: 600;
  text-decoration: none
}

.pub-link:hover {
  color: var(--accent);
  text-decoration: underline
}

/* CONTACT */
.contact-info {
  margin-bottom: 1rem;
  color: #333;
  font-size: .98rem
}

.contact-info i {
  color: var(--unipi-blue);
  margin-right: .5rem
}

form {
  display: grid;
  gap: .9rem
}

input,
textarea {
  width: 100%;
  padding: .8rem;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  font-size: 1rem;
}

button {
  background: var(--unipi-blue);
  color: white;
  border: 0;
  padding: .85rem 1rem;
  border-radius: 8px;
  font-weight: 700;
}

button:hover {
  background: var(--accent);
  cursor: pointer
}

/* FOOTER */
footer {
  background: var(--unipi-blue);
  color: white;
  padding: 2rem 1rem;
  text-align: center;
  margin-top: 2rem;
}

.social {
  display: flex;
  justify-content: center;
  gap: .6rem;
  margin-bottom: .8rem
}

.social a {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  text-decoration: none;
  transition: transform .2s ease, box-shadow .25s ease, background .25s ease;
}

.social a:hover {
  transform: scale(1.08);
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.35), 0 0 28px rgba(42, 112, 163, 0.28);
  background: rgba(255, 255, 255, 0.28);
}

footer p {
  margin: 0;
  font-size: .92rem;
  opacity: 0.95
}

/* responsive nav dropdown */
@media (max-width:820px) {
  .nav-links {
    display: none;
    /* Stili per il menu dropdown */
    flex-direction: column;
    position: absolute;
    top: 100%;
    /* Posiziona sotto la navbar */
    left: 0;
    right: 0;
    background: var(--unipi-blue);
    padding: 1rem;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
  }

  /* Classe .active per mostrare il menu (aggiunta via JS) */
  .nav-links.active {
    display: flex;
  }

  .menu-toggle {
    display: block
  }

  nav {
    padding: .7rem 1rem
  }
}

@media (max-width:700px) {
  header {
    height: 52vh
  }

  .hero-content h1 {
    font-size: 1.9rem
  }

  /* Correzione per img dentro il nuovo background */
  .about-header-background .about-centered img {
    width: 150px;
    height: 150px
  }

  .project img {
    height: 150px
  }
}

/* ---------Tesi ----------*/
#theses h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.5;
}

.thesis-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.thesis-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.thesis-title {
  font-weight: 600;
}

.thesis-info {
  font-size: 0.85rem;
  opacity: 0.55;
}


/* --- STILI SPECIFICI PAGINA TEACHING --- */
.page-header-background {
  background:
    linear-gradient(rgba(4, 71, 123, 0.55), rgba(4, 71, 123, 0.55)),
    url('../img/ai_header.png') center/cover no-repeat;
  color: white;
  margin: -1.8rem -2rem 1.8rem -2rem;
  padding: 1.8rem 2rem;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  text-align: center;
}

.page-header-background h2 {
  color: white;
  margin-bottom: .4rem;
}

.page-header-background p {
  margin: 0 auto;
  max-width: 720px;
  color: rgba(255, 255, 255, 0.92);
  font-size: .98rem;
}

/* Tabella corsi */
.table-wrapper {
  overflow-x: auto;
}

table.courses {
  width: 100%;
  border-collapse: collapse;
  font-size: .95rem;
}

table.courses th {
  text-align: left;
  padding: .7rem .6rem;
  color: var(--unipi-blue);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom: 2px solid rgba(4, 71, 123, 0.15);
  white-space: nowrap;
}

table.courses td {
  padding: .7rem .6rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  vertical-align: top;
  color: #333;
}

table.courses tbody tr:hover {
  background: rgba(4, 71, 123, 0.04);
}

.course-name {
  font-weight: 600;
  color: var(--unipi-blue);
}

.role-badge {
  display: inline-block;
  padding: .2rem .55rem;
  border-radius: 999px;
  background: rgba(4, 71, 123, 0.09);
  color: var(--unipi-blue);
  font-size: .8rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Lista materiali / seminari */
.teaching-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.teaching-list li {
  padding: .7rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: .15rem;
}

.teaching-list li:last-child {
  border-bottom: 0;
}

.item-title {
  font-weight: 600;
}

.item-info {
  font-size: .85rem;
  opacity: .55;
}

/* Link attivo nella navbar */
.nav-links a.active {
  text-decoration: underline;
  text-underline-offset: 5px;
}

@media (max-width:700px) {
  .page-header-background {
    margin: -1.8rem -1.2rem 1.4rem -1.2rem;
    padding: 1.5rem 1.2rem;
  }
}
