/* ===================================================
   Andrea Manente — Ingegnere Metallurgico
   style.css
   =================================================== */

/* --- Design Tokens --- */
:root {
  --color-dark: #1c2130;
  --color-light: #f4f3ef;
  --color-white: #ffffff;
  --color-bronze: #9a7c3f;
  --color-steel: #4d6475;
  --color-text: #1e1e1e;
  --color-muted: #6b7280;
  --color-divider: #ddd9d0;

  --font-heading: 'Playfair Display', Georgia, serif;
  --font-body: 'Source Serif 4', Georgia, serif;

  --base-size: 18px;
  --line-height: 1.7;
  --max-width: 900px;

  --nav-height: 64px;
  --section-padding: 80px 24px;
  --section-padding-sm: 48px 24px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: var(--base-size);
  line-height: var(--line-height);
  color: var(--color-text);
  background-color: var(--color-white);
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* --- Layout Utilities --- */
.container {
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: 24px;
  padding-right: 24px;
}

.section {
  padding: var(--section-padding);
}

.section--sm {
  padding: var(--section-padding-sm);
}

.section--dark {
  background-color: var(--color-dark);
  color: var(--color-white);
}

.section--light {
  background-color: var(--color-light);
  color: var(--color-text);
}

.section--white {
  background-color: var(--color-white);
  color: var(--color-text);
}

/* --- Typography --- */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.2;
}

h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.2rem); margin-bottom: 0.6em; }
h3 { font-size: clamp(1.1rem, 2.5vw, 1.4rem); margin-bottom: 0.4em; }

p {
  margin-bottom: 1em;
}

p:last-child {
  margin-bottom: 0;
}

.text-muted {
  color: var(--color-muted);
}

.text-muted--light {
  color: rgba(255, 255, 255, 0.6);
}

.text-bronze {
  color: var(--color-bronze);
}

.section-label {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-bronze);
  margin-bottom: 0.75rem;
  display: block;
}

.section-label--light {
  color: var(--color-bronze);
  opacity: 0.85;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 12px 28px;
  border-radius: 3px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--color-bronze);
  color: var(--color-white);
  border-color: var(--color-bronze);
}

.btn-primary:hover {
  background-color: #7e6430;
  border-color: #7e6430;
}

.btn-outline {
  background-color: transparent;
  color: var(--color-bronze);
  border-color: var(--color-bronze);
}

.btn-outline:hover {
  background-color: var(--color-bronze);
  color: var(--color-white);
}

.btn-outline--light {
  background-color: transparent;
  color: rgba(255, 255, 255, 0.85);
  border-color: rgba(255, 255, 255, 0.4);
}

.btn-outline--light:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.7);
  color: var(--color-white);
}

.btn-linkedin {
  background-color: var(--color-dark);
  color: var(--color-white);
  border-color: var(--color-dark);
}

.btn-linkedin:hover {
  background-color: #0a66c2;
  border-color: #0a66c2;
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

/* --- Navigation --- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--nav-height);
  background-color: var(--color-dark);
  transition: box-shadow 0.25s ease;
}

.nav.scrolled {
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.4);
}

.nav__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav__brand {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-white);
  letter-spacing: 0.01em;
  text-decoration: none;
  flex-shrink: 0;
}

.nav__brand:hover {
  color: var(--color-bronze);
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav__link {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  padding-bottom: 3px;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.nav__link:hover {
  color: var(--color-white);
}

.nav__link.active {
  color: var(--color-white);
  border-bottom-color: var(--color-bronze);
}

/* Hamburger button */
.nav__hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav__hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background-color: var(--color-white);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.nav__hamburger[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav__hamburger[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.nav__hamburger[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Mobile overlay */
.nav__overlay {
  display: none;
  position: fixed;
  top: var(--nav-height);
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--color-dark);
  z-index: 99;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
}

.nav__overlay.open {
  display: flex;
}

.nav__overlay .nav__link {
  font-size: 1.4rem;
  font-family: var(--font-heading);
  font-weight: 600;
}

/* --- Hero Section --- */
.hero {
  background-color: var(--color-dark);
  color: var(--color-white);
  min-height: 100vh;
  padding-top: calc(var(--nav-height) + 80px);
  padding-bottom: 80px;
  padding-left: 24px;
  padding-right: 24px;
  display: flex;
  align-items: center;
}

.hero__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 60px;
  align-items: center;
}

.hero__content {
  max-width: 560px;
}

.hero__title {
  font-family: var(--font-heading);
  font-size: clamp(2.4rem, 6vw, 3.8rem);
  font-weight: 600;
  line-height: 1.1;
  margin-bottom: 16px;
  color: var(--color-white);
}

.hero__subtitle {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-bronze);
  margin-bottom: 24px;
}

.hero__lead {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.7;
  margin-bottom: 0;
}

.hero__photo {
  flex-shrink: 0;
}

/* --- Photo Placeholder --- */
.photo-placeholder {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background-color: var(--color-steel);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 2.4rem;
  font-weight: 600;
  color: var(--color-white);
  letter-spacing: 0.04em;
  flex-shrink: 0;
  border: 3px solid rgba(154, 124, 63, 0.4);
}

/* --- Intro Section --- */
.intro__text {
  font-size: 1.05rem;
  max-width: 720px;
}

/* --- Book Cards --- */
.books-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-top: 40px;
}

