/* Stegi's Welt – Video-Portal */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Outfit:wght@500;600;700&display=swap');

/* ── Tokens ─────────────────────────────────────────────────────── */
:root {
  --bg: #0f0f12;
  --bg-elevated: #18181f;
  --surface: #1e1e28;
  --surface-hover: #26263300;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.13);
  --text: #f4f4f5;
  --text-muted: #a1a1aa;
  --accent: #7c6cf0;
  --accent-soft: rgba(124, 108, 240, 0.18);
  --accent-glow: #b3a6ff;
  --progress: #34d399;
  --focus-ring: #b3a6ff;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
  --shadow-focus: 0 0 0 3px var(--accent), 0 0 28px rgba(124, 108, 240, 0.45);
  --radius: 16px;
  --radius-sm: 10px;
  --card-min: 270px;
  --header-padding: 2.75rem;
  --grid-gap: 1.25rem;
  --font-title-scale: 3.5rem;
}

/* ── Reset ──────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 18px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'DM Sans', system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

/* ── Aurora background ──────────────────────────────────────────── */
@keyframes orb1 {
  0%   { transform: translate(0,     0)     scale(1);    }
  25%  { transform: translate(10vw,  8vh)   scale(1.12); }
  50%  { transform: translate(4vw,   18vh)  scale(0.93); }
  75%  { transform: translate(-8vw,  10vh)  scale(1.07); }
  100% { transform: translate(0,     0)     scale(1);    }
}

@keyframes orb2 {
  0%   { transform: translate(0,     0)     scale(1);    }
  30%  { transform: translate(-12vw, 6vh)   scale(1.08); }
  60%  { transform: translate(-6vw,  -8vh)  scale(0.9);  }
  80%  { transform: translate(10vw,  -4vh)  scale(1.05); }
  100% { transform: translate(0,     0)     scale(1);    }
}

@keyframes orb3 {
  0%   { transform: translate(0,     0)     scale(1);    }
  20%  { transform: translate(6vw,   -10vh) scale(0.95); }
  55%  { transform: translate(-4vw,  -6vh)  scale(1.1);  }
  75%  { transform: translate(8vw,   5vh)   scale(0.92); }
  100% { transform: translate(0,     0)     scale(1);    }
}

.aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.aurora__orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  will-change: transform;
}

.aurora__orb--1 {
  width: 80vw;
  height: 80vw;
  top: -25vw;
  left: 10vw;
  background: radial-gradient(circle at 40% 40%, rgba(124, 108, 240, 0.28) 0%, transparent 65%);
  animation: orb1 20s ease-in-out infinite;
}

.aurora__orb--2 {
  width: 65vw;
  height: 65vw;
  top: 20vh;
  right: -10vw;
  background: radial-gradient(circle at 60% 50%, rgba(232, 100, 220, 0.2) 0%, transparent 60%);
  animation: orb2 27s ease-in-out infinite;
}

.aurora__orb--3 {
  width: 55vw;
  height: 55vw;
  bottom: -10vw;
  left: -5vw;
  background: radial-gradient(circle at 45% 55%, rgba(80, 120, 255, 0.18) 0%, transparent 60%);
  animation: orb3 34s ease-in-out infinite;
}

/* ── Header ─────────────────────────────────────────────────────── */
.site-header {
  text-align: center;
  padding: var(--header-padding) 1.5rem 1.75rem;
}

@keyframes title-bounce-in {
  0%   { opacity: 0; transform: translateY(-32px) scale(0.88); }
  55%  { opacity: 1; transform: translateY(8px)  scale(1.03); }
  75%  { transform: translateY(-5px) scale(0.98); }
  90%  { transform: translateY(3px)  scale(1.01); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes title-shimmer {
  0%   { background-position: 200% center; }
  35%  { background-position: -30% center; }
  100% { background-position: -30% center; }
}

.site-title {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: clamp(2.25rem, 5vw, var(--font-title-scale));
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.035em;
  background: linear-gradient(135deg, #ffffff 0%, #c4b5fd 40%, #f0abfc 75%, #fda4c8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  background-size: 220% auto;
  opacity: 0;
  animation:
    title-bounce-in 0.75s cubic-bezier(0.22, 0.68, 0, 1.2) 0.15s forwards,
    title-shimmer   6s   linear                              2.5s infinite;
}

@keyframes subtitle-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.site-subtitle {
  font-size: clamp(0.9rem, 1.8vw, 1.1rem);
  color: var(--text-muted);
  margin: 0.5rem 0 0;
  font-weight: 400;
  letter-spacing: 0.04em;
  opacity: 0;
  animation: subtitle-in 0.55s ease 1.1s forwards;
}

/* ── Main ───────────────────────────────────────────────────────── */
.portal-main {
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 1.25rem 6rem;
}

.state-message {
  text-align: center;
  padding: 3rem 1rem;
  font-size: 1.05rem;
  color: var(--text-muted);
}

.state-message.hidden,
.hidden {
  display: none !important;
}

/* ── Grid ───────────────────────────────────────────────────────── */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--card-min)), 1fr));
  gap: var(--grid-gap);
}

