/* Import font */
@import url("https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@300;400;500;600&display=swap");

:root {
  --primary-color: #ff0000;
  --text-color: #ffffff;
  --background-color: #000000;
  --accent-color: #333333;
  --header-height: 120px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Chakra Petch", "Roboto", sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
  position: relative;
  min-height: 100vh;
}

/* Personalizza i pesi del font per diversi elementi */
h1,
h2,
h3 {
  font-weight: 600;
  letter-spacing: 0.5px;
}

p,
li {
  font-weight: 300;
  letter-spacing: 0.3px;
}

nav a {
  font-weight: 500;
  letter-spacing: 0.5px;
}

header {
  position: relative;
  background-color: transparent;
  text-align: center;
  border-bottom: 1px solid var(--primary-color);
  overflow: hidden;
  z-index: 2;
}

.header-content {
  position: relative;
  z-index: 1;
}

.logo {
  max-width: min(600px, 90vw);
  width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
  padding: 1rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.subtitle {
  display: none;
}

nav {
  background-color: rgba(51, 51, 51);
  border-bottom: 1px solid var(--primary-color);
  padding: 1.5rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  height: 56px;
  display: flex;
  align-items: center;
}

nav ul {
  display: flex;
  justify-content: center;
  list-style: none;
  gap: 2rem;
}

nav a {
  color: var(--text-color);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

nav a:hover {
  color: var(--primary-color);
}

main {
  position: relative;
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem;
  min-height: 100vh;
}

section {
  margin-bottom: 4rem;
  animation: fadeIn 0.8s ease-out forwards;
  padding-top: 40px;
  scroll-margin-top: 40px;
}

section:first-of-type {
  padding-top: 40px;
}

h2 {
  color: var(--primary-color);
  margin-bottom: 1rem;
  font-size: 2rem;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.skill-category {
  background-color: rgba(51, 51, 51, 0.9);
  padding: 1.5rem 0.9rem;
  border-radius: 8px;
  transition: transform 0.3s ease;
  backdrop-filter: blur(5px);
}

.skill-category:hover {
  transform: translateY(-5px);
}

.skill-category h3 {
  color: var(--primary-color);
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.8rem;
}

.skill-category h3 i {
  font-size: 2.5rem;
}

.skill-category ul {
  list-style: none;
}

.skill-category li {
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.skill-category li i {
  color: var(--primary-color);
  width: 20px;
  text-align: center;
}

.timeline {
  position: relative;
  padding: 2rem 0;
}

#contact-form {
  max-width: 100%;
  margin: 0 auto;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.form-row .form-group {
  flex: 1;
  margin-bottom: 0;
}

label {
  display: block;
  margin-bottom: 0.5rem;
}

input,
textarea {
  width: 100%;
  padding: 0.8rem;
  background-color: var(--accent-color);
  border: 1px solid var(--primary-color);
  color: var(--text-color);
  border-radius: 4px;
  font-family: "Roboto", sans-serif;
}

textarea {
  min-height: 150px;
  resize: vertical;
}

button,
.cookie-btn.accept {
  background-color: var(--primary-color);
  color: #fff;
  font-size: 1.125rem;
  padding: 1rem 2rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s ease, color 0.3s;
}

button:hover,
.cookie-btn.accept:hover {
  background-color: #cc0000;
  color: #fff;
}

footer {
  position: relative;
  background-color: rgba(51, 51, 51, 0.95);
  border-top: 1px solid var(--primary-color);
  padding-top: 0.5rem;
  text-align: center;
  z-index: 1;
}

.social-links {
  margin-bottom: 0.5rem;
}

.social-links a {
  color: var(--text-color);
  font-size: 2rem;
  margin: 0 1rem;
  transition: color 0.3s ease;
}

.social-links a:hover {
  color: var(--primary-color);
}

/* Responsive Design */
@media (max-width: 768px) {
  nav ul {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }

  .skills-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  h1 {
    font-size: 2rem;
  }

  .subtitle {
    font-size: 1rem;
  }

  .form-row {
    flex-direction: column;
    gap: 1.5rem;
  }

  .logo {
    max-width: 85vw;
    padding: 0.5rem;
  }

  header {
    padding: 0.5rem 0;
  }
}

@media (max-width: 480px) {
  .logo {
    max-width: 95vw;
    padding: 0.25rem;
  }
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

section {
  animation: fadeIn 0.8s ease-out forwards;
}

#matrix-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 1;
  pointer-events: none;
  background-color: rgba(0, 0, 0, 0.97);
}

.nav-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  justify-content: center;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 100;
}

.hamburger-box {
  width: 30px;
  height: 24px;
  display: inline-block;
  position: relative;
}

.hamburger-inner {
  display: block;
  top: 50%;
  margin-top: -2px;
}

.hamburger-inner,
.hamburger-inner::before,
.hamburger-inner::after {
  width: 30px;
  height: 3px;
  background-color: var(--text-color);
  position: absolute;
  transition: transform 0.15s ease;
}

.hamburger-inner::before,
.hamburger-inner::after {
  content: "";
  display: block;
}

.hamburger-inner::before {
  top: -10px;
}

.hamburger-inner::after {
  bottom: -10px;
}

/* Animazione hamburger */
.hamburger.is-active .hamburger-inner {
  transform: rotate(45deg);
}

.hamburger.is-active .hamburger-inner::before {
  top: 0;
  opacity: 0;
}

.hamburger.is-active .hamburger-inner::after {
  bottom: 0;
  transform: rotate(-90deg);
}

@media (max-width: 768px) {
  .hamburger {
    display: block;
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 101;
  }

  .nav-container {
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
    height: 100%;
    max-width: none;
  }

  .nav-menu {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.97);
    z-index: 2000;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    padding-top: 100px;
    border-top: 3px solid var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    overflow-y: auto;
  }

  .nav-menu.is-active {
    display: flex;
  }

  .nav-menu ul {
    flex-direction: column;
    gap: 0;
  }

  .nav-menu li {
    width: 100%;
    text-align: center;
  }

  .nav-menu a {
    display: block;
    padding: 1rem;
    font-size: 1.1rem;
    border-bottom: 1px solid rgba(255, 0, 0, 0.2);
    transition: all 0.3s ease;
  }

  .nav-menu li:last-child a {
    border-bottom: none;
  }

  .nav-menu a:hover {
    background-color: rgba(255, 0, 0, 0.1);
    transform: translateX(5px);
  }

  .lang-switch {
    position: relative;
    left: 0;
    transform: none;
    display: flex;
    gap: 0.5rem;
  }

  .lang-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
  }

  body.menu-open {
    overflow: hidden !important;
  }
}

.lang-switch {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 0.5rem;
}

.lang-btn {
  background: none;
  border: 1px solid var(--text-color);
  color: var(--text-color);
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.lang-btn.active {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.lang-btn:hover {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

@media (max-width: 768px) {
  .lang-switch {
    left: 1rem;
  }
}

/* Honeypot field - completamente nascosto */
.contact-field-hp {
  display: none !important;
  position: absolute !important;
  left: -9999px !important;
  opacity: 0 !important;
  visibility: hidden !important;
  height: 0 !important;
  width: 0 !important;
  overflow: hidden !important;
  border: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.contact-field-hp label,
.contact-field-hp input {
  display: none !important;
  position: absolute !important;
  left: -9999px !important;
  opacity: 0 !important;
  visibility: hidden !important;
}

/* Cookie Banner */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: rgba(0, 0, 0, 0.98);
  padding: 1.5rem;
  z-index: 1000;
  border-top: 1px solid var(--primary-color);
  transform: translateY(100%);
  transition: transform 0.3s ease-in-out;
  backdrop-filter: blur(10px);
}

.cookie-banner.show {
  transform: translateY(0);
}

.cookie-content {
  max-width: 800px;
  margin: 0 auto;
}

.cookie-content h3 {
  color: var(--primary-color);
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

.cookie-content p {
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  line-height: 1.5;
}

.cookie-buttons {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.cookie-btn {
  padding: 0.8rem 1.5rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.cookie-btn.accept {
  background-color: var(--primary-color);
  color: var(--text-color);
}

.cookie-btn.accept:hover {
  background-color: #cc0000;
}

.cookie-btn.reject {
  background-color: transparent;
  border: 1px solid var(--text-color);
  color: var(--text-color);
}

.cookie-btn.reject:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.cookie-link {
  color: var(--text-color);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.3s ease;
}

.cookie-link:hover {
  color: var(--primary-color);
}

@media (max-width: 768px) {
  .cookie-buttons {
    flex-direction: column;
    align-items: stretch;
  }

  .cookie-btn,
  .cookie-link {
    text-align: center;
  }
}

/* Privacy Policy Page */
.privacy-policy {
  position: relative;
  z-index: 1;
  padding: 4rem 2rem;
  margin-top: 56px;
}

.privacy-policy .container {
  background-color: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(10px);
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 0, 0, 0.1);
}

.privacy-policy h1 {
  color: var(--primary-color);
  font-size: 2.5rem;
  margin-bottom: 1rem;
  text-align: center;
}

.privacy-policy .last-update {
  text-align: center;
  color: #b3b3b3;
  margin-bottom: 3rem;
  font-size: 0.9rem;
}

.privacy-policy section {
  margin-bottom: 3rem;
}

.privacy-policy h2 {
  color: var(--primary-color);
  font-size: 1.8rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--primary-color);
  padding-bottom: 0.5rem;
}

.privacy-policy h3 {
  color: var(--text-color);
  font-size: 1.3rem;
  margin: 1.5rem 0 1rem;
}

.privacy-policy p {
  line-height: 1.6;
  margin-bottom: 1rem;
}

.privacy-policy ul {
  list-style-type: disc;
  margin-left: 2rem;
  margin-bottom: 1rem;
}

.privacy-policy li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.privacy-policy .back-to-home {
  text-align: center;
  margin-top: 4rem;
}

.privacy-policy .back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-color);
  text-decoration: none;
  padding: 0.8rem 1.5rem;
  border: 1px solid var(--text-color);
  border-radius: 4px;
  transition: all 0.3s ease;
  font-size: 1rem;
}

.privacy-policy .back-btn:hover {
  color: var(--primary-color);
  border-color: var(--primary-color);
}

@media (max-width: 768px) {
  .privacy-policy {
    padding: 2rem 1rem;
  }

  .privacy-policy h1 {
    font-size: 2rem;
  }

  .privacy-policy h2 {
    font-size: 1.5rem;
  }

  .privacy-policy h3 {
    font-size: 1.2rem;
  }
}

.cookie-content p .cookie-link {
  color: var(--primary-color);
  text-decoration: underline;
}

.cookie-content p .cookie-link:hover {
  color: #cc0000;
}

.quote {
  font-style: italic;
  text-align: right;
  margin-top: 1.5rem;
  padding: 1rem 1rem 0.3rem 1rem;
  border-top: 1px solid rgba(255, 0, 0, 0.3);
  color: #e0e0e0;
  font-size: 1rem;
  margin-bottom: 0;
  background: rgba(255, 0, 0, 0.05);
  border-radius: 4px 4px 0 0;
  letter-spacing: 0.5px;
}

@media (max-width: 768px) {
  .quote {
    font-size: 0.86rem;
  }
}

.quote::before {
  content: "«";
  margin-right: 0.2rem;
  color: var(--primary-color);
}

.quote::after {
  content: "»";
  margin-left: 0.2rem;
  color: var(--primary-color);
}

.quote-source {
  text-align: right;
  font-size: 0.85rem;
  color: #b3b3b3;
  margin: 0;
  padding: 0 1rem 0.7rem 1rem;
  font-style: italic;
  background: rgba(255, 0, 0, 0.05);
  border-radius: 0 0 4px 4px;
}

.quote-source a {
  color: #b3b3b3;
  text-decoration: none;
  transition: color 0.3s ease;
}

.quote-source a:hover {
  color: var(--primary-color);
}

#about p {
  line-height: 1.8;
  margin-bottom: 15px;
}

#about p:last-of-type {
  margin-bottom: 0;
}

#about strong {
  color: var(--text-color);
  font-weight: 700;
  letter-spacing: 0.8px;
  text-shadow: 0 0 1px rgba(255, 255, 255, 0.5);
}

