/* Variables */
:root {
  --bg: #fcfaf7;
  --ink: #1f2c46;
  --muted: #4b5563;
  --accent: #b97c2f;
  --soft: #f3ecdf;
  --card: rgba(31, 44, 70, 0.06);
  --blue: #224993;
}

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

/* Base */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg);
  color: var(--ink);
  line-height: 1.6;
}

a {
  color: var(--ink);
  text-decoration-color: rgba(31, 44, 70, 0.35);
}

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

/* Header */
.site-header {
  background-color: var(--bg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  font-size: 1.1rem;
}

.navbar-brand span:last-child {
  border-left: 2px solid #234a8c;
  padding-left: 10px;
  color: #234a8c;
  line-height: 1;
}

.bocconi-logo {
  height: 20px;
  width: auto;
  vertical-align: middle;
  transform: translateY(-2px);
}

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

.nav-link {
  text-decoration: none;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.2s;
}

.nav-link:hover,
.nav-link.active {
  color: var(--ink);
}

/* Hamburger Menu Button */
.menu-toggle {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--muted);
}

.menu-toggle:hover {
  color: var(--ink);
}

.navbar {
  position: relative;
}

.nav-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--bg);
  flex-direction: column;
  gap: 0;
  padding: 0;
  display: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  min-width: 180px;
  z-index: 100;
}

.nav-menu.open {
  display: flex;
}

.nav-menu li {
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.nav-menu li:first-child {
  border-top: none;
}

.nav-menu .nav-link {
  display: block;
  padding: 0.75rem 1.25rem;
}

/* Homepage Hero */
.home-hero {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 4rem;
  max-width: 1100px;
  margin: 0 auto;
  padding: 4rem 2rem;
  align-items: start;
}

.home-photo {
  position: sticky;
  top: 100px;
  overflow: hidden;
  border-radius: 16px;
}

.avatar-img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: center -50%;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(31, 44, 70, 0.12);
  transform: scale(1.55);
}

.home-content {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding-top: 0.5rem;
}

.home-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--muted);
}

.home-org {
  color: #234a8c;
}

.home-separator {
  color: rgba(31, 44, 70, 0.25);
}

.home-name {
  color: var(--ink);
}

.home-role {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
  margin-top: 0.25rem;
}

.home-bio p {
  font-size: 1.1rem;
  line-height: 1.7;
  color: var(--muted);
}

.bio-keyword {
  color: var(--blue);
}

.home-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.keyword {
  padding: 0.4rem 0.9rem;
  background: var(--soft);
  color: var(--blue);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 999px;
  border: 1px solid rgba(31, 44, 70, 0.08);
}

.cv-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: var(--ink);
  color: #ffffff;
  font-weight: 600;
  font-size: 0.85rem;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.2s ease;
  margin-top: 0.25rem;
}

.cv-btn:hover {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 10px 30px rgba(185, 124, 47, 0.25);
  transform: translateY(-2px);
}

.home-social {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #ffffff;
  color: var(--muted);
  transition: all 0.2s ease;
  text-decoration: none;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.06),
    0 4px 16px rgba(0, 0, 0, 0.04),
    inset 0 -1px 2px rgba(0, 0, 0, 0.02);
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.social-link:hover {
  background: var(--accent);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow:
    0 4px 12px rgba(185, 124, 47, 0.3),
    0 8px 24px rgba(185, 124, 47, 0.15);
}

.social-icon {
  width: 22px;
  height: 22px;
}

.social-icon-img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  filter: grayscale(1) brightness(0.55);
  transition: filter 0.2s ease;
}

.ssrn-icon {
  width: 44px;
  height: 28px;
}

.social-link:hover .social-icon-img {
  filter: brightness(0) invert(1);
}

.section-divider {
  max-width: 1100px;
  margin: 0 auto 2rem;
  border: none;
  border-top: 1px solid rgba(31, 44, 70, 0.12);
}

/* Home Research Section */
.home-research {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem 4rem;
}

/* Home Teaching Section */
.home-teaching {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem 4rem;
}

.section-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 0.15rem 0;
  scroll-margin-top: 80px;
}

.subsection-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 0.25rem 0;
}

.research-page .subsection-title + ul,
.teaching-page .subsection-title + ul {
  margin-top: 0;
  margin-bottom: 1.5rem;
  padding-top: 0;
}

/* Page Content */
.page-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 3rem 2rem;
}

.page-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 2rem;
  color: var(--ink);
}

/* Research Page */
.research-page h2 {
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
}

.research-page .papers-grid {
  margin-bottom: 1.5rem;
}

.papers-grid {
  display: grid;
  gap: 2rem;
}

.paper-card {
  display: grid;
  gap: 0.9rem;
  padding: 1.5rem;
  background: var(--card);
  border: 1px solid rgba(31, 44, 70, 0.12);
  border-radius: 14px;
}

.paper-card h3 {
  margin: 0;
  font-size: 1.4rem;
  line-height: 1.25;
  color: var(--ink);
}

.paper-meta {
  margin: 0;
  color: var(--muted);
  font-weight: 500;
}

.paper-meta a {
  font-weight: 600;
}

.paper-block {
  display: grid;
  gap: 0.45rem;
  padding: 1rem 1.1rem;
  background: var(--soft);
  border-radius: 12px;
  border: 1px solid rgba(31, 44, 70, 0.08);
}

