/* =====================================================================
   HUB LAYOUT -- the one shared layout for every activity hub (Game Hub,
   Articulation, Language, Flashcards, Puzzles, Social Skills).

   Load it AFTER the page's own stylesheet and after UnifiedAppShell.css.
   The page needs <body class="mode-play"> (deep-blue neural backdrop, white
   text). Nothing here draws a container around the page: content sits
   straight on the backdrop inside .hub-page.

   Markup contract:

   <div class="hub-page">
     <header class="hub-head">
       <div class="hub-head-copy">
         <span class="hub-chip">Play mode</span>
         <h1 class="hub-title">Game Hub</h1>
         <p class="hub-lead">One friendly line about the page.</p>
       </div>
       <div class="hub-actions"> ...record pill, primary buttons... </div>
     </header>

     <nav class="hub-filters" aria-label="Filter">
       <button class="hub-pill" aria-pressed="true">All</button> ...
       <input class="hub-search" type="search" placeholder="Search">
     </nav>

     <section class="hub-section" data-accent="orange|green|lime|blue|amber|cyan">
       <header class="hub-section-head">
         <span class="hub-badge"><svg class="hub-badge-icon">...</svg></span>
         <h2 class="hub-section-title">Category name</h2>
         <span class="hub-count">12 games</span>
       </header>
       <div class="hub-grid">
         <article class="hub-card [is-locked]">
           <div class="hub-thumb"><img src="..." alt="..."></div>
           <div class="hub-card-body">
             <h3 class="hub-card-title">Game name</h3>
             <p class="hub-card-copy">One line of description.</p>
             <div class="hub-card-foot">
               <span class="hub-tag">Category</span>
               <span class="hub-play">Play</span>   <!-- a <span> if the whole card is the link/button -->
             </div>
           </div>
         </article>
       </div>
     </section>
   </div>

   The existing thumbnail images, card click behaviour, ids and JS hooks all
   stay: add the hub-* classes ALONGSIDE the existing ones. The card element may
   be a <button> or <a> instead of <article>; every hub-card rule works on any tag.

   Accent colours come from the section's data-accent (the palette's badge
   gradients). Assign them consistently: Articulation orange, Language green,
   Social Skills lime, Game Hub blue, Flashcards amber, Puzzles cyan; hubs with
   several groups can use the full set in that order.
   ===================================================================== */

.hub-page {
  position: relative;
  z-index: 1;
  max-width: 1240px;
  margin: 0 auto;
  color: #ffffff;
  font-family: var(--sx-font-body, 'Sora', 'Segoe UI', system-ui, sans-serif);
}

/* ---------------------------- header ---------------------------- */
.hub-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px 28px;
}

.hub-head-copy {
  min-width: 0;
  flex: 1 1 380px;
}

.hub-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(42, 208, 241, 0.35);
  background: rgba(42, 208, 241, 0.16);
  color: #b8f0fb;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hub-title {
  margin: 12px 0 0;
  color: #ffffff;
  font-family: var(--sx-font-display, 'Space Grotesk', 'Sora', sans-serif);
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.hub-lead {
  margin: 8px 0 0;
  max-width: 62ch;
  color: #c5d3ff;
  font-size: 16px;
  line-height: 1.55;
}

.hub-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

/* --------------------------- filters --------------------------- */
.hub-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 24px 0 8px;
}

.hub-pill {
  padding: 9px 16px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #e3ebff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.hub-pill:hover {
  background: rgba(255, 255, 255, 0.16);
}

