/* ===== Design tokens ===== */
:root {
  --bg: #05051e;
  --blue: #31a8ff;
  --blue-dark: #1d79d8;
  --blue-glow: rgba(49, 168, 255, 0.5);
  --orange: #f59e0b;
  --purple: #a855f7;
  --white: #ffffff;
  --text-muted: #d1d5dc;
  --text-subtle: #99a1af;
  --card-bg: rgba(255, 255, 255, 0.05);
  --card-border: rgba(255, 255, 255, 0.1);
  --nav-bg: rgba(223, 246, 255, 0.15);
  --radius-sm: 16px;
  --radius-md: 30px;
  --radius-lg: 32px;
  --radius-xl: 40px;
  --radius-2xl: 60px;
  --font-heading: 'Poppins', sans-serif;
  --font-body: 'Montserrat', sans-serif;
  --font-nav: 'Roboto', sans-serif;
  --section-gap: 128px;
  --max-width: 1792px;
}

/* ===== Reset & base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--white);
  font-family: var(--font-body);
  font-weight: 500;
  line-height: 1;
  overflow-x: hidden;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

button {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font: inherit;
}

/* ===== Header / Nav ===== */
.site-header {
  display: flex;
  justify-content: center;
  padding: 16px 64px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  margin-bottom: var(--section-gap, 128px);
}

.navbar {
  backdrop-filter: blur(8px);
  background: var(--nav-bg);
  border-radius: var(--radius-lg);
  display: flex;
  gap: 57px;
  justify-content: center;
  padding: 22px 40px;
  width: 100%;
  max-width: 576px;
}

.nav-link {
  font-family: var(--font-nav);
  font-size: 18px;
  transition: color 0.2s;
  white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
  color: var(--blue);
}

/* ===== Sections ===== */
.section {
  margin: 0 auto;
  max-width: var(--max-width);
  padding: 0 64px;
  width: 100%;
}

.section + .section,
.hero-section + .section {
  margin-top: var(--section-gap);
}

.section-title {
  font-family: var(--font-heading);
  font-size: clamp(48px, 8vw, 112px);
  font-weight: 700;
  line-height: 1;
  margin-bottom: 64px;
  text-align: center;
  text-transform: uppercase;
}

.section-title--contact {
  font-size: clamp(40px, 6vw, 96px);
  line-height: 1.2;
}

/* ===== Hero ===== */
.hero-section {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-top: 0;
}

.hero-card {
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  box-shadow:
    0 2px 4px -2px rgba(0, 0, 0, 0.1),
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    inset 0 0 8px rgba(255, 255, 255, 0.25);
  display: flex;
  flex-direction: column;
  gap: 128px;
  overflow: hidden;
  padding: 32px 64px;
  position: relative;
  width: 100%;
}

.hero-card::before {
  backdrop-filter: blur(30px);
  background: linear-gradient(-71deg, rgba(49, 168, 255, 0.1) 0%, rgba(168, 85, 247, 0.025) 100%);
  border-radius: inherit;
  content: '';
  inset: 0;
  pointer-events: none;
  position: absolute;
}

.hero-card__inner {
  align-items: center;
  display: flex;
  justify-content: space-between;
  position: relative;
  width: 100%;
  z-index: 1;
}

.hero-branding__name {
  font-family: var(--font-heading);
  font-size: clamp(20px, 2.5vw, 33px);
  font-weight: 700;
  text-transform: uppercase;
}

.hero-branding__title {
  font-family: var(--font-heading);
  font-size: clamp(64px, 12vw, 160px);
  font-weight: 700;
  line-height: 0.9;
  text-transform: uppercase;
  white-space: nowrap;
}

.hero-branding__subtitle {
  align-items: center;
  display: flex;
  font-family: var(--font-heading);
  font-size: clamp(20px, 2.5vw, 33px);
  font-weight: 700;
  gap: 4px;
  justify-content: flex-end;
  text-transform: uppercase;
  width: 100%;
}

.hero-branding__dash {
  opacity: 0.8;
}

.hero-logo {
  flex-shrink: 0;
  height: auto;
  max-height: 319px;
  width: clamp(150px, 20vw, 310px);
}

.hero-description {
  font-family: var(--font-heading);
  font-size: clamp(18px, 2.5vw, 32px);
  font-weight: 600;
  line-height: 1.4;
  position: relative;
  text-align: center;
  z-index: 1;
}

