/* =====================================================
   RED BOOK QUEST – MASTER CSS
   Covers:
   - Home page gateway (page-id-4)
   - RBQ main page (page-id-212)
   ===================================================== */


/* =====================================================
   1) GLOBAL UTILITIES
   ===================================================== */

.rbq-hidden {
  display: none !important;
}

.rbq-fade-out {
  opacity: 0 !important;
  transition: opacity 600ms ease !important;
}

.rbq-fade-in {
  opacity: 1 !important;
  transition: opacity 900ms ease !important;
}


/* =====================================================
   2) HOME PAGE GATEWAY (page-id-4)
   Structure expected:
   - rbq-home-screen rbq-home-attic is-visible
   - rbq-home-overlay rbq-home-question
   - rbq-home-screen rbq-home-result rbq-result-c
   - rbq-home-screen rbq-home-result rbq-result-jefferson
   - rbq-home-screen rbq-home-result rbq-result-square
   - rbq-home-screen rbq-home-result rbq-result-three
   ===================================================== */

body.page-id-4 {
  overflow: hidden !important;
}

body.page-id-4 .site-content,
body.page-id-4 .ast-container,
body.page-id-4 .ast-article-single,
body.page-id-4 .entry-content,
body.page-id-4 .content-area {
  margin: 0 !important;
  padding: 0 !important;
  max-width: none !important;
}

/* ----- Fullscreen layers ----- */
body.page-id-4 .rbq-home-screen,
body.page-id-4 .rbq-home-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100svh;
  opacity: 0;
  pointer-events: none;
  transition: opacity 700ms ease;
  box-sizing: border-box;
}

body.page-id-4 .is-visible {
  opacity: 1 !important;
  pointer-events: auto !important;
}

body.page-id-4 .is-hiding {
  opacity: 0 !important;
  pointer-events: none !important;
}

body.page-id-4 .is-gone {
  display: none !important;
}

/* ----- Layer order ----- */
body.page-id-4 .rbq-home-attic {
  z-index: 1;
}

body.page-id-4 .rbq-home-result {
  z-index: 3;
}

body.page-id-4 .rbq-home-question {
  z-index: 5;
}

/* ----- Background images fill screen ----- */
body.page-id-4 .rbq-home-attic img,
body.page-id-4 .rbq-home-result img {
  width: 100vw !important;
  height: 100svh !important;
  object-fit: cover !important;
  display: block !important;
  margin: 0 !important;
}

/* ----- Question overlay ----- */
body.page-id-4 .rbq-home-question {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 8vh 5vw;
  text-align: center;
  background: rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(3px);
}

body.page-id-4 .rbq-home-question h1,
body.page-id-4 .rbq-home-question h2,
body.page-id-4 .rbq-home-question h3,
body.page-id-4 .rbq-home-question p {
  color: #d7b66a !important;
  max-width: 760px;
  margin: 0 0 22px 0 !important;
  line-height: 1.14;
  text-shadow: 0 2px 18px rgba(0,0,0,0.55);
}

/* ----- Home page buttons ----- */
body.page-id-4 .rbq-home-buttons {
  width: min(980px, 92vw);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
  margin: 0 auto;
}

body.page-id-4 .rbq-home-buttons .wp-block-button {
  flex: 0 1 220px;
  display: flex;
  justify-content: center;
}

body.page-id-4 .rbq-home-buttons .wp-block-button__link,
body.page-id-4 .rbq-answer {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-width: 220px;
  max-width: 220px;
  min-height: 58px;
  padding: 14px 18px;
  border-radius: 16px;
  background: #a61d24 !important;
  color: #d7b66a !important;
  text-align: center;
  text-decoration: none !important;
  box-sizing: border-box;
  line-height: 1.1;
  white-space: normal;
  letter-spacing: 0.04em;
  transition: transform 180ms ease, filter 180ms ease, background 180ms ease;
}