.hub-pill[aria-pressed="true"],
.hub-pill.is-active,
.hub-pill.active {
  border-color: #ffffff;
  background: #ffffff;
  color: var(--sx-navy-900, #071751);
}

.hub-search {
  min-height: 40px;
  margin-left: auto;
  padding: 8px 14px;
  width: min(260px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font: inherit;
  font-size: 14px;
}

.hub-search::placeholder {
  color: #c6d3ff;
}

/* ---------------------------- sections ---------------------------- */
.hub-section {
  --hub-a1: #2ad0f1;
  --hub-a2: #3376d9;
  --hub-glow: rgba(42, 208, 241, 0.4);
  margin-top: 36px;
}

.hub-section[data-accent="orange"] { --hub-a1: #fda640; --hub-a2: #fb5a45; --hub-glow: rgba(251, 90, 69, 0.42); }
.hub-section[data-accent="green"]  { --hub-a1: #a1e58f; --hub-a2: #38b49c; --hub-glow: rgba(56, 180, 156, 0.42); }
.hub-section[data-accent="lime"]   { --hub-a1: #e1ef74; --hub-a2: #7fd06a; --hub-glow: rgba(127, 208, 106, 0.4); }
.hub-section[data-accent="blue"]   { --hub-a1: #2ad0f1; --hub-a2: #3376d9; --hub-glow: rgba(51, 118, 217, 0.5); }
.hub-section[data-accent="amber"]  { --hub-a1: #fed94c; --hub-a2: #fca642; --hub-glow: rgba(252, 166, 66, 0.42); }
.hub-section[data-accent="cyan"]   { --hub-a1: #b8f0fb; --hub-a2: #2ad0f1; --hub-glow: rgba(42, 208, 241, 0.4); }

.hub-section-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.hub-badge {
  display: grid;
  place-items: center;
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(160deg, var(--hub-a1), var(--hub-a2));
  color: #ffffff;
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--hub-a2) 20%, transparent), 0 8px 20px var(--hub-glow);
}

.hub-badge svg,
.hub-badge-icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hub-section-title {
  margin: 0;
  color: #ffffff;
  font-family: var(--sx-font-display, 'Space Grotesk', 'Sora', sans-serif);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.005em;
}

.hub-count {
  margin-left: auto;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #c5d3ff;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

/* ------------------------------ grid ------------------------------ */
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}

/* ------------------------------ card ------------------------------ */
.hub-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.09);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #ffffff;
  text-align: left;
  text-decoration: none;
  font: inherit;
  cursor: pointer;
  transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.hub-card:hover,
.hub-card:focus-visible {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.36);
  background: rgba(255, 255, 255, 0.14);
  box-shadow: 0 16px 34px rgba(3, 10, 40, 0.4), 0 0 0 1px var(--hub-glow, rgba(42, 208, 241, 0.3));
}

.hub-card:focus-visible {
  outline: 3px solid #2ad0f1;
  outline-offset: 3px;
}

.hub-thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  margin: 10px 10px 0;
  overflow: hidden;
  border-radius: 16px;
  background: linear-gradient(160deg, #123f92, #0b2a6f);
}

.hub-thumb img,
.hub-thumb picture,
.hub-thumb canvas,
.hub-thumb svg {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hub-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 6px;
  padding: 14px 18px 18px;
}

.hub-card-title {
  margin: 0;
  color: #ffffff;
  font-family: var(--sx-font-display, 'Space Grotesk', 'Sora', sans-serif);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
}

.hub-card-copy {
  margin: 0;
  flex: 1;
  color: #c5d3ff;
  font-size: 13.5px;
  line-height: 1.5;
}

.hub-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}

.hub-tag {
  color: #c6d3ff;
  font-size: 12.5px;
  font-weight: 600;
}

.hub-play {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border: 0;
  border-radius: 999px;
  background: #ffffff;
  color: var(--sx-navy-900, #071751);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

/* the big gradient call-to-action (hero buttons, "Choose sounds", etc.) */
.hub-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 11px 22px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #2ad0f1, #3376d9);
  color: #04123a;
  font-family: var(--sx-font-display, 'Space Grotesk', 'Sora', sans-serif);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(42, 208, 241, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.hub-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(42, 208, 241, 0.45);
}

.hub-btn.is-ghost {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #ffffff;
  box-shadow: none;
}

/* locked / coming soon */
.hub-card.is-locked {
  cursor: not-allowed;
  opacity: 0.55;
}

.hub-card.is-locked:hover {
  transform: none;
  box-shadow: none;
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.09);
}

.hub-card.is-locked .hub-thumb img {
  filter: grayscale(0.85);
}

@media (max-width: 700px) {
  .hub-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
  }

  .hub-card-copy {
    display: none;
  }

  .hub-card-body {
    padding: 10px 12px 14px;
  }

  .hub-card-title {
    font-size: 15px;
  }

  .hub-search {
    margin-left: 0;
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hub-card,
  .hub-btn,
  .hub-pill {
    transition: none;
  }

  .hub-card:hover,
  .hub-card:focus-visible,
  .hub-btn:hover {
    transform: none;
  }
}

/* phones: the play shell has no side padding, so give the page its own gutter */
@media (max-width: 600px) {
  .hub-page {
    padding-left: 14px;
    padding-right: 14px;
  }
}
