html {
  scroll-behavior: smooth;
}

/* Media query per schermi più piccoli */
@media (max-width: 768px) {
  .intro {
    font-size: 120%;
    padding: 30px 15px;
  }
}

/* Media query per schermi ancora più piccoli */
@media (max-width: 480px) {
  .intro {
    font-size: 100%;
  }
}

/* Media query per schermi più piccoli */
@media (max-width: 768px) {
  .intro {
    font-size: 120%; /* Riduci la dimensione del testo per schermi più piccoli */
    padding: 30px 15px; /* Riduci il padding per schermi più piccoli */
  }
}

/* Media query per schermi ancora più piccoli */
@media (max-width: 480px) {
  .intro {
    font-size: 100%; /* Riduci ulteriormente la dimensione del testo */
  }
}

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

/* NAVI BAR */
.nav-1 {
  font-family: "Roboto Mono";
  background-color: black;
  font-weight: bold;
  padding: 15px 15px;
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 9999;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.nav-1 li {
  display: inline-block;
  margin-left: 30px;
}

.social-icons {
  margin-left: 20px;
}

.social-icons a {
  margin-left: 15px;
  font-size: 1.2em;
  transition: color 0.3s ease;
}

.social-icons a:hover {
  color: aqua;
}

.nav-link {
  padding: 10px;
  font-weight: bold;
  position: relative;
  transition: all 0.3s ease;
}

.glitch-hover {
  position: relative;
  display: inline-block;
}

.glitch-hover::before,
.glitch-hover::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: all 0.3s ease;
}

.glitch-hover:hover {
  color: aqua;
  animation: glitch-text 0.4s infinite;
}

.glitch-hover:hover::before {
  opacity: 1;
  color: #ff0080;
  animation: glitch-before 0.4s infinite;
}

.glitch-hover:hover::after {
  opacity: 1;
  color: #00ffff;
  animation: glitch-after 0.4s infinite;
}

@keyframes glitch-text {
  0% { transform: translate(0); }
  20% { transform: translate(-1px, 1px); }
  40% { transform: translate(-1px, -1px); }
  60% { transform: translate(1px, 1px); }
  80% { transform: translate(1px, -1px); }
  100% { transform: translate(0); }
}

@keyframes glitch-before {
  0% { transform: translate(0); }
  20% { transform: translate(-2px, 2px); }
  40% { transform: translate(-2px, -2px); }
  60% { transform: translate(2px, 2px); }
  80% { transform: translate(2px, -2px); }
  100% { transform: translate(0); }
}

@keyframes glitch-after {
  0% { transform: translate(0); }
  20% { transform: translate(2px, -2px); }
  40% { transform: translate(2px, 2px); }
  60% { transform: translate(-2px, -2px); }
  80% { transform: translate(-2px, 2px); }
  100% { transform: translate(0); }
}

/* Hamburger Menu */
.hamburger,
.hamburger span,
.hamburger.active span {
  display: none;
}

.git-logo {
  color: whitesmoke;
  float: right;
}

.git-logo:hover {
  color: aqua;
}

/* INTRO */

.name-intro {
  color: whitesmoke;
}

.name-intro:hover {
  color: aqua;
}

.intro {
  background-image: url(photo/nasa-planet.jpg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: whitesmoke;
  font-family: "Roboto Mono";
  padding: 50px 30px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-bottom: 50px;
  position: relative;
  overflow: hidden;
}

.intro-title {
  font-size: 350%;
  padding-bottom: 2%;
  animation: moveAnimation 2s linear forwards;
}

.intro-text {
  font-size: 150%;
  animation: moveAnimation-one 2s linear forwards;
}

.project-button {
  color: whitesmoke;
  background-color: black;
  border-color: whitesmoke;
  border-radius: 15%;
  font-family: "Roboto Mono";
  height: 50px;
  max-width: 90px;
  margin-top: 25px;
  animation: moveAnimation-three 2s linear forwards;
}

/* PROJECT */

.projects {
  color: whitesmoke;
  font-family: "Roboto Mono";
  padding: 50px 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.undertitle {
  color: black;
  font-family: "Roboto Mono";
  font-size: large;
  padding: 50px 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.project-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
}

.project-card {
  display: flex;
  flex-direction: column;
  background-color: black;
  border-radius: 10px;
  padding: 10px;
  margin: 50px;
  width: 200px;
  height: 275px;
  box-shadow: 0 2.8px 2.2px rgba(0, 0, 0, 0.034),
    0 6.7px 5.3px rgba(0, 0, 0, 0.048), 0 12.5px 10px rgba(0, 0, 0, 0.06),
    0 22.3px 17.9px rgba(0, 0, 0, 0.072), 0 41.8px 33.4px rgba(0, 0, 0, 0.086),
    0 100px 80px rgba(0, 0, 0, 0.12);
  position: relative;
  transition: all 0.3s ease;
  overflow: hidden;
  opacity: 0;
  transform: translateY(50px);
}

.project-card.reveal {
  opacity: 1;
  transform: translateY(0);
  animation: revealGlitch 1s ease forwards;
}

.project-card:hover {
  transform: scale(1.05);
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
  animation: cardGlitch 0.5s ease-in-out;
}

.project-card:hover::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    45deg,
    transparent 0%,
    rgba(0, 255, 255, 0.2) 50%,
    transparent 100%
  );
  animation: glitchBorder 2s infinite;
}

