/* Grundreset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html, body {
  height: 100%;
  font-family: 'Playfair Display', serif;
  overflow: hidden;
  background-color: #000;
}

/* 1. Playfair Display einbinden */
@font-face {
  font-family: 'Playfair Display';
  src: url('fonts/PlayfairDisplay-Regular.woff2') format('woff2'),
       url('fonts/PlayfairDisplay-Regular.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Playfair Display';
  src: url('fonts/PlayfairDisplay-Italic.woff2') format('woff2'),
       url('fonts/PlayfairDisplay-Italic.woff') format('woff');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Playfair Display';
  src: url('fonts/PlayfairDisplay-Bold.woff2') format('woff2'),
       url('fonts/PlayfairDisplay-Bold.woff') format('woff');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Playfair Display';
  src: url('fonts/PlayfairDisplay-BoldItalic.woff2') format('woff2'),
       url('fonts/PlayfairDisplay-BoldItalic.woff') format('woff');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

/* 2. Globale Font-Family setzen */
html, body {
  height: 100%;
  font-family: 'Playfair Display', serif;
  overflow: hidden;
  background-color: #000;
}

/* 3. Überschriften und Text gezielt anpassen (optional) */
h1, h2, h3, h4, h5, h6, .bookTitle, .chapterTitle {
  font-family: 'Playfair Display', serif;
  /* z.B. etwas größer oder fetter */
  font-weight: 700;
}
p, li, button, input, .bookTitleOverlay {
  font-family: 'Playfair Display', serif;
  font-weight: 400;
}



/* Header im Start Screen – fixiert oben */
#header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1001;
  background: transparent;
}
#logo, #infoImg {
  max-height: 50px;
}

/* Intro Screen */
#introScreen {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('images/intro_de.jpg');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  color: #cac7a0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding-bottom: 16.67%;
}
#introContent {
  text-align: center;
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
}
.introQuote {
  font-size: 2em;
  opacity: 0;
  margin: 5px 0;
  color: #cac7a0;
}
@keyframes zoomInAnimation {
  from { transform: scale(0.5); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.zoomIn {
  animation: zoomInAnimation 1s ease-out forwards;
}
#ageButton {
  padding: 10px 20px;
  font-size: 1.2em;
  background: #cac7a0;
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  display: none;
}

/* Passwort-Screen */
#passwordScreen {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('images/intro_de.jpg');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  color: #cac7a0;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding-bottom: 16.67%;
}
#passwordContent {
  text-align: center;
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
}
.passwordHint {
  font-size: 2em;
  margin: 5px 0;
  color: #cac7a0;
}
#passwordContent input {
  padding: 10px;
  font-size: 1.2em;
  margin-top: 10px;
  border: 1px solid #cac7a0;
  border-radius: 5px;
  background: #fff;
  color: #000;
  width: 80%;
  max-width: 300px;
}
#passwordSubmit, #passwordButton {
  padding: 10px 20px;
  font-size: 1.2em;
  background: #cac7a0;
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  margin-top: 10px;
}
#passwordButton {
  text-decoration: none;
  display: inline-block;
}

/* Secret Modal */
#secretModal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.8);
  color: #cac7a0;
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 3000;
}
#secretContent {
  text-align: center;
  max-width: 300px;
}
#secretContent p {
  font-size: 1.8em;
  margin-bottom: 20px;
}
#secretContent button {
  padding: 10px 20px;
  font-size: 1.2em;
  background: #cac7a0;
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  margin: 5px;
}

/* End-of-Book Overlay */
#endPopup {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 3000;
}
#endPopup.hidden { display: none; }
#endPopup .popupContent {
  background: transparent;
  padding: 20px;
  border-radius: 5px;
  text-align: center;
  color: #cac7a0;
  border: 2px solid #cac7a0;
}
#endPopup .popupContent button {
  background: #cac7a0;
  color: #fff;
  padding: 10px 20px;
  font-size: 1.2em;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  margin-top: 10px;
}

