* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.wrapper,
.content {
    position: relative;
    width: 100%;
    z-index: 1;
}

.content {
    overflow-x: hidden;
}

.content .section {
    width: 100%;
    height: 100vh;
}

.content .section.hero {
    position: relative;
    overflow: hidden;
}

.content .section.hero video {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: auto;
    object-fit: contain;
    transform: translate(-50%, -50%);
    z-index: 0;
}

.content .section.hero::after {
    content: 'NB DEVELOPER';
   
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: black;
    font-size: 4rem;
    font-weight: bold;
    padding: 1rem 2rem;
    border-radius: 10px;
    text-align: center;
    z-index: 3;
    pointer-events: none;

    /* Aggiunte: */
    opacity: 0;
    transition: opacity 1s ease;
}

.image-container {
    width: 100%;
    height: 100vh;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2;
    perspective: 500px;
    overflow: hidden;
}

.image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
}

.gradient-purple {
    background: linear-gradient(to bottom right, #6a11cb, #2575fc);
}

.gradient-blue {
    background: linear-gradient(to bottom right, #00c6ff, #0072ff);
}

#intro {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;  /* usa min-height invece di height fisso */
    background-color: #000;
    color: white;
    text-align: center;
    z-index: 1;
    position: relative;
    padding-bottom: 0; /* niente spazio extra che crea il buco */
    margin-bottom: 0;  /* unisce direttamente con la sezione successiva */
}

.intro-logo {
    width: 120px;
    height: auto;
    margin-bottom: 1rem;
}

.intro-content h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.intro-content p {
    font-size: 1.2rem;
    max-width: 600px;
    line-height: 1.6;
    margin-bottom: 1.25rem;
}

#skills {
    background-color: #000;
    color: white;
    padding: 5rem 2rem;
    text-align: center;
    margin-top: 0; /* elimina il distacco bianco tra intro e competenze */
}

.skills-header {
    font-size: 2.5rem;
    margin-bottom: 3rem;
}

.skills-columns {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 3rem;
}

.skills-category {
    background-color: #111;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 0 15px rgba(97, 218, 251, 0.2);
    transition: transform 0.3s ease;
    flex: 1 1 250px;
    min-width: 200px;
    max-width: 300px;
    text-align: left;
}

.skills-category:hover {
    transform: translateY(-5px);
}

.skills-category h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #61dafb;
    display: inline-block;
    padding-bottom: 0.5rem;
}

.skills {
    list-style: none;
    padding: 0;
}

.skills li {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.services-panel {
    margin-top: 2rem;
}

.services-header {
    font-size: 2.5rem;
    margin-bottom: 3rem;
}

.services-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2rem;
    justify-items: center;
}

.service-item {
    background-color: #fff;
    color: #000;
    border-radius: 16px;
    padding: 2rem 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-align: center;
    border: none;
    max-width: 320px;
}

.service-item:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.service-item i {
    margin-bottom: 1rem;
    font-size: 2.5rem;
}

.service-item h3 {
    margin-bottom: 1rem;
    font-size: 1.3rem;
    font-weight: 600;
}

.service-item p {
    font-size: 1rem;
    line-height: 1.4;
    color: #333;
}

#projects {
    background-color: #000;
    color: white;
    padding: 5rem 2rem;
    text-align: center;
}

#projects .h2-hero {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    color: white;
    text-shadow: 0 0 10px black;
}

#projects p {
    font-size: 1.2rem;
    margin-bottom: 3rem;
    color: #ccc;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2rem;
    justify-items: center;
}

.project-link {
    text-decoration: none;
}

.project-card {
    background: #ffffff;
    border-radius: 20px;
    overflow: hidden;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.05);
    padding: 1.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #000;
    max-width: 280px;
}

.project-card:hover {
    transform: translateY(-8px) scale(1.03);
    box-shadow: 0 0 25px rgba(97, 218, 251, 0.3);
}