.discover-btn {
  align-items: center;
  background: var(--card-bg);
  border-radius: 50px;
  color: var(--white);
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 32px;
  padding: 5px 20px;
  transition: background 0.2s, transform 0.2s;
}

.discover-btn span {
  font-family: var(--font-nav);
  font-size: 18px;
  text-transform: uppercase;
}

.discover-btn:hover {
  background: rgba(49, 168, 255, 0.15);
  transform: translateY(4px);
}

/* ===== About grid ===== */
.about-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: auto auto auto;
}

.about-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-2xl);
  padding: 16px 32px;
}

.about-card--photo {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.1),
    0 4px 6px rgba(0, 0, 0, 0.1),
    inset 0 0 8px rgba(255, 255, 255, 0.25);
  grid-column: 1;
  grid-row: 1 / span 2;
  overflow: hidden;
  padding: 16px;
  position: relative;
}

.about-card--photo::before {
  backdrop-filter: blur(30px);
  background: linear-gradient(-59deg, rgba(20, 116, 184, 0.05) 0%, rgba(20, 116, 184, 0.1) 100%);
  border-radius: inherit;
  content: '';
  inset: 0;
  pointer-events: none;
  position: absolute;
}

.about-photo {
  border-radius: var(--radius-2xl);
  height: 100%;
  min-height: 400px;
  object-fit: cover;
  position: relative;
  width: 100%;
  z-index: 1;
}

.about-card--small {
  display: flex;
  flex-direction: column;
  gap: 32px;
  justify-content: center;
}

.about-card--presentation {
  display: flex;
  flex-direction: column;
  gap: 32px;
  grid-column: 2 / span 2;
  grid-row: 2;
  justify-content: center;
}

.about-card--skills {
  display: flex;
  flex-direction: column;
  gap: 32px;
  grid-column: 1 / span 3;
  grid-row: 3;
  justify-content: center;
  padding: 64px 32px;
}

.card-header {
  align-items: center;
  display: flex;
  gap: 16px;
}

.card-icon {
  align-items: center;
  background: rgba(49, 168, 255, 0.2);
  border-radius: 50%;
  display: flex;
  flex-shrink: 0;
  height: 48px;
  justify-content: center;
  width: 48px;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 32px;
  font-weight: 600;
  line-height: 32px;
}

.info-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.info-list li {
  align-items: center;
  display: flex;
  font-size: 20px;
  gap: 12px;
}

.info-list--interests li {
  gap: 12px;
}

.flag {
  border-radius: 2px;
  display: inline-block;
  flex-shrink: 0;
  height: 21px;
  width: 32px;
}

