/* FAQ popup, visually aligned with the Sample Camp Schedule dialog:
   white panel, orange-ruled heading, dim backdrop. Close is an X.
   The page FAQ section is removed; this dialog holds the same items.
   v2: closed dialog is display:none so it cannot appear in-flow. */

.d-head-faq,
.d-nav-faq,
.d-foot-faq{
  font-family: var(--font);
  font-weight: 700;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  background: none;
  border: 0;
}
.d-head-faq{
  font-size: 16px;
  padding: 8px 6px;
  letter-spacing: .02em;
}
.d-head-faq:hover{ color: #FF7800; }
.d-head-faq:focus-visible,
.d-nav-faq:focus-visible,
.d-foot-faq:focus-visible,
.faq-dialog-x:focus-visible{
  outline: 3px solid #FF7800;
  outline-offset: 3px;
}
.d-head-r .d-head-faq{ display: none; }
@media (max-width: 1023px){
  .d-nav .d-nav-faq{
    display: inline-flex;
    margin-top: 8px;
    font-size: 28px;
    font-weight: 800;
  }
}

/* A bare display:flex here would override the UA rule dialog:not([open]){display:none}
   and paint the closed panel in document flow under the footer. */
.faq-dialog:not([open]){
  display: none !important;
}
.faq-dialog[open]{
  box-sizing: border-box;
  width: min(800px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: min(90vh, 900px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: #fff;
  color: #111;
  box-shadow: 0 16px 48px rgba(0,0,0,.22);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  /* Top layer from showModal() + margin:auto centers the panel.
     Do not use inset:0 here or the card becomes a full-viewport sheet. */
}
.faq-dialog:focus{ outline: none; }
.faq-dialog::backdrop{
  background: rgba(0, 28, 80, .48);
}

.faq-dialog-bar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
  margin: 0;
  padding: 20px 16px 12px 20px;
}
.faq-dialog-bar h2{
  margin: 0;
  font-size: clamp(20px, 2.4vw, 22px);
  line-height: 1.2;
  font-weight: 800;
  padding: 0 0 0 12px;
  border-left: 3px solid #FF7800;
  color: #111;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.faq-dialog-x{
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: #003CD5;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.faq-dialog-x:hover,
.faq-dialog-x:focus-visible{ background: #002ea8; }
.faq-dialog-x svg{ width: 18px; height: 18px; display: block; }

.faq-dialog-body{
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 4px 24px 24px;
  max-height: calc(min(90vh, 900px) - 76px);
}
.faq-dialog .d-faq-list{
  max-width: none;
  margin: 0;
  background: #fff;
}
.faq-dialog .d-faq-item{ border-bottom: 1px solid rgba(0,60,213,.18); }
.faq-dialog .d-faq-item summary{ color: #111; font-size: 18px; }
.faq-dialog .d-faq-a p{ color: #111; }

html:has(.faq-dialog[open]),
body:has(.faq-dialog[open]),
html.faq-dialog-open,
body.faq-dialog-open{
  overflow: hidden;
}

@media (max-width: 799px){
  .faq-dialog[open]{
    position: fixed;
    inset: 0;
    width: 100vw;
    width: 100dvw;
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    border-radius: 0;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
  }
  .faq-dialog-bar{ padding: 16px 12px 8px 16px; }
  .faq-dialog-body{
    max-height: none;
    height: calc(100dvh - 64px);
    padding: 4px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  }
  .faq-dialog .d-faq-item summary{ font-size: 17px; padding: 16px 0; }
}

@media (prefers-reduced-motion: reduce){
  .faq-dialog{ animation: none; }
}
