:root{
  --faqs-head-top: 65px;
  --faqs-head-height: 132px;
  --faqs-space-below-head: 16px;
  --faqs-container-max: 1200px;
  --faqs-page-gutters: 80px;
}

/* ======================================================= */
/* === FINAL FLEXBOX + FLEXIBLE GRID LAYOUT === */
/* ======================================================= */

#faqs {
  display: flex;
  flex-direction: column;
  height: 100vh; /* Use height, not min-height, for a fixed viewport section */
  box-sizing: border-box;

  scroll-snap-align: center;
  scroll-margin-top: calc(var(--faqs-head-top) + 8px);
  
  /* --- ADJUSTED PADDING FOR MORE SPACING --- */
  padding-top: 80px;
  padding-bottom: 80px;
}

#faqs .section-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0; /* Prevents flexbox overflow bugs */

  max-width: var(--faqs-container-max);
  margin: 0 auto;
  width: 100%; /* Ensure it takes up space */
}

#faqs .text-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0; /* Prevents flexbox overflow bugs */
  gap: var(--faqs-space-below-head);

  margin: 0;
  padding: 0;
}

#faqs .faq-head {
  /* Header has a fixed height */
  flex: 0 0 auto;
  z-index: 6;
}

#faqs .faq-grid {
  /* The grid takes all remaining vertical space */
  flex: 1;
  min-height: 0; /* Prevents flexbox overflow bugs */

  /* The grid layout itself */
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-content: start;

  /* Rows now divide the available space */
  grid-auto-rows: 1fr;
}

.faq-tile {
  /* Make the tile fill its flexible grid cell completely */
  height: 100%;
  width: 100%;
  padding: 12px 14px;
  box-sizing: border-box;

  position: relative;
  text-align: left;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(199, 185, 255, 0.08) 0%, rgba(199, 185, 255, 0.02) 100%);
  border: 1px solid rgba(199, 185, 255, 0.15);
  color: var(--text-color);
  cursor: pointer;
  transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  max-height: 125px;
  overflow: hidden;
}

.faq-tile::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at top right, rgba(199, 185, 255, 0.15), transparent 60%);
  opacity: 0;
  transition: opacity .3s ease;
  pointer-events: none;
}

.faq-tile:hover::before {
  opacity: 1;
}

/* ======================================================= */
/* === END OF LAYOUT FIXES === */
/* ======================================================= */


html.no-snap{ scroll-snap-type: none !important; }

#faqs .faq-head-inner{
  height: var(--faqs-head-height);
  display: grid;
  grid-template-rows: auto auto;
  align-content: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--nav-bg-color);
  border: 1px solid rgba(255,255,255,0.14);
  backdrop-filter: blur(6px);
  box-sizing: border-box;
}
.light-mode #faqs .faq-head-inner{ border-color: rgba(0,0,0,0.08); }

#faqs .faq-section-title{
  margin: 0;
  font-size: clamp(1.2rem, 2.5vw, 1.6rem);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  -webkit-text-stroke: 1px var(--brand-color);
  text-stroke: 1px var(--brand-color);
  color: transparent;
  line-height: 1.2;
}

#faqs .faq-search{
  position: relative;
  height: 56px;
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px 0 40px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
  box-sizing: border-box;
}
.light-mode #faqs .faq-search{
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.08);
}
#faqs .faq-search-icon{
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; color: var(--brand-color);
}
#faqs .faq-search-input{
  flex: 1; height: 100%;
  background: transparent; border: none; outline: none;
  color: var(--text-color);
  font: inherit; font-weight: 600;
}
#faqs .faq-search-input::placeholder{ opacity: .6; }
#faqs .faq-search-clear{
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.08);
  color: var(--text-color);
  cursor: pointer;
}
.light-mode #faqs .faq-search-clear{
  border-color: rgba(0,0,0,0.12);
  background: rgba(0,0,0,0.05);
}

.faq-tile:hover{
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 12px 32px rgba(199, 185, 255, 0.3), 0 0 20px rgba(199, 185, 255, 0.1);
  border-color: var(--brand-color);
}

.light-mode .faq-tile{
  background: linear-gradient(135deg, rgba(88, 53, 208, 0.06) 0%, rgba(88, 53, 208, 0.01) 100%);
  border-color: rgba(88, 53, 208,.12);
  box-shadow: 0 4px 12px rgba(0,0,0,.05);
}

.light-mode .faq-tile:hover{
  box-shadow: 0 12px 32px rgba(88, 53, 208, 0.2);
  border-color: #5835d0;
}

.faq-tile__badge{
  position: absolute; top: 8px; left: 10px;
  font-size: .72rem; opacity: .85; padding: 3px 8px; border-radius: 999px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
}
.light-mode .faq-tile__badge{ background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.08); }

.faq-tile__row{ display: flex; align-items: center; gap: 12px; width: 100%; }

.faq-tile__icon{
  width: 36px;
  height: 36px;
  padding: 6px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(199, 185, 255, 0.2), rgba(199, 185, 255, 0.1));
  color: var(--brand-color);
  flex: 0 0 auto;
  transition: all .3s ease;
}

.faq-tile:hover .faq-tile__icon{
  transform: scale(1.1) rotate(5deg);
  background: linear-gradient(135deg, rgba(199, 185, 255, 0.3), rgba(199, 185, 255, 0.15));
  box-shadow: 0 4px 12px rgba(199, 185, 255, 0.3);
}

