/* NES theme - only active when data-theme="nes" */
html[data-theme="nes"],
html[data-theme="nes"] body,
html[data-theme="nes"] * {
  font-family: 'Pixelify Sans', "Press Start 2P", cursive !important;
  font-weight: 500;
}

html[data-theme="nes"],
html[data-theme="nes"] body {
  background-color: #f0f0f0 !important; /* Grigio molto chiaro */
  color: #000;
  font-size: 20px !important; /* Base font size aumentato */
}

html[data-theme="nes"] .cv-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

html[data-theme="nes"] .section {
  margin-bottom: 3rem;
}

html[data-theme="nes"] .section-title {
  font-size: 1.4rem;
  margin-bottom: 1.5rem;
  color: #92cc41; /* NES green */
}

html[data-theme="nes"] .subsection-title {
  font-size: 1rem;
  margin: 1.5rem 0 1rem 0;
  color: #209fb5;
}

/* NES.css component overrides */
html[data-theme="nes"] .nes-container {
  margin-bottom: 2rem;
}

html[data-theme="nes"] .nes-text.is-disabled {
  color: #666 !important; /* Grigio più scuro */
}

html[data-theme="nes"] .nes-text.is-primary {
  color: #333 !important; /* Grigio più scuro */
}

html[data-theme="nes"] .nes-badge {
  margin: 0.25rem;
  display: inline-block !important;
  min-width: 0 !important;
  width: auto !important;
  max-width: 100% !important;
  height: auto !important;
  padding: 0.35rem 0.65rem !important;
  vertical-align: middle;
  box-sizing: border-box !important;
  font-size: 0.75rem !important;
}

html[data-theme="nes"] .nes-badge::before,
html[data-theme="nes"] .nes-badge::after {
  content: none !important;
}

html[data-theme="nes"] .nes-badge > span {
  display: inline !important;
  position: static !important;
  transform: none !important;
  padding: 0 !important;
  margin: 0 !important;
  white-space: nowrap !important;
  font-size: 0.75rem !important;
}

/* SVG Icon styling */
html[data-theme="nes"] .icon {
  display: inline-block;
  width: 3em;
  height: 3em;
  margin-right: 0.4rem;
  vertical-align: middle;
  position: relative;
  top: -0.3em;
}

html[data-theme="nes"] .icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
  display: block;
}

/* Header title - Nome prominente */
html[data-theme="nes"] .nes-container.with-title .title {
  font-size: 1.5rem !important;
  text-align: center;
  color: #ffd700 !important;
  text-shadow: 3px 3px 0 #000;
  margin-bottom: 1.5rem !important;
  letter-spacing: 0.05em;
}

/* Profile image styling */
html[data-theme="nes"] .profile-img {
  image-rendering: pixelated;
  border: 4px solid #fff;
  margin-bottom: 1rem;
}

/* Header layout */
html[data-theme="nes"] .header-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}

html[data-theme="nes"] .header-text h1 {
  font-size: 1rem;
  margin: 0.5rem 0;
  line-height: 1.5;
}

html[data-theme="nes"] .header-text p {
  font-size: 0.9rem;
  margin: 0.5rem 0;
  line-height: 1.5;
}

html[data-theme="nes"] .keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1rem;
  overflow-x: auto;
  max-width: 100%;
}

/* Competencies grid */
html[data-theme="nes"] .competencies-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

html[data-theme="nes"] .competency-description {
  font-size: 0.85rem;
  line-height: 1.6;
  margin: 1rem 0;
}

html[data-theme="nes"] .competency-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
  overflow-x: auto;
  max-width: 100%;
}

/* Experience styling */
html[data-theme="nes"] .experience-section .nes-container.with-title {
  background-color: #f0f0f0 !important; /* Coordinato con sfondo pagina */
}

html[data-theme="nes"] .experience-section .nes-container.with-title .title {
  background-color: #f0f0f0 !important; /* Coordinato con sfondo pagina */
  color: #000 !important;
  text-shadow: none !important;
  font-size: 0.8rem !important;
}

html[data-theme="nes"] .job-meta {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.5rem 0 1rem 0;
  font-size: 0.8rem;
}

html[data-theme="nes"] .company-description {
  font-size: 0.8rem;
  font-style: italic;
  margin: 0.5rem 0;
  line-height: 1.5;
}

html[data-theme="nes"] .highlight {
  font-size: 0.85rem;
  margin: 0.5rem 0;
  color: #d97706;
  line-height: 1.5;
}

html[data-theme="nes"] .nes-list {
  font-size: 0.8rem;
  line-height: 1.6;
  margin: 1rem 0;
}

html[data-theme="nes"] .nes-list li {
  margin: 0.75rem 0;
  padding-left: 0.5rem;
}

