/* ============================================================
   Design History — Lecture Slide Presentation
   Dark theme · serif typography · fade transitions
   ============================================================ */

/* 0. Custom Properties
   ---------------------------------------------------------- */
:root {
  --color-bg: #000;
  --color-fg: #f0ece4;
  --color-fg-muted: #9a9590;
  --color-accent: #d4a843;
  --color-accent-hover: #e6be5a;
  --color-glass: rgba(18, 18, 18, 0.82);
  --color-glass-border: rgba(255, 255, 255, 0.08);
  --color-glass-hover: rgba(255, 255, 255, 0.06);

  --font-heading: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body: 'IBM Plex Sans', system-ui, sans-serif;
  --font-quote: 'IBM Plex Serif', Georgia, serif;

  --slide-transition: 800ms;
  --content-max-width: 1200px;
  --nav-width: 260px;

  --z-slides: 1;
  --z-nav: 100;
  --z-arrows: 90;
  --z-hamburger: 110;
  --z-overlay: 95;
}


/* 1. Reset / Base
   ---------------------------------------------------------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-fg);
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
}

img { display: block; max-width: 100%; height: auto; }

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color 0.25s ease;
}
a:hover { color: var(--color-accent-hover); }

button {
  font-family: inherit;
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
}

::selection {
  background: var(--color-accent);
  color: var(--color-bg);
}


/* 2. Typography
   ---------------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.15;
}
h1 { font-size: clamp(2.4rem, 5vw, 4rem); }

p, li {
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  line-height: 1.65;
}


/* 3. Deck & Slide Transitions
   ---------------------------------------------------------- */
.deck {
  position: fixed;
  inset: 0;
  z-index: var(--z-slides);
}

.slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--slide-transition) ease,
    visibility var(--slide-transition) ease;
  will-change: opacity;
  padding: 2rem;
}

@media (min-width: 900px) {
  .slide {
    padding-left: calc(var(--nav-width) + 5rem);
    padding-right: 3rem;
  }
}

.slide.is-active {
  opacity: 1;
  visibility: visible;
  z-index: 2;
}

.slide.is-prev {
  opacity: 0;
  visibility: hidden;
  z-index: 1;
}

/* Shared inner content wrapper — JS generates .slide__content */
.slide__content {
  width: 100%;
  max-width: var(--content-max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-height: calc(100vh - 6rem);
  max-height: calc(100dvh - 6rem);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.slide__content::-webkit-scrollbar { width: 4px; }
.slide__content::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
}


/* 4a. Title Slides  (.slide--title)
   ---------------------------------------------------------- */
.slide--title {
  text-align: left;
}

.slide__content--title {
  justify-content: center;
  gap: 0.6rem;
  overflow: visible;
}

.slide__subtitle {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-fg-muted);
}

.slide__title {
  font-size: clamp(2.8rem, 6vw, 5rem);
  font-weight: 400;
  line-height: 1.1;
}

.slide__date {
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  color: var(--color-fg);
  letter-spacing: 0.02em;
  margin-top: 0.2rem;
}


/* 4b. Quote Slides  (.slide--quote)
   ---------------------------------------------------------- */
.slide__content--quote {
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 5rem;
  overflow: visible;
}

.slide__quote-text {
  flex: 1 1 auto;
  max-width: 580px;
}

.slide__quote-text blockquote {
  font-family: var(--font-quote);
  font-size: clamp(1.15rem, 2.2vw, 1.3rem);
  line-height: 1.55;
  font-weight: 300;
  color: var(--color-fg);
  text-indent: -12px;
}

.slide__quote-text cite {
  display: block;
  margin-top: 1.4rem;
  font-family: var(--font-body);
  font-style: normal;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: var(--color-fg-muted);
}

.slide__quote-portrait {
  flex: 0 0 auto;
}

.slide__quote-portrait img {
  width: clamp(180px, 22vw, 320px);
  height: auto;
  object-fit: contain;
}

@media (max-width: 720px) {
  .slide__content--quote {
    flex-direction: column-reverse;
    text-align: center;
    gap: 1.5rem;
  }
  .slide__quote-portrait img {
    width: 200px;
  }
}


/* 4c. Content Slides  (.slide--content)
   ---------------------------------------------------------- */
.slide__content--body {
  gap: 1.5rem;
}

.slide__images {
  display: flex;
  gap: 3rem;
  width: 100%;
  justify-content: flex-start;
  align-items: flex-end;
}

