/* Base styles */
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background-color: #000000; /* Dark purple/brownish background */
  color: #E2E7EB; /* Light off-white for text */
  font-family: "Century Schoolbook Bold", Georgia, "Times New Roman", serif;
  overflow: auto;
}

html {
  overflow-y: scroll;
}

a {
  color: inherit;
  text-decoration: none;
}

.layout-container {
  display: flex;
  flex-direction: column;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  color: #E2E7EB;
  height: auto; /* Set min-height to fill the viewport */
  position: relative;
  background-image: url('images/BackgroundE.jpg'); /* New background image */
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center top;
}

.page-wrapper {
  flex: 1; /* Allows it to grow and fill available space */
  display: flex;
  flex-direction: column;
  padding-top: 0px;
}

.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

/* New Unified Grid Layout for main content */
.main-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-areas:
    "top-left-quote . . . top-right-quote"
    "book-section author-section extras-section speaker-section call-to-action-section";
  gap: 0px;
  margin-top: 10px;
}

.traintracks-box {
  height: 340px;
  width: 100%;
  background-image: url('images/traintracks.jpg');
  background-size: cover;
  background-position: center;
  border-bottom: 15px solid #000000;
  border-left: 15px solid #000000;
  border-right: 15px solid #000000;
  border-top: none;
  box-sizing: border-box; /* To keep the borders within the 100% width */
}

.top-quote {
  position: absolute;
  background-color: transparent;
  padding: 0px;
  font-size: 1.1em;
  line-height: 1.5;
  text-align: center;
}

.top-quote.left-quote {
  width: 380px;
  top: 110px;
  left: 100px;
}

.top-quote.left-quote p {
  line-height: .1;
}

.ghost-girl-box {
  position: absolute;
  top: 165px; 
  left: 60px;
  background-color: transparent;
}

.ghost-girl-box img {
  width: 80px; 
  height: auto;
}

.top-quote.right-quote {
  width: 380px;
  top: 175px;
  right: 60px;
}

.top-quote.right-quote p {
  line-height: .1;
}

.top-book-cover {
  grid-area: book-cover;
  position: absolute;
  top: 35px;
  left: 530px;
  z-index: 1001;
  transform: rotate(5deg);
  width: 230px;
  justify-self: center;
}

.top-book-cover img {
  width: 100%;
  max-width: 230px;
  height: auto;
  box-shadow: 10px 12px 16px rgba(0, 0, 0, 0.6);
  border: 5px solid #694d5c;
  border-radius: 4px;
}

/* Assign grid areas to the content boxes */
.section-box {
  background-color: rgba(92, 65, 78, 0.9); /* Box background color */
  padding-top: 15px;
  padding-right: 20px;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  line-height: 1.5;
  box-sizing: border-box;
  border-bottom: 15px solid #271126;
}

.section-box h3 {
  font-size: 1.4em;
  font-weight: bold;
  margin-top: 0;
  text-align: center;
}

.book-section {
  grid-area: book-section;
  background-color: rgba(39, 17, 38, 0.9);
}

.author-section {
  grid-area: author-section;
}

.speaker-section {
  grid-area: speaker-section;
}

.call-to-action-section {
  grid-area: call-to-action-section;
  background-color: rgba(39, 17, 38, 0.9);
}

.extras-section {
  grid-area: extras-section;
  padding: 20px;
  text-align: left;
  background-color: transparent;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-weight: bold;
  padding-bottom: 0;
}

.extras-section ul {
  line-height: 1.2em;
}

.social-icons-extras {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 0px;
}

.social-icons-extras img {
  width: 28px;
  height: 28px;
}

.section-title {
  font-size: 1.5em;
  font-weight: bold;
  margin-bottom: 10px;
}

/* --- The Book Section --- */
.book-section .section-title {
  font-size: 1.4em;
  line-height: 1.2;
}

.book-section .book-quote {
  font-style: italic;
  margin-top: 20px;
  line-height: 1.4;
  text-align: left;
}

/* --- The Author Section --- */
.author-title-photo-group {
  display: flex;
  flex-direction: row;        /* Make text and image sit in a row */
  align-items: center;        /* Vertically center them */
  justify-content: flex-start;/* Keep them aligned to the left */
  gap: 10px;                  /* Space between text and photo */
  margin: 0px 0;
}

.author-section .author-photo {
  width: 100px;
  height: auto;
  transform: rotate(5deg);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  margin-right: 10px;
}

.author-section .author-quote {
  margin-top: 40px;
  font-style: italic;
  margin-bottom: 0;
}

