/* ═══════════════════════════════════════════════════════
   MIG Mediencenter – Stylesheet
   Brand Blue: #23325D
   ═══════════════════════════════════════════════════════ */

/* ─── Local Fonts (Roboto) ───────────────────────────── */

@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('/assets/fonts/roboto-300.woff2') format('woff2');
}

@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/roboto-400.woff2') format('woff2');
}

@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/assets/fonts/roboto-500.woff2') format('woff2');
}

@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/assets/fonts/roboto-700.woff2') format('woff2');
}

:root {
  --blue:       #23325D;
  --blue-mid:   #2C3E72;
  --blue-dark:  #1A2548;
  --bg:         #DFE4EA;
  --text:       #23325D;
  --text-muted: #6B7A9A;
  --white:      #FFFFFF;
  --silver:     #C9CED8;
  --font-body:    'Roboto', system-ui, sans-serif;
  --font-display: 'Roboto', system-ui, sans-serif;
  --ease:       cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ─── Header ─────────────────────────────────────────── */

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2.5rem;
  flex-shrink: 0;
  background: var(--blue);
  position: relative;
  z-index: 10;
}

.header__left {
  display: flex;
  align-items: stretch;
  gap: 0;
}

.header__left > a {
  display: flex;
  align-items: center;
}

.header__nav {
  align-self: stretch;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  white-space: nowrap;
}

/* SVG Logo images */
.logo-img {
  display: block;
  flex-shrink: 0;
}

.logo-img--combined {
  height: 110px;
  width: auto;
  max-width: 100%;
  filter: brightness(0) invert(1);
  display: block;
}

.header__tagline {
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--blue);
  letter-spacing: 0.01em;
  border-left: 2px solid var(--blue);
  padding-left: 1.5rem;
  align-self: stretch;
  display: flex;
  align-items: center;
}

.nav-link {
  font-size: clamp(0.78rem, 1.1vw, 1rem);
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  padding: 0 clamp(0.4rem, 0.8vw, 1rem) 0 clamp(0.5rem, 0.9vw, 1.2rem);
  position: relative;
  align-self: stretch;
  display: flex;
  align-items: center;
  letter-spacing: 0.01em;
  transition: color 0.2s, opacity 0.2s;
}

.nav-link:hover { color: #fff; }

.nav-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 60%;
  background: rgba(255, 255, 255, 0.35);
}

.social-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0 0.75rem;
  align-self: stretch;
}

.social-group:first-of-type {
  margin-left: calc(5rem + 6cm);
}

.social-link {
  display: flex;
  align-items: center;
  transition: opacity 0.2s;
}

.social-link:hover { opacity: 0.65; }

.social-label {
  font-size: 1rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  letter-spacing: 0.01em;
  padding-left: 0.3rem;
}

.social-icon {
  width: 30px;
  height: 30px;
  display: block;
  filter: brightness(0) invert(1);
}

@media (max-width: 600px) {
  .header {
    padding: 0 1rem;
  }

  .logo-img--combined {
    height: 60px;
  }

  .header__nav {
    margin-left: auto;
    justify-content: flex-end;
  }

  .nav-link {
    font-size: 0.8rem;
    padding: 0 0 0 0.75rem;
    text-align: right;
    line-height: 1.3;
    white-space: nowrap;
  }

  .nav-link::before {
    display: none;
  }

  .social-group {
    display: none;
  }
}

/* ─── Main ───────────────────────────────────────────── */

.main {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 2rem 2.5rem 1.5rem;
  gap: 0;
  min-height: 0;
}

/* ─── Hero / Title ───────────────────────────────────── */

.hero {
  flex-shrink: 0;
  width: 30%;
  min-width: 210px;
  padding-right: 1rem;
}

.hero__title {
  font-family: var(--font-body);
  color: var(--blue);
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.hero__line--top {
  display: block;
  font-size: clamp(2.2rem, 3.5vw, 3.8rem);
  font-weight: 400;
}

.hero__line--bottom {
  display: block;
  font-size: clamp(2.2rem, 3.5vw, 3.8rem);
  font-weight: 400;
}

/* ─── Hero Social ────────────────────────────────────── */

.hero__social {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 1.1rem;
  margin-top: 1.6rem;
}

.hero__social-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.hero__social-link {
  display: flex;
  align-items: center;
  transition: opacity 0.2s;
}

.hero__social-link:hover { opacity: 0.5; }

.hero__social-icon {
  width: 32px;
  height: 32px;
  display: block;
  filter: brightness(0) saturate(100%) invert(16%) sepia(40%) saturate(800%) hue-rotate(200deg) brightness(90%);
}

.hero__social-label {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--blue);
  padding-left: 0.2rem;
  opacity: 0.8;
}