.project-card:hover .project-image img {
  animation: imageGlitch 0.5s ease-in-out infinite;
}

.project-card:hover .project-name {
  color: aqua;
  text-shadow: 2px 0 0 rgba(255,0,80,0.3), -2px 0 0 rgba(0,255,255,0.5);
  animation: textGlitch 2s infinite;
}

@keyframes cardGlitch {
  0% {
    transform: scale(1.05) skew(0deg);
  }
  20% {
    transform: scale(1.05) skew(3deg);
  }
  40% {
    transform: scale(1.05) skew(-3deg);
  }
  60% {
    transform: scale(1.05) skew(2deg);
  }
  80% {
    transform: scale(1.05) skew(-2deg);
  }
  100% {
    transform: scale(1.05) skew(0deg);
  }
}

@keyframes glitchBorder {
  0% {
    clip-path: inset(0 0 0 0);
  }
  5% {
    clip-path: inset(10% 0 80% 0);
  }
  10% {
    clip-path: inset(80% 0 10% 0);
  }
  15% {
    clip-path: inset(0 0 0 0);
  }
  100% {
    clip-path: inset(0 0 0 0);
  }
}

@keyframes imageGlitch {
  0% {
    transform: translate(0);
    filter: hue-rotate(0deg);
  }
  25% {
    transform: translate(2px, -2px);
    filter: hue-rotate(90deg);
  }
  50% {
    transform: translate(-2px, 2px);
    filter: hue-rotate(180deg);
  }
  75% {
    transform: translate(2px, -2px);
    filter: hue-rotate(270deg);
  }
  100% {
    transform: translate(0);
    filter: hue-rotate(360deg);
  }
}

@keyframes textGlitch {
  0% {
    transform: translate(0);
  }
  20% {
    transform: translate(-2px, 2px);
  }
  40% {
    transform: translate(2px, -2px);
  }
  60% {
    transform: translate(-2px, -2px);
  }
  80% {
    transform: translate(2px, 2px);
  }
  100% {
    transform: translate(0);
  }
}

.project-image {
  height: 200px;
  overflow: hidden;
  border-radius: 10px 10px;
  margin-bottom: 30px;
  position: relative;
}

.project-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: all 0.3s ease;
}

.project-name {
  font-family: "Roboto Mono";
  text-align: center;
  transition: all 0.3s ease;
}

/* .project-details {
  background-color: black;
  color: white;
  padding: 20px;
  border-radius: 0 0 10px 10px;
} */

/* ABOUT */

.main-about {
  font-family: "Roboto Mono";
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  background-color: black;
  padding: 50px 0;
  width: 100%;
  overflow-x: hidden;
}

.about-title {
  color: whitesmoke;
  font-size: 28px;
  margin: 0 auto;
  text-align: center;
  opacity: 0;
  transform: translateY(20px);
}

.about-wrapper {
  color: whitesmoke;
  max-width: 800px;
  min-height: 60vh;
  margin: 40px auto;
  padding: 0 40px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
}

.about-wrapper p {
  line-height: 1.6;
  margin: 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-line;
}

.about-wrapper h4 {
  margin: 0 0 20px 0;
  font-size: 1.5em;
}

