/* ============================================================
   Base
   ============================================================ */
:root {
  color-scheme: light;
  --bg: #f5f6f7;
  --surface: #ffffff;
  --text: #111315;
  --muted: #5b6166;
  --link: #0a66c2;
  --border: #e4e7eb;
  --shadow: 0 20px 40px rgba(17, 19, 21, 0.08);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --accent1: #f2b705;
  --accent2: #ff4d3d;
  --accent3: #7dd9e8;
  --accent4: #4d6dff;
  --accent5: #44c271;
}
*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue",
    Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  /* overflow-x: hidden; <-- RIMOSSO: Anti-pattern. L'overflow è stato risolto alla radice nei layout. */
}
img {
  max-width: 100%;
  display: block;
}
a {
  color: var(--link);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
p {
  margin: 0 0 1.1em;
}
h1,
h2,
h3,
h4 {
  margin: 0 0 0.6em;
  font-weight: 700;
  color: var(--text);
}
.container {
  width: min(1120px, 92vw);
  margin: 0 auto;
}
.container.narrow {
  width: min(780px, 90vw);
}
main {
  padding-block: 24px 80px;
}
.section-title {
  font-size: 22px;
  letter-spacing: 0.3px;
  text-transform: none;
}
.lede {
  color: var(--muted);
  font-size: 18px;
  max-width: 60ch;
  margin: 0;
}
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
/* ============================================================
   Header / Navigation
   ============================================================ */
[data-navbar] {
  display: block;
  min-height: 72px;
}
[data-navbar] > .navbar {
  position: relative;
}
.navbar {
  position: sticky;
  top: 0;
  z-index: 80;
  background: rgba(245, 246, 247, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(228, 231, 235, 0.9);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 700;
}
.brand .brand-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
}
.brand .role {
  font-weight: 500;
  font-size: 14px;
  color: var(--muted);
}
.brand-link {
  color: inherit;
}
.navlinks {
  display: flex;
  gap: 28px;
  align-items: center;
  white-space: nowrap;
}
.navlinks a {
  color: var(--text);
  font-weight: 500;
  position: relative;
}
.navlinks a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -8px;
  height: 2px;
  background: var(--accent1);
}
.hamburger {
  display: none;
  background: transparent;
  border: 0;
  color: var(--text);
  padding: 6px;
  cursor: pointer;
}
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 19, 21, 0.35);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 60;
}
.backdrop[hidden] {
  display: none;
}
.backdrop.is-open {
  opacity: 1;
}
.drawer {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  transform: translateY(-120%);
  transition: transform 0.24s ease;
  z-index: 160;
  width: 100%;
  background: rgba(245, 246, 247, 0.97);
  border-bottom: 1px solid rgba(228, 231, 235, 0.85);
  box-shadow: 0 20px 45px rgba(15, 17, 19, 0.16);
  will-change: transform;
  max-height: 90vh;
  overflow: hidden;
}
.drawer::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at top,
    rgba(255, 255, 255, 0.94),
    rgba(245, 246, 247, 0.92)
  );
  z-index: -1;
}
.drawer.is-open {
  transform: translateY(0) !important;
}
.drawer-inner {
  max-width: 1120px;
  margin: 0 auto;
  width: 92vw;
  padding: 24px 0 28px;
  display: grid;
  gap: 24px;
  overflow-y: auto;
  max-height: calc(90vh - 48px);
  overscroll-behavior: contain;
}
@supports (height: 100dvh) {
  .drawer {
    max-height: 90dvh;
  }
  .drawer-inner {
    max-height: calc(90dvh - 48px);
  }
}