.slide__figure {
 /* flex: 1 1 0; */
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.slide__images img {
  width: 100%;
  height: auto;
  max-height: 50vh;
  object-fit: contain;
  /* Scale up small images to fill their container */
  min-height: 200px;
}

/* Grid helpers */
.images-1 .slide__figure { max-width: 700px; flex: 0 1 auto; }
.images-1 img { max-height: 60vh; }

.images-2 img { max-height: 50vh; }

.images-3 img { max-height: 42vh; }

@media (max-width: 600px) {
  .slide__images {
    flex-direction: column;
    align-items: center;
  }
  .slide__figure { width: 100%; flex: none; }
  .images-2 img, .images-3 img { max-height: 35vh; }
}

.slide__body {
  width: 100%;
  max-width: 920px;
}

.slide__body p {
  font-family: var(--font-quote);
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  line-height: 1.7;
}

.slide__body em { font-style: italic; }

.slide__group-caption {
  font-style: italic;
  font-size: 0.82rem;
  color: var(--color-fg-muted);
  margin-top: -0.8rem;
}

/* Side-by-side layout: image left, text right */
.slide__content--side-by-side {
  flex-direction: row;
  align-items: center;
  gap: 3rem;
}

.slide__side-left {
  flex: 0 0 auto;
  max-width: 45%;
}

.slide__side-left img {
  width: 100%;
  height: auto;
  max-height: 70vh;
  object-fit: contain;
}

.slide__side-right {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1rem;
}

.slide__side-right .slide__body p {
  font-size: clamp(0.95rem, 1.4vw, 1.1rem);
}

@media (max-width: 768px) {
  .slide__content--side-by-side {
    flex-direction: column;
  }
  .slide__side-left {
    max-width: 100%;
  }
}


/* 4d. Image Slides  (.slide--image)
   ---------------------------------------------------------- */
.slide__content--image {
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.slide__figure--full {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.slide__figure--full img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
}


/* 5. Captions
   ---------------------------------------------------------- */
figcaption {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.82rem;
  color: var(--color-fg-muted);
  text-align: left;
  margin-top: 0.5rem;
  line-height: 1.45;
}


/* 6. References
   ---------------------------------------------------------- */
.slide__references {
  margin-top: 0.5rem;
  font-size: 0.82rem;
  font-style: italic;
  color: var(--color-fg-muted);
}

.slide__references a {
  color: var(--color-accent);
}

.slide__references span {
  color: var(--color-fg-muted);
}


/* 7. Navigation Panel (Desktop)
   ---------------------------------------------------------- */
.nav-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--nav-width);
  height: 100vh;
  height: 100dvh;
  z-index: var(--z-nav);
  display: flex;
  flex-direction: column;
  background: var(--color-glass);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  border-right: 1px solid var(--color-glass-border);
}

@media (max-width: 899px) {
  .nav-panel { display: none; }
}

.nav-header {
  padding: 2rem 1.5rem 1.2rem;
  border-bottom: 1px solid var(--color-glass-border);
}

.nav-logo {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--color-fg) !important;
}
.nav-logo:hover { text-decoration: none; }

.nav-week {
  display: block;
  font-size: 0.78rem;
  color: var(--color-fg-muted);
  margin-top: 0.3rem;
}

.nav-sections {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1rem 1rem;
  gap: 0.15rem;
  overflow-y: auto;
}

.nav-sections a {
  display: block;
  padding: 0.55rem 0.8rem;
  font-size: 0.88rem;
  color: var(--color-fg-muted);
  border-radius: 6px;
  transition: all 0.2s ease;
  line-height: 1.35;
}

.nav-sections a:hover {
  color: var(--color-fg);
  background: var(--color-glass-hover);
  text-decoration: none;
}

.nav-sections a.is-active {
  color: var(--color-fg);
  background: rgba(212, 168, 67, 0.1);
  border-left: 2px solid var(--color-accent);
  padding-left: calc(0.8rem - 2px);
}

.nav-footer {
  padding: 1rem 1.5rem 1.5rem;
  border-top: 1px solid var(--color-glass-border);
}

.nav-arrows {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.nav-prev,
.nav-next {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-fg);
  transition: background 0.2s ease;
}

.nav-prev:hover,
.nav-next:hover {
  background: var(--color-glass-hover);
}

.nav-prev[disabled],
.nav-next[disabled] {
  opacity: 0.25;
  pointer-events: none;
}

.nav-counter {
  font-family: var(--font-body);
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
  color: var(--color-fg-muted);
  min-width: 4rem;
  text-align: center;
  user-select: none;
}

.nav-current {
  color: var(--color-fg);
  font-weight: 600;
}

