/**
 * CrazyGames-style hub layout — VixoGames fantasy theme
 */

.home-crazy {
  --hub-sidebar-w: 232px;
  --hub-row-card: 168px;
  --hub-row-gap: 0.65rem;
}

/* Header: logo + wide search */
.home-crazy .site-header {
  gap: 1rem;
  padding: 0 1.25rem;
}

.home-crazy .site-header .logo {
  order: 1;
}

.home-crazy .site-header .header-actions {
  order: 2;
  flex: 1;
  max-width: 640px;
  margin: 0 auto;
}

.home-crazy .site-header .search-wrap {
  width: 100%;
}

.home-crazy .site-header .search {
  width: 100%;
  max-width: none;
  background: rgba(22, 18, 42, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 0.55rem 1rem 0.55rem 2.75rem;
}

.home-crazy .site-header .search input {
  font-size: 0.95rem;
}

.home-crazy .site-header .menu-toggle {
  order: 3;
  margin-left: 0;
  flex-shrink: 0;
}

/* Hamburger menu button (mobile / tablet) */
.home-crazy .menu-toggle--hub {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  background: rgba(30, 24, 56, 0.95);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.home-crazy .menu-toggle--hub:hover {
  background: rgba(124, 58, 237, 0.35);
  border-color: rgba(168, 85, 247, 0.45);
}

.home-crazy .menu-toggle__bar {
  display: block;
  width: 20px;
  height: 2.5px;
  border-radius: 2px;
  background: #f4f0ff;
  transition: transform 0.28s ease, opacity 0.2s ease, width 0.2s ease;
}

body.hub-nav-open .home-crazy .menu-toggle--hub {
  background: rgba(124, 58, 237, 0.4);
  border-color: rgba(168, 85, 247, 0.55);
}

body.hub-nav-open .home-crazy .menu-toggle__bar:nth-child(1) {
  transform: translateY(7.5px) rotate(45deg);
}

body.hub-nav-open .home-crazy .menu-toggle__bar:nth-child(2) {
  opacity: 0;
  width: 0;
}

body.hub-nav-open .home-crazy .menu-toggle__bar:nth-child(3) {
  transform: translateY(-7.5px) rotate(-45deg);
}

/* Shell: sidebar + main */
.hub-shell {
  display: flex;
  align-items: flex-start;
  gap: 0;
  min-height: calc(100dvh - var(--header-h));
  position: relative;
  z-index: 1;
}

.hub-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  top: var(--header-h);
  background: rgba(0, 0, 0, 0.55);
  z-index: 90;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.hub-sidebar {
  flex: 0 0 var(--hub-sidebar-w);
  width: var(--hub-sidebar-w);
  position: sticky;
  top: var(--header-h);
  align-self: flex-start;
  max-height: calc(100dvh - var(--header-h));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  background: rgba(10, 8, 18, 0.38);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.hub-sidebar-nav.main-nav {
  flex-shrink: 0;
  padding: 1rem 0.75rem 0.75rem;
  margin-bottom: 0;
}

.hub-sidebar-cats {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.hub-sidebar-cats .hub-sidebar-label {
  flex-shrink: 0;
  padding-top: 0.75rem;
}

.hub-cat-nav {
  display: block;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 0.5rem 1.25rem 0.75rem;
  margin-bottom: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(124, 58, 237, 0.5) transparent;
}

.hub-cat-nav::-webkit-scrollbar {
  width: 6px;
}

.hub-cat-nav::-webkit-scrollbar-thumb {
  background: rgba(124, 58, 237, 0.45);
  border-radius: 999px;
}

.hub-main {
  flex: 1;
  min-width: 0;
}

.home-crazy .home-main {
  max-width: none;
  padding: 1rem 1.25rem 3rem;
}

/* Sidebar nav */
.hub-sidebar-nav.main-nav {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0.15rem;
}

.hub-sidebar-nav .nav-indicator {
  display: none;
}

.hub-sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.88rem;
  border-radius: 10px;
  color: var(--text-muted);
}

.hub-sidebar-nav .nav-link:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.hub-sidebar-nav .nav-link.active {
  background: rgba(124, 58, 237, 0.28);
  color: var(--text);
  font-weight: 600;
  border: 1px solid rgba(168, 85, 247, 0.35);
}

.hub-sidebar-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem 0.35rem;
  margin: 0;
}

.hub-cat-nav a {
  display: block;
  width: 100%;
  padding: 0.38rem 0.65rem;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--text-muted);
  border-radius: 8px;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  transition: color 0.2s, background 0.2s;
}

.hub-cat-nav a:hover {
  color: var(--accent-bright);
  background: rgba(124, 58, 237, 0.12);
}

/* Compact welcome strip */
.hub-welcome {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 1fr);
  gap: 2.25rem;
  align-items: center;
  padding: 1.75rem 1.9rem 2.2rem;
  margin-bottom: 1.8rem;
  border-radius: calc(var(--radius-lg) + 4px);
  background:
    radial-gradient(circle at top left, rgba(76, 29, 149, 0.9), transparent 60%),
    radial-gradient(circle at bottom right, rgba(239, 68, 68, 0.7), transparent 60%),
    linear-gradient(135deg, rgba(17, 24, 39, 0.98), rgba(15, 23, 42, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 1),
    0 26px 80px rgba(15, 23, 42, 0.95);
}

.hub-welcome__eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-cyan);
  margin-bottom: 0.35rem;
}

