/* ============================================
   MY STORY PAGE (my-story/index.qmd)
   Full-bleed GSAP theater, no Quarto chrome.
   Scoped to body.my-story-page
   ============================================ */

/* Reset Quarto wrappers */
body.my-story-page,
body.my-story-page main,
body.my-story-page main.content,
body.my-story-page main.column-page,
body.my-story-page #quarto-content,
body.my-story-page #quarto-document-content,
body.my-story-page .page-columns,
body.my-story-page .quarto-container,
body.my-story-page .quarto-container-page-margin,
body.my-story-page .column-page,
body.my-story-page .column-body,
body.my-story-page .page-layout-full,
body.my-story-page .content {
  max-width: none !important;
  width: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
  grid-template-columns: 1fr !important;
  display: block !important;
}

body.my-story-page {
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden;
  background: #faf6ef;
}

/* Hide every fragment of Quarto chrome */
body.my-story-page #quarto-header,
body.my-story-page header#quarto-header,
body.my-story-page .navbar,
body.my-story-page nav.navbar,
body.my-story-page #quarto-document-content > header,
body.my-story-page header#title-block-header,
body.my-story-page #title-block-header,
body.my-story-page footer,
body.my-story-page footer.footer,
body.my-story-page .nav-footer,
body.my-story-page .page-footer,
body.my-story-page #quarto-margin-sidebar,
body.my-story-page #quarto-sidebar,
body.my-story-page .quarto-title-banner,
body.my-story-page .quarto-secondary-nav,
body.my-story-page .quarto-title-block {
  display: none !important;
}

body.my-story-page.nav-fixed,
body.my-story-page {
  padding-top: 0 !important;
}

html,
body.my-story-page {
  height: 100%;
  margin: 0;
  padding: 0;
}

/* ============================================
   THEATER -> FULL SCREEN
   ============================================ */
body.my-story-page .gs-theater {
  width: 100vw !important;
  max-width: none !important;
  height: 100vh !important;
  min-height: 100vh;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: #faf6ef !important;
  display: flex;
  flex-direction: column;
  position: relative;
  box-sizing: border-box;
  overflow: hidden;
}

/* Keep the thin gradient accent line across the top */
body.my-story-page .gs-theater::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #2c3e50, #b8945a, #2c3e50);
  z-index: 5;
}

/* Scene canvas fills the ENTIRE theater. Padding moves to .scene-layer so
   the cross-fade layers can stack and center their own content. */
body.my-story-page .gs-screen {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  flex: none !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  padding: 0 !important;
  display: block;
  box-sizing: border-box;
  overflow: hidden;
  z-index: 1;
  background: #0E1B26;
}

/* Each scene mounts as its own absolutely-positioned layer so the previous
   scene can fade out while the new one fades in. */
body.my-story-page .scene-layer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5rem 3vw 6rem;
  box-sizing: border-box;
  will-change: opacity;
}

/* Make the theater itself dark too so any brief gap between scenes does
   not flash the cream Quarto base color */
body.my-story-page .gs-theater {
  background: #0E1B26 !important;
}

/* ============================================
   SCENE 0: FULL-BLEED VIDEO + TYPEWRITER OVERLAY
   ============================================ */
body.my-story-page .gs-intro-fullscreen {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  background: #0E1B26;
}

body.my-story-page .gs-intro-video {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  min-width: 100%;
  min-height: 100%;
  transform: translate(-50%, -50%);
  object-fit: cover !important;
  object-position: center center;
  z-index: 1;
  display: block !important;
  max-height: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background-color: #faf6ef !important;
}

/* Hide native video controls that flash on some mobile browsers */
body.my-story-page .gs-intro-video::-webkit-media-controls {
  display: none !important;
}
body.my-story-page .gs-intro-video::-webkit-media-controls-start-playback-button {
  display: none !important;
}

/* Dark gradient anchored bottom-left for text legibility */
body.my-story-page .gs-intro-vignette {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(
      to top,
      rgba(14, 27, 38, 0.78) 0%,
      rgba(14, 27, 38, 0.45) 25%,
      rgba(14, 27, 38, 0.18) 45%,
      rgba(14, 27, 38, 0) 65%
    ),
    radial-gradient(
      ellipse at center,
      transparent 60%,
      rgba(14, 27, 38, 0.3) 100%
    );
}