body.page-id-4 .rbq-home-buttons .wp-block-button__link:hover,
body.page-id-4 .rbq-answer:hover {
  filter: brightness(1.04);
}

body.page-id-4 .rbq-home-buttons .wp-block-button__link:active,
body.page-id-4 .rbq-answer:active {
  transform: scale(0.98);
}

/* ----- Result screens ----- */
body.page-id-4 .rbq-home-result {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8vh 6vw;
  text-align: center;
}

body.page-id-4 .rbq-home-result > * {
  position: relative;
  z-index: 4;
}

body.page-id-4 .rbq-home-result h1,
body.page-id-4 .rbq-home-result h2,
body.page-id-4 .rbq-home-result h3,
body.page-id-4 .rbq-home-result p {
  color: #d7b66a !important;
  max-width: 760px;
  margin: 0 auto 18px auto !important;
  line-height: 1.15;
  text-shadow: 0 2px 18px rgba(0,0,0,0.55);
}

body.page-id-4 .rbq-home-result .wp-block-image {
  margin: 0 auto 20px auto !important;
  max-width: 360px;
}

/* ----- Fade overlay used by JS ----- */
body.page-id-4 .rbq-fade-black {
  position: fixed;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  z-index: 99999;
  transition: opacity 700ms ease;
}

body.page-id-4 .rbq-fade-black.is-visible {
  opacity: 1;
  pointer-events: auto;
}

/* ----- Mobile home fixes ----- */
@media (max-width: 600px) {
  body.page-id-4 .rbq-home-question {
    padding: 7vh 4vw;
  }

  body.page-id-4 .rbq-home-buttons {
    width: 92vw;
    flex-direction: column;
    align-items: center;
    gap: 14px;
  }

  body.page-id-4 .rbq-home-buttons .wp-block-button {
    flex: none;
    width: 100%;
    justify-content: center;
  }

  body.page-id-4 .rbq-home-buttons .wp-block-button__link,
  body.page-id-4 .rbq-answer {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }
}


/* =====================================================
   3) RBQ MAIN PAGE (page-id-212)
   Structure expected:
   - each screen wrapper: rbq-screen rbq-sX
   - only first starts with is-active
   - inside each screen:
     - image block: rbq-bg (optional rbq-flicker on screen 1 image)
     - overlay group: rbq-overlay
     - button wrapper: rbq-button
     - button: rbq-next rbq-to-sX rbq-btn
   ===================================================== */

body.page-id-212 {
  overflow: hidden !important;
}

body.page-id-212 .site-content,
body.page-id-212 .entry-content,
body.page-id-212 .content-area,
body.page-id-212 .ast-container {
  margin: 0 !important;
  padding: 0 !important;
  max-width: none !important;
}

/* ----- Fullscreen screen system ----- */
body.page-id-212 .rbq-screen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100svh;
  opacity: 0;
  pointer-events: none;
  transition: opacity 700ms ease;
  z-index: 1;
  overflow: hidden;
}

body.page-id-212 .rbq-screen.is-active {
  opacity: 1;
  pointer-events: auto;
  z-index: 5;
}

/* ----- Background image ----- */
body.page-id-212 .rbq-bg img,
body.page-id-212 .rbq-screen > .wp-block-image img {
  width: 100vw !important;
  height: 100svh !important;
  object-fit: cover !important;
  display: block !important;
  margin: 0 !important;
}

/* ----- Optional vignette for readability ----- */
body.page-id-212 .rbq-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    rgba(0,0,0,0.08) 0%,
    rgba(0,0,0,0.42) 68%,
    rgba(0,0,0,0.70) 100%
  );
  pointer-events: none;
  z-index: 2;
}

/* ----- Overlay layout ----- */
body.page-id-212 .rbq-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 14vh 6vw 10vh;
  text-align: center;
  box-sizing: border-box;
}

body.page-id-212 .rbq-overlay,
body.page-id-212 .rbq-overlay * {
  color: #d7b66a;
  text-shadow: 0 2px 18px rgba(0,0,0,0.55);
}