/* ─── Books Stage ────────────────────────────────────── */

.books-stage {
  flex: 1;
  align-self: stretch;
  /* position: relative; — nur für Scattered-Layout benötigt, dort wieder einkommentieren */
}

/* ─── Individual Book ────────────────────────────────── */

/* Scattered: position: absolute — auskommentiert
.book {
  position: absolute;
  cursor: pointer;
}
*/
.book {
  cursor: pointer;
  position: relative; /* für .book__tag positioning */
}

.book:hover .book__body {
  transform: translateY(-10px);
}

.book__front {
  position: relative;
  border-radius: 3px;
  overflow: hidden;
  aspect-ratio: 1 / 1.414;
  box-shadow:
    0 24px 64px rgba(20, 30, 65, 0.22),
    0 8px 24px rgba(20, 30, 65, 0.1),
    0 2px 6px rgba(20, 30, 65, 0.06);
  transition: box-shadow 0.35s var(--ease);
  background: var(--blue-dark);
}

.book:hover .book__front {
  box-shadow:
    0 38px 90px rgba(20, 30, 65, 0.32),
    0 16px 40px rgba(20, 30, 65, 0.16),
    0 4px 10px rgba(20, 30, 65, 0.08);
}

.book__cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.book__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, var(--blue) 0%, var(--blue-dark) 100%);
  color: var(--white);
  padding: 2rem;
  text-align: center;
}

.book__placeholder-title {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.02em;
}

/* Hover overlay */
.book__open {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(35, 50, 93, 0.58);
  color: var(--white);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(3px);
}

.book:hover .book__open {
  opacity: 1;
}

/* Floating tag label — hangs below the book cover */
.book__tag {
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: 7px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(35, 50, 93, 0.06);
  padding: 5px 13px 6px;
  border-radius: 2px;
  box-shadow:
    0 6px 24px rgba(35, 50, 93, 0.16),
    0 1px 4px rgba(35, 50, 93, 0.06);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--blue);
  white-space: nowrap;
  z-index: 25;
  letter-spacing: 0.015em;
  pointer-events: none;
}

/* Entry animation — applied to __body so JS parallax on .book doesn't conflict */
@keyframes bookIn {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.book__body {
  transition: transform 0.35s var(--ease);
  animation: bookIn 0.7s var(--ease) both;
}

.book:nth-child(1) .book__body { animation-delay: 0.1s; }
.book:nth-child(2) .book__body { animation-delay: 0.22s; }
.book:nth-child(3) .book__body { animation-delay: 0.34s; }

/* ─── Grid Layout (primäres Layout) ──────────────────── */

.books-stage--grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  column-gap: 2.5rem;
  row-gap: 4rem;
  align-content: start;
  padding: 2rem 2rem 2rem 2.5rem;
}

.books-stage--grid .book {
  width: auto !important;
  transform: none !important;
}

.books-stage--grid .book__front {
  aspect-ratio: 1 / 1.414;
}

@media (max-width: 900px) {
  .books-stage--grid {
    grid-template-columns: 1fr;
    padding: 1.5rem 1rem;
    row-gap: 3.5rem;
  }
}

/* ─── Flipbook Overlay ───────────────────────────────── */

.flipbook-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgb(20, 28, 55);
  backdrop-filter: blur(22px);
  display: none;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.flipbook-overlay.active {
  display: flex;
  opacity: 1;
}

.flipbook-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
}

.flipbook-title {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--white);
}

.flipbook-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.flipbook-download {
  font-size: 1rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  padding: 0.65rem 1.6rem;
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  border-radius: 100px;
  letter-spacing: 0.04em;
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.flipbook-download:hover {
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-3px);
}

.flipbook-close {
  cursor: pointer;
  font-family: var(--font-body);
}

.flipbook-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.5rem 1rem;
  min-height: 0;
  overflow: hidden;
}

/* Heyzine / Video iframe — füllt den gesamten flipbook-container */
.heyzine-mode .flipbook-nav   { display: none; }
.heyzine-mode .flipbook-pages { display: none; }