/* Stile specifico per i bullet points */
#about p:nth-child(4),
#about p:nth-child(5),
#about p:nth-child(6) {
  margin-bottom: 0;
  padding-left: 15px;
}

@media (max-width: 768px) {
  .about-text {
    position: relative;
    transition: max-height 0.3s ease-out;
    overflow: hidden;
    margin-bottom: 0;
    max-height: 1000px; /* Altezza massima quando espanso */
  }

  .about-text.collapsed {
    max-height: 300px;
  }

  .about-text.collapsed::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100px;
    background: linear-gradient(transparent, var(--background-color));
    pointer-events: none;
  }

  .expand-btn {
    display: inline-block;
    width: 100%;
    text-align: center;
    padding: 0.5rem;
    margin-bottom: 0;
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 1rem;
    text-decoration: none;
  }

  .expand-btn:hover {
    color: #cc0000;
  }

  .expand-btn i {
    margin-left: 0.5rem;
    transition: transform 0.3s ease;
    display: inline-block;
  }
}

@media (min-width: 769px) {
  .expand-btn {
    display: none;
  }
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 1rem 2rem;
  border-radius: 8px;
  color: #fff;
  font-size: 0.9rem;
  transform: translateY(100px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease-in-out;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast.success {
  background-color: #28a745;
}

.toast.error {
  background-color: #dc3545;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

@media (max-width: 768px) {
  .toast {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    text-align: center;
  }
}

@media (max-width: 768px) {
  .cookie-banner {
    padding: 1rem;
  }

  .cookie-banner.show {
    padding-bottom: calc(1rem + var(--header-height));
  }

  .nav-menu {
    z-index: 1001;
  }

  .hamburger {
    z-index: 1002;
  }
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.tool-item {
  background-color: rgba(51, 51, 51, 0.9);
  padding: 2rem;
  border-radius: 8px;
  text-align: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(5px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  border: 1px solid transparent;
  text-decoration: none;
  color: inherit;
}

.tool-item:hover {
  transform: translateY(-5px);
  border-color: var(--primary-color);
  box-shadow: 0 5px 15px rgba(255, 0, 0, 0.1);
}

.tool-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  transition: all 0.3s ease;
}

.tool-item:hover .tool-logo {
  transform: scale(1.1);
}

.tool-item h3 {
  color: var(--primary-color);
  margin: 0;
  font-size: 1.2rem;
}

.tool-item p {
  color: #e0e0e0;
  font-size: 0.9rem;
  margin: 0;
}

@media (max-width: 768px) {
  .tools-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .tool-item {
    padding: 1.5rem;
  }
}

@media (max-width: 480px) {
  .tools-grid {
    grid-template-columns: 1fr;
  }
}

a:focus,
button:focus,
input:focus,
textarea:focus,
.cookie-btn:focus,
.expand-btn:focus {
  outline: 3px solid #ff0000;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(255, 0, 0, 0.3);
  transition: outline 0.2s, box-shadow 0.2s;
}

.skip-link {
  position: absolute;
  left: 0;
  top: 0;
  background: #ff0000;
  color: #fff;
  padding: 0.75rem 1.5rem;
  z-index: 2000;
  font-size: 1rem;
  border-radius: 0 0 8px 0;
  transform: translateY(-100%);
  transition: transform 0.2s;
  text-decoration: none;
  outline: none;
}
.skip-link:focus {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
    scroll-behavior: auto !important;
  }
  .cursor-effect,
  .network-effect,
  .matrix-bg,
  .about-text.collapsed::after {
    animation: none !important;
  }
}

/* Link nella privacy policy */
.privacy-policy a,
.privacy-policy .cookie-link {
  color: #ff4d4d;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.2s, text-decoration-thickness 0.2s;
  text-decoration-thickness: 2px;
  outline: none;
}
.privacy-policy a:hover,
.privacy-policy .cookie-link:hover {
  color: #fff;
  background: #ff0000;
  text-decoration: underline;
  text-decoration-thickness: 3px;
  border-radius: 2px;
}
.privacy-policy a:focus,
.privacy-policy .cookie-link:focus {
  outline: 3px solid #ff0000;
  outline-offset: 2px;
  background: #222;
  color: #fff;
  text-decoration: underline;
  text-decoration-thickness: 3px;
  border-radius: 2px;
}
