/* ============================================
   Filippo Cavaleri — Personal Academic Site
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700&family=Inter:wght@300;400;500;600&display=swap');

/* --- Reset & Custom Properties --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --text:           #18181b;
  --text-secondary: #71717a;
  --text-muted:     #a1a1aa;
  --accent:         #1e3a5f;
  --accent-hover:   #2d5491;
  --bg:             #ffffff;
  --bg-subtle:      #fafaf9;
  --border:         #e4e4e7;
  --award:          #783b0f;
  --award-bg:       #fef3c7;
  --award-border:   #fde68a;

  --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --max-w: 1160px;
  --nav-h: 60px;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* --- Navigation --- */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

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

.nav-name {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.nav-name:hover {
  color: var(--accent);
  text-decoration: none;
}

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

.nav-links a {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 0.15s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
  text-decoration: none;
}

/* --- Main Content --- */
main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2.5rem 2rem 4rem;
  min-height: calc(100vh - var(--nav-h));
}

/* --- Home Page --- */
.home-grid {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 3.5rem;
  align-items: start;
}

.profile-photo-wrap {
  position: sticky;
  top: calc(var(--nav-h) + 2rem);
}

.profile-photo {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 6px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.10);
  display: block;
  object-fit: cover;
  object-position: center top;
  margin: 0 auto;
}

.profile-placeholder {
  width: 100%;
  aspect-ratio: 3 / 4;
  background: var(--bg-subtle);
  border: 2px dashed var(--border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: center;
  padding: 1rem;
}

/* Icon-based social links under photo */
.social-icons {
  margin-top: 1rem;
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 0.35rem;
}

.icon-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.95rem;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.icon-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--bg-subtle);
  text-decoration: none;
}

/* --- News Section --- */
.news-section {
  border-left: 1px solid #dce9f8;
  border-right: 1px solid #dce9f8;
  background: #fafcff;
  position: relative;
  overflow: hidden;
  margin-top: 0.4rem;
}

.news-section::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2rem;
  background: linear-gradient(to bottom, transparent, #fafcff);
  pointer-events: none;
}

.news-text a {
  color: #1a5cbe;
  font-weight: 500;
}

.news-list {
  list-style: none;
  max-height: 7.5rem;
  overflow-y: auto;
  padding: 0.25rem 1rem;
}

.news-list li {
  display: flex;
  gap: 0.9rem;
  font-size: 0.875rem;
  color: var(--text);
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  line-height: 1.5;
  align-items: baseline;
  overflow: hidden;
}

.news-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.news-list li:last-child {
  border-bottom: none;
}

.news-date {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  letter-spacing: 0.03em;
  padding-top: 0.05rem;
  min-width: 4.5rem;
}

.bio-name {
  font-family: var(--serif);
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 0.4rem;
}

.bio-title {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 1.75rem;
}

.bio-title strong {
  color: var(--text);
  font-weight: 500;
}

.announcement-badge {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: #eef4fc;
  color: #1a5cbe;
  border: 1px solid #b8d0f0;
  border-left: 3px solid #1a5cbe;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.65rem 1rem;
  border-radius: 6px;
  margin-bottom: 1.25rem;
  line-height: 1.4;
}

.bio-body {
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 1.25rem;
  line-height: 1.75;
}

.interests-label {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
  padding-left: 0.75rem;
  border-left: 2px solid var(--accent);
}

.interests-list {
  list-style: none;
  margin-bottom: 1.5rem;
}

.interests-list li {
  font-size: 0.875rem;
  color: var(--text-secondary);
  padding: 0.15rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.interests-list li::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.social-link {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent);
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.social-link:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  text-decoration: none;
}

/* --- Section & Subsection Headers --- */
.page-title {
  font-family: var(--sans);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 2rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.subsection-label {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-top: 3rem;
  margin-bottom: 0;
}

/* --- Paper List --- */
.paper-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0.75rem;
}

.paper {
  padding: 1.5rem 1.25rem 1.5rem 1.1rem;
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  border-radius: 6px;
  background: var(--bg);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  transition: background 0.18s, border-left-color 0.18s, box-shadow 0.18s;
  cursor: default;
}