/* Video-Kachel: Querformat */
.book__front--video {
  position: relative;
  aspect-ratio: 16 / 9 !important;
}

/* Video-Kachel: Volle Galeriebreite */
.books-stage--grid .book--full-width {
  grid-column: 1 / -1;
}
.book--expanded {
  cursor: pointer;
}
.books-stage--grid .book--full-width .book__front--video {
  aspect-ratio: 16 / 9;
  height: auto;
}
.books-stage--grid .book--full-width .book__cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book__front--autoplay {
  position: relative;
  overflow: hidden;
}
.book__front--autoplay iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}
.autoplay-clickover {
  position: absolute;
  inset: 0;
  z-index: 10;
  cursor: pointer;
}

.video__play-btn {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}

.book:hover .video__play-btn { opacity: 1; }

/* Video-Overlay: nur Download-Link ausblenden, Zurück-Button bleibt */
.video-mode #flipbookDownload { display: none; }

.heyzine-mode .flipbook-container {
  padding: 0.75rem;
  gap: 0;
}

.heyzine-mode .flipbook-stage-wrap {
  flex: 1;
  align-self: stretch;
  width: 100%;
  min-height: 0;
}

.heyzine-mode #flipbookStage {
  width: 100%;
  height: 100%;
}

.heyzine-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  border-radius: 4px;
}

/* 16:9 Stage im Video-Modus — nach heyzine-mode-Regeln damit kein Override */
.video-mode.heyzine-mode .flipbook-container {
  padding: 1rem;
}
.video-mode.heyzine-mode .flipbook-stage-wrap {
  flex: unset;
  align-self: auto;
  width: min(100%, calc((100vh - 80px) * 16 / 9));
  aspect-ratio: 16 / 9;
}
.video-mode.heyzine-mode #flipbookStage {
  width: 100%;
  height: 100%;
}

.flipbook-stage-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.flipbook-nav {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--white);
  font-size: 1.6rem;
  line-height: 1;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.2s;
  flex-shrink: 0;
}

.flipbook-nav:hover { background: rgba(255, 255, 255, 0.14); }

@media (max-width: 700px) {
  .flipbook-header {
    padding: 0.4rem 1rem;
  }

  .flipbook-title {
    font-size: 0.8rem;
  }

  .flipbook-download {
    font-size: 0.8rem;
    padding: 0.35rem 0.85rem;
  }

  .flipbook-container {
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem;
    align-items: flex-start;
  }

  .flipbook-stage-wrap {
    width: 100%;
    order: 1;
  }

  .flipbook-nav {
    order: 2;
    flex: 1;
    border-radius: 8px;
    height: 44px;
    width: auto;
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
  }
}

.flipbook-pages {
  text-align: center;
  padding: 0.5rem;
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.82rem;
  flex-shrink: 0;
}

/* ─── Footer ─────────────────────────────────────────── */

.footer {
  padding: 1.1rem 2.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(35, 50, 93, 0.07);
  flex-shrink: 0;
}

.footer__links {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.footer__links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.925rem;
  transition: color 0.2s;
}

.footer__links a:hover { color: var(--blue); }

.footer__links span {
  color: var(--text-muted);
  font-size: 0.925rem;
}

.footer__copy {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ─── Hero sticky (desktop) ──────────────────────────── */

@media (min-width: 901px) {
  .main {
    align-items: flex-start;
    padding-top: 0;
    padding-bottom: 0;
  }

  .hero {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding: 0 1rem 0 0;
  }
}

/* ─── Responsive ─────────────────────────────────────── */

@media (max-width: 900px) {
  .main {
    flex-direction: column;
    align-items: flex-start;
    padding: 1.5rem;
    overflow: visible;
  }

  .hero {
    width: 100%;
    min-width: unset;
    padding-right: 0;
    padding-bottom: 1rem;
  }

  .books-stage {
    width: 100%;
    min-height: unset;
  }
}

@media (max-width: 600px) {
  .header { padding: 1rem 1.25rem; }
  .header__logo--hmw { display: none; }
  .footer { flex-direction: column; gap: 0.4rem; text-align: center; padding: 1rem 1.25rem; }
  .flipbook-canvas { max-width: 90vw; }
  .flipbook-viewport { flex-direction: column; gap: 2px; }
}
