/* ==========================================================================
   Project Kenny - Autism-Friendly Accessible Stylesheet
   Focus: High clarity, sensory-friendly calming colors, large touch targets
   ========================================================================== */

:root {
  --bg-gradient: linear-gradient(135deg, #eef2f7 0%, #e0e7f1 100%);
  --header-bg: #ffffff;
  --card-bg: #ffffff;
  --text-primary: #1f2937;
  --text-muted: #4b5563;
  --border-radius-lg: 24px;
  --border-radius-md: 18px;
  --border-radius-sm: 12px;
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);

  /* Theme Accents */
  --accent-music: #ec4899;
  --accent-colours: #3b82f6;
  --accent-alphabets: #10b981;
  --accent-numbers: #f59e0b;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Fredoka', 'Nunito', system-ui, -apple-system, sans-serif;
  background: var(--bg-gradient);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  user-select: none; /* Prevents accidental text selection while clicking */
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */

.app-header {
  background: var(--header-bg);
  box-shadow: var(--shadow-sm);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 3px solid #e2e8f0;
}

.logo-area .app-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: #1e293b;
  letter-spacing: -0.5px;
}

.nav-tabs {
  display: flex;
  gap: 0.75rem;
  background: #f1f5f9;
  padding: 6px;
  border-radius: 999px;
  border: 2px solid #e2e8f0;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.4rem;
  border: none;
  background: transparent;
  border-radius: 999px;
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.nav-btn .nav-icon {
  font-size: 1.4rem;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.8);
  transform: translateY(-2px);
  color: #0f172a;
}

.nav-btn:focus-visible {
  outline: 3px solid #3b82f6;
  outline-offset: 2px;
}

/* Tab Active States with distinct theme colors */
.nav-btn[data-target="music"].active {
  background: var(--accent-music);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(236, 72, 153, 0.4);
}

.nav-btn[data-target="colours"].active {
  background: var(--accent-colours);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.nav-btn[data-target="alphabets"].active {
  background: var(--accent-alphabets);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.nav-btn[data-target="numbers"].active {
  background: var(--accent-numbers);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

/* Top Right Controls */
.header-controls {
  display: flex;
  gap: 0.6rem;
}

.tool-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: #f8fafc;
  border: 2px solid #cbd5e1;
  padding: 0.6rem 1rem;
  border-radius: var(--border-radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.tool-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

/* ==========================================================================
   Main Content Layout
   ========================================================================== */

.content-container {
  max-width: 1300px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem 1.5rem;
  flex: 1;
}

.content-section {
  display: none;
  animation: fadeIn 0.35s ease;
}

.content-section.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section-intro {
  text-align: center;
  margin-bottom: 2rem;
}

.section-intro h2 {
  font-size: 2.2rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.4rem;
}

.section-intro p {
  font-size: 1.25rem;
  color: var(--text-muted);
}

/* ==========================================================================
   1. MUSIC SECTION - Artist Cards
   ========================================================================== */

.artists-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.25rem;
  justify-content: center;
}

.artist-card {
  background: var(--card-bg);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 4px solid #f1f5f9;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  position: relative;
}

.artist-card:hover, .artist-card:focus-visible {
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent-music);
  outline: none;
}

.artist-card:active {
  transform: translateY(-2px) scale(0.99);
}

.artist-image-container {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #f8fafc;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.artist-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.artist-card:hover .artist-img {
  transform: scale(1.05);
}

/* Fallback illustrated avatar */
.artist-avatar-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #fbcfe8 0%, #f472b6 100%);
  color: #831843;
}

.avatar-initials {
  font-size: 4rem;
  font-weight: 800;
}

.avatar-note {
  font-size: 2.5rem;
  margin-top: 0.5rem;
}

/* Play Badge Overlay */
.play-badge {
  position: absolute;
  bottom: 16px;
  right: 16px;
  background: #ec4899;
  color: white;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  transition: transform 0.2s;
}

.artist-card:hover .play-badge {
  transform: scale(1.15);
  background: #db2777;
}

.artist-info {
  padding: 1.5rem 1.25rem;
  text-align: center;
  background: #ffffff;
}

.artist-name {
  font-size: 1.6rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.4rem;
}

.artist-desc {
  font-size: 1.05rem;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

/* ==========================================================================
   Common Interactive Tiles Grid (Colours, Alphabets, Numbers)
   ========================================================================== */

.tiles-grid {
  display: grid;
  gap: 0.85rem;
}

.interactive-tile {
  background: var(--card-bg);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 4px solid #e2e8f0;
  transition: var(--transition-smooth);
  position: relative;
  text-align: center;
  padding: 1rem 0.5rem;
}

.interactive-tile:hover, .interactive-tile:focus-visible {
  transform: translateY(-6px) scale(1.05);
  box-shadow: var(--shadow-hover);
  outline: none;
}

.interactive-tile:active {
  transform: translateY(0) scale(0.97);
}

/* Speaking pulse effect */
.interactive-tile.speaking {
  animation: speakingGlow 0.8s ease-in-out infinite alternate;
}

@keyframes speakingGlow {
  from {
    transform: scale(1.06);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.6);
  }
  to {
    transform: scale(1.09);
    box-shadow: 0 0 25px rgba(59, 130, 246, 0.9);
  }
}

/* ==========================================================================
   2. COLOURS SECTION
   ========================================================================== */

.colours-grid {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.85rem;
}

.colour-tile {
  aspect-ratio: 1 / 1;
  border-radius: var(--border-radius-lg);
  border: 5px solid #ffffff;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.85rem;
}

.colour-swatch-circle {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  margin-bottom: 0.5rem;
}

.colour-name {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}

/* ==========================================================================
   3. ALPHABETS SECTION
   ========================================================================== */

.alphabets-grid {
  grid-template-columns: repeat(auto-fit, minmax(105px, 1fr));
  gap: 0.65rem;
}

.alphabet-tile {
  aspect-ratio: 1 / 1;
  border: 4px solid #e2e8f0;
  border-radius: var(--border-radius-md);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.alphabet-tile:hover {
  border-color: var(--accent-alphabets);
}

.letter-case-container {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.4rem;
}

.letter-upper {
  font-size: 3.4rem;
  font-weight: 800;
  line-height: 1;
  color: #0f172a;
}

.letter-lower {
  font-size: 2.2rem;
  font-weight: 700;
  color: #64748b;
}

/* ==========================================================================
   4. NUMBERS SECTION
   ========================================================================== */

.numbers-grid {
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 0.85rem;
}

.number-tile {
  min-height: 180px;
  border: 4px solid #e2e8f0;
  border-radius: var(--border-radius-lg);
  background: #ffffff;
}

.number-tile:hover {
  border-color: var(--accent-numbers);
}

.number-digit {
  font-size: 4rem;
  font-weight: 900;
  line-height: 1;
  color: #d97706;
  margin-bottom: 0.3rem;
}

.number-word {
  font-size: 1.35rem;
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 0.6rem;
}

.number-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 130px;
  justify-content: center;
  align-items: center;
  min-height: 36px;
}

.count-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #f59e0b;
  border: 2px solid #b45309;
}

