
/* =========================================================
   UNDER — FINAL MOVIE POSTER
   =========================================================

   THIS FILE SECTION CONTROLS:

   1. The final movie poster
   2. Poster size and positioning
   3. The black background
   4. Navigation buttons below the poster
   5. Mobile layout
   6. Fade-out animation
   7. Error messages

   This does NOT control the regular story cards
   or the 3D cave environment.

========================================================= */


/* =========================================================
   01. FINAL POSTER CONTAINER

   This is the full-screen area that contains
   the movie poster and navigation buttons.
========================================================= */

#under-end-card {

  /* Fill the entire browser window */
  position: fixed;
  inset: 0;

  /* Keep the poster above everything else */
  z-index: 1000;

  /* Black background behind the poster */
  background: #000;

  /* Center the poster */
  display: grid;
  place-items: center;

  /* First row = poster
     Second row = navigation buttons */
  grid-template-rows: minmax(0, 1fr) auto;

  /* Hide anything extending beyond the screen */
  overflow: hidden;

  /* Prevent scrolling and dragging */
  touch-action: none;
  overscroll-behavior: none;
  user-select: none;

  outline: none;
}


/* Hide the final card when inactive */

#under-end-card[hidden] {
  display: none;
}


/* =========================================================
   02. MOVIE POSTER IMAGE

   EDIT HERE TO CHANGE THE POSTER SIZE!

   object-fit: contain = show the entire poster
   object-fit: cover   = fill the area, cropping edges

   Keep "contain" so the movie credits aren't cut off.
========================================================= */

#under-end-card img {

  display: block;

  /* Image container dimensions */
  width: 100%;
  height: 100%;

  /* Never exceed the available screen space */
  max-width: 100vw;
  max-height: 100%;

  min-height: 0;

  /* Show the whole image without cropping */
  object-fit: contain;

  /* Prevent dragging or clicking the image */
  pointer-events: none;


  /* ==========================================
     POSTER ZOOM — EDIT HERE

     1.00 = Original size
     0.95 = 95% size
     0.92 = 92% size
     0.85 = 85% size

     Remove the comment marks below to enable.
  ========================================== */

  /* transform: scale(0.92); */

  transform-origin: center;

}


/* =========================================================
   03. FINAL POSTER EXIT ANIMATION

   Controls the fade when leaving the final poster.
========================================================= */

#under-end-card.is-leaving {

  /* Fade duration */
  transition: opacity 0.6s ease;

  /* Disable clicks during transition */
  pointer-events: none;

}


/* =========================================================
   04. DISABLE PAGE SCROLLING

   When the final poster is active, prevent the
   rest of the website from scrolling.
========================================================= */

body.end-card-active {

  overflow: hidden;
  overscroll-behavior: none;

}


/* =========================================================
   05. HIDE THE NORMAL WEBSITE INTERFACE

   Hides the navigation, HUD, overlays and controls
   while the final movie poster is displayed.
========================================================= */

body.end-card-active > header,
body.end-card-active > #controls,
body.end-card-active > #hud,
body.end-card-active > .vignette,
body.end-card-active > .grain,
body.end-card-active > #finish,
body.end-card-active > #notice {

  visibility: hidden;

}


/* =========================================================
   06. FINAL POSTER NAVIGATION BAR

   This is the row containing the buttons below
   the movie poster.

   The navigation has its own space so it doesn't
   cover artwork or movie credits.
========================================================= */

.end-card-nav {

  display: flex;

  /* Center all navigation buttons */
  justify-content: center;
  align-items: center;

  /* EDIT HERE — Space between buttons */
  gap: clamp(14px, 3vw, 44px);

  width: 100%;

  /* Top, horizontal, and bottom spacing */
  padding:
    10px
    18px
    max(18px, env(safe-area-inset-bottom));

  background: #000;

}


/* =========================================================
   07. NAVIGATION BUTTON APPEARANCE

   Controls the text, size, and colors of buttons
   such as Restart and Return to Menu.
========================================================= */

.end-card-nav button,
.end-card-nav a {

  /* Minimum touch-friendly button height */
  min-height: 44px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  /* Button spacing */
  padding: 8px 2px;

  /* No button background or border */
  border: 0;
  background: none;

  /* EDIT HERE — Button text color */
  color: #c8c2b4;

  /* EDIT HERE — Button text styling */
  font: 12px/1.5 Georgia, "Times New Roman", serif;

  letter-spacing: 0.06em;

  text-decoration: none;
  text-align: center;

  cursor: pointer;

}


/* =========================================================
   08. BUTTON HOVER EFFECT

   Makes navigation text brighter when the
   mouse moves over it.
========================================================= */

.end-card-nav button:hover,
.end-card-nav a:hover {

  color: #fff;

}


/* =========================================================
   09. KEYBOARD ACCESSIBILITY

   Shows an outline when someone navigates
   using the Tab key.
========================================================= */

.end-card-nav :focus-visible {

  outline: 1px solid #e5decc;
  outline-offset: 4px;

}


/* =========================================================
   10. MOBILE NAVIGATION

   Only applies to screens 420px wide or smaller.

   Makes the buttons easier to fit and tap.
========================================================= */

@media (max-width: 420px) {

  .end-card-nav {

    /* Reduce distance between buttons */
    gap: 12px;

    /* Reduce left/right padding */
    padding-inline: 12px;

  }

  .end-card-nav button,
  .end-card-nav a {

    /* Slightly smaller text on phones */
    font-size: 11px;

    /* Let buttons share available space */
    flex: 1;

  }

}


/* =========================================================
   11. ERROR MESSAGE

   If the poster fails to load, this controls
   the position and appearance of the error text.
========================================================= */

.end-card-error {

  position: absolute;

  /* Position error text around screen center */
  inset: 40% 10% auto;

  /* Text color */
  color: #d8d0c4;

  text-align: center;

  /* Text styling */
  font: 14px/1.7 Georgia, serif;

  max-width: 50ch;

  margin: auto;

}


/* Hide the error message when not needed */

.end-card-error[hidden] {
  display: none;
}


/* =========================================================
   12. REDUCED MOTION ACCESSIBILITY

   If someone's device requests reduced motion,
   disable the poster's fade-out animation.
========================================================= */

@media (prefers-reduced-motion: reduce) {

  #under-end-card.is-leaving {

    transition: none;

  }

}


/* =========================================================
   END — UNDER FINAL MOVIE POSTER
========================================================= */