.paper:hover {
  background: var(--bg-subtle);
  border-left-color: var(--accent);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.paper-title {
  font-size: 1rem;
  font-weight: 600;
  color: #1a5cbe;
  margin-bottom: 0.3rem;
  line-height: 1.4;
}

.paper-title a {
  color: #1a5cbe;
  text-decoration: none;
  background-image: linear-gradient(#1a4fa8, #1a4fa8);
  background-size: 0% 1.5px;
  background-repeat: no-repeat;
  background-position: left bottom;
  transition: background-size 0.3s ease, color 0.25s ease;
}

.paper-title a:hover {
  color: #1a4fa8;
  background-size: 100% 1.5px;
  text-decoration: none;
}

.paper-authors {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.paper-awards {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  margin-bottom: 0.6rem;
}

.award-tag {
  font-size: 0.75rem;
  font-weight: 500;
  font-style: italic;
  color: #810c0cd4;
  letter-spacing: 0.01em;
}

.award-tag + .award-tag::before {
  content: '·';
  margin: 0 0.45rem;
  color: var(--text-muted);
  font-style: normal;
}

.paper-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.paper-link {
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--accent);
  padding: 0.22rem 0.75rem;
  border: 1.5px solid var(--accent);
  border-radius: 2rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: background 0.15s, color 0.15s;
}

.paper-link:hover {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

.abstract-toggle {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: color 0.15s;
  font-family: var(--sans);
}

.abstract-toggle:hover {
  color: var(--accent);
}

.abstract-toggle .arrow {
  display: inline-block;
  font-style: normal;
  line-height: 1;
}

.abstract-body {
  display: none;
  margin-top: 0.9rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.75;
  padding-left: 1rem;
  border-left: 3px solid var(--border);
}

.abstract-body.open {
  display: block;
}

/* --- Teaching --- */
.teaching-block {
  margin-bottom: 3.5rem;
}

.teaching-institution {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.2rem;
  padding-left: 0.75rem;
  border-left: 2px solid var(--accent);
}

.teaching-role {
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding-left: 0.75rem;
  margin-bottom: 1.25rem;
}

.teaching-sublabel {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}


.course-list-clean {
  list-style: none;
}

.course-entry {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.course-entry:last-child {
  border-bottom: none;
}

.course-name-clean {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1a5cbe;
  margin-bottom: 0.15rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.course-level {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 0.05rem 0.4rem;
  border-radius: 3px;
}

.course-meta {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* --- Discussions --- */
.discussion-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.discussion {
  padding: 1.5rem 1.25rem 1.5rem 1.1rem;
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  border-radius: 6px;
  background: var(--bg);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  transition: background 0.18s, border-left-color 0.18s, box-shadow 0.18s;
  cursor: default;
}

.discussion:hover {
  background: var(--bg-subtle);
  border-left-color: var(--accent);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.discussion-venue {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  margin-top: 0.35rem;
  margin-bottom: 0.35rem;
}

.discussion-paper-title {
  font-size: 1rem;
  font-weight: 600;
  color: #1a5cbe;
  margin-bottom: 0;
  line-height: 1.4;
}

.discussion-paper-title a {
  color: #1a5cbe;
  text-decoration: none;
  background-image: linear-gradient(#1a4fa8, #1a4fa8);
  background-size: 0% 1.5px;
  background-repeat: no-repeat;
  background-position: left bottom;
  transition: background-size 0.3s ease, color 0.25s ease;
}

.discussion-paper-title a:hover {
  color: #1a4fa8;
  background-size: 100% 1.5px;
  text-decoration: none;
}

.discussion-authors {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.6rem;
}

/* --- CV Page --- */
.cv-page {
  text-align: center;
  padding: 5rem 2rem;
}

.cv-page p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.cv-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.75rem 1.75rem;
  border-radius: 5px;
  transition: background 0.15s;
}

.cv-download-btn:hover {
  background: var(--accent-hover);
  color: #fff;
  text-decoration: none;
}

/* --- Footer --- */
footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 2rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* --- Responsive --- */
@media (max-width: 680px) {
  .home-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .profile-photo-wrap {
    position: static;
    max-width: 250px;
  }

  .bio-name {
    font-size: 1.75rem;
  }

  .nav-links {
    gap: 1.25rem;
  }

  .nav-links a {
    font-size: 0.72rem;
  }

  .course-table td:nth-child(2) {
    display: none;
  }
}