body.my-story-page .gs-intro-text-wrap {
  position: absolute;
  right: 1.5vw;
  top: 50%;
  transform: translateY(-50%) rotate(-1.5deg);
  z-index: 5;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.1rem;
  width: min(40vw, 420px);
  text-align: left;
}

body.my-story-page .gs-intro-text {
  margin: 0;
  font-family: 'Kalam', 'Caveat', 'Comic Sans MS', cursive;
  font-style: normal;
  font-weight: 700;
  font-size: clamp(1.4rem, 2.6vw, 2.15rem);
  line-height: 1.35;
  color: #FFFFFF;
  letter-spacing: 0.002em;
  text-shadow:
    0 1px 3px rgba(0, 0, 0, 0.7),
    0 3px 14px rgba(0, 0, 0, 0.55),
    0 0 22px rgba(0, 0, 0, 0.35);
  white-space: pre-wrap;
}

body.my-story-page .gs-intro-cursor {
  display: inline-block;
  width: 0.07em;
  height: 0.95em;
  margin-left: 0.1em;
  background: #C77B45;
  transform: translateY(0.16em);
  animation: introCursorBlink 0.95s steps(2, end) infinite;
  font-size: clamp(1.4rem, 2.6vw, 2.15rem);
  box-shadow: 0 0 12px rgba(199, 123, 69, 0.7);
}

body.my-story-page .gs-intro-cursor.done {
  animation: introCursorBlink 1.4s steps(2, end) infinite;
  opacity: 0.65;
}

@keyframes introCursorBlink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

@media (max-width: 768px) {
  body.my-story-page .gs-intro-video {
    object-fit: contain !important;
    object-position: center center;
    background: #0E1B26;
  }
  body.my-story-page .gs-intro-text-wrap {
    left: 1.5rem;
    right: 1.5rem;
    top: auto;
    bottom: 6rem;
    width: auto;
    transform: rotate(-1deg);
  }
  body.my-story-page .gs-intro-text,
  body.my-story-page .gs-intro-cursor {
    font-size: clamp(1.2rem, 4.5vw, 1.65rem);
  }
}

/* ============================================
   HANDWRITTEN CAPTION OVERLAY (Scene 1+)
   ============================================ */
body.my-story-page .story-beat-caption {
  position: absolute;
  left: 50%;
  bottom: 13%;
  transform: translateX(-50%) rotate(-1.5deg);
  z-index: 5;
  width: max-content;
  max-width: min(80vw, 920px);
  text-align: center;
  pointer-events: none;
}

body.my-story-page .story-beat-caption-inner {
  display: inline;
  font-family: 'Caveat', 'Kalam', cursive;
  font-weight: 700;
  font-size: clamp(1.5rem, 2.6vw, 2.4rem);
  line-height: 1.4;
  color: #1a2540;
  letter-spacing: 0.005em;
}

/* Keep letters of a word locked together so words never split mid-letter */
body.my-story-page .story-beat-caption .cap-word {
  display: inline-block;
  white-space: nowrap;
}

