/* --- General Foundation --- */
.interactive-board-section {
  background-color: var(--bg-tertiary);
  padding: 2rem 1rem; /* More horizontal padding on mobile */
  border-radius: 12px;
  margin: 2.5rem 0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.variation-selector {
  text-align: center;
  margin-bottom: 2rem;
}

#variation-dropdown {
  padding: 12px 20px;
  font-size: 1.1rem;
  border-radius: 8px;
  border: 1px solid var(--border-secondary);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  min-width: 250px;
  max-width: 400px; /* set max for large */
  width: 90%; /* fluid but with max */
  cursor: pointer;
  transition: all 0.3s ease;
}

.board-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  margin-top: 1rem;
  width: 100%;
  box-sizing: border-box;
}

/* Board container layout */
.board-container-interactive {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2rem;
  width: 100%;
}

/* Chessboard size */
.chessboard {
  width: 100%;
  max-width: 480px;
  min-width: 280px;
  aspect-ratio: 1 / 1; /* keeps square */
}

/* Annotations */
.board-annotations {
  flex: 1;
  min-width: 280px;
  max-width: 100%;
  background: var(--bg-secondary);
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  height: fit-content;
  border-left: 3px solid var(--accent-primary);
}

.board-annotations h4 {
  margin-top: 0;
  font-size: 1.3rem;
  color: var(--accent-primary);
  margin-bottom: 1rem;
}

.board-annotations p {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* Controls */
.board-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.8rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.board-controls button {
  background-color: var(--accent-primary);
  color: white;
  border: none;
  padding: 10px 18px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 50px;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.board-controls button:hover {
  background-color: var(--accent-hover);
  transform: translateY(-2px);
}

.board-controls button:disabled {
  background-color: #555;
  cursor: not-allowed;
  transform: none;
}

/* Board info text */
.board-info {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  width: 100%;
  font-family: "Courier New", monospace;
}

/* Square highlighting */
.highlight-red {
  box-shadow: inset 0 0 4px 3px rgba(255, 0, 0, 0.7);
}
.highlight-yellow {
  box-shadow: inset 0 0 4px 3px rgba(255, 255, 0, 0.7);
}
.highlight-green {
  box-shadow: inset 0 0 4px 3px rgba(10, 186, 2, 0.7);
}
.highlight-blue {
  box-shadow: inset 0 0 4px 3px rgba(0, 119, 255, 0.7);
}

/* Mobile Screen Adjustments */

/* Tablet and small devices */
@media (max-width: 768px) {
  .board-wrapper {
    gap: 1rem;
    margin-top: 0.5rem;
    align-items: stretch; /* fill width */
    padding: 0 5vw;
  }

  .board-container-interactive {
    flex-direction: column;
    gap: 1rem;
  }

  #variation-dropdown {
    min-width: 100%;
    max-width: none;
    font-size: 1.05rem;
  }

  .board-annotations {
    min-width: 100%;
    padding: 1rem;
  }

  .board-annotations h4 {
    font-size: 1.1rem;
  }

  .board-annotations p {
    font-size: 0.9rem;
  }

  .board-controls button {
    padding: 8px 14px;
    font-size: 0.9rem;
  }
}

/* Very small phones */
@media (max-width: 480px) {
  #variation-dropdown {
    min-width: 100%;
    font-size: 1rem;
    padding: 10px 15px;
  }

  .board-controls {
    gap: 0.5rem;
  }

  .board-controls button {
    padding: 6px 10px;
    font-size: 0.85rem;
    flex: 1 1 auto;
    min-width: 70px;
  }

  .board-controls button i {
    font-size: 0.8rem;
  }

  .board-info {
    font-size: 0.8rem;
    word-break: break-word;
  }

  .chessboard {
    max-width: 100%;
    min-width: auto; /* remove min */
    aspect-ratio: 1 / 1;
  }

  .board-annotations {
    border-left: none;
    border-top: 3px solid var(--accent-primary);
    padding: 0.75rem 1rem;
    box-shadow: none; /* simpler on small */
  }
}

/* --- Gallery & Accordion (also fluid) --- */
.tactics-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.tactic-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-secondary);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.tactic-card h4 {
  color: var(--accent-primary);
}

.mini-chessboard {
  width: 100%;
  margin-bottom: 1rem;
}

.faq-accordion {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1rem; /* fluid on mobile */
}

.faq-item {
  background: var(--bg-tertiary);
  border-radius: 8px;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

.faq-question {
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  padding: 1.4rem 1rem;
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  color: var(--text-primary);
}

.faq-question::after {
  content: "\f078"; /* Font Awesome chevron-down */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  right: 1.5rem;
  transition: transform 0.3s;
  color: var(--accent-primary);
}

.faq-question.active::after {
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
  background: var(--bg-secondary);
}

.faq-answer p {
  padding: 0 1rem 1rem 1rem;
  margin: 15px;
  color: var(--text-secondary);
}