.drawer-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.drawer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  flex: 1 1 auto;
}
.drawer-brand .brand-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
}
.drawer-brand .role {
  font-weight: 500;
  font-size: 14px;
  color: var(--muted);
}
.drawer-brand .brand-link {
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}
.drawer-brand .brand-link:hover {
  text-decoration: none;
}
.drawer-close {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  color: var(--text);
  padding: 6px;
  cursor: pointer;
}
.drawer-nav {
  display: grid;
  gap: 12px;
  padding-bottom: 8px;
}
.drawer-nav a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid rgba(17, 19, 21, 0.08);
  text-decoration: none;
  transition: color 0.2s ease, padding-left 0.2s ease;
}
.drawer-nav a:last-child {
  border-bottom: none;
}
.drawer-nav a:hover {
  color: var(--accent2);
  padding-left: 6px;
}
.drawer-nav a[aria-current="page"] {
  color: var(--accent1);
  position: relative;
  padding-left: 6px;
}
.drawer-nav a[aria-current="page"]::before {
  content: "";
  width: 40px;
  height: 2px;
  background: var(--accent1);
  position: absolute;
  left: 0;
  bottom: -2px;
}
body.no-scroll {
  overflow: hidden;
  height: 100%;
}
html.no-scroll {
  overflow: hidden;
  height: 100%;
}
/* ============================================================
   Hero (home)
   ============================================================ */
.hero {
  padding: 96px 0 40px;
}
.hero-grid {
  display: grid;
  gap: 48px;
  grid-template-columns: minmax(280px, 440px) minmax(0, 1fr);
  align-items: start;
}
.hero-copy {
  display: grid;
  gap: 18px;
  min-width: 0;
}
.hero-copy .lede {
  max-width: 48ch;
}
.portrait {
  width: 100%;
  max-width: 350px;
  aspect-ratio: 1/1;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: var(--shadow);
  margin: 0 auto;
}
.hero h1 {
  font-size: clamp(44px, 6vw, 86px);
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}
.hero h2 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 16px;
}
.lede {
  margin-bottom: 24px;
}
.cta-circles {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
}
.circle-btn {
  width: clamp(120px, 18vw, 180px);
  height: clamp(120px, 18vw, 180px);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  text-transform: uppercase;
  color: #141618;
  background: var(--accent1);
  box-shadow: var(--shadow);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.circle-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 24px 42px rgba(17, 19, 21, 0.18);
}
.circle-btn.red {
  background: var(--accent2);
  color: #111;
}
.circle-btn.teal {
  background: var(--accent3);
  color: #0b1f24;
}
/* ============================================================
   Generic cards
   ============================================================ */