/* ----- General overlay text ----- */
body.page-id-212 .rbq-overlay h1,
body.page-id-212 .rbq-overlay h2,
body.page-id-212 .rbq-overlay h3,
body.page-id-212 .rbq-overlay p {
  max-width: 820px;
  margin: 0 auto;
  line-height: 1.16;
}

/* ----- Screen 1 flicker effect ----- */
body.page-id-212 .rbq-flicker img,
body.page-id-212 .rbq-s1 .rbq-bg img {
  animation: rbqFlicker 5.5s infinite;
  filter: brightness(0.85);
}

@keyframes rbqFlicker {
  0%, 100% { filter: brightness(0.80) contrast(1.02); }
  7%       { filter: brightness(0.92) contrast(1.04); }
  10%      { filter: brightness(0.78) contrast(1.01); }
  12%      { filter: brightness(0.95) contrast(1.04); }
  18%      { filter: brightness(0.82) contrast(1.02); }
  60%      { filter: brightness(0.88) contrast(1.03); }
  62%      { filter: brightness(0.76) contrast(1.00); }
  66%      { filter: brightness(0.93) contrast(1.04); }
}

/* ----- Scrolling quote block ----- */
body.page-id-212 .rbq-scrollwrap {
  position: absolute;
  left: 50%;
  top: 16vh;
  transform: translateX(-50%);
  width: min(88vw, 760px);
  text-align: center;
  z-index: 50;
  pointer-events: none;
}

body.page-id-212 .rbq-scrolltext {
  color: #d7b66a;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(18px, 2.4vw, 30px);
  line-height: 1.2;
  letter-spacing: 0.01em;
  text-shadow: 0 2px 18px rgba(0,0,0,.65);
}

body.page-id-212 .rbq-scrolltext p,
body.page-id-212 .rbq-scrolltext > div {
  margin: 0 0 0.45em 0;
  padding: 0;
}

/* Scroll once, start after 1 second, disappear after */
body.page-id-212 .rbq-scroll-slow {
  opacity: 0;
  transform: translateY(40px);
  animation: rbqScrollUp 10s linear 1;
  animation-delay: 1s;
  animation-fill-mode: forwards;
  will-change: transform, opacity;
}

@keyframes rbqScrollUp {
  0%   { transform: translateY(40px); opacity: 0; }
  10%  { opacity: 1; }
  75%  { opacity: 1; }
  100% { transform: translateY(-80px); opacity: 0; }
}

/* ----- Buttons on RBQ screens ----- */
body.page-id-212 .rbq-button {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 4vh;
}

body.page-id-212 .rbq-button .wp-block-button__link {
  background: transparent !important;
  box-shadow: none !important;
}

body.page-id-212 .rbq-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-width: 260px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  letter-spacing: 0.06em;
  color: #d7b66a !important;
  background: transparent !important;
  border: 2px solid #d7b66a;
  border-radius: 999px;
  padding: 16px 30px;
  text-decoration: none;
  text-align: center;
  transition: all .3s ease;
}

body.page-id-212 .rbq-btn:hover {
  background: rgba(215,182,106,0.12) !important;
  transform: scale(1.03);
}

body.page-id-212 .rbq-btn:active {
  transform: scale(0.98);
}

/* ----- Fade overlay used by JS ----- */
body.page-id-212 #rbq-fade-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  z-index: 999999;
  transition: opacity 700ms ease;
}

/* ----- Mobile RBQ fixes ----- */
@media (max-width: 600px) {
  body.page-id-212 .rbq-overlay {
    padding: 16vh 5vw 8vh;
    gap: 14px;
  }

  body.page-id-212 .rbq-scrollwrap {
    top: 18vh;
    width: 92vw;
  }

  body.page-id-212 .rbq-btn {
    min-width: 220px;
    font-size: 18px;
    padding: 14px 24px;
  }
}