.author-section .section-title {
  font-size: 1.5em;
  font-family: 'Times New Roman', Times, serif;
  font-variant: small-caps;
}

/* --- The Extras Section --- */
.extras-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
  line-height: 1.6;
  text-align: left;
}

.extras-section ul li {
  margin-bottom: 5px;
}

.extras-section ul a {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.extras-section .lozenge {
  color: #513642;
  font-size: 1.5em !important;
}

/* --- The Speaker Section --- */
.speaker-section .section-title {
  font-size: 1.7em;
}

.speaker-section p {
  font-size: 1.1em;
  line-height: 1.4;
  margin: 5px 0;
  color: #fff;
}

.speaker-section .email-link,
.speaker-section .contact-link {
  font-size: 1.2em;
  font-weight: bold;
  padding: 8px 15px;
  background-color: #513642;
  color: #fff;
  border-radius: 5px;
  margin-top: 10px;
  border: 1px solid #775161;
}

.speaker-section .media-link-text {
  font-size: 1.1em;
  font-weight: bold;
  margin-top: 20px;
  margin-bottom: 5px;
}

.speaker-section .email-address,
.speaker-section .phone-number {
  font-size: 1.1em;
  margin-top: 5px;
}

/* --- The Call to Action Section --- */
.call-to-action-section .section-title {
  font-size: 1.7em;
  line-height: 1.2;
  font-family: 'Times New Roman', Times, serif;
  font-variant: small-caps;
}

.call-to-action-section .cta-quote {
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
  font-style: italic;
  font-size: 1.1em;
  line-height: 1.4;
  text-align: center;
}

.call-to-action-section .cta-quote-author {
  font-size: 1.1em;
  text-align: right;
  margin-top: 5px;
  font-weight: bold;
}

.cta-details-link {
  font-size: 1.2em;
  font-weight: bold;
  padding: 8px 15px;
  background-color: #513642;
  color: #fff;
  border-radius: 5px;
  margin-top: 10px;
}

.go-back-button {
  display: none; /* Hidden by default on desktop */
  background-color: #513642;
  color: #fff;
  padding: 8px 15px;
  margin: 10px;
  border-radius: 5px;
  text-decoration: none;
  font-family: "Century Schoolbook", Georgia, serif;
  font-size: 1em;
  border: 1px solid #775161;
}

.email-form {
  display: flex;
  flex-direction: row;
  align-items: center;
  margin-top: 10px;
  gap: 10px;
}



.email-form input[type="email"],
.email-form textarea {
  border: 1px solid #ccc;
  padding: 8px;
  font-size: 14px;
  border-radius: 5px;
  width: 100%;
  box-sizing: border-box;
}

.email-form button {
  padding: 6px 5px;
  font-size: 20px;
  background-color: #513642;
  color: #fff;
  border: 1px solid #775161;
  cursor: pointer;
  border-radius: 5px;
  align-self: flex-start;
  align-self: center;
}

/* --- Modal (Popup) Styles --- */

/* The dark background overlay */
.modal-overlay {
  display: none; /* Hidden by default */
  position: fixed; /* Stay in place even when scrolling */
  z-index: 1000; /* Sit on top of everything */
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto; /* Enable scroll if needed */
  background-color: rgba(0, 0, 0, 0.85); /* Black with opacity */
  justify-content: center; /* Center horizontally */
  align-items: center; /* Center vertically */
}

/* Specific rule for the video modal to appear on top */
#videoModal {
  z-index: 2000;
}

/* The popup window itself */
.modal-content {
  background-color: #5c414e; /* Same color as orders page */
  padding: 30px;
  border: 1px solid #E2E7EB;
  border-radius: 8px;
  width: 80%;
  max-width: 550px;
  color: #E2E7EB;
  font-family: 'Times New Roman', Times, serif;
  position: relative;
  text-align: center;
}

/* The close button (X) */
.close-button {
  color: #E2E7EB;
  position: absolute;
  top: 10px;
  right: 20px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.close-button:hover,
.close-button:focus {
  color: #ccc;
}

/* Styles for the content inside the popup */
.modal-content h1 {
  font-family: 'Times New Roman', Times, serif;
  font-size: 2rem;
  margin-bottom: 1rem;
}

.modal-content .purchase-text {
  font-size: 1.2rem;
  margin: 1rem 0;
}

.modal-content .retail-links {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
}

.modal-content .retail-links a {
  text-decoration: none;
  color: #E2E7EB;
  text-align: center;
  width: 100px;
}

.modal-content .retail-links img {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  margin-bottom: 10px;
  background-color: white;
  padding: 5px;
  box-sizing: border-box;
  border: 1px solid #ddd;
}

.modal-content .retail-links span {
  display: block;
  font-size: 1rem;
  line-height: 1.2;
}

/* New styles for the video modal */
#videoModal .modal-content {
  max-width: 900px;
  width: 90%;
  padding: 15px;
  background-color: #000;
  border: 2px solid #a39589;
}