.progress-bar {
  width: 100%;
  height: 2px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 1px;
  margin-top: 0.8rem;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--color-accent);
  border-radius: 1px;
  transition: width 0.4s ease;
}


/* 8. Mobile Navigation
   ---------------------------------------------------------- */

/* Hamburger */
.hamburger {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: var(--z-hamburger);
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--color-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--color-glass-border);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
}

.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--color-fg);
  border-radius: 1px;
  transition: all 0.3s ease;
  transform-origin: center;
}

.hamburger.is-open span:nth-child(1) { transform: rotate(45deg) translate(2.5px, 2.5px); }
.hamburger.is-open span:nth-child(2) { opacity: 0; }
.hamburger.is-open span:nth-child(3) { transform: rotate(-45deg) translate(2.5px, -2.5px); }

@media (max-width: 899px) {
  .hamburger { display: flex; }
}

/* Mobile slide-out menu */
.mobile-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: min(300px, 85vw);
  height: 100vh;
  height: 100dvh;
  z-index: var(--z-nav);
  display: none;
  flex-direction: column;
  background: rgba(10, 10, 10, 0.95);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid var(--color-glass-border);
  transform: translateX(-100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-nav.is-open { transform: translateX(0); }

@media (max-width: 899px) {
  .mobile-nav { display: flex; }
}

.mobile-nav-header {
  padding: 1.8rem 1.5rem 1.2rem;
  border-bottom: 1px solid var(--color-glass-border);
}

.mobile-nav-sections {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  gap: 0.15rem;
}

.mobile-nav-sections a {
  display: block;
  padding: 0.6rem 0.8rem;
  font-size: 0.95rem;
  color: var(--color-fg-muted);
  border-radius: 6px;
  transition: all 0.2s ease;
}

.mobile-nav-sections a:hover,
.mobile-nav-sections a.is-active {
  color: var(--color-fg);
  text-decoration: none;
}

/* Bottom capsule */
.mobile-capsule {
  display: none;
  position: fixed;
  bottom: 1.2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-arrows);
  background: var(--color-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--color-glass-border);
  border-radius: 999px;
  padding: 0.5rem 0.6rem;
  gap: 0.3rem;
  align-items: center;
}

@media (max-width: 899px) {
  .mobile-capsule { display: flex; }
}

.capsule-prev,
.capsule-next {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-fg);
  transition: background 0.2s ease;
}

.capsule-prev:hover,
.capsule-next:hover {
  background: var(--color-glass-hover);
}

.capsule-prev[disabled],
.capsule-next[disabled] {
  opacity: 0.25;
  pointer-events: none;
}

.capsule-counter {
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--color-fg-muted);
  min-width: 3.5rem;
  text-align: center;
  user-select: none;
}


/* 9. Animations
   ---------------------------------------------------------- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.slide.is-active .slide__content > * {
  animation: fadeInUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.slide.is-active .slide__content > *:nth-child(1) { animation-delay: 0.1s; }
.slide.is-active .slide__content > *:nth-child(2) { animation-delay: 0.2s; }
.slide.is-active .slide__content > *:nth-child(3) { animation-delay: 0.3s; }
.slide.is-active .slide__content > *:nth-child(4) { animation-delay: 0.4s; }

.slide.is-active .slide__images .slide__figure {
  animation: fadeIn 0.5s ease both;
}
.slide.is-active .slide__images .slide__figure:nth-child(1) { animation-delay: 0.15s; }
.slide.is-active .slide__images .slide__figure:nth-child(2) { animation-delay: 0.3s; }
.slide.is-active .slide__images .slide__figure:nth-child(3) { animation-delay: 0.45s; }


/* 10. Responsive
   ---------------------------------------------------------- */
@media (min-width: 1400px) {
  :root { --content-max-width: 1280px; }
}

@media (max-width: 899px) {
  .slide {
    padding: 1.5rem 1.5rem 5rem;
  }
  .slide__content {
    max-height: calc(100vh - 8rem);
    max-height: calc(100dvh - 8rem);
  }
  .slide__title { font-size: clamp(2rem, 7vw, 3.5rem); }
}

@media (max-width: 480px) {
  .slide { padding: 1rem 1rem 5rem; }
  .slide__content { gap: 1rem; }
  .slide__images { gap: 0.6rem; }
  .slide__quote-portrait img { width: 140px; }
}

@media (max-height: 600px) {
  .slide__images img { max-height: 35vh; }
  .images-1 img { max-height: 40vh; }
}


/* 11. Accessibility
   ---------------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  :root { --slide-transition: 0ms; }
}