html[data-theme="nes"] .technologies {
  margin-top: 1rem;
  font-size: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  overflow-x: auto;
  max-width: 100%;
}

html[data-theme="nes"] .technologies strong {
  display: block;
  margin-bottom: 0.5rem;
  width: 100%;
  flex-basis: 100%;
}

/* Skills grid */
html[data-theme="nes"] .skills-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

html[data-theme="nes"] .skills-grid h3 {
  font-size: 0.8rem;
  margin-bottom: 0.75rem;
  color: #92cc41;
}

html[data-theme="nes"] .skills-grid h4 {
  font-size: 0.85rem;
  margin: 0.75rem 0 0.5rem 0;
  color: #209fb5;
}

html[data-theme="nes"] .skills-grid p,
html[data-theme="nes"] .skills-grid ul {
  font-size: 0.8rem;
  line-height: 1.6;
}

html[data-theme="nes"] .skill-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.5rem 0;
  overflow-x: auto;
  max-width: 100%;
}

/* Projects */
html[data-theme="nes"] .project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
  overflow-x: auto;
  max-width: 100%;
}

/* Contact section */
html[data-theme="nes"] .contact-info {
  font-size: 0.85rem;
  line-height: 1.8;
}

html[data-theme="nes"] .contact-info a {
  color: #92cc41 !important;
  text-decoration: underline;
}

html[data-theme="nes"] .contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
}

/* Values */
html[data-theme="nes"] .values-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
  overflow-x: auto;
  max-width: 100%;
}

/* Legal */
html[data-theme="nes"] .legal-text {
  font-size: 0.75rem;
  line-height: 1.5;
  opacity: 0.8;
}

/* NES decorative elements */

/* Pixel pattern background overlay */
html[data-theme="nes"]::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(0, 0, 0, 0.03) 2px,
      rgba(0, 0, 0, 0.03) 4px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 2px,
      rgba(0, 0, 0, 0.03) 2px,
      rgba(0, 0, 0, 0.03) 4px
    );
  pointer-events: none;
  z-index: 1;
}

/* Pokéball interactive element */
html[data-theme="nes"] .nes-pokeball-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 998;
  cursor: pointer;
  animation: pokeball-bounce 2s ease-in-out infinite;
  transition: transform 0.2s;
}

html[data-theme="nes"] .nes-pokeball-container:hover {
  transform: scale(1.2);
}

html[data-theme="nes"] .nes-pokeball-container .nes-pokeball {
  font-size: 4rem;
  display: block;
}

@keyframes pokeball-bounce {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  50% { transform: translateY(-10px) rotate(5deg); }
}

/* Progress bar removed - was ugly */

/* SNES Logo interactive element */
html[data-theme="nes"] .snes-logo-container {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1;
  cursor: pointer;
  transition: transform 0.2s;
}

html[data-theme="nes"] .snes-logo-container:hover {
  transform: scale(1.1);
}

html[data-theme="nes"] .snes-logo-container .snes-logo {
  font-size: 3rem;
  display: block;
  filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.3));
}