.flag--gb {
  background: linear-gradient(to bottom, #012169 33%, #fff 33%, #fff 66%, #C8102E 66%);
}

.flag--it {
  background: linear-gradient(to right, #009246 33%, #fff 33%, #fff 66%, #CE2B37 66%);
}

.presentation-text {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.presentation-text p {
  color: var(--text-muted);
  font-size: 20px;
  line-height: 1.5;
}

/* ===== Skills ===== */
.skills-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(4, 1fr);
}

.skill__header {
  align-items: center;
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.skill__icon {
  align-items: center;
  border-radius: 6px;
  color: #fff;
  display: flex;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  height: 32px;
  justify-content: center;
  width: 32px;
}

.skill__icon--ps { background: #001e36; color: #31a8ff; }
.skill__icon--ai { background: #330000; color: #ff9a00; }
.skill__icon--id { background: #49021f; color: #ff3366; }

.skill__name {
  font-size: 18px;
}

.skill__bar {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  height: 8px;
  margin-bottom: 8px;
  overflow: hidden;
  width: 100%;
}

.skill__fill {
  background: linear-gradient(to bottom, var(--blue), var(--blue-dark));
  border-radius: 999px;
  box-shadow: 0 0 10px var(--blue-glow);
  height: 100%;
}

.skill__level {
  color: var(--text-subtle);
  font-size: 14px;
}

/* ===== Filter bar ===== */
.filter-bar {
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 64px;
}

.filter-btn {
  background: var(--card-bg);
  border: 2px solid var(--card-border);
  border-radius: var(--radius-md);
  height: 140px;
  padding: 24px;
  position: relative;
  text-align: left;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.filter-btn:nth-child(1) {
  grid-column: 1 / span 4;
}

.filter-btn:nth-child(2) {
  grid-column: 5 / span 4;
}

.filter-btn:nth-child(3) {
  grid-column: 9 / span 4;
}

.filter-btn:nth-child(4) {
  grid-column: 13 / span 4;
}

.filter-btn__top {
  align-items: flex-start;
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.filter-btn__icon {
  align-items: center;
  border: 1px solid;
  border-radius: var(--radius-sm);
  display: flex;
  height: 48px;
  justify-content: center;
  width: 48px;
}

.filter-btn__icon--blue {
  background: rgba(49, 168, 255, 0.13);
  border-color: rgba(49, 168, 255, 0.25);
  color: var(--blue);
}

.filter-btn__icon--orange {
  background: rgba(245, 158, 11, 0.13);
  border-color: rgba(245, 158, 11, 0.25);
  color: var(--orange);
}

.filter-btn__icon--purple {
  background: rgba(168, 85, 247, 0.13);
  border-color: rgba(168, 85, 247, 0.25);
  color: var(--purple);
}

.filter-btn__count {
  background: rgba(49, 168, 255, 0.13);
  border-radius: 999px;
  color: var(--blue);
  font-size: 14px;
  padding: 4px 12px;
}

.filter-btn__count--orange {
  background: rgba(245, 158, 11, 0.13);
  color: var(--orange);
}

.filter-btn__count--purple {
  background: rgba(168, 85, 247, 0.13);
  color: var(--purple);
}

.filter-btn__label {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 600;
}

.filter-btn--active {
  background: rgba(49, 168, 255, 0.06);
  border-color: rgba(49, 168, 255, 0.5);
  box-shadow:
    0 0 30px rgba(49, 168, 255, 0.38),
    inset 0 0 30px rgba(49, 168, 255, 0.13);
}
.filter-btn--active:nth-child(3) {
  background: rgba(245, 158, 11, 0.06);
  border-color: rgba(245, 158, 11, 0.5);
  box-shadow:
    0 0 30px rgba(245, 158, 11, 0.38),
    inset 0 0 30px rgba(245, 158, 11, 0.13);
}
.filter-btn--active:nth-child(4) {
  background: rgb(168, 85, 247, 0.06);
  border-color: rgba(168, 85, 247, 0.5);
  box-shadow:
    0 0 30px rgba(168, 85, 247, 0.38),
    inset 0 0 30px rgba(168, 85, 247, 0.13);
}

.filter-btn--active .filter-btn__label {
  color: var(--blue);
}

.filter-btn--active:nth-child(3) .filter-btn__label {
  color: var(--orange);
}

.filter-btn--active:nth-child(4) .filter-btn__label {
  color: var(--purple);
}

.filter-btn:not(.filter-btn--active):hover {
  border-color: rgba(255, 255, 255, 0.25);
}

/* ===== Project cards ===== */
.projects-grid {
  display: grid;
  gap: 32px;
  grid-template-columns: repeat(4, 1fr);
}

.project-card {
  background: var(--card-bg);
  border: 2px solid var(--card-border);
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 445px;
  overflow: hidden;
  padding: 16px;
  transition: border-color 0.25s, transform 0.25s, box-shadow 0.25s;
}

.project-card:hover {
  border-color: rgba(49, 168, 255, 0.4);
  box-shadow: 0 0 24px rgba(49, 168, 255, 0.15);
  transform: translateY(-4px);
}

.project-card:nth-child(3):hover {
  border-color: rgba(245, 158, 11, 0.4);
  box-shadow: 0 0 24px rgba(245, 158, 11, 0.15);
  transform: translateY(-4px);
}

.project-card:nth-child(4):hover {
  border-color: rgba(168, 85, 247, 0.4);
  box-shadow: 0 0 24px rgba(168, 85, 247, 0.15);
  transform: translateY(-4px);
}

.project-card:nth-child(5):hover {
  border-color: rgba(245, 158, 11, 0.4);
  box-shadow: 0 0 24px rgba(245, 158, 11, 0.15);
  transform: translateY(-4px);
}

.project-card.hidden {
  display: none;
}

.project-card__header {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.project-tag {
  align-items: center;
  border: 1px solid;
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  gap: 8px;
  padding: 8px 17px;
}

.project-tag--blue {
  background: rgba(49, 168, 255, 0.13);
  border-color: rgba(49, 168, 255, 0.25);
  color: var(--blue);
}

.project-tag--orange {
  background: rgba(245, 158, 11, 0.13);
  border-color: rgba(245, 158, 11, 0.25);
  color: var(--orange);
}

.project-tag--purple {
  background: rgba(168, 85, 247, 0.13);
  border-color: rgba(168, 85, 247, 0.25);
  color: var(--purple);
}

.project-card__title {
  font-family: var(--font-heading);
  font-size: 32px;
  font-weight: 600;
  line-height: 32px;
  margin-bottom: 8px;
}

.project-card__title--blue { color: var(--blue); }
.project-card__title--orange { color: var(--orange); }
.project-card__title--purple { color: var(--purple); }

.project-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.project-card__tags span {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 12px;
  padding: 4px 12px;
}

.project-card__image {
  align-items: flex-end;
  display: flex;
  flex: 1;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
}

.project-card__image img {
  height: 100%;
  max-height: 261px;
  object-fit: contain;
  width: 100%;
}

.project-card__image--crop img {
  object-fit: cover;
}

.project-card__image--rounded {
  align-items: center;
}

.project-card__image--rounded img {
  border-radius: 64px;
  max-height: 241px;
  max-width: 336px;
  object-fit: cover;
}

.project-card__image--photo {
  align-items: center;
}

.project-card__image--photo img {
  border-radius: 32px;
  max-height: 171px;
  max-width: 256px;
  object-fit: cover;
}

/* ===== Contact ===== */
.contact-grid {
  display: grid;
  gap: 32px;
  grid-template-columns: 1fr 1fr;
}

.contact-card {
  align-items: center;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-2xl);
  display: flex;
  gap: 24px;
  justify-content: center;
  min-height: 130px;
  padding: 33px;
  transition: border-color 0.25s, background 0.25s;
}

.contact-card:hover {
  background: rgba(49, 168, 255, 0.08);
  border-color: rgba(49, 168, 255, 0.3);
}

.contact-card__icon {
  align-items: center;
  background: rgba(49, 168, 255, 0.2);
  border-radius: 50%;
  display: flex;
  flex-shrink: 0;
  height: 64px;
  justify-content: center;
  width: 64px;
}

.contact-card__text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.contact-card__label {
  color: var(--text-subtle);
  font-size: 14px;
  letter-spacing: 0.7px;
  text-transform: uppercase;
}

.contact-card__value {
  font-family: var(--font-heading);
  font-size: 20px;
}

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--card-border);
  margin: var(--section-gap) auto 0;
  max-width: 896px;
  padding: 33px 64px 64px;
  text-align: center;
}

.site-footer p {
  color: var(--text-subtle);
  font-size: 16px;
}

/* ===== Responsive ===== */
@media (max-width: 1200px) {
  .skills-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero-card {
    gap: 64px;
  }

  .hero-card__inner {
    flex-direction: column;
    gap: 32px;
    text-align: center;
  }

  .hero-branding__subtitle {
    justify-content: center;
  }
}

@media (max-width: 900px) {
  .section {
    padding: 0 24px;
  }

  .site-header {
    padding: 16px 24px 0;
  }

  .navbar {
    gap: 20px;
    padding: 16px 20px;
  }

  .nav-link {
    font-size: 14px;
  }

  .about-grid {
    grid-template-columns: 1fr;
  }

  .about-card--photo {
    grid-column: 1;
    grid-row: auto;
  }

  .about-card--presentation {
    grid-column: 1;
    grid-row: auto;
  }

  .about-card--skills {
    grid-column: 1;
    grid-row: auto;
  }

  .filter-bar {
    flex-wrap: wrap;
  }

  .filter-btn {
    flex: 1 1 calc(50% - 8px);
    min-width: 200px;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }

  .contact-grid {
    grid-template-columns: 1fr;
  }

  .hero-card {
    padding: 24px;
  }
}

@media (max-width: 480px) {
  .navbar {
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
  }

  .filter-btn {
    flex: 1 1 100%;
  }

  .skills-grid {
    grid-template-columns: 1fr;
  }
}
