@import url("https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap");

body {
  background-color: #f2f2f2;
  color: #222;
  /* Pixel font (Minecraft-style) */
  font-family: "Press Start 2P", monospace;
  font-size: 13px;
  margin: 40px;
  line-height: 1.4;
  letter-spacing: 0.02em;
}

h1,
h2,
h3 {
  color: var(--accent);
  margin-bottom: 10px;
}

/* Header box */
.page-header {
  max-width: 960px;
  margin: 0 auto 24px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.95),
    rgba(250, 250, 250, 0.9)
  );
  padding: 20px 24px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 6px 20px rgba(2, 6, 23, 0.08);
  position: relative;
  overflow: hidden;
}

.page-header::before {
  /* subtle left accent bar */
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  background: var(--accent);
}

.page-header h1 {
  margin: 0 0 8px 0;
  font-size: 20px;
  letter-spacing: 0;
  font-weight: 700;
}

.page-header h4 {
  margin: 6px 0 10px 0;
  font-weight: 500;
  color: rgba(0, 0, 0, 0.65);
}

.page-header h2 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--accent);
  margin-top: 6px;
}

.page-header .subtitle-pill {
  display: inline-block;
  background: rgba(0, 0, 0, 0.06);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.9rem;
}

/* dark mode adjustments for header */
body[data-theme="dark"] .page-header {
  background: linear-gradient(
    180deg,
    rgba(36, 36, 36, 0.95),
    rgba(32, 32, 32, 0.9)
  );
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}
body[data-theme="dark"] .page-header h4 {
  color: rgba(255, 255, 255, 0.85);
}

/* Flex für Text + Bild */
.section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
  padding: 20px 24px;
  border-radius: 10px;
  /* limit width on very wide screens and center */
  max-width: 960px;
  margin: 0 auto 20px;
  min-height: 160px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.section .text {
  flex: 1;
}

.media-container {
  display: flex;
  gap: 20px;
  /* make media column a fixed, moderate width so text doesn't stretch */
  flex: 0 0 240px;
  align-items: center;
}

.preview-wrapper {
  position: relative;
  cursor: pointer;
}

.video-preview,
.image-preview {
  width: 200px;
  height: 120px;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 18px 0 18px 34px;
  border-color: transparent transparent transparent rgba(255, 255, 255, 0.8);
  pointer-events: none;
}

footer {
  text-align: center;
  margin-top: 40px;
  font-size: 0.9em;
  color: var(--text);
}

/* Theme toggle button fixed bottom-right */
#theme-toggle {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  z-index: 1100;
  border: none;
}

#theme-toggle svg {
  width: 22px;
  height: 22px;
  display: block;
}

/* Theme variables - default (light) */
:root {
  --bg: #f2f2f2;
  --panel: #ffffff;
  --text: #222222;
  --accent: #005a8d;
}

body[data-theme="dark"] {
  --bg: #1e1e1e;
  --panel: #2a2a2a;
  --text: #f0f0f0;
  --accent: #00b4ff;
}

/* ensure toggle contrasts in dark */
body[data-theme="dark"] #theme-toggle {
  background: rgba(30, 30, 30, 0.95);
}

/* Apply variables */
body {
  background-color: var(--bg);
  color: var(--text);
}

/* When a theme is explicitly set, force colors using the variables (higher specificity) */
body[data-theme="dark"],
body[data-theme="light"] {
  background-color: var(--bg) !important;
  color: var(--text) !important;
}

body[data-theme="dark"] h1,
body[data-theme="light"] h1,
body[data-theme="dark"] h2,
body[data-theme="light"] h2,
body[data-theme="dark"] h3,
body[data-theme="light"] h3 {
  color: var(--accent) !important;
}

/* smooth transition when switching theme */
body,
.section {
  transition: background-color 180ms ease, color 180ms ease;
}

.section {
  background: var(--panel);
}

/* Overlay */
#video-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

#video-overlay video {
  max-width: 90%;
  max-height: 80%;
  border-radius: 10px;
}

#close-overlay {
  position: absolute;
  top: 20px;
  right: 40px;
  font-size: 2rem;
  color: white;
  cursor: pointer;
}

/* Dark Mode (only apply when the user HAS NOT chosen a theme manually) */
@media (prefers-color-scheme: dark) {
  body:not([data-theme]) {
    background-color: #1e1e1e;
    color: #f0f0f0;
  }
  body:not([data-theme]) h1,
  body:not([data-theme]) h2,
  body:not([data-theme]) h3 {
    color: #00b4ff;
  }
  body:not([data-theme]) strong {
    color: #ff5555;
  }
  body:not([data-theme]) .section {
    background-color: #2a2a2a;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  }
  body:not([data-theme]) footer {
    color: #aaa;
  }
}

/* Responsive: stack sections on narrow screens */
@media (max-width: 720px) {
  body {
    margin: 16px;
  }
  .section {
    flex-direction: column;
    gap: 12px;
    max-width: 100%;
    min-height: auto;
  }
  .media-container {
    justify-content: flex-start;
    flex: none;
    width: 100%;
  }
}