/* Typing Animation for About section */
.about-title.visible,
.about-wrapper .typing-text.visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.about-wrapper .typing-text {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.about-wrapper .typing-text.visible {
  opacity: 1;
  width: 100%;
  animation: typing 1s steps(30, end), blink-caret 0.75s step-end infinite;
}

.about-wrapper .typing-text.completed {
  border-right: none;
  animation: none;
}

.quote {
  font-style: italic;
  color: aqua;
  margin-top: 20px;
  font-size: 1.2em;
  text-align: center;
}

.quote-author {
  color: #888;
  font-size: 0.9em;
  margin-top: 5px;
  text-align: center;
}

/* Responsive Design for About Section */
@media (max-width: 768px) {
  .about-wrapper {
    padding: 0 20px;
    margin: 20px auto;
  }

  .about-wrapper p {
    font-size: 0.95em;
    line-height: 1.5;
  }

  .quote {
    font-size: 0.9em;
    padding: 15px;
    margin: 10px 0;
  }
}

@media (max-width: 480px) {
  .about-wrapper {
    padding: 0 15px;
    margin: 15px auto;
  }

  .about-wrapper p {
    font-size: 0.9em;
    line-height: 1.4;
  }

  .quote {
    font-size: 0.85em;
    padding: 10px;
    margin: 8px 0;
  }
}

/* Landscape Mode for About Section */
@media (max-height: 600px) and (orientation: landscape) {
  .about-wrapper {
    padding: 0 20px;
    margin: 15px auto;
  }

  .about-wrapper p {
    font-size: 0.9em;
    line-height: 1.4;
  }
}

/* FOOTER */

.footer-container {
  background-image: url(photo/tunnel.jpg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  max-width: 100%;
  min-height: 50vh;
  display: flex;
  flex-direction: column;
  padding: 50px 0;
  position: relative;
  overflow: hidden;
}

.section-title {
  color: whitesmoke;
  font-size: 28px;
  margin: 0 auto 30px;
  text-align: center;
}

.info-links {
  font-size: 25px;
  color: whitesmoke;
  margin: 80px;
  display: inline-block;
}

/* ANIMATION */

@keyframes moveAnimation {
  0% {
    transform: translateX(-50%);
  }
  100% {
    transform: translateX(0%);
  }
}

@keyframes moveAnimation-one {
  0% {
    transform: translateX(150%);
  }
  100% {
    transform: translateX(0%);
  }
}

@keyframes moveAnimation-three {
  0% {
    transform: translateX(-150%);
  }
  100% {
    transform: translateX(0%);
  }
}

#title-ani {
  animation: moveAnimation 2s linear forwards;
}

#title-text-ani {
  animation: moveAnimation-one 2s linear forwards;
}

.project-button {
  animation: moveAnimation-three 2s linear forwards;
}

/* Loading Animation */
.loader-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s ease-out;
}

.loader {
  position: relative;
  width: 80px;
  height: 80px;
}

.loader:before,
.loader:after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-color: aqua;
  opacity: 0.6;
  animation: pulse 2s ease-in-out infinite;
}

.loader:after {
  animation-delay: -1s;
}

@keyframes pulse {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

/* Theme Toggle */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 80px;
  z-index: 10000;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
  color: whitesmoke;
  font-size: 1.2rem;
  transition: transform 0.3s ease;
}

.theme-toggle:hover {
  transform: scale(1.1);
}

/* Light Theme Styles */
body.light-theme {
  background-color: #ffffff;
  color: #333333;
}