.hub-welcome h1 {
  font-size: clamp(1.35rem, 2.5vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 0.35rem;
}

.hub-welcome__desc {
  margin-top: 0.7rem;
  font-size: 0.98rem;
  color: var(--text-muted);
  max-width: 36rem;
}

.hub-welcome__meta {
  margin-top: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.hub-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.7rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(15, 23, 42, 0.7);
  color: var(--text-muted);
}

.hub-pill--accent {
  border-color: rgba(250, 250, 255, 0.9);
  background: linear-gradient(135deg, rgba(250, 250, 255, 0.12), rgba(56, 189, 248, 0.32));
  color: #e5e7ff;
}

.hub-pill--soft {
  border-style: dashed;
}

.hub-welcome__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 1.5rem;
}

.hub-welcome__card {
  width: min(340px, 40vw);
  border-radius: 2rem;
  overflow: hidden;
  border: 1px solid rgba(251, 191, 36, 0.55);
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 1),
    0 24px 70px rgba(15, 23, 42, 0.98),
    0 0 55px rgba(251, 191, 36, 0.5);
  position: relative;
  aspect-ratio: 16 / 10;
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}

.hub-welcome__card .hero-thumb {
  width: 100%;
  height: 100%;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.hero-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: center;
  transition: transform 14s linear, opacity 0.45s ease-out;
}

.hub-welcome__card:hover .hero-thumb-img {
  transform: scale(1.08);
}

.hub-welcome__card::before {
  content: "";
  position: absolute;
  inset: -30%;
  background: radial-gradient(circle at top left, rgba(251, 191, 36, 0.32), transparent 60%),
    radial-gradient(circle at bottom right, rgba(59, 130, 246, 0.3), transparent 60%);
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity 0.6s ease-out;
  pointer-events: none;
}

.hub-welcome__card.is-hero-active::before {
  opacity: 1;
}

.hub-welcome__card .hero-card-play {
  position: absolute;
  bottom: 0.65rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.78rem;
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.95);
}

/* Quick filters — pill row */
.home-crazy .quick-filters {
  margin-bottom: 1.5rem;
  padding: 0;
  background: transparent;
  border: 0;
}

.home-crazy .quick-filters__label {
  display: none;
}

.home-crazy .categories-scroll {
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 0.35rem;
  scrollbar-width: thin;
}

/* Section headers */
.home-crazy .section-head--hub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.home-crazy .section-head--hub h2 {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
}

.home-crazy .section-head--hub .section-desc {
  display: none;
}

.home-crazy .section-view-all {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-bright);
  white-space: nowrap;
  flex-shrink: 0;
}

.home-crazy .section-view-all:hover {
  color: var(--accent-cyan);
}

.home-crazy .section-count {
  display: none;
}

/* Horizontal rows + scroll buttons */
.game-row-wrap {
  position: relative;
  margin: 0 -0.25rem;
  --hub-thumb-h: var(--hub-row-card);
}

.game-row-wrap:has(.game-card--featured) {
  --hub-thumb-h: calc(min(320px, 42vw) * 10 / 16);
}

.game-row-wrap .game-grid--row {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--hub-row-gap);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding: 0.25rem 0.5rem 0.75rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.game-row-wrap .game-grid--row::-webkit-scrollbar {
  display: none;
}

.game-row-wrap .game-card {
  flex: 0 0 var(--hub-row-card);
  scroll-snap-align: start;
}

.game-row-wrap .game-card--featured {
  flex: 0 0 min(320px, 42vw);
}

.game-row-wrap .game-card-link {
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
}

.game-row-wrap .game-card--featured .game-card-link {
  aspect-ratio: 16 / 10;
}