.faq-tile__title{ font-weight: 800; font-size: 1.12rem; line-height: 1.2; flex: 1 1 auto; padding-right: 8px; }

.faq-tile__chev{
  width: 22px;
  height: 22px;
  color: var(--brand-color);
  flex: 0 0 auto;
  transition: transform .3s ease;
}

.faq-tile:hover .faq-tile__chev{
  transform: translateX(3px);
}

.faq-empty{ text-align: center; opacity: .7; padding: 18px 8px; }

/* ---------- Drawer + overlay title (No changes needed below) ---------- */
#faqDrawer.faq-drawer{
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: grid; grid-template-columns: 1fr auto;
  opacity: 0; pointer-events: none; transition: opacity .25s ease; z-index: 2000;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
#faqDrawer.open{ opacity: 1; pointer-events: auto; }

#faqDrawer .faq-drawer__title {
  position: fixed;
  left: var(--faqs-page-gutters);
  right: calc(720px + var(--faqs-page-gutters));
  top: calc(var(--faqs-head-top) + var(--faqs-head-height) + 10px);
  font-weight: 900;
  font-size: clamp(1.8rem, 3vw + 1rem, 3rem);
  line-height: 1.15;
  color: var(--text-color);
  text-shadow: 0 6px 22px rgba(0,0,0,.3);
  pointer-events: none;
  opacity: 0;
  transition: opacity .28s ease;
  word-wrap: break-word;
  white-space: normal;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
#faqDrawer .faq-drawer__title.show{ opacity: 1; }

#faqDrawer .faq-drawer__title svg.faq-tile__icon {
  width: 64px;
  height: 64px;
  padding: 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(199, 185, 255, 0.2), rgba(199, 185, 255, 0.1));
  color: var(--brand-color);
  box-shadow: 0 8px 24px rgba(199, 185, 255, 0.3);
  align-self: flex-start;
}

.faq-drawer__title-text {
  display: block;
}

#faqDrawer .faq-drawer__panel{
  grid-column: 2 / 3; width: min(720px, 92vw); height: 100%;
  background: var(--card-bg-color); border-left: 1px solid rgba(255,255,255,0.12);
  padding: 20px 18px 24px; box-shadow: -24px 0 40px rgba(0,0,0,.35);
  transform: translateX(8%); transition: transform .28s cubic-bezier(0.22,1,0.36,1);
  overflow: auto;
}
#faqDrawer.open .faq-drawer__panel{ transform: translateX(0); }

.faq-drawer__close{
  position: sticky; top: 0; margin-left: auto; display: inline-grid; place-items: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.18); color: var(--text-color);
}

#faqs .accordion-chevron{ width: 20px; height: 20px; color: var(--brand-color); transition: transform .25s ease; }
.faq-qa{ margin-top: 10px; }
.faq-qa h5{ margin: 14px 0 10px; color: var(--brand-color); font-size: 1rem; }

.faq-q.holographic-card{
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  overflow: hidden;
  margin-bottom: 12px;
}
.light-mode .faq-q.holographic-card{ background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.08); }

.faq-q > summary{ list-style: none; cursor: pointer; user-select: none; }
.faq-q > summary::-webkit-details-marker{ display: none; }
.faq-q-head{
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 12px 12px;
}
.faq-q-head .q{ font-weight: 800; font-size: 1.06rem; }
.faq-q[open] .accordion-chevron{ transform: rotate(90deg); }

.faq-a-wrap{ height: 0; opacity: 0; overflow: hidden; }
.faq-a{ padding: 0 12px 12px 12px; opacity: .92; line-height: 1.65; font-size: .97rem; }

@media (max-width: 1100px){
  #faqs .faq-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px){
  #faqs {
    height: auto;
    min-height: auto;
    padding: 60px 0;
    overflow: visible;
  }
  #faqs .section-content {
    padding: 0 15px;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    overflow: visible;
  }
  #faqs .faq-head-inner {
    padding: 12px;
    height: auto;
    min-height: auto;
    width: 100%;
    box-sizing: border-box;
  }
  #faqs .faq-section-title {
    font-size: clamp(1.8rem, 6vw, 2.5rem);
    padding: 0;
    -webkit-text-stroke: 2px var(--brand-color);
    text-stroke: 2px var(--brand-color);
    color: transparent;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 800;
  }
  #faqs .faq-search {
    width: 100%;
    box-sizing: border-box;
    height: 48px;
  }
  #faqs .faq-grid{
    grid-template-columns: 1fr;
    /* On mobile, we have more rows, so 1fr might be too small.
       A min-height is better here. The flex layout prevents cutoff. */
    grid-auto-rows: minmax(90px, auto);
    max-width: 100%;
    overflow: visible;
  }
  .faq-tile {
    max-height: none;
    max-width: 100%;
    box-sizing: border-box;
  }
}

body.state-faqs .court-container{ visibility: visible; opacity: 1; transform: scale(1.55) translateY(18%); }
body.state-faqs .ball-front{ opacity: 1; }
body.state-faqs .ball-back { opacity: 0; }

.faq-info h3 {
    color: var(--brand-color);
    font-size: 1.2rem;
}

.faq-head-spacer {
    height: 16px;
}