/* Start Screen: Buchauswahl */
#startScreen {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px 20px;
  background: #000;
  height: 100vh;
  overflow-y: auto;
}
#bookGrid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  width: 100%;
  max-width: 800px;
}
#bookGrid button {
  position: relative;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  border-radius: 5px;
}
#bookGrid img {
  width: 100%;
  display: block;
  object-fit: cover;
}
.bookTitleOverlay {
  position: absolute;
  top: 66%;
  left: 0;
  width: 100%;
  background: rgba(0,0,0,0.6);
  color: #cac7a0;
  text-align: center;
  padding: 5px 0;
  font-size: 1.1em;
}

/* Info Modal */
#infoModal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.8);
  color: #cac7a0;
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 3000;
  padding: 20px;
  text-align: center;
}
#infoContent { max-width: 600px; }

/* Reading View */
#readingView {
  display: none;
  height: 100vh;
  background: #000;
  position: relative;
  overflow: hidden;
}

/* Media Container im festen 9:16-Hochkant, passt sich an Viewport an */
#mediaContainer {
  position: relative;
  aspect-ratio: 9 / 16;
  width:  min(100vw, calc(100vh * (9 / 16)));
  height: min(100vh, calc(100vw * (16 / 9)));
  margin: 0 auto;
  background: #000;
  overflow: hidden;
}
#mediaContainer img,
#mediaContainer video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Text-Overlay wieder sichtbar */
#textOverlay {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 80%;
  background: rgba(0,0,0,0.5);
  color: #fff;
  padding: 10px 20px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: normal;
  text-align: left;
  transition: opacity 0.3s ease;
  opacity: 1;
}


/* Navigation-Buttons */
#backButton, #menuToggle {
  position: absolute;
  top: 10px;
  z-index: 1100;
  background: #000000;
  color: #fff;
  border: none;
  padding: 10px 15px;
  cursor: pointer;
  border-radius: 5px;
}
#backButton { left: 10px; }
#menuToggle { right: 10px; }
#musicButton {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: #000000;
  color: #fff;
  border: none;
  padding: 10px 15px;
  cursor: pointer;
  border-radius: 5px;
  z-index: 1100;
}

/* Kapitel-Menü */
#chapterMenu {
  position: fixed;
  top: 0; left: -250px;
  width: 250px; height: 100%;
  background: rgba(0,0,0,0.5);
 color: #cac7a0;
  box-shadow: 2px 0 5px rgba(0,0,0,0.5);
  transition: left 0.3s ease;
  padding: 20px;
  z-index: 2000;
  border: 2px solid #cac7a0;
  border-radius: 15px;
}
#chapterMenu.open { left: 0; }
#chapterMenu h2 {
  margin-bottom: 20px;
  font-size: 1.2em;
  text-align: center;
  color: #000000;
}
#chapterMenu ul { list-style: none; padding: 0; }
#chapterMenu li {
  padding: 10px;
  border-bottom: 1px solid #ccc;
  cursor: pointer;
}
#chapterMenu li:hover { background: #f0f0f0; }
#menuClose {
  position: absolute;
  top: 10px; right: 10px;
  background: transparent;
  border: none;
  font-size: 1.2em;
  cursor: pointer;
}

/* Suchleiste unter dem Header */
#searchContainer {
  width: 90%;
  max-width: 800px;
  margin: 20px auto;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  box-sizing: border-box;
}
#searchContainer input[type="text"] {
  flex: 1;
  padding: 8px;
  font-size: 16px;
  box-sizing: border-box;
}
#searchContainer button {
  padding: 8px 16px;
  font-size: 16px;
  cursor: pointer;
}
/* Landscape auf Mobilgeräten: Text etwas kleiner und Overlay flacher */
@media only screen and (orientation: landscape) and (max-width: 768px) {
  body > * { display: none; }             /* alle Inhalte ausblenden */
  body::before {
    content: "Bitte Gerät drehen";        /* Hinweis einblenden */
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    color: #000000;
    font-size: 1.5em;
    text-align: center;
    padding: 1em;
  }
}