.section {
  padding: 40px 0 60px;
}
.section h3 {
  margin-bottom: 20px;
  font-size: 24px;
}
.cards {
  display: grid;
  gap: 24px;
  /* Questa regola è già responsive! Non serve sovrascriverla nelle media query */
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 48px rgba(15, 17, 19, 0.18);
}
.card h4 {
  margin: 0 0 8px;
}
.card p:last-child {
  margin-bottom: 0;
}
/* accomplishments */
.accomplishment-card {
  --accent-color: #5c6be7;
  --chip-bg: rgba(92, 107, 231, 0.15);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 30px 28px 26px;
  border-radius: 30px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.96) 0%,
    rgba(255, 255, 255, 0.88) 60%,
    #ffffff 100%
  );
  border: 1px solid rgba(17, 19, 21, 0.05);
  box-shadow: 0 18px 36px rgba(17, 19, 21, 0.1),
    inset 0 0 0 1px rgba(255, 255, 255, 0.6);
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.accomplishment-card::before {
  content: "";
  position: absolute;
  inset: 18px 18px auto auto;
  width: 120px;
  height: 120px;
  border-radius: 30px;
  background: radial-gradient(
    circle at top,
    rgba(255, 255, 255, 0.8),
    transparent 70%
  );
  opacity: 0.65;
  pointer-events: none;
}
.accomplishment-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 22px 46px rgba(17, 19, 21, 0.16),
    inset 0 0 0 1px rgba(255, 255, 255, 0.66);
}
.card-accent {
  position: absolute;
  inset: 0 auto auto 0;
  height: 100%;
  width: 8px;
  border-radius: 30px;
  background: linear-gradient(180deg, var(--accent-color), rgba(255, 255, 255, 0));
  opacity: 0.88;
}
.card-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}
.card-emoji {
  font-size: 26px;
}
.card-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  background: var(--chip-bg);
  color: var(--accent-color);
}
.accomplishment-card h4 {
  margin: 6px 0 0;
  font-size: 22px;
}
.card-summary {
  margin: 0;
  color: #3f454b;
  font-weight: 600;
}
.card-info {
  margin: 0;
  color: #1a1f21;
  font-size: 15px;
  line-height: 1.6;
}
.card-link {
  margin-top: auto;
  font-weight: 600;
  color: var(--accent-color);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.card-link::after {
  content: "";
  width: 12px;
  height: 12px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  margin-top: -1px;
}
.card-link:hover {
  text-decoration: underline;
}
.accomplishment-card.approach {
  --accent-color: #5c6be7;
  --chip-bg: rgba(92, 107, 231, 0.18);
}
.accomplishment-card.field {
  --accent-color: #06a4c9;
  --chip-bg: rgba(6, 164, 201, 0.16);
}
.accomplishment-card.communication {
  --accent-color: #ff5a3f;
  --chip-bg: rgba(255, 90, 63, 0.16);
}
.accomplishment-card.innovation {
  --accent-color: #ecaf14;
  --chip-bg: rgba(234, 176, 41, 0.18);
}
.accomplishment-card.research {
  --accent-color: #36b276;
  --chip-bg: rgba(54, 178, 118, 0.16);
}
/* ============================================================
   Buttons & pills
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.btn:hover {
  transform: translateY(-2px);
}
.btn.primary {
  background: var(--accent1);
  color: #111;
}
.btn.ghost {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  background: rgba(255, 255, 255, 0.4);
}
.pill-yellow {
  background: rgba(242, 183, 5, 0.25);
  color: #7a5d00;
}
.pill-blue {
  background: rgba(60, 142, 226, 0.22);
  color: #114878;
}
.pill-red {
  background: rgba(255, 77, 61, 0.24);
  color: #7a1f15;
}
.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  background: rgba(17, 19, 21, 0.06);
  color: var(--text);
}
/* ============================================================
   Page hero (secondary pages)
   ============================================================ */
.page-hero {
  padding: 72px 0 28px;
  text-align: left;
}
.page-hero p {
  color: var(--muted);
  margin: 0;
}
/* ============================================================
   Projects page
   ============================================================ */
.project-grid {
  display: grid;
  gap: 36px;
  margin-top: 40px;
}

.project-card {
  --accent: var(--accent1);
  --accent-ink: #1f1f1f;
  position: relative;
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(360px, 1.15fr);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.project-card::before {
  content: "";
  position: absolute;
  inset: 0;
  width: 8px;
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 55%, transparent));
  z-index: 2;
}

.project-card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 24px 48px rgba(17, 19, 21, 0.12);
}

.project-card:hover .project-card__media img {
  transform: scale(1.05);
}

.project-card__media {
  position: relative;
  overflow: hidden;
}

.project-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.project-card__content {
  position: relative;
  padding: 32px 36px 36px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.project-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.project-card__category {
  font-weight: 700;
  color: var(--accent-ink);
}

.project-card__title {
  font-size: clamp(24px, 2vw + 14px, 30px);
  margin: 0;
}

.project-card__summary {
  margin: 0;
  color: var(--text);
  font-size: 16px;
}

.project-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.project-tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: color-mix(in srgb, var(--accent, var(--accent1)) 20%, #ffffff 80%);
  color: var(--accent-ink, var(--text));
}

.project-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.btn {
  --btn-bg: transparent;
  --btn-color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
  padding: 12px 20px;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  background: var(--btn-bg);
  color: var(--btn-color);
}

.btn:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent, var(--accent1)) 55%, transparent);
  outline-offset: 2px;
}

.btn--ghost {
  --btn-bg: color-mix(in srgb, var(--accent, var(--accent1)) 12%, transparent);
  --btn-color: var(--accent-ink, var(--text));
  border: 1px solid color-mix(in srgb, var(--accent, var(--accent1)) 30%, transparent);
}