/* Highlighter lives on each letter so it advances with the typing */
body.my-story-page .story-beat-caption .cap-letter {
  display: inline-block;
  white-space: pre;
  padding: 0.2rem 0.02em;
  background-image: linear-gradient(
    180deg,
    transparent 0%,
    transparent 38%,
    rgba(248, 207, 95, 0.78) 38%,
    rgba(248, 207, 95, 0.78) 92%,
    transparent 92%
  );
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

body.my-story-page .story-beat-caption .cap-letter.cap-space {
  width: 0.28em;
  padding-left: 0;
  padding-right: 0;
}

@media (max-width: 768px) {
  body.my-story-page .story-beat-caption {
    bottom: 11%;
    max-width: 92vw;
  }
  body.my-story-page .story-beat-caption-inner {
    font-size: clamp(1.1rem, 4.8vw, 1.55rem);
    padding: 0.15rem 0.55rem;
  }
}

/* Timeline pinned as a thin progress line at the very bottom */
body.my-story-page .gs-timeline-bar {
  position: absolute !important;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0 !important;
  height: 3px !important;
  background: rgba(255, 255, 255, 0.18) !important;
  z-index: 40;
}

body.my-story-page .gs-timeline-fill {
  background: linear-gradient(90deg, #C77B45, #b8945a, #C77B45) !important;
  height: 100% !important;
  box-shadow: 0 0 12px rgba(199, 123, 69, 0.55);
}

/* Floating glass nav controls pill, bottom-right corner */
body.my-story-page .gs-nav-controls {
  position: absolute !important;
  right: 1.25rem !important;
  bottom: 1.25rem !important;
  top: auto !important;
  left: auto !important;
  transform: none !important;
  z-index: 50;
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 0.4rem !important;
  padding: 0.45rem 0.6rem !important;
  border-radius: 9999px !important;
  background: rgba(14, 27, 38, 0.55) !important;
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border: 1px solid rgba(245, 239, 230, 0.18) !important;
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  margin: 0 !important;
  width: auto !important;
  flex-shrink: 0;
}

body.my-story-page .gs-nav-controls .gs-nav-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0.5rem 1.1rem !important;
  border-radius: 9999px !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(245, 239, 230, 0.22) !important;
  color: rgba(245, 239, 230, 0.95) !important;
  font-family: 'Source Sans 3', sans-serif !important;
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.04em !important;
  cursor: pointer;
  transition: background 200ms ease, border-color 200ms ease, color 200ms ease, transform 200ms ease;
  min-width: 0 !important;
  margin: 0 !important;
}

body.my-story-page .gs-nav-controls .gs-nav-btn:hover:not(:disabled) {
  background: rgba(199, 123, 69, 0.35) !important;
  border-color: rgba(199, 123, 69, 0.7) !important;
  color: #F5EFE6 !important;
  transform: translateY(-1px);
}

body.my-story-page .gs-nav-controls .gs-nav-btn:disabled {
  opacity: 0.35 !important;
  cursor: default !important;
}

body.my-story-page .gs-nav-controls .gs-nav-counter {
  color: rgba(245, 239, 230, 0.85) !important;
  font-family: 'Source Sans 3', sans-serif !important;
  font-size: 0.74rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.12em !important;
  padding: 0 0.45rem !important;
  margin: 0 !important;
  white-space: nowrap;
}

/* Restart button: pin top-right of the theater */
body.my-story-page .gs-nav-restart {
  position: absolute !important;
  top: 1.25rem;
  right: 2rem;
  z-index: 50;
  margin: 0 !important;
  padding: 0 !important;
}

/* ============================================
   TOP-LEFT WORDMARK / BACK LINK
   ============================================ */
body.my-story-page .gs-back-link {
  position: absolute;
  top: 1.25rem;
  left: 2rem;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.95rem;
  border-radius: 9999px;
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-size: 0.95rem;
  color: rgba(44, 62, 80, 0.78);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(184, 148, 90, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: color 200ms ease, background 200ms ease, transform 200ms ease;
}

body.my-story-page .gs-back-link:hover {
  color: #2c3e50;
  background: rgba(255, 255, 255, 0.85);
  transform: translateY(-1px);
}

body.my-story-page .gs-back-link .arrow {
  font-style: normal;
  font-size: 1rem;
  transition: transform 200ms ease;
}

body.my-story-page .gs-back-link:hover .arrow {
  transform: translateX(-3px);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  body.my-story-page .gs-screen {
    padding: 4rem 1rem 5rem !important;
  }
  body.my-story-page .gs-nav-controls {
    right: 0.75rem !important;
    bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px)) !important;
    padding: 0.35rem 0.5rem !important;
    gap: 0.3rem !important;
  }
  body.my-story-page .gs-nav-controls .gs-nav-btn {
    padding: 0.4rem 0.85rem !important;
    font-size: 0.78rem !important;
  }
  body.my-story-page .gs-nav-controls .gs-nav-counter {
    font-size: 0.7rem !important;
    padding: 0 0.35rem !important;
  }
  body.my-story-page .gs-back-link {
    top: 0.85rem;
    left: 1rem;
    font-size: 0.85rem;
    padding: 0.35rem 0.75rem;
  }
  body.my-story-page .gs-nav-restart {
    top: 0.85rem;
    right: 1rem;
  }
  body.my-story-page .gs-intro-text-wrap {
    bottom: calc(5rem + env(safe-area-inset-bottom, 0px));
  }
  body.my-story-page .story-beat-caption {
    bottom: calc(11% + env(safe-area-inset-bottom, 0px));
  }
}