body.light-theme .nav-1 {
  background-color: #ffffff;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

body.light-theme .nav-1 li a {
  color: #333333;
}

body.light-theme .project-card {
  background-color: #f5f5f5;
  color: #333333;
}

body.light-theme .about-wrapper {
  color: #333333;
}

body.light-theme .intro {
  background-color: #f5f5f5;
  color: #333333;
}

body.light-theme .name-intro {
  color: #333333;
}

/* Typing Animation */
.typing-text {
  opacity: 0;
  white-space: nowrap;
  overflow: hidden;
  border-right: 2px solid #fff;
  width: 0;
  position: relative;
  display: inline-block;
}

.typing-text.visible {
  opacity: 1;
  width: 100%;
  animation: typing 1s steps(30, end), blink-caret 0.75s step-end infinite;
}

.typing-text.completed {
  border-right: none;
  animation: none;
}

@keyframes typing {
  from { width: 0 }
  to { width: 100% }
}

@keyframes blink-caret {
  from, to { border-color: transparent }
  50% { border-color: #fff }
}

.quote {
  font-style: italic;
  color: aqua;
  margin-top: 20px;
  font-size: 1.2em;
}

.quote-author {
  color: #888;
  font-size: 0.9em;
  margin-top: 5px;
}

/* Social Links */
.social-links {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-top: 20px;
}

.social-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: whitesmoke;
  text-decoration: none;
  transition: all 0.3s ease;
  padding: 20px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

.social-link i {
  font-size: 2.5rem;
  margin-bottom: 10px;
  transition: transform 0.3s ease;
}

.social-link span {
  font-family: "Roboto Mono";
  font-size: 1rem;
}

.social-link:hover {
  transform: translateY(-5px);
  background: rgba(255, 255, 255, 0.2);
}

.social-link:hover i {
  transform: scale(1.1);
}

/* Remove old contact form styles */
.contact-form,
.form-group,
.submit-btn {
  display: none;
}

/* Tech Text Animation */
.tech-text {
  opacity: 1;
  position: relative;
  color: whitesmoke;
}

.tech-text::before {
  content: attr(data-text);
  position: absolute;
  left: 0;
  width: 100%;
  height: 100%;
  color: whitesmoke;
  overflow: hidden;
  white-space: nowrap;
  animation: none;
}

.tech-text.animate {
  animation: glitchTextContinuous 5s infinite;
}

.tech-text.animate::before {
  animation: glitchContinuous 5s infinite;
}

@keyframes glitchTextContinuous {
  0% {
    text-shadow: 3px 0 0 rgba(0,255,255,0.5), -3px 0 0 rgba(255,0,80,0.3);
  }
  20% {
    text-shadow: -3px 0 0 rgba(0,255,255,0.5), 3px 0 0 rgba(255,0,80,0.3);
  }
  40% {
    text-shadow: 2px 0 0 rgba(0,255,255,0.5), -2px 0 0 rgba(255,0,80,0.3);
  }
  60% {
    text-shadow: 4px 0 0 rgba(0,255,255,0.5), -4px 0 0 rgba(255,0,80,0.3);
  }
  80% {
    text-shadow: -2px 0 0 rgba(0,255,255,0.5), 2px 0 0 rgba(255,0,80,0.3);
  }
  100% {
    text-shadow: 3px 0 0 rgba(0,255,255,0.5), -3px 0 0 rgba(255,0,80,0.3);
  }
}

@keyframes glitchContinuous {
  0% {
    clip-path: inset(71% 0 10% 0);
    transform: translate(-2px, 2px);
  }
  10% {
    clip-path: inset(24% 0 62% 0);
    transform: translate(2px, -2px);
  }
  20% {
    clip-path: inset(47% 0 37% 0);
    transform: translate(1px, 2px);
  }
  30% {
    clip-path: inset(90% 0 7% 0);
    transform: translate(2px, -1px);
  }
  40% {
    clip-path: inset(54% 0 15% 0);
    transform: translate(-2px, 1px);
  }
  50% {
    clip-path: inset(77% 0 33% 0);
    transform: translate(1px, -2px);
  }
  60% {
    clip-path: inset(33% 0 57% 0);
    transform: translate(-1px, 2px);
  }
  70% {
    clip-path: inset(67% 0 23% 0);
    transform: translate(2px, -1px);
  }
  80% {
    clip-path: inset(43% 0 47% 0);
    transform: translate(-2px, 1px);
  }
  90% {
    clip-path: inset(28% 0 62% 0);
    transform: translate(1px, -2px);
  }
  100% {
    clip-path: inset(71% 0 10% 0);
    transform: translate(-2px, 2px);
  }
}

/* Button Styles */
.button-container {
  display: flex;
  gap: 20px;
  justify-content: left;
  margin-top: 30px;
}

.nav-button {
  background: none;
  border: 2px solid aqua;
  color: aqua;
  padding: 10px 20px;
  font-family: "Roboto Mono";
  font-size: 1em;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.nav-button::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(0, 255, 255, 0.2),
    transparent
  );
  transition: 0.5s;
  z-index: -1;
}

.nav-button:hover {
  background-color: rgba(0, 255, 255, 0.1);
  box-shadow: 0 0 10px aqua;
  transform: translateY(-2px);
}

.nav-button:hover::before {
  left: 100%;
}

@keyframes revealGlitch {
  0% {
    clip-path: inset(100% 0 0 0);
    transform: translateY(50px);
    opacity: 0;
  }
  20% {
    clip-path: inset(20% 0 40% 0);
    transform: translateY(40px) skew(10deg);
    opacity: 0.3;
  }
  40% {
    clip-path: inset(60% 0 20% 0);
    transform: translateY(30px) skew(-5deg);
    opacity: 0.5;
  }
  60% {
    clip-path: inset(10% 0 70% 0);
    transform: translateY(20px) skew(7deg);
    opacity: 0.7;
  }
  80% {
    clip-path: inset(40% 0 30% 0);
    transform: translateY(10px) skew(-3deg);
    opacity: 0.9;
  }
  100% {
    clip-path: inset(0 0 0 0);
    transform: translateY(0) skew(0);
    opacity: 1;
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  /* Navigation */
  .nav-1 {
    padding: 10px;
  }

  .nav-1 li {
    margin-left: 15px;
    font-size: 0.9em;
  }

  .social-icons {
    margin-left: 10px;
  }

  .social-icons a {
    margin-left: 10px;
    font-size: 1em;
  }

  /* Intro Section */
  .intro {
    padding: 30px 15px;
    text-align: center;
  }

  .intro h1 {
    font-size: 2em;
  }

  .intro p {
    font-size: 1.1em;
  }

  .button-container {
    flex-direction: column;
    gap: 15px;
  }

  .button {
    width: 200px;
  }

  /* About Section */
  .main-about {
    padding: 30px 15px;
  }

  .about-wrapper {
    padding: 20px;
  }

  .about-wrapper h2 {
    font-size: 1.8em;
  }

  .about-wrapper p {
    font-size: 1em;
  }

  .quote {
    font-size: 0.9em;
    padding: 15px;
  }

  /* Projects Section */
  .projects {
    padding: 30px 15px;
  }

  .project-card {
    width: 100%;
    margin: 15px 0;
  }

  .project-card img {
    height: 200px;
  }

  .project-card h3 {
    font-size: 1.2em;
  }

  .project-card p {
    font-size: 0.9em;
  }

  /* Contact Section */
  .contact-container {
    padding: 30px 15px;
  }

  .contact-form {
    width: 100%;
    padding: 20px;
  }

  .form-group input,
  .form-group textarea {
    font-size: 1em;
  }

  /* Footer */
  .footer-container {
    padding: 30px 15px;
  }

  .section-title {
    font-size: 1.8em;
  }

  .social-links {
    gap: 20px;
  }

  .social-links a {
    font-size: 1.5em;
  }
}

@media (max-width: 480px) {
  /* Navigation */
  .nav-1 li {
    margin-left: 10px;
    font-size: 0.8em;
  }

  /* Intro Section */
  .intro h1 {
    font-size: 1.8em;
  }

  .intro p {
    font-size: 1em;
  }

  .button {
    width: 180px;
    font-size: 0.9em;
  }

  /* About Section */
  .about-wrapper h2 {
    font-size: 1.5em;
  }

  .about-wrapper p {
    font-size: 0.9em;
  }

  .quote {
    font-size: 0.8em;
  }

  /* Projects Section */
  .project-card img {
    height: 180px;
  }

  .project-card h3 {
    font-size: 1.1em;
  }

  .project-card p {
    font-size: 0.8em;
  }

  /* Contact Section */
  .contact-form {
    padding: 15px;
  }

  .form-group input,
  .form-group textarea {
    font-size: 0.9em;
  }

  /* Footer */
  .section-title {
    font-size: 1.5em;
  }

  .social-links a {
    font-size: 1.3em;
  }
}

/* Tablet Specific Adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
  .project-card {
    width: calc(50% - 20px);
  }

  .about-wrapper {
    padding: 30px;
  }

  .contact-form {
    width: 80%;
  }
}

/* Landscape Mode Adjustments */
@media (max-height: 600px) and (orientation: landscape) {
  .intro {
    min-height: auto;
    padding: 100px 30px;
  }

  .footer-container {
    min-height: auto;
    padding: 30px 0;
  }

  .project-card img {
    height: 150px;
  }
}