.book-card {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 28px;
  border: 1px solid var(--color-divider);
  border-radius: 4px;
  background-color: var(--color-white);
  transition: box-shadow 0.2s ease;
}

.book-card:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.book-card--dark {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

.book-card--dark:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.book-cover-placeholder {
  aspect-ratio: 3 / 4;
  width: 100%;
  max-width: 140px;
  background-color: var(--color-divider);
  border: 1px solid var(--color-bronze);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.book-cover-placeholder--dark {
  background-color: rgba(255, 255, 255, 0.08);
  border-color: var(--color-bronze);
}

.book-cover-placeholder span {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  color: var(--color-muted);
  text-align: center;
  padding: 8px;
  line-height: 1.4;
}

.book-card__body {
  flex: 1;
}

.book-card__title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.35;
}

.book-card__meta {
  font-size: 0.82rem;
  color: var(--color-muted);
  margin-bottom: 4px;
  line-height: 1.5;
}

.book-card--dark .book-card__meta {
  color: rgba(255, 255, 255, 0.5);
}

.book-card__desc {
  font-size: 0.88rem;
  margin-top: 10px;
  margin-bottom: 16px;
  line-height: 1.6;
  color: #444;
}

.book-card--dark .book-card__desc {
  color: rgba(255, 255, 255, 0.7);
}

/* Full-detail book layout (libri.html) */
.book-detail {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 40px;
  align-items: start;
  padding: 40px 0;
  border-bottom: 1px solid var(--color-divider);
}

.book-detail:last-of-type {
  border-bottom: none;
}

.book-detail--dark-section {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.book-detail__title {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 12px;
  line-height: 1.3;
}

.book-detail__meta-table {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 16px;
  font-size: 0.88rem;
  margin-bottom: 20px;
}

.book-detail__meta-label {
  font-weight: 600;
  color: var(--color-muted);
  white-space: nowrap;
}

.book-detail--dark .book-detail__meta-label {
  color: rgba(255, 255, 255, 0.5);
}

.book-detail__meta-value {
  color: var(--color-text);
}

.book-detail--dark .book-detail__meta-value {
  color: rgba(255, 255, 255, 0.8);
}

.book-detail__desc {
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 24px;
}

/* --- Paper List --- */
.papers-list {
  margin-top: 32px;
}

.paper-item {
  display: flex;
  gap: 16px;
  padding: 20px 0;
  border-bottom: 1px solid var(--color-divider);
}

.paper-item:first-child {
  border-top: 1px solid var(--color-divider);
}

.paper-item__num {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  color: var(--color-bronze);
  font-weight: 600;
  min-width: 24px;
  padding-top: 2px;
}

.paper-item__title {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 4px;
  font-style: italic;
  line-height: 1.4;
}

.paper-item__journal {
  font-size: 0.82rem;
  color: var(--color-muted);
}

/* Papers preview (home) */
.papers-preview {
  margin-top: 32px;
}

.papers-preview .paper-item {
  border-bottom-color: var(--color-divider);
}

/* --- Section Header --- */
.section-header {
  padding-top: calc(var(--nav-height) + 60px);
  padding-bottom: 60px;
  padding-left: 24px;
  padding-right: 24px;
  background-color: var(--color-dark);
  color: var(--color-white);
}

.section-header__inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.section-header__title {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 600;
  color: var(--color-white);
}

.section-header__subtitle {
  margin-top: 12px;
  font-size: 1.05rem;
  color: rgba(255, 255, 255, 0.65);
  max-width: 600px;
}

/* --- Contact CTA Section --- */
.cta-section {
  text-align: center;
}

.cta-section h2 {
  margin-bottom: 12px;
}

.cta-section p {
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 0;
  font-size: 1rem;
}

.cta-section .btn-group {
  justify-content: center;
}

/* Contact page */
.contact-main {
  padding: var(--section-padding);
}

.contact-email-link {
  font-family: var(--font-heading);
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  font-weight: 600;
  color: var(--color-bronze);
  text-decoration: none;
  word-break: break-all;
  display: inline-block;
  margin: 8px 0 28px;
  transition: opacity 0.2s;
}

.contact-email-link:hover {
  opacity: 0.75;
}

.contact-intro {
  font-size: 1rem;
  color: var(--color-muted);
  margin-bottom: 32px;
  max-width: 540px;
}

/* --- Footer --- */
.footer {
  background-color: var(--color-dark);
  color: rgba(255, 255, 255, 0.55);
  padding: 36px 24px;
  font-size: 0.85rem;
  line-height: 1.6;
}

.footer__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.footer__name {
  font-family: var(--font-heading);
  color: rgba(255, 255, 255, 0.8);
  font-weight: 600;
  font-size: 0.95rem;
}

.footer__links {
  display: flex;
  gap: 20px;
  align-items: center;
}

.footer__link {
  color: rgba(255, 255, 255, 0.55);
  text-decoration: none;
  transition: color 0.2s;
}

.footer__link:hover {
  color: var(--color-bronze);
}

.footer__copy {
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.8rem;
  width: 100%;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* --- Section link (Vedi tutti) --- */
.section-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-bronze);
  text-decoration: none;
  margin-top: 32px;
  transition: gap 0.2s ease;
}

.section-link:hover {
  gap: 10px;
}

.section-link--light {
  color: var(--color-bronze);
}

/* --- Divider --- */
.divider {
  border: none;
  border-top: 1px solid var(--color-divider);
  margin: 0;
}

.divider--dark {
  border-top-color: rgba(255, 255, 255, 0.1);
}

/* --- Researchgate note --- */
.placeholder-note {
  font-size: 0.82rem;
  color: var(--color-muted);
  font-style: italic;
  margin-top: -8px;
  margin-bottom: 24px;
}

/* --- Responsive: Mobile-first adjustments --- */
@media (max-width: 768px) {
  :root {
    --section-padding: 56px 20px;
    --section-padding-sm: 36px 20px;
  }

  .container {
    padding-left: 20px;
    padding-right: 20px;
  }

  /* Nav */
  .nav__links {
    display: none;
  }

  .nav__hamburger {
    display: flex;
  }

  /* Hero */
  .hero {
    padding-top: calc(var(--nav-height) + 48px);
    padding-bottom: 56px;
    min-height: auto;
    padding-left: 20px;
    padding-right: 20px;
  }

  .hero__inner {
    grid-template-columns: 1fr;
    gap: 36px;
    text-align: center;
  }

  .hero__photo {
    order: -1;
    display: flex;
    justify-content: center;
  }

  .photo-placeholder {
    width: 140px;
    height: 140px;
    font-size: 1.8rem;
  }

  .btn-group {
    justify-content: center;
  }

  /* Books */
  .books-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .book-detail {
    grid-template-columns: 120px 1fr;
    gap: 24px;
  }

  /* Section header */
  .section-header {
    padding-top: calc(var(--nav-height) + 40px);
    padding-bottom: 40px;
    padding-left: 20px;
    padding-right: 20px;
  }

  /* Footer */
  .footer__inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  /* Book detail */
  .book-detail {
    grid-template-columns: 1fr;
  }

  .book-detail .book-cover-placeholder {
    max-width: 120px;
  }
}

@media (max-width: 480px) {
  .book-detail__meta-table {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .book-detail__meta-label {
    margin-top: 8px;
  }
}