.project-card img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    margin-bottom: 1rem;
}

.project-card h5 {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #000;
    /* text-shadow: 0 0 6px rgba(97, 218, 251, 0.5); */
}

.project-card p {
    font-size: 0.95rem;
    color: #333;
}

@media (max-width: 768px) {
    #projects {
        padding: 3rem 1rem;
    }

    .project-card {
        padding: 1rem;
    }

    .services-columns {
        grid-template-columns: 1fr;
    }

    /* Intro mobile: altezza auto e più spazio sotto per separare da #skills */
    #intro {
        height: auto;
        min-height: auto;
        padding: 3.5rem 1.25rem 2rem; /* padding bottom ridotto per non creare spazio bianco */
    }

    /* Skills mobile: più respiro sopra e titolo bilanciato */
    #skills {
        margin-top: 0;    /* unisce direttamente con #intro */
        padding-top: 3rem;   /* respiro interno */
    }
    .skills-header {
        font-size: clamp(1.8rem, 6vw, 2.2rem);
        margin-top: 2rem;        /* spazio sopra al titolo */
        margin-bottom: 2rem;     /* spazio sotto al titolo */
        display: block;
        text-align: center;
    }
}

.nfc-cards {
    background-color: #ffffff;
    padding: 5rem 2rem;
    text-align: center;
}

.nfc-header {
    font-size: 2.5rem;
    margin-bottom: 1rem;
      color: white;
    font-weight: 700;
}

.nfc-description {
    font-size: 1.2rem;
    max-width: 800px;
    margin: 0 auto 3rem;
    color: white;
    line-height: 1.6;
}

.nfc-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    justify-items: center;
    align-items: center;
}