/* Pokemon Dialog */
html[data-theme="nes"] .pokemon-dialog {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1003;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

html[data-theme="nes"] .pokemon-window {
  max-width: 600px;
  width: 90%;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { transform: translateY(-50px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

html[data-theme="nes"] .pokemon-content {
  display: flex;
  gap: 2rem;
  align-items: center;
  margin: 1rem 0;
  flex-wrap: wrap;
}

html[data-theme="nes"] .pokemon-sprite {
  font-size: 6rem;
  animation: pokemonAppear 0.5s ease;
}

@keyframes pokemonAppear {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}

html[data-theme="nes"] .pokemon-sprite i {
  display: block;
}

html[data-theme="nes"] .pokemon-info {
  flex: 1;
  min-width: 250px;
}

html[data-theme="nes"] .pokemon-info p {
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 0.5rem 0;
}

html[data-theme="nes"] .pokemon-speech {
  margin-top: 1.5rem;
  font-size: 0.85rem;
}

html[data-theme="nes"] .pokemon-speech p {
  color: #212529 !important;
  font-size: 0.85rem;
  line-height: 1.6;
}

html[data-theme="nes"] .dialog-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

html[data-theme="nes"] .catch-message {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1004;
  animation: popIn 0.3s ease;
}

@keyframes popIn {
  0% { transform: translate(-50%, -50%) scale(0); }
  50% { transform: translate(-50%, -50%) scale(1.1); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

/* Settings Dialog */
html[data-theme="nes"] .snes-showcase-dialog {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1003;
  overflow-y: auto;
  padding: 2rem 1rem;
}

html[data-theme="nes"] .settings-window {
  max-width: 700px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
  margin: auto;
}

html[data-theme="nes"] .settings-content {
  padding: 1rem 1.5rem;
}

html[data-theme="nes"] .settings-section {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 4px dashed #666;
}

html[data-theme="nes"] .settings-section:last-of-type {
  border-bottom: none;
}

html[data-theme="nes"] .settings-section h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

html[data-theme="nes"] .form-controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

html[data-theme="nes"] .form-controls label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  font-size: 0.95rem;
  color: #fff;
}

html[data-theme="nes"] .volume-control {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

html[data-theme="nes"] .volume-control label {
  color: #fff;
  font-size: 0.9rem;
}

html[data-theme="nes"] .volume-slider {
  width: 100%;
  height: 8px;
  -webkit-appearance: none;
  appearance: none;
  background: #666;
  outline: none;
  border-radius: 4px;
}

html[data-theme="nes"] .volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: #f7d51d;
  cursor: pointer;
  border-radius: 50%;
  border: 3px solid #212529;
}

html[data-theme="nes"] .volume-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: #f7d51d;
  cursor: pointer;
  border-radius: 50%;
  border: 3px solid #212529;
}

html[data-theme="nes"] .cheat-hint {
  font-size: 0.75rem;
  color: #92cc41;
  margin-top: 0.5rem;
  font-style: italic;
}

html[data-theme="nes"] .stats-display {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  color: #fff;
}

html[data-theme="nes"] .stats-display p {
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

html[data-theme="nes"] .settings-tip {
  margin-top: 1.5rem;
  font-size: 0.85rem;
}

/* Hide 98 theme elements when NES is active */
html[data-theme="nes"] [data-theme-target="98"] {
  display: none;
}

html[data-theme="nes"] [data-theme-target="nes"] {
  display: block;
}

/* Responsive adjustments */
@media screen and (min-width: 768px) {
  html[data-theme="nes"] .header-content {
    flex-direction: row;
    text-align: left;
  }

  html[data-theme="nes"] .keywords {
    justify-content: flex-start;
  }

  html[data-theme="nes"] .competencies-grid,
  html[data-theme="nes"] .skills-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media screen and (max-width: 768px) {
  html[data-theme="nes"] {
    font-size: 0.8rem;
  }

  html[data-theme="nes"] .cv-container {
    padding: 1rem;
    padding-top: 5rem; /* Spazio per i pulsanti fissi */
  }

  html[data-theme="nes"] .profile-img {
    width: 150px !important;
    height: 150px !important;
  }

  /* Fix trofei che vanno a capo nel nome */
  html[data-theme="nes"] .nes-container.with-title .title {
    font-size: 0.9rem !important; /* Ridotto per mobile */
    line-height: 1.4;
    white-space: normal;
    word-wrap: break-word;
  }

  html[data-theme="nes"] .nes-container.with-title .title .nes-icon {
    display: inline-block;
    vertical-align: middle;
  }

  /* Fix headline che sfonda il bordo */
  html[data-theme="nes"] .header-text h1 {
    font-size: 0.8rem !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  html[data-theme="nes"] .header-text p {
    font-size: 0.75rem !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  /* Fix badge che sfondano su mobile */
  html[data-theme="nes"] .nes-badge {
    font-size: 0.7rem !important;
    padding: 0.3rem 0.5rem !important;
    max-width: calc(100vw - 4rem);
    overflow: hidden;
    text-overflow: ellipsis;
  }

  html[data-theme="nes"] .nes-badge > span {
    font-size: 0.7rem !important;
    white-space: normal !important;
    word-wrap: break-word;
  }

  /* Keywords e altri badge wrappabili */
  html[data-theme="nes"] .keywords,
  html[data-theme="nes"] .competency-keywords,
  html[data-theme="nes"] .skill-badges,
  html[data-theme="nes"] .project-meta,
  html[data-theme="nes"] .values-list {
    max-width: 100%;
    overflow-x: visible;
  }

  /* Hide SNES logo on mobile, keep pokeball smaller */
  html[data-theme="nes"] .snes-logo-container {
    display: none;
  }

  html[data-theme="nes"] .nes-pokeball-container {
    bottom: 1rem;
    right: 1rem;
  }

  html[data-theme="nes"] .nes-pokeball-container .nes-pokeball {
    font-size: 3rem;
  }


  /* Smaller pokemon dialog */
  html[data-theme="nes"] .pokemon-content {
    flex-direction: column;
    gap: 1rem;
  }

  html[data-theme="nes"] .pokemon-sprite {
    font-size: 4rem;
  }

  /* Smaller settings window */
  html[data-theme="nes"] .settings-window {
    width: 100%;
    max-height: 85vh;
  }

  html[data-theme="nes"] .stats-display {
    grid-template-columns: 1fr;
  }
}

/* Hide SNES logo on medium screens to avoid covering CV content */
@media screen and (max-width: 1200px) {
  html[data-theme="nes"] .snes-logo-container {
    display: none;
  }
}
