/*
  Copyright (C) 2025, 2026 MauriceLambert

  This file is part of PySlideGenerator.

  PySlideGenerator is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  PySlideGenerator is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with PySlideGenerator.  If not, see <https://www.gnu.org/licenses/>.
*/

:root {
  --bg-color-dark: #0d0d0d;
  --text-color-dark: #00ff00;
  --bg-color-light: #ffffff;
  --text-color-light: #003300;

  --transition-speed: 0.5s;
  --font-family: 'Courier New', Courier, monospace;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  height: 100%;
}

body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font-family);
  line-height: 1.6;
  background-color: var(--bg-color-dark);
  color: var(--text-color-dark);
  scrollbar-width: none;
  -ms-overflow-style: none;
  --text-color: var(--text-color-dark);
  --bg-color: var(--bg-color-dark);

  --text-dim: color-mix(in srgb, var(--text-color, #00ff00) 60%, var(--bg-color, #0d0d0d));
  --text-muted: color-mix(in srgb, var(--text-color, #00ff00) 45%, var(--bg-color, #0d0d0d));
  --text-faint: color-mix(in oklab, var(--text-color, #00ff00) 35%, var(--bg-color, #0d0d0d));

  --accent: color-mix(in srgb, var(--text-color, #00ff00) 60%, cyan);
  --accent: color-mix(in oklab, var(--text-color, #00ff00) 70%, cyan);
  --border-subtle: color-mix(in srgb, var(--text-color, #00ff00) 20%, var(--bg-color, #0d0d0d));
  --bg-alt: color-mix(in srgb, var(--bg-color, #0d0d0d) 85%, black);
}

body *::selection {
  background-color: var(--text-color-dark);
  color: var(--bg-color-dark);
}

body::-webkit-scrollbar {
  display: none;
}

body.light {
  background-color: var(--bg-color-light);
  color: var(--text-color-light);
  --text-color: var(--text-color-light);
  --bg-color: var(--bg-color-light);

  --text-dim: color-mix(in srgb, var(--text-color, #003300) 60%, var(--bg-color, #ffffff));
  --text-muted: color-mix(in srgb, var(--text-color, #003300) 45%, var(--bg-color, #ffffff));
  --text-faint: color-mix(in oklab, var(--text-color, #003300) 60%, var(--bg-color, #ffffff));

  --accent: color-mix(in srgb, var(--text-color, #003300) 60%, cyan);
  --accent: color-mix(in oklab, var(--text-color, #003300) 70%, cyan);
  --border-subtle: color-mix(in srgb, var(--text-color, #003300) 20%, var(--bg-color));
  --bg-alt: color-mix(in srgb, var(--bg-color, #ffffff) 85%, black);
}

body.light *::selection {
  background-color: var(--text-color-light);
  color: var(--bg-color-light);
}

main {
  height: 100vh;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

main::-webkit-scrollbar {
  display: none;
}

section {
  position: relative;
  height: 100vh;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4rem 2rem 2rem;
  box-sizing: border-box;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

section::-webkit-scrollbar {
  display: none;
}

section.title-slide,
section.subtitle-slide {
  justify-content: center;
  text-align: center;
}

section.title-slide h1,
section.subtitle-slide h2 {
  max-width: 90vw;
  word-break: break-word;
  line-height: 1.2;
  margin: 0;
}

section header {
  position: absolute;
  top: 1rem;
  left: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  width: auto;
  box-sizing: border-box;
}

section header img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 50%;
  flex-shrink: 0;
}

section header h3 {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 3rem);
  line-height: 1;
  text-align: left;
}

section.content-slide article {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
  width: 100%;
  max-width: 1200px;
  padding: 1rem;
  box-sizing: border-box;
  margin-top: 6rem;
}

section.content-slide article .text {
  flex: 1;
  min-width: 300px;
}

section.content-slide article img {
  flex: 1;
  max-width: min(70vw, 50%);
  max-height: min(70vh, var(--max-article-size, 175px));
  object-fit: contain;
}

section nav {
  max-width: 90vw;
  max-height: 100%;
  width: 100%;
  text-align: center;
}

h1 {
  font-size: clamp(2.5rem, 8vw, 6rem);
  margin: 0.5em 0;
  text-align: center;
}

h2 {
  font-size: clamp(2rem, 6vw, 4rem);
  margin: 0.5em 0;
  text-align: center;
}

h3 {
  font-size: clamp(1.5rem, 4vw, 3rem);
  margin: 0.5em 0;
  text-align: center;
}

aside {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  font-size: 0.9rem;
  opacity: 0.6;
  max-width: 300px;
}

p, li {
  font-size: clamp(1rem, 2vw, 1.5rem);
}

ul, ol {
  max-width: 600px;
  margin: 1rem auto;
  padding-left: 1.5rem;
  text-align: left;
}

a {
  color: inherit;
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
  margin-top: 1rem;
}

nav ul {
  list-style: none;
  padding: 0;
  margin: 0 auto;
  max-width: 600px;
}

nav ul li {
  margin: 0.5rem 0;
}

nav ul li ul {
  margin-left: 1.5rem;
}

.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: none;
  border: 2px solid currentColor;
  color: inherit;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-family: inherit;
}

@keyframes flicker {
  0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
    opacity: 1;
  }
  20%, 24%, 55% {
    opacity: 0.4;
  }
}

h1, h2, h3 {
  animation: flicker 3s infinite;
}

@media (max-width: 600px) {
  .theme-toggle {
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.3rem 0.6rem;
    font-size: 0.9rem;
  }
}

@media (max-width: 900px) {
  section.content-slide article {
    flex-direction: column;
    text-align: center;
  }

  section.content-slide article .text,
  section.content-slide article img {
    width: 100%;
    max-width: 100%;
  }

  section.content-slide article img {
    max-height: 50vh;
  }
}

#terminal-overlay {
  text-align: left;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--bg-color-dark);
  font-size: 0.8rem;
  padding: 2rem;
  box-sizing: border-box;
  z-index: 9999;
  overflow-y: hidden;
  display: none;
  white-space: pre-wrap;
}

#terminal-overlay.light {
  background-color: var(--bg-color-light);
}

#timeline-container {
  font-family: "Courier New", monospace;
  white-space: pre-wrap;
  overflow: hidden;
  font-size: 1.2rem;
  min-height: 200px;
  margin-bottom: 1rem;
  animation: flickerText 0.2s infinite alternate;
}

@keyframes flickerText {
  0% { opacity: 1; }
  100% { opacity: 0.95; }
}

#timeline-progress {
  font-family: "Courier New", monospace;
  /* border: 1px solid #00ff00; */
  padding: 4px 8px;
  font-size: 1rem;
  position: absolute;
  bottom: 20px;
  /* left: 50%;
  transform: translateX(-50%);
  width: 90%; */
  left: 0;
  transform: none;
  width: 100%;
  text-align: left;
  box-sizing: border-box;
  height: auto;
  white-space: pre;
}

.theme-toggle {
  transition: opacity 0.3s ease;
}

.theme-toggle[style*="display: none"] {
  opacity: 0;
  pointer-events: none;

}

#bios-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
.bios-box {
  width: 560px; border: 2px solid var(--text-color, #00ff00);
  background: var(--bg-color, #0d0d0d); color: var(--text-color, #00ff00);
  font-family: 'Courier New', monospace; font-size: 13px;
}
.bios-title-bar {
  background: var(--text-color, #00ff00); color: var(--bg-color, #0d0d0d);
  text-align: center; padding: 3px; font-weight: bold; letter-spacing: 2px;
}
.bios-body { padding: 14px 18px; }
.bios-subtitle { color: var(--text-dim); font-size: 11px; margin-bottom: 12px; }
.bios-section-label { color: var(--accent); font-size: 11px; margin: 10px 0 5px; letter-spacing: 1px; }
.bios-row {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 8px; cursor: pointer; border: 1px solid transparent;
}
.bios-row.focused { border-color: var(--text-color, #00ff00); background: color-mix(in srgb, var(--text-color) 10%, transparent); }
.bios-arrow { width: 12px; visibility: hidden; }
.bios-name { flex: 1; }
.swatch { width: 12px; height: 12px; border: 1px solid #333; display: inline-block; }
.bios-swatches { display: flex; gap: 3px; }
.bios-sep { border: none; border-top: 1px dashed var(--border-subtle); margin: 10px 0; }
.bios-mode-row { display: flex; border: 1px solid var(--text-color, #00ff00); width: fit-content; margin-top: 6px; }
.bios-mode-btn {
  padding: 3px 16px; background: transparent;
  border: none; border-right: 1px solid var(--text-color, #00ff00);
  color: var(--text-muted); font-family: 'Courier New', monospace; font-size: 12px; cursor: pointer;
}
.bios-mode-btn:last-child { border-right: none; }
.bios-mode-btn.selected { background: var(--text-color, #00ff00); color: var(--bg-color, #0d0d0d); font-weight: bold; }
.bios-live-bar {
  background: var(--bg-alt); border-top: 1px solid #1a1a1a;
  padding: 6px 18px; font-size: 11px; color: var(--text-faint);
}
.bios-dot {
  display: inline-block; width: 6px; height: 6px;
  border-radius: 50%; background: var(--text-color, #00ff00);
  margin-right: 6px; animation: biosblnk 1s step-end infinite;
}
@keyframes biosblnk { 50% { opacity: 0; } }
.bios-footer {
  border-top: 1px solid #1a1a1a; padding: 8px 18px;
  display: flex; gap: 20px; color: var(--text-muted); font-size: 11px;
}
.bios-footer kbd { color: var(--accent); }

#code-popup-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.82);
  z-index: 10000;
  display: flex; align-items: center; justify-content: center;
}
#code-popup-box {
  width: min(860px, 92vw);
  max-height: 80vh;
  display: flex; flex-direction: column;
  border: 2px solid var(--text-color, #00ff00);
  background: var(--bg-color, #0d0d0d);
  font-family: 'Courier New', monospace;
}
#code-popup-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 14px;
  background: var(--text-color, #00ff00);
  color: var(--bg-color, #0d0d0d);
  font-size: 12px; font-weight: bold; letter-spacing: 1px;
}
#code-popup-header button {
  background: transparent; border: none;
  color: var(--bg-color, #0d0d0d); font-size: 16px; cursor: pointer; font-weight: bold;
}
#code-popup-pre {
  overflow: auto; margin: 0;
  padding: 20px;
  color: var(--text-color, #00ff00);
  font-size: 13px; line-height: 1.6;
  flex: 1;
}
.code-popup-btn {
  position: absolute; bottom: 14px; right: 14px;
  background: transparent;
  border: 1px solid var(--text-color, #00ff00);
  color: var(--text-color, #00ff00);
  font-family: 'Courier New', monospace;
  font-size: 12px; padding: 4px 10px;
  cursor: pointer; z-index: 100;
}
.code-popup-btn:hover { background: rgba(0,255,0,0.08); }
article.image-left { flex-direction: row-reverse; }
article.image-only {
  display: flex; align-items: center; justify-content: center;
  height: 100%;
}
section.content-slide article.image-only img { max-width: 100%; max-height: 70vh; object-fit: contain; }

.image-zoom-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  cursor: zoom-out;
  animation: fadeIn 0.2s ease;
}

.image-zoom-overlay img {
  max-width: 95vw;
  max-height: 95vh;
  object-fit: contain;
  transition: transform 0.2s ease;
  transform: scale(0.95);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