.video-player-container {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
}

.video-player-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* --- STYLES FOR THE TEXT POP-UP --- */
.text-modal-content {
  background-color: #5F4152; /* Dark mauve color */
  color: #E6DED5; /* Parchment text color */
  font-family: 'Times New Roman', Times, serif;
  border: 1px solid #E6DED5;
  text-align: center;
  padding: 40px 60px;
  max-width: 600px;
}

.text-modal-body .modal-header {
    font-size: 1.2rem;
    font-variant: small-caps;
    letter-spacing: 2px;
    margin-bottom: 25px;
}

.text-modal-body .modal-title {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.text-modal-body .modal-series {
    font-size: 1.1rem;
    margin-bottom: 30px;
}

.text-modal-body .modal-description {
    font-size: 1.3rem;
    line-height: 1.5;
}

/* Make the close button visible on the dark background */
.text-modal-content .close-button {
  color: #E6DED5;
}

/* --- NEW RULES FOR SHIFTED MODALS --- */
/* This targets only the pop-ups with the .modal-shifted class */
.modal-shifted {
  /* This overrides the 'align-items: center' from the parent rule,
     allowing us to position the content from the top. */
  align-items: flex-start;
}

.modal-shifted .modal-content {
  /* This is the positioning logic */
  margin-top: 40vh; /* Start at the vertical halfway point of the screen */
  transform: translateY(-50%) translateY(250px); /* Move up by half its height, then down by 250px */
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  .go-back-button {
    display: inline-block; 
  }

  .main-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "book-cover"
      "top-left-quote"
      "top-right-quote"
      "book-section"
      "author-section"
      "extras-section"
      "speaker-section"
      "call-to-action-section";
  }
  
  .top-book-cover, .top-quote {
    text-align: center;
    padding: 10px;
  }

  .extras-section {
    text-align: center;
  }

  .social-icons-extras {
    justify-content: center;
  }

  /* Add these styles inside your existing @media (max-width: 768px) block */

  .main-grid {
    /* This ensures content stacks vertically */
    display: flex;
    flex-direction: column;
  }

.traintracks-box {
  height: 150px;
  /* Add a black border to the top */
  border-top: 10px solid #000000;
}

  /* Reset the absolutely positioned elements */
.top-quote, .top-book-cover, .ghost-girl-box {
  position: static; /* This is the key change! */
  width: 90%;
  margin: 20px auto; /* Center the elements */
  transform: none; /* Remove rotation from book cover */
  text-align: center;
  top: auto;
  left: auto;
  right: auto;
}
.ghost-girl-box {
  position: absolute;   /* Take it out of the normal flow */
  top: 25px;            /* Position from the top */
  left: 60px;           /* Position from the left */
  width: auto;          /* Reset width */
  margin: 0;            /* Reset margin */
}
.ghost-girl-box img {
  width: 40px; /* Make the image smaller */
}
.top-book-cover {
  margin-top: 20px; /* Add some space above the book cover */
  z-index: 1; /* Ensure it's below the absolute positioned nav */
}

.top-book-cover img {
  width: 60%; /* Make the book cover smaller */
  max-width: 200px;
}
.top-quote.left-quote {
  position: absolute;   /* Take it out of the normal flow */
  top: 10px;            /* Position from the top */
  left: 80px;           /* Position it next to the girl */
  width: 73%;           /* Make the quote box narrower */
  text-align: center;     /* Align text to the left */
  font-size: 0.8em;     /* Make font slightly smaller */
  margin: 0 !important;            /* Reset margin */
}
.top-quote.left-quote p{
  margin: 0 !important;            /* Reset margin */
}
.top-quote.right-quote {
  display: none;
}

  .section-box {
    border-bottom: 10px solid #271126;
  }

  .layout-container {
    background-image: url('images/mobile_background.jpg');
  }

  .modal-shifted .modal-content {
  margin: 0px;
  align-items: center;
}

.social-icons-extras {
  margin-top: 20px;
}

}