.game-row-wrap .game-card h3 {
  font-size: 0.82rem;
  margin-top: 0.45rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-row-wrap .game-meta {
  font-size: 0.7rem;
  opacity: 0.85;
}

.game-row-scroll {
  position: absolute;
  top: calc(0.25rem + var(--hub-thumb-h) / 2);
  transform: translateY(-50%);
  z-index: 5;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(12, 10, 20, 0.92);
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
  transition: background 0.2s, border-color 0.2s;
}

.game-row-scroll:hover {
  background: rgba(124, 58, 237, 0.35);
  border-color: rgba(168, 85, 247, 0.5);
}

.game-row-scroll--prev {
  left: 0.35rem;
}

.game-row-scroll--next {
  right: 0.35rem;
}

/* Badges */
/* Sections — lighter dividers */
.home-crazy .game-section {
  margin-bottom: 1.35rem;
  padding-bottom: 0;
  border-bottom: 0;
}

.home-crazy .game-section--alt {
  padding: 0;
  background: transparent;
  border: 0;
}

.home-crazy .category-sections .game-section--category {
  border-top: 0;
  border-bottom: 0;
  margin-bottom: 0.75rem;
  padding: 0.15rem 0 0.35rem;
}

.home-crazy .category-sections .game-section--category.is-category-lazy {
  margin-bottom: 0.75rem;
  padding-bottom: 0.35rem;
}

.home-crazy .category-sections .category-skeleton {
  padding: 0.25rem 0 0.35rem;
}

/* Scroll targets sit below sticky header */
.home-crazy [data-section],
.home-crazy .hub-welcome {
  scroll-margin-top: calc(var(--effective-header-h, var(--header-h)) + 1.25rem);
}

.home-crazy .game-section--library {
  padding: 1.25rem;
  background: rgba(22, 18, 42, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
}

.home-crazy .home-stats--pro,
.home-crazy .browse-categories,
.home-crazy .hero--pro {
  display: none !important;
}

/* Footer in hub main */
.home-crazy .hub-main .site-footer {
  margin-top: 2rem;
  padding: 2rem 0 0;
}

/* Tablet / phone */
@media (max-width: 1023px) {
  .home-crazy {
    --hub-sidebar-w: 260px;
  }

  html.hub-nav-lock,
  html.hub-nav-lock body {
    overflow: hidden;
  }

  body.hub-nav-lock {
    position: fixed;
    width: 100%;
    left: 0;
    right: 0;
  }

  body.hub-nav-open .site-body,
  body.hub-nav-open .hub-main,
  body.hub-nav-open .page-content {
    overflow: hidden;
    touch-action: none;
  }

  .hub-sidebar {
    position: fixed;
    left: 0;
    top: var(--header-h);
    bottom: 0;
    z-index: 200;
    max-height: none;
    height: calc(100dvh - var(--header-h));
    width: min(92vw, 300px);
    background: #0c0818 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    transform: translate3d(-110%, 0, 0);
    visibility: hidden;
    pointer-events: none;
    transition:
      transform 0.32s var(--ease),
      visibility 0.32s;
    box-shadow: 12px 0 48px rgba(0, 0, 0, 0.65);
  }

  body.hub-nav-open .hub-sidebar {
    transform: translate3d(0, 0, 0);
    visibility: visible;
    pointer-events: auto;
    touch-action: pan-y;
    overscroll-behavior: contain;
  }

  body.hub-nav-open .hub-cat-nav {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .hub-sidebar-backdrop {
    z-index: 190;
    background: rgba(0, 0, 0, 0.78);
  }

  body.hub-nav-open .hub-sidebar-backdrop {
    display: block;
  }

  .hub-shell {
    display: block;
  }

  .home-crazy .site-header .header-actions {
    max-width: none;
    flex: 1;
  }

  .game-row-scroll {
    display: grid;
    width: 34px;
    height: 34px;
  }

  .game-row-wrap .game-grid--row {
    padding-right: 0.25rem;
  }

  .home-crazy .menu-toggle--hub {
    display: flex;
  }
}

@media (max-width: 768px) {
  .home-crazy .site-header .header-actions,
  .home-crazy .site-header .search-wrap {
    display: flex !important;
  }

  /* Row card size — overridden in mobile.css for swipe rows */

  .home-crazy .section-head--hub h2 {
    font-size: 1.05rem;
  }

  .home-crazy .section-view-all {
    font-size: 0.78rem;
  }

}

@media (max-width: 640px) {
  .hub-welcome {
    grid-template-columns: 1fr;
  }

  .hub-welcome__card {
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
  }

  .home-crazy .home-main {
    padding: 0.75rem 0.85rem 2.5rem;
  }

}

/* Desktop with ad rails — sidebar stays inside center column */
@media (min-width: 1024px) {
  body.home-crazy.has-ad-rail .hub-sidebar {
    top: var(--effective-header-h);
    max-height: calc(100dvh - var(--effective-header-h));
  }

  .home-crazy .menu-toggle--hub {
    display: none;
  }

  .home-crazy .site-header .header-actions {
    display: flex;
  }
}

/* Sidebar categories: block layout so items never shrink to slivers */
.home-crazy .hub-cat-nav a {
  display: block !important;
  min-height: 28px;
  line-height: 1.35 !important;
  flex-shrink: 0;
}