.paper-label {
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
}

.label-triangle {
  color: var(--accent);
  font-size: 0.65em;
  margin-right: 0.35rem;
}

.paper-block p {
  margin: 0;
  line-height: 1.6;
  color: var(--muted);
}

.paper-note {
  font-style: italic;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  border: 1px solid rgba(31, 44, 70, 0.08);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 1rem;
}

th, td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(31, 44, 70, 0.08);
  text-align: left;
}

th {
  background: rgba(35, 74, 140, 0.1);
  color: #234a8c;
  font-weight: 600;
}

tr:last-child td {
  border-bottom: none;
}

/* Teaching Page */
.teaching-page h2 {
  font-size: 1.5rem;
  margin: 2rem 0 1rem;
  color: var(--ink);
}

.teaching-page h2:first-child {
  margin-top: 0;
}

.teaching-page ul,
.research-page ul {
  list-style: disc;
  padding-left: 1.5rem;
  color: var(--muted);
}

.teaching-page li,
.research-page li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.teaching-page hr {
  border: none;
  border-top: 1px solid rgba(31, 44, 70, 0.12);
  margin: 2rem 0;
}

/* Contact Page */
.contact-page {
  line-height: 2;
}

.contact-page h2 {
  font-size: 1.5rem;
  margin: 2rem 0 0.25rem;
  color: var(--ink);
}

.contact-page h2:first-child {
  margin-top: 0;
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Scroll to top button */
.scroll-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--muted);
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 99;
}

.scroll-top.visible {
  opacity: 1;
  visibility: visible;
}

.scroll-top:hover {
  background: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(185, 124, 47, 0.3);
}

/* Responsive - Tablet (1024px) */
@media (max-width: 1024px) {
  .home-hero {
    grid-template-columns: 180px 1fr;
    gap: 2.5rem;
    padding: 3rem 1.5rem;
  }

  .home-role {
    font-size: 1.9rem;
  }

  .section-title {
    font-size: 1.75rem;
  }

  .page-content {
    padding: 2.5rem 1.5rem;
  }

  .home-research,
  .home-teaching {
    padding: 0 1.5rem 3rem;
  }
}

/* Responsive - Mobile (768px) */
@media (max-width: 768px) {
  .home-hero {
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
    padding: 2.5rem 1.25rem;
  }

  .home-photo {
    position: static;
    max-width: 200px;
    margin: 0 auto;
  }

  .home-header {
    justify-content: center;
    flex-wrap: wrap;
    font-size: 1rem;
  }

  .home-role {
    font-size: 1.65rem;
  }

  .home-bio p {
    font-size: 1rem;
  }

  .home-keywords {
    justify-content: center;
  }

  .home-social {
    justify-content: center;
  }

  .social-link {
    width: 46px;
    height: 46px;
  }

  .navbar {
    padding: 0.75rem 1.25rem;
  }


  .section-title {
    font-size: 1.5rem;
  }

  .page-title {
    font-size: 1.65rem;
  }

  .page-content {
    padding: 2rem 1.25rem;
  }

  .home-research,
  .home-teaching {
    padding: 0 1.25rem 2.5rem;
  }

  .paper-card {
    padding: 1.25rem;
  }

  .paper-card h3 {
    font-size: 1.2rem;
  }

  .paper-block {
    padding: 0.85rem 1rem;
  }

  /* Responsive tables */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  th, td {
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
    white-space: nowrap;
  }

  .scroll-top {
    bottom: 1.25rem;
    right: 1.25rem;
    width: 44px;
    height: 44px;
  }

  .cv-btn {
    align-self: center;
  }
}

/* Responsive - Small Mobile (480px) */
@media (max-width: 480px) {
  .home-hero {
    padding: 2rem 1rem;
    gap: 1.5rem;
  }

  .home-photo {
    max-width: 160px;
  }

  .home-header {
    font-size: 0.9rem;
    gap: 0.4rem;
  }

  .home-role {
    font-size: 1.4rem;
  }

  .home-bio p {
    font-size: 0.95rem;
  }

  .keyword {
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
  }

  .social-link {
    width: 42px;
    height: 42px;
  }

  .social-icon {
    width: 18px;
    height: 18px;
  }

  .social-icon-img {
    width: 20px;
    height: 20px;
  }

  .ssrn-icon {
    width: 36px;
    height: 24px;
  }

  .navbar {
    padding: 0.6rem 1rem;
  }

  .navbar-brand {
    font-size: 1rem;
    gap: 8px;
  }

  .bocconi-logo {
    height: 16px;
  }

  .section-title {
    font-size: 1.35rem;
  }

  .page-title {
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
  }

  .page-content {
    padding: 1.5rem 1rem;
  }

  .home-research,
  .home-teaching {
    padding: 0 1rem 2rem;
  }

  .paper-card {
    padding: 1rem;
    gap: 0.75rem;
  }

  .paper-card h3 {
    font-size: 1.1rem;
  }

  .paper-meta {
    font-size: 0.9rem;
  }

  .paper-block p {
    font-size: 0.9rem;
  }

  .teaching-page h2,
  .research-page h2,
  .contact-page h2 {
    font-size: 1.25rem;
  }

  .site-footer {
    padding: 1.5rem 1rem;
    font-size: 0.85rem;
  }

  .scroll-top {
    bottom: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
  }
}