/* ── Skeleton loader ────────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -400% 0; }
  100% { background-position:  400% 0; }
}

.skeleton-card {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
}

.skeleton-thumb {
  aspect-ratio: 16 / 9;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 25%,
    rgba(255, 255, 255, 0.10) 50%,
    rgba(255, 255, 255, 0.04) 75%
  );
  background-size: 400% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
}

.skeleton-body {
  padding: 1.15rem 1.25rem 1.3rem;
}

.skeleton-line {
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 25%,
    rgba(255, 255, 255, 0.12) 50%,
    rgba(255, 255, 255, 0.05) 75%
  );
  background-size: 400% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
}

.skeleton-line--title {
  height: 1.15rem;
  width: 75%;
  margin-bottom: 0.65rem;
  animation-delay: 0.1s;
}

.skeleton-line--desc {
  height: 0.85rem;
  width: 55%;
  animation-delay: 0.2s;
}

/* ── Card ───────────────────────────────────────────────────────── */
@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.video-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
  padding: 0;
  box-shadow: var(--shadow);
  transition: transform 0.22s ease, border-color 0.22s, box-shadow 0.22s;
  opacity: 0;
  animation: card-in 0.4s ease forwards;
}

.video-card:hover,
.video-card:focus-visible {
  transform: translateY(-7px) scale(1.015);
  border-color: rgba(124, 108, 240, 0.6);
  box-shadow: var(--shadow-focus);
  outline: none;
}

.video-card__thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: linear-gradient(145deg, #17172200 0%, #2a2a3a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.video-card__thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 45%, rgba(0, 0, 0, 0.6) 100%);
  pointer-events: none;
}

.video-card__play {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.93);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.4);
  z-index: 2;
  transition: transform 0.2s ease, box-shadow 0.2s;
}

.video-card:hover .video-card__play,
.video-card:focus-visible .video-card__play {
  transform: scale(1.12);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.video-card__play::after {
  content: '';
  margin-left: 0.2rem;
  border: 10px solid transparent;
  border-left: 16px solid var(--bg);
}

.video-card__year {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  letter-spacing: 0.04em;
}

/* Progress bar */
.video-card__progress-wrap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  height: 3px;
  background: rgba(255, 255, 255, 0.12);
}

.video-card__progress-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--progress), #a7f3d0);
  transition: width 0.3s ease;
}

.video-card__progress-label {
  position: absolute;
  bottom: 10px;
  left: 10px;
  z-index: 3;
  font-size: 0.68rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 0.15rem 0.45rem;
  border-radius: 5px;
}

.video-card.has-progress .video-card__thumb::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  border: 2px solid rgba(52, 211, 153, 0.3);
  pointer-events: none;
}

/* Card body */
.video-card__body {
  padding: 1.1rem 1.25rem 1.25rem;
  flex: 1;
}