.nfc-card img {
    width: 100%;
    max-width: 400px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.nfc-card img:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

@media (max-width: 1024px) {
    .nfc-header {
        font-size: 2rem;
    }
    .nfc-description {
        font-size: 1rem;
        padding: 0 1rem;
    }
    .nfc-gallery {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .nfc-gallery {
        grid-template-columns: 1fr;
    }
}

/* =============================
   FLUID TYPOGRAPHY & SPACING
   ============================= */
:root {
  --space-1: clamp(8px, 0.8vw, 14px);
  --space-2: clamp(12px, 1.2vw, 18px);
  --space-3: clamp(16px, 1.6vw, 24px);
  --space-4: clamp(24px, 2.2vw, 36px);
  --space-5: clamp(32px, 3vw, 56px);
  --section-pad: clamp(48px, 8vh, 96px);

  --fs-sm: clamp(0.95rem, 1.2vw, 1.05rem);
  --fs-base: clamp(1rem, 1.4vw, 1.15rem);
  --fs-lg: clamp(1.1rem, 1.8vw, 1.3rem);
  --fs-h2: clamp(1.6rem, 2.6vw, 2.4rem);
  --fs-h1: clamp(1.9rem, 3.2vw, 3rem);
}

/* Prefer dynamic viewport on mobile browsers to avoid 100vh jumps */
@supports (height: 100dvh) {
  .content .section,
  .image-container { height: 100dvh; }
}

/* Fluid headings where used */
.intro-content h1 { font-size: var(--fs-h1); }
.skills-header, .services-header, #projects .h2-hero { font-size: var(--fs-h2); }
.intro-content p, #projects p, .service-item p, .skills li { font-size: var(--fs-base); }

/* Section padding on large content sections */
#skills, #projects, .nfc-cards { padding: var(--section-pad) var(--space-3); }

/* Ensure full-height sections don’t clip content on small screens */
.content .section { min-height: 100vh; }

/* -----------------------------
   BREAKPOINTS
   ----------------------------- */

/******** >= 1440px (large desktops) ********/
@media (min-width: 1440px) {
  .projects-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
  .project-card { max-width: 320px; }
}

/******** 1200px–1439px ********/
@media (max-width: 1439px) {
  .skills-columns { gap: var(--space-4); }
  .services-columns { gap: var(--space-3); }
}

/******** 992px–1199px (tablets landscape / small desktops) ********/
@media (max-width: 1199px) {
  .content .section.hero video {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  .skills-category { max-width: 340px; }
  .project-card { max-width: 300px; }
}

/******** 768px–991px (tablets portrait) ********/
@media (max-width: 991px) {
  /* Sections become auto-height but keep viewport feel */
  .content .section { height: auto; min-height: 100dvh; }

  .skills-columns { gap: var(--space-3); }
  .projects-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .service-item { max-width: 420px; }
}

/******** 576px–767px (large phones / small tablets) ********/
@media (max-width: 767px) {
  .intro-logo { width: 96px; }

  .content .section.hero video {
    /* Fill the viewport height elegantly on mobile */
    width: auto;
    height: 100%;
    object-fit: cover;
  }

  .projects-grid { grid-template-columns: 1fr; }
  .project-card { max-width: 420px; }

  .services-columns { grid-template-columns: 1fr; }
  .service-item { max-width: 520px; }

  #skills, #projects, .nfc-cards { padding: 3.5rem 1.25rem; }
}

/******** <= 575px (small phones) ********/
@media (max-width: 575px) {
  .intro-content p { max-width: 90%; margin-left: auto; margin-right: auto; }

  .skills-category { padding: 1.25rem; }
  .skills-category h3 { font-size: 1.15rem; }
  .skills li { font-size: var(--fs-sm); }

  .project-card { padding: 1rem; }
  .project-card img { width: 56px; height: 56px; }

  .nfc-gallery { grid-template-columns: 1fr; }
  .nfc-card img { max-width: 100%; }
}

/* Micro-interactions tuning for touch */
@media (hover: none) and (pointer: coarse) {
  .service-item:hover, .project-card:hover, .skills-category:hover {
    transform: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  }
}

/* NFC 3D viewer: centered container + responsive sizing */
#nfc-3d-viewer {
  display: block;
  margin: 0 auto;
  width: 100%;
  max-width: 600px;
  height: 400px;
}
#nfc-3d-viewer canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Tablets landscape / small desktops */
@media (max-width: 1199px) {
  #nfc-3d-viewer { max-width: 640px; height: 360px; }
}
/* Tablets portrait */
@media (max-width: 991px) {
  #nfc-3d-viewer { max-width: 560px; height: 340px; }
}
/* Large phones / small tablets */
@media (max-width: 767px) {
  #nfc-3d-viewer { max-width: 520px; height: 300px; }
}
/* Small phones */
@media (max-width: 575px) {
  #nfc-3d-viewer { max-width: 460px; height: 260px; }
}

/* ==== Contacts section mobile tuning ==== */
@media (max-width: 767px) {
  #contatti { padding: 3rem 1.25rem !important; }
  #contatti h2 { font-size: clamp(1.7rem, 6.5vw, 2.1rem); margin-bottom: .75rem; }
  #contatti p { font-size: 0.98rem; line-height: 1.5; max-width: 34rem; margin: 0 auto 1.25rem; }
  /* Make buttons stack, centered and slimmer */
  #contatti a[aria-label] { 
    display: block; 
    width: 100%; 
    max-width: 320px; 
    margin-left: auto; 
    margin-right: auto; 
    padding: 0.75rem 1rem !important; 
    font-size: 1rem !important; 
    border-radius: 8px; 
  }
}
@media (max-width: 575px) {
  #contatti { padding: 2.25rem 1rem !important; }
  #contatti h2 { font-size: clamp(1.5rem, 7vw, 1.9rem); }
  #contatti p { font-size: 0.95rem; max-width: 28rem; }
  #contatti a[aria-label] { max-width: 300px; padding: 0.65rem .9rem !important; font-size: 0.98rem !important; }
}