.btn--ghost:hover {
  transform: translateY(-1px);
  background: color-mix(in srgb, var(--accent, var(--accent1)) 22%, #ffffff 78%);
}

.btn--primary {
  --btn-bg: var(--accent, var(--accent1));
  --btn-color: var(--accent-ink, var(--text));
  box-shadow: 0 14px 30px color-mix(in srgb, var(--accent, var(--accent1)) 35%, transparent);
}

.btn--primary:hover {
  transform: translateY(-1px) scale(1.01);
  box-shadow: 0 18px 38px color-mix(in srgb, var(--accent, var(--accent1)) 45%, transparent);
}

.project-card__details {
  overflow: hidden;
  max-height: 0;
  margin-top: 0;
  padding-top: 0;
  transition: max-height 0.4s ease, margin-top 0.25s ease, padding-top 0.25s ease;
  border-top: 1px solid color-mix(in srgb, var(--accent) 20%, var(--border));
  display: grid;
  gap: 24px;
}

.project-card__details[hidden] {
  display: block;
}

.project-card.is-open .project-card__details {
  margin-top: 24px;
  padding-top: 24px;
}

.project-card__highlights h4 {
  margin: 0 0 12px;
  font-size: 16px;
  color: var(--accent-ink, var(--text));
}

.project-card__highlights ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  display: grid;
  gap: 8px;
}

.project-card__gallery {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.project-card__gallery figure {
  margin: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: 0 14px 28px rgba(17, 19, 21, 0.08);
}

.project-card__gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-card--field {
  --accent: var(--accent3);
  --accent-ink: #0b4c56;
}

.project-card--communication {
  --accent: var(--accent2);
  --accent-ink: #7a1f15;
}

.project-card--research {
  --accent: var(--accent4);
  --accent-ink: #1f2f87;
}

.project-card--innovation {
  --accent: var(--accent1);
  --accent-ink: #744804;
}

.project-card.is-open {
  box-shadow: 0 28px 54px rgba(17, 19, 21, 0.16);
}

.project-card.is-open::before {
  width: 12px;
}

.project-card.is-open .btn--ghost {
  background: color-mix(in srgb, var(--accent, var(--accent1)) 22%, transparent);
}

.btn[disabled] {
  cursor: not-allowed;
  opacity: 0.65;
  box-shadow: none;
  transform: none;
}

.btn__label {
  pointer-events: none;
}

@media (max-width: 1024px) {
  .project-card {
    grid-template-columns: minmax(240px, 0.9fr) minmax(320px, 1.1fr);
  }
}

@media (max-width: 880px) {
  .project-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .project-card::before {
    width: 100%;
    height: 6px;
  }

  .project-card__content {
    padding: 28px 24px 32px;
  }

  .project-card__media {
    max-height: 320px;
  }
}

@media (max-width: 540px) {
  .project-card__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ============================================================
   Project detail pages
   ============================================================ */
.project-page {
  padding-block: 0 80px;
}

.project-hero {
  --accent: var(--accent1);
  --accent-ink: #1f1f1f;
  width: min(1120px, 94vw);
  margin: 0 auto 64px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  position: relative;
}

.project-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  height: 10px;
  background: linear-gradient(
    90deg,
    var(--accent, var(--accent1)),
    color-mix(in srgb, var(--accent, var(--accent1)) 55%, transparent)
  );
  z-index: 2;
}

.project-hero__image {
  position: relative;
  aspect-ratio: 16 / 9;
  min-height: 260px;
}

.project-hero__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-hero__content {
  padding: 40px;
  display: grid;
  gap: 18px;
}

.project-hero__content.container {
  width: 100%;
  margin: 0;
}

.project-hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 13px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.project-hero__category {
  font-weight: 700;
  color: var(--accent-ink, var(--text));
}

.project-hero h1 {
  margin: 0;
  font-size: clamp(32px, 3vw + 18px, 42px);
}

.project-hero__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.project-hero__lede {
  margin: 0;
  font-size: 18px;
  color: var(--text);
}

.project-section {
  margin-bottom: 48px;
}

.project-section--end {
  margin-bottom: 0;
}

.project-section__content {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 36px;
  display: grid;
  gap: 18px;
}

.project-section__content h2 {
  margin: 0;
  font-size: 26px;
}

.project-bullets {
  margin: 0;
  padding-left: 22px;
  display: grid;
  gap: 10px;
  color: var(--muted);
}

.project-gallery {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.project-gallery figure {
  margin: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 18px 36px rgba(17, 19, 21, 0.12);
}

.project-gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.project-links a {
  font-weight: 600;
  color: var(--link);
}

.project-overview {
  display: grid;
  gap: 18px;
}

.project-details {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.project-details li strong {
  color: var(--text);
}

@media (min-width: 880px) {
  .project-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.project-section--end .project-section__content {
  display: flex;
  justify-content: center;
}

.project-page--field,
.project-hero--field {
  --accent: var(--accent3);
  --accent-ink: #0b4c56;
}

.project-page--communication,
.project-hero--communication {
  --accent: var(--accent2);
  --accent-ink: #7a1f15;
}

.project-page--research,
.project-hero--research {
  --accent: var(--accent4);
  --accent-ink: #1f2f87;
}

.project-page--innovation,
.project-hero--innovation {
  --accent: var(--accent1);
  --accent-ink: #744804;
}

@media (min-width: 980px) {
  .project-hero {
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1fr);
  }

  .project-hero__image {
    aspect-ratio: unset;
    min-height: 100%;
  }
}

@media (max-width: 640px) {
  .project-hero__content {
    padding: 28px;
  }

  .project-section__content {
    padding: 28px 24px;
  }
}
/* ============================================================
   Contact page
   ============================================================ */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(
    2,
    minmax(0, 1fr)
  ); /* Diventa 1 colonna in @media (max-width: 720px) */
  gap: 28px;
}
.contact-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.contact-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}
.contact-list li {
  display: grid;
  gap: 4px;
}
.contact-list .label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--muted);
}
.contact-social {
  display: flex;
  gap: 16px;
}
.contact-form {
  display: grid;
  gap: 16px;
}
.field {
  display: grid;
  gap: 6px;
}
.field label {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
input[type="text"],
input[type="email"],
textarea {
  font: inherit;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  resize: vertical;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent3);
  box-shadow: 0 0 0 3px rgba(125, 217, 232, 0.35);
}
.hint {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}
/* ============================================================
   Resume page
   ============================================================ */