/* ==========================================================================
   EMBEDDED YOUTUBE MODAL & BIG CLOSE BUTTON
   ========================================================================== */

.video-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.video-modal.active {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
}

.modal-content {
  position: relative;
  z-index: 1001;
  width: 100%;
  max-width: 1000px;
  background: #ffffff;
  border-radius: var(--border-radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPop {
  from {
    transform: scale(0.92);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.75rem;
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
}

.modal-artist-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: #1e293b;
}

/* The High-Visibility Big Close Button for Kenny */
.big-close-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background: #ef4444;
  color: #ffffff;
  border: 4px solid #b91c1c;
  padding: 0.9rem 1.8rem;
  border-radius: 999px;
  font-family: inherit;
  font-size: 1.25rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(239, 68, 68, 0.4);
  transition: transform 0.2s, background-color 0.2s;
  letter-spacing: 0.5px;
}

.big-close-btn .close-icon {
  font-size: 1.4rem;
  background: rgba(0, 0, 0, 0.2);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.big-close-btn:hover {
  background: #dc2626;
  transform: scale(1.05);
  box-shadow: 0 8px 20px rgba(239, 68, 68, 0.6);
}

.big-close-btn:active {
  transform: scale(0.98);
}

.big-close-btn:focus-visible {
  outline: 4px solid #fbbf24;
  outline-offset: 3px;
}

/* 16:9 Video Frame */
.video-frame-wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 Aspect Ratio */
  background: #000000;
}

.video-frame-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.modal-footer {
  padding: 1rem 1.75rem;
  background: #f8fafc;
  text-align: center;
  color: #64748b;
  font-size: 1rem;
  border-top: 1px solid #e2e8f0;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

@media (max-width: 768px) {
  .app-header {
    padding: 0.8rem 1rem;
    flex-direction: column;
    align-items: stretch;
  }

  .nav-tabs {
    justify-content: space-around;
  }

  .nav-btn {
    padding: 0.6rem 0.8rem;
    font-size: 1rem;
  }

  .header-controls {
    justify-content: center;
  }

  .section-intro h2 {
    font-size: 1.8rem;
  }

  .big-close-btn {
    padding: 0.6rem 1.2rem;
    font-size: 1.05rem;
  }

  .modal-artist-title {
    font-size: 1.2rem;
  }
}
