/* ═══════════════════════════════════════════════════════
   MIG Mediencenter – Stylesheet
   Corporate Style: Navy, Silver, Clean
   ═══════════════════════════════════════════════════════ */

:root {
  --navy: #1B2A4A;
  --navy-deep: #0F1A2E;
  --navy-light: #2A3F6A;
  --silver: #C8CDD5;
  --silver-light: #E8EBF0;
  --bg-gradient: linear-gradient(165deg, #E8EBF0 0%, #D5D9E2 40%, #C8CDD5 100%);
  --text-dark: #1B2A4A;
  --text-muted: #5A6577;
  --white: #FFFFFF;
  --accent: #3B7DD8;
  --accent-hover: #2A65B5;
  --shadow-card: 0 20px 60px rgba(15, 26, 46, 0.15), 0 8px 20px rgba(15, 26, 46, 0.08);
  --shadow-card-hover: 0 30px 80px rgba(15, 26, 46, 0.25), 0 15px 40px rgba(15, 26, 46, 0.12);
  --radius: 6px;
  --font-body: 'DM Sans', -apple-system, sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;
  --transition: 0.4s 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; }

body {
  font-family: var(--font-body);
  color: var(--text-dark);
  background: var(--bg-gradient);
  min-height: 100vh;
  overflow-x: hidden;
}

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

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 3rem;
  position: relative;
  z-index: 10;
}

.header__left {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.header__logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.logo-mig {
  font-family: var(--font-body);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--navy);
}

.logo-divider {
  width: 1px;
  height: 28px;
  background: var(--navy);
  opacity: 0.3;
}

.logo-sub {
  font-size: 0.6rem;
  line-height: 1.3;
  color: var(--navy);
  letter-spacing: 0.02em;
  font-weight: 500;
  text-transform: uppercase;
}

.logo-hmw {
  font-family: var(--font-body);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--navy);
}

.logo-sub-hmw {
  font-size: 0.55rem;
  color: var(--navy);
  letter-spacing: 0.08em;
  font-weight: 500;
  text-transform: uppercase;
  margin-left: 0.4rem;
}

.header__logo--hmw {
  padding-left: 1rem;
  border-left: 1px solid rgba(27, 42, 74, 0.15);
}

.nav-link {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--navy);
  text-decoration: none;
  padding: 0.5rem 1.2rem;
  border-left: 2px solid var(--accent);
  transition: var(--transition);
}

.nav-link:hover {
  color: var(--accent);
}

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

.main {
  padding: 0 3rem;
  max-width: 1400px;
  margin: 0 auto;
}

.hero {
  padding: 2rem 0 3rem;
}

.hero__title {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--navy);
}

.hero__title-line {
  display: block;
  font-size: clamp(2.5rem, 5vw, 4rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.hero__title-line:first-child {
  font-weight: 400;
  opacity: 0.7;
}

/* ─── Magazine Grid ──────────────────────────────────── */

.magazines {
  padding: 2rem 0 4rem;
}

.magazines__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2.5rem;
  perspective: 1200px;
}

/* ─── Magazine Card ──────────────────────────────────── */

.card {
  position: relative;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
}

.card__inner {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.5s ease;
  aspect-ratio: 3 / 4;
  background: var(--navy-deep);
}

.card:hover .card__inner {
  box-shadow: var(--shadow-card-hover);
}

.card__cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease, filter 0.6s ease;
}

.card:hover .card__cover {
  transform: scale(1.03);
}

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

.card__placeholder-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.6;
}

.card__placeholder-text {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.4;
}

/* Card shine effect on hover */
.card__shine {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: radial-gradient(
    circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(255,255,255,0.15) 0%,
    rgba(255,255,255,0) 60%
  );
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: 2;
}

.card:hover .card__shine {
  opacity: 1;
}

/* Card label */
.card__label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2rem 1.5rem 1.5rem;
  background: linear-gradient(to top, rgba(15, 26, 46, 0.95) 0%, rgba(15, 26, 46, 0) 100%);
  z-index: 3;
  transform: translateY(0);
  transition: var(--transition);
}

.card__title {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 0.25rem;
}

.card__subtitle {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 400;
}

/* Hover indicator */
.card__open {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  z-index: 4;
  background: rgba(255, 255, 255, 0.95);
  color: var(--navy);
  padding: 0.75rem 1.5rem;
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  backdrop-filter: blur(10px);
  letter-spacing: 0.03em;
}

.card:hover .card__open {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* No PDF state */
.card--no-pdf {
  cursor: default;
}

.card--no-pdf .card__open {
  display: none;
}

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

.flipbook-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 26, 46, 0.92);
  backdrop-filter: blur(20px);
  display: none;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.4s 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.08);
}

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

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

.flipbook-download {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 100px;
  transition: var(--transition);
}

.flipbook-download:hover {
  background: var(--accent);
  color: var(--white);
}

.flipbook-close {
  background: none;
  border: none;
  color: var(--white);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  opacity: 0.7;
  transition: opacity 0.2s;
  line-height: 1;
}

.flipbook-close:hover { opacity: 1; }

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

.flipbook-viewport {
  display: flex;
  gap: 4px;
  max-height: calc(100vh - 140px);
  justify-content: center;
  align-items: center;
}

.flipbook-canvas {
  max-height: calc(100vh - 140px);
  max-width: 45vw;
  box-shadow: 0 5px 30px rgba(0,0,0,0.4);
  border-radius: 2px;
}

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

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

.flipbook-nav:disabled {
  opacity: 0.2;
  cursor: default;
}

.flipbook-pages {
  text-align: center;
  padding: 0.75rem;
  color: rgba(255,255,255,0.5);
  font-size: 0.85rem;
}

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

.footer {
  padding: 2rem 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(27, 42, 74, 0.08);
}

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

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

.footer__links a:hover { color: var(--navy); }
.footer__links span { color: var(--text-muted); font-size: 0.85rem; }

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

/* ─── Loading State ──────────────────────────────────── */

.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem;
  color: var(--text-muted);
  font-size: 1rem;
}

.loading-spinner::after {
  content: '';
  width: 24px;
  height: 24px;
  border: 2px solid var(--silver);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-left: 0.75rem;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Entry Animations ───────────────────────────────── */

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

.card {
  animation: fadeInUp 0.6s ease forwards;
  opacity: 0;
}

.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.2s; }
.card:nth-child(3) { animation-delay: 0.3s; }
.card:nth-child(4) { animation-delay: 0.4s; }
.card:nth-child(5) { animation-delay: 0.5s; }
.card:nth-child(6) { animation-delay: 0.6s; }
.card:nth-child(7) { animation-delay: 0.7s; }
.card:nth-child(8) { animation-delay: 0.8s; }

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

@media (max-width: 768px) {
  .header { padding: 1rem 1.5rem; flex-wrap: wrap; gap: 1rem; }
  .header__left { gap: 1rem; }
  .header__logo--hmw { display: none; }
  .main { padding: 0 1.5rem; }
  .hero__title-line { font-size: 2.2rem; }
  .magazines__grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1.5rem; }
  .flipbook-canvas { max-width: 85vw; }
  .flipbook-viewport { flex-direction: column; gap: 2px; }
  .flipbook-nav { width: 40px; height: 40px; font-size: 1.5rem; }
  .footer { flex-direction: column; gap: 0.5rem; text-align: center; }
}