main.resume-page {
  padding-block: 0;
}
.resume-layout {
  display: grid;
  grid-template-columns: 320px 1fr; /* Causa di overflow: diventa 1 colonna in @media (max-width: 960px) */
  gap: 32px;
  align-items: start;
}
.resume-sidebar {
  display: grid;
  gap: 24px;
}
.profile-card {
  display: grid;
  gap: 18px;
  justify-items: center;
  text-align: center;
}
.profile-card .avatar {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: var(--shadow);
}
.profile-card h2 {
  margin: 0;
}
.profile-tagline {
  margin: 0;
  color: var(--muted);
  font-weight: 500;
}
.fact-card dl {
  margin: 0;
  display: grid;
  gap: 16px;
}
.fact-card dt {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
  font-weight: 700;
}
.fact-card dd {
  margin: 2px 0 0;
  color: var(--text);
}
.cta-card {
  display: grid;
  gap: 12px;
}
.resume-main {
  display: grid;
  gap: 32px;
}
.resume-section {
  display: grid;
  gap: 16px;
}
.resume-timeline {
  display: grid;
  gap: 24px;
}
.timeline-item {
  position: relative;
  padding-left: 42px;
}
.timeline-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-left: 2px solid var(--border);
  border-radius: 0;
  pointer-events: none;
}
.timeline-item::after {
  content: "";
  position: absolute;
  top: 6px;
  left: 0;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent1);
  box-shadow: 0 0 0 4px rgba(242, 183, 5, 0.25);
  transform: translate(-50%, 0);
}
.timeline-header {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  font-weight: 600;
}
.timeline-header h3 {
  margin: 0;
  font-size: 20px;
  flex: 1 1 auto;
}
.timeline-header span {
  font-size: 14px;
  color: var(--muted);
  font-weight: 600;
}
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 2px 0;
}
.timeline-body {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}
.timeline-body li {
  margin-bottom: 6px;
}
.resume-projects {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); /* Già responsive! */
  gap: 20px;
}
.resume-card {
  --accent-color: #5c6be7;
  --chip-bg: rgba(92, 107, 231, 0.16);
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 28px 26px 24px;
  border-radius: 28px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.96) 0%,
    rgba(255, 255, 255, 0.88) 60%,
    #ffffff 100%
  );
  border: 1px solid rgba(17, 19, 21, 0.06);
  box-shadow: 0 16px 34px rgba(17, 19, 21, 0.08),
    inset 0 0 0 1px rgba(255, 255, 255, 0.5);
  color: inherit;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.resume-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 44px rgba(17, 19, 21, 0.16),
    inset 0 0 0 1px rgba(255, 255, 255, 0.66);
}
.resume-card .card-accent {
  position: absolute;
  inset: 0 auto auto 0;
  width: 6px;
  height: 100%;
  border-radius: 28px;
  background: linear-gradient(180deg, var(--accent-color), rgba(255, 255, 255, 0));
}
.resume-card .card-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}
.resume-card .card-emoji {
  font-size: 24px;
}
.resume-card .card-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  background: var(--chip-bg);
  color: var(--accent-color);
}
.resume-card h3 {
  margin: 6px 0 0;
  font-size: 21px;
}
.resume-card .card-summary {
  margin: 0;
  color: #3f454b;
  font-weight: 600;
}
.resume-card .card-info {
  margin: 0;
  color: #1a1f21;
  font-size: 15px;
  line-height: 1.6;
}
.resume-card .card-link {
  margin-top: auto;
  font-weight: 600;
  color: var(--accent-color);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.resume-card .card-link::after {
  content: "";
  width: 12px;
  height: 12px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  margin-top: -1px;
}
.resume-card.field {
  --accent-color: #06a4c9;
  --chip-bg: rgba(6, 164, 201, 0.16);
}
.resume-card.communication {
  --accent-color: #ff5a3f;
  --chip-bg: rgba(255, 90, 63, 0.16);
}
.resume-card.research {
  --accent-color: #5c6be7;
  --chip-bg: rgba(92, 107, 231, 0.16);
}
.resume-card.innovation {
  --accent-color: #36b276;
  --chip-bg: rgba(54, 178, 118, 0.16);
}
.resume-skills {
  display: grid;
  grid-template-columns: repeat(
    2,
    minmax(0, 1fr)
  ); /* Diventa 1 colonna in @media (max-width: 720px) */
  gap: 18px;
}
.resume-skills h3 {
  margin-bottom: 8px;
  font-size: 18px;
}
.resume-skills ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}
.resume-education {
  display: grid;
  grid-template-columns: repeat(
    auto-fit,
    minmax(260px, 1fr)
  ); /* Già responsive! */
  gap: 18px;
  margin: 0;
}
.edu-card {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 16px;
  padding: 20px 22px;
  border-radius: 24px;
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.92),
    rgba(246, 247, 248, 1)
  );
  box-shadow: 0 16px 32px rgba(17, 19, 21, 0.08),
    inset 0 0 0 1px rgba(255, 255, 255, 0.6);
  position: relative;
  overflow: hidden;
}
.edu-card::after {
  content: "";
  position: absolute;
  inset: auto 18px 18px auto;
  width: 90px;
  height: 90px;
  border-radius: 30px;
  background: radial-gradient(
    circle at top,
    rgba(255, 255, 255, 0.8),
    transparent 70%
  );
  opacity: 0.6;
}
.edu-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 22px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 10px 20px rgba(17, 19, 21, 0.08);
}
.edu-body {
  display: grid;
  gap: 6px;
  position: relative;
  z-index: 1;
}
.edu-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.edu-head h3 {
  margin: 0;
  font-size: 17px;
}
.edu-date {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: rgba(17, 19, 21, 0.6);
}
.edu-school {
  margin: 0;
  color: #3f454b;
  font-weight: 600;
}
.edu-notes {
  margin: 0;
  color: #1a1f21;
  font-size: 14px;
  line-height: 1.55;
}
/* ============================================================
   Footer
   ============================================================ */