.video-card__title {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 0.3rem;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.video-card__desc {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Footer ─────────────────────────────────────────────────────── */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.25rem;
  padding: 2rem 1.5rem;
  border-top: 1px solid var(--border);
}

.footer-link {
  background: none;
  border: none;
  color: var(--accent-glow);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: background 0.2s, color 0.2s;
}

.footer-link--muted {
  color: var(--text-muted);
}

.footer-link:hover,
.footer-link:focus-visible {
  color: var(--text);
  background: var(--accent-soft);
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
  font: inherit;
  font-weight: 600;
  font-size: 1rem;
  padding: 0.85rem 1.35rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  min-height: 48px;
  transition: transform 0.15s, background 0.2s, box-shadow 0.2s;
}

.btn--primary {
  background: linear-gradient(135deg, #7c6cf0 0%, #5b4cdb 100%);
  color: #fff;
  box-shadow: 0 4px 18px rgba(124, 108, 240, 0.35);
}

.btn--primary:hover,
.btn--primary:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 6px 26px rgba(124, 108, 240, 0.5);
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.btn--ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid var(--border-strong);
}

.btn--ghost:hover,
.btn--ghost:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.btn--subtle {
  color: var(--text-muted);
  border-color: transparent;
  background: transparent;
}

/* ── Resume dialog ──────────────────────────────────────────────── */
.resume-dialog {
  position: fixed;
  inset: 0;
  z-index: 90;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.resume-dialog:not(.hidden) {
  display: flex;
}

.resume-dialog__panel {
  width: 100%;
  max-width: 420px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow-lg);
}

.resume-dialog__heading {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 1.3rem;
  font-weight: 600;
  margin: 0 0 0.45rem;
  letter-spacing: -0.02em;
}

.resume-dialog__text {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.resume-dialog__bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.resume-dialog__bar-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--progress), var(--accent));
  border-radius: 999px;
  transition: width 0.4s ease;
}

.resume-dialog__actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

/* ── Player ─────────────────────────────────────────────────────── */
.player-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  flex-direction: column;
}

.player-overlay:not(.hidden) {
  display: flex;
}

.player-close {
  position: absolute;
  top: max(1rem, env(safe-area-inset-top));
  left: max(1rem, env(safe-area-inset-left));
  z-index: 110;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(15, 15, 18, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.15rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 48px;
  transition: background 0.2s;
}

.player-close__icon {
  width: 1.1em;
  height: 1.1em;
  flex-shrink: 0;
}

.player-close:hover,
.player-close:focus-visible {
  background: rgba(40, 40, 55, 0.9);
  outline: 2px solid var(--focus-ring);
}

.player-meta {
  position: absolute;
  top: max(4.5rem, calc(env(safe-area-inset-top) + 3.5rem));
  left: 0;
  right: 0;
  z-index: 105;
  padding: 0 1.5rem;
  text-align: center;
  pointer-events: none;
  text-shadow: 0 2px 14px #000;
}

.player-meta h2 {
  margin: 0;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
}

.player-meta p {
  margin: 0.2rem 0 0;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.88rem;
}

/* Buffering spinner */
.player-spinner {
  position: absolute;
  inset: 0;
  z-index: 108;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.player-spinner:not(.hidden) {
  display: flex;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.player-spinner__ring {
  width: 3.5rem;
  height: 3.5rem;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

.player-video {
  flex: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* ── Admin shared ───────────────────────────────────────────────── */
body.admin-body {
  background: var(--bg);
}

/* ── TV / large screen ──────────────────────────────────────────── */
@media (min-width: 1600px) {
  :root {
    --card-min: 370px;
    --grid-gap: 1.75rem;
    --font-title-scale: 4.25rem;
    --header-padding: 3.5rem;
  }

  .portal-main {
    padding-left: 2.5rem;
    padding-right: 2.5rem;
  }

  .site-subtitle {
    font-size: 1.2rem;
  }

  .video-card__title {
    font-size: 1.25rem;
  }

  .video-card__play {
    width: 4.25rem;
    height: 4.25rem;
  }

  .video-card__play::after {
    border: 13px solid transparent;
    border-left: 20px solid var(--bg);
  }

  .player-close {
    font-size: 1.2rem;
    padding: 0.85rem 1.5rem;
    min-height: 56px;
  }

  .player-close__icon {
    width: 1.3em;
    height: 1.3em;
  }

  .player-spinner__ring {
    width: 5rem;
    height: 5rem;
    border-width: 4px;
  }

  .player-meta h2 {
    font-size: 1.5rem;
  }
}

/* ── Touch devices ──────────────────────────────────────────────── */
@media (pointer: coarse) {
  .video-card__play {
    width: 4rem;
    height: 4rem;
  }
}

/* ── Tablet ─────────────────────────────────────────────────────── */
@media (min-width: 900px) {
  :root {
    --card-min: 290px;
  }

  .resume-dialog__actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .resume-dialog__actions .btn--primary {
    flex: 1;
    min-width: 140px;
  }
}

/* ── Reduced motion ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .aurora {
    display: none;
  }

  /* Titel und Untertitel sofort sichtbar */
  .site-title,
  .site-subtitle {
    opacity: 1 !important;
    animation: none !important;
  }
}