.footer {
  margin-top: 48px;
}
.footer--dark {
  background: #0f1113;
  color: #e7eaee;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 36px 0 48px;
}
.footer--dark a {
  color: #e7eaee;
}
.footer__wrap {
  display: grid;
  row-gap: 18px;
  justify-items: center;
  text-align: center;
}
.footer__social {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: center;
}
.social {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform 0.15s ease, background 0.15s ease,
    border-color 0.15s ease;
}
.social img {
  filter: invert(100%) grayscale(100%);
}
.social:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.18);
}
.footer__quote {
  margin: 10px 0 0;
  font-size: 18px;
  color: #f1f3f5;
  font-style: italic;
}
.footer__contact {
  margin-top: 4px;
}
.footer__email {
  color: #cfe1ff;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px dashed rgba(207, 225, 255, 0.4);
  padding-bottom: 2px;
}
.footer__email:hover {
  text-decoration: none;
  border-bottom-color: rgba(207, 225, 255, 0.8);
}
.footer__legal {
  margin-top: 8px;
  font-size: 12.5px;
  color: #9aa3ab;
  max-width: 72ch;
}

/* ============================================================
   Media Queries (ORA CORRETTE E OTTIMIZZATE)
   ============================================================ */

@media (max-width: 960px) {
  /* --- Navigazione Mobile --- */
  .navlinks {
    display: none;
  }
  .hamburger {
    display: inline-flex;
  }
  .nav-inner {
    gap: 16px;
    align-items: center; /* Modificato per layout brand mobile */
  }
  .brand {
    /* NON più in colonna, ma rimpicciolito */
    font-size: 17px; /* Originale 18px */
    gap: 10px; /* Originale 12px */
    align-items: center; /* Manteniamo l'allineamento orizzontale */
  }
  .brand .brand-icon {
    width: 40px;
    height: 40px;
  }
  .brand .role {
    font-size: 13px; /* Questo va bene */
  }
  .circle-btn {
    width: 105px;
    height: 105px;
    font-size: 14px;
  }
  /* --- FIX RESPONSIVE --- */
  /* Stack layout principale del resume. Questa era la causa di overflow #1. */
  .resume-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .container {
    width: 94vw;
  }
  .hero {
    padding: 60px 0 24px;
  }
  .circle-btn {
    width: 105px;
    height: 105px;
    font-size: 14px;
  }
  .resume-skills {
    grid-template-columns: 1fr;
  }
  .edu-card {
    grid-template-columns: 32px 1fr;
  }
  /* --- FIX RESPONSIVE --- */
  /* Stack degli altri layout a 2 colonne */
  .hero-grid {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 32px;
  }
  .hero-copy {
    text-align: left; /* Centra i testi (Hello, I'm Pietro, ecc.) */
  }
  .portrait {
    max-width: 250px; /* Rimpicciolisce l'immagine (da 380px) */
    order: -1; /* Mette l'immagine PRIMA del testo */
  }
  .cta-circles {
    justify-content: center; /* Centra i bottoni */
  }
  .proj-card {
    grid-template-columns: 1fr;
  }
  .contact-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .hero {
    padding: 72px 0 24px;
  }
  .hero h1 {
    font-size: clamp(36px, 10vw, 52px);
  }
  .hero h2 {
    font-size: 18px;
  }
  .portrait {
    max-width: 230px; /* Rimpicciolisce l'immagine (da 380px) */
  }
  .circle-btn {
    width: 100px;
    height: 100px;
    font-size: 13px;
  }
  .timeline-item {
    padding-left: 36px;
  }
  /* .cards { grid-template-columns: 1fr; } <-- RIMOSSO: Inutile, 'auto-fit' fa già il lavoro. */
}

@media (max-width: 520px) {
  .hero {
    padding: 56px 0 20px;
  }
  .hero h1 {
    font-size: clamp(32px, 12vw, 46px);
  }
  .hero h2 {
    font-size: 16px;
  }
  .drawer-inner {
    width: 94vw;
  }
  .drawer-nav a {
    font-size: 17px;
  }
  .nav-inner {
    gap: 12px;
  }
  .brand {
    font-size: 16px; /* Ancora più piccolo */
    gap: 8px;
  }
  .brand .role {
    font-size: 12px;
  }
  .brand .brand-icon {
    width: 30px;
    height: 30px;
  }
}

