/**
 * Florent Stroppa - Slide Viewer
 * Shared slide deck viewer used by courses, brand kit, and other deck-style pages.
 *
 * Slides have a FIXED intrinsic size (1600x900) and are scaled uniformly via
 * CSS transform. This guarantees they look identical at every viewport size —
 * only smaller or larger, never reflowed. The scale value is set in JS via
 * the `--slide-scale` custom property on `.slide-container`.
 */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #08090c;
  --bg-slide-top: #0f1014;
  --bg-slide-bottom: #141520;
  --bg-code: #1a1b23;
  --bg-sidebar: rgba(8, 9, 12, 0.98);
  --border: rgba(255, 255, 255, 0.08);
  --text: #f5f5f7;
  --text-dim: rgba(245, 245, 247, 0.72);
  --text-muted: rgba(245, 245, 247, 0.42);
  --accent: #22d3ee;
  --accent-dim: rgba(34, 211, 238, 0.22);
  --success: #4ade80;
  --danger: #e879f9;
  --sidebar-width: 280px;

  /* Intrinsic slide design size. Everything inside slides is authored at this size. */
  --slide-width: 1600px;
  --slide-height: 900px;

  /* Type scale — THE ONLY sizes allowed inside a slide.
     Never set font-size inline in HTML. */
  --s-detail: 26px;   /* captions, metadata, small supporting copy */
  --s-body: 32px;     /* default reading size, list items, swatch labels */
  --s-subhead: 44px;  /* subtitles, h3, large labels, font samples */
  --s-title: 92px;    /* h1, h2, main headlines */
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
}

/* ============ Header ============ */

.viewer-header {
  height: 56px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
  z-index: 100;
}

.viewer-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--text-dim);
  text-decoration: none;
  border-radius: 6px;
  transition: all 0.2s;
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.back-btn svg { width: 20px; height: 20px; }

.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text);
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.sidebar-toggle svg { width: 18px; height: 18px; }

.course-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-left: 4px;
}

.viewer-header-center {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
}

.nav-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.2);
}

.nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.nav-btn svg { width: 18px; height: 18px; }

.progress-bar {
  width: 120px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
}

.viewer-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.slide-counter {
  font-size: 13px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  min-width: 50px;
  text-align: center;
}

/* ============ Main layout ============ */

.viewer-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
  min-height: 0;
}

/* ============ Sidebar ============ */

.sidebar {
  width: var(--sidebar-width);
  min-width: 200px;
  max-width: 400px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s ease;
  z-index: 50;
  position: relative;
  flex-shrink: 0;
}

.sidebar.collapsed { margin-left: calc(-1 * var(--sidebar-width)); }
.sidebar.resizing { transition: none; user-select: none; }

.sidebar-resize-handle {
  position: absolute;
  top: 0;
  right: -4px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 60;
}

.sidebar-resize-handle::after {
  content: '';
  position: absolute;
  top: 0;
  left: 3px;
  width: 2px;
  height: 100%;
  background: transparent;
  transition: background 0.2s;
}

.sidebar-resize-handle:hover::after,
.sidebar.resizing .sidebar-resize-handle::after {
  background: var(--accent);
}

.sidebar-header {
  padding: 16px 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.slide-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.slide-list-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 4px;
}

.slide-list-item:hover { background: rgba(255, 255, 255, 0.05); }
.slide-list-item.active { background: var(--accent-dim); }

.slide-number {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
}

.slide-list-item.active .slide-number {
  background: var(--accent);
  color: #fff;
}

.slide-info { flex: 1; min-width: 0; }

.slide-list-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slide-list-label {
  font-size: 11px;
  color: var(--text-muted);
}

/* ============ Slide container ============
   Acts as the viewport for the scaled slide. The slide is absolutely
   positioned at the center and scaled via a CSS variable set by JS. */

.slide-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  padding: 20px;
  min-width: 0;
  transition: margin-left 0.3s ease;
  --slide-scale: 1;
}

/* ============ Slide ============
   Fixed intrinsic size. Visual size is handled by the scale transform. */

.slide {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--slide-width);
  height: var(--slide-height);
  background:
    radial-gradient(ellipse at 30% 0%, rgba(34, 211, 238, 0.05), transparent 55%),
    linear-gradient(160deg, var(--bg-slide-top) 0%, var(--bg-slide-bottom) 100%);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 88px 110px;
  overflow: hidden;
  transform: translate(-50%, -50%) scale(var(--slide-scale));
  transform-origin: center center;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 0 0 1px rgba(0, 0, 0, 0.5),
    0 60px 120px -30px rgba(0, 0, 0, 0.9),
    0 30px 60px -20px rgba(0, 0, 0, 0.7),
    0 0 200px -40px rgba(34, 211, 238, 0.08);
}

.slide.active {
  display: flex;
  flex-direction: column;
}

/* Editorial giant slide number in the background */
.slide::before {
  content: attr(data-num);
  position: absolute;
  top: -120px;
  right: 20px;
  font-family: 'Space Grotesk', -apple-system, sans-serif;
  font-size: 820px;
  font-weight: 200;
  line-height: 1;
  color: rgba(255, 255, 255, 0.025);
  letter-spacing: -0.08em;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

/* Subtle vignette */
.slide::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.35));
  pointer-events: none;
  z-index: 0;
}

.slide > * {
  position: relative;
  z-index: 1;
}

/* ============ Variant: bright (cyan fill) ============
   Strong saturated background with dark text — for punchy announcements. */

.slide--bright {
  background:
    radial-gradient(ellipse at 20% 100%, rgba(255, 255, 255, 0.28), transparent 55%),
    linear-gradient(135deg, #22d3ee 0%, #0891b2 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.2) inset,
    0 0 0 1px rgba(0, 0, 0, 0.3),
    0 60px 120px -30px rgba(8, 145, 178, 0.7),
    0 30px 60px -20px rgba(0, 0, 0, 0.5);
}

.slide--bright::before { color: rgba(10, 10, 11, 0.06); }
.slide--bright::after {
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.12));
}

.slide--bright .slide-label { color: #0a0a0b; }
.slide--bright .slide-label::before { background: #0a0a0b; }

.slide--bright h1,
.slide--bright h2,
.slide--bright h3 { color: #0a0a0b; }

.slide--bright p { color: rgba(10, 10, 11, 0.74); }
.slide--bright .slide-detail,
.slide--bright p.slide-detail { color: rgba(10, 10, 11, 0.5); }

.slide--bright .slide-branding img {
  filter: brightness(0);
  opacity: 0.55;
}

/* ============ Variant: C64 (the two C64 blues) ============
   Classic Commodore 64 boot screen palette. */

.slide--c64 {
  background:
    radial-gradient(ellipse at 30% 0%, rgba(123, 113, 213, 0.28), transparent 60%),
    linear-gradient(160deg, #40318D 0%, #2a2266 100%);
  box-shadow:
    0 1px 0 rgba(123, 113, 213, 0.15) inset,
    0 0 0 1px rgba(0, 0, 0, 0.6),
    0 60px 120px -30px rgba(0, 0, 0, 0.9),
    0 30px 60px -20px rgba(64, 49, 141, 0.4),
    0 0 200px -40px rgba(123, 113, 213, 0.25);
}

.slide--c64::before { color: rgba(123, 113, 213, 0.12); }

.slide--c64 .slide-label { color: #7B71D5; }
.slide--c64 .slide-label::before { background: #7B71D5; }

.slide--c64 h1,
.slide--c64 h2,
.slide--c64 h3 { color: #f5f5f7; }

.slide--c64 p { color: rgba(245, 245, 247, 0.82); }
.slide--c64 .slide-detail,
.slide--c64 p.slide-detail { color: rgba(123, 113, 213, 0.78); }

.slide--c64 .slide-branding img { opacity: 0.62; }

/* ============ Variant: split (50/50 with image) ============
   Content on the dark left half, full-bleed image on the right half. */

.slide--split.active {
  flex-direction: row;
  padding: 0;
}

.slide--split .slide-body {
  flex: 1;
  padding: 88px 110px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
  z-index: 1;
}

.slide--split .slide-media {
  flex: 1;
  background-size: cover;
  background-position: center;
  position: relative;
  z-index: 1;
}

/* Logo stays at the default bottom-right of the slide, over the image.
   Add a subtle drop shadow so it reads on any photo. */
.slide--split .slide-branding img {
  filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.8));
  opacity: 0.85;
}

/* Keep giant number behind the content side only */
.slide--split::before { right: calc(50% + 20px); }

.slide-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* ============ FS branding ============
   Absolute-positioned brand signature in the bottom-right corner of every slide.
   Aligned with the slide's content padding so it sits on the same grid. */

.slide-branding {
  position: absolute;
  right: 110px;
  bottom: 88px;
  margin: 0;
  z-index: 2;
}

.slide-branding img {
  width: 40px;
  height: 40px;
  opacity: 0.5;
}

/* ============ Slide content ============ */

.slide-header {
  margin-bottom: 36px;
  flex-shrink: 0;
}

/* Fixed type scale — identical across all variants. All sizes come from tokens. */

.slide-label {
  font-family: 'Space Mono', monospace;
  font-size: var(--s-detail);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--accent);
  margin-bottom: 22px;
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.slide-label::before {
  content: '';
  display: inline-block;
  width: 26px;
  height: 1px;
  background: var(--accent);
}

.slide h1,
.slide h2 {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: var(--s-title);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.035em;
  color: var(--text);
}

.slide h3 {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: var(--s-subhead);
  font-weight: 600;
  margin-bottom: 18px;
  letter-spacing: -0.01em;
  color: var(--text);
}

.slide p {
  font-size: var(--s-body);
  line-height: 1.5;
  color: var(--text-dim);
  margin-bottom: 18px;
}

.slide ul,
.slide ol {
  font-size: var(--s-body);
  line-height: 1.5;
  color: var(--text-dim);
  margin-left: 28px;
  margin-bottom: 18px;
}

.slide-detail,
.slide p.slide-detail {
  font-size: var(--s-detail);
  line-height: 1.5;
  color: var(--text-muted);
  margin-top: 4px;
  margin-bottom: 12px;
}

.slide li { margin-bottom: 12px; }
.slide li strong { color: var(--text); }

.slide code {
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg-code);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.85em;
  color: var(--accent);
}

.slide pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 22px 26px;
  overflow: hidden;
  margin: 16px 0;
  flex-shrink: 0;
}

.slide pre code {
  background: none;
  padding: 0;
  font-size: var(--s-detail);
  line-height: 1.5;
  color: var(--text-dim);
  white-space: pre;
}

.slide .highlight { color: var(--accent); }

.slide .two-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  flex: 1;
  min-height: 0;
}

.slide .column {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.slide .center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex: 1;
}


.slide .icon-large {
  width: 96px;
  height: 96px;
  margin-bottom: 28px;
  color: var(--accent);
}

.slide .subtitle {
  font-size: var(--s-subhead);
  color: var(--text-dim);
  margin-top: 16px;
}

/* ============ Fullscreen button ============ */

.fullscreen-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
  margin-left: 12px;
}

.fullscreen-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.2);
}

.fullscreen-btn svg { width: 18px; height: 18px; }

/* ============ Fullscreen mode ============
   Hides the chrome; the slide-container expands to the whole viewport
   and the JS recomputes --slide-scale accordingly. */

body.fullscreen .viewer-header { display: none; }
body.fullscreen .sidebar { display: none; }
body.fullscreen .keyboard-hint { display: none; }
body.fullscreen .slide-container { padding: 0; }

body.fullscreen .slide {
  border-radius: 0;
  border: none;
}

/* ============ Feature grid ============ */

.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-top: 20px;
  flex: 1;
  min-height: 0;
}

.feature-item {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  display: flex;
  flex-direction: column;
}

.feature-item h4 {
  font-size: var(--s-body);
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}

.feature-item p {
  font-size: var(--s-detail);
  margin-bottom: 0;
  line-height: 1.5;
}

/* ============ Comparison table ============ */

.comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px;
  flex: 1;
}

.comparison-col {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 36px;
}

.comparison-col h3 {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.comparison-col.muted h3 { color: var(--text-muted); }

.comparison-col ul {
  margin-left: 28px;
  margin-bottom: 0;
  font-size: var(--s-body);
}

.comparison-col li { margin-bottom: 14px; }

/* ============ Keyboard hint ============ */

.keyboard-hint {
  position: fixed;
  bottom: 20px;
  right: 20px;
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 16px;
}

.keyboard-hint span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.keyboard-hint kbd {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
}

/* ============ Scrollbar ============ */

.slide-list::-webkit-scrollbar { width: 6px; }
.slide-list::-webkit-scrollbar-track { background: transparent; }
.slide-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}
.slide-list::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.3); }

/* ============ Brand Kit helpers ============ */

.color-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  flex: 1;
  min-height: 0;
}

.color-swatch {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 22px;
  border-radius: 12px;
  border: 1px solid var(--border);
  min-height: 160px;
  position: relative;
  overflow: hidden;
}

.color-swatch .swatch-name {
  font-size: var(--s-body);
  font-weight: 600;
  margin-bottom: 4px;
}

.color-swatch .swatch-hex {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--s-detail);
  opacity: 0.78;
}

.font-row {
  padding: 22px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 32px;
}

.font-row:last-child { border-bottom: none; }

.font-row .font-sample {
  font-size: var(--s-subhead);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.font-row .font-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--s-detail);
  color: var(--text-muted);
  text-align: right;
  flex-shrink: 0;
}

.principle-list {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Two-column variant for dense lists (6+ items on a full-width slide) */
.principle-list.principle-list--grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 24px;
  align-content: start;
}

.principle-row {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 20px 24px;
  background: var(--bg-code);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.principle-row .mark {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--s-detail);
  font-weight: 700;
  margin-top: 2px;
}

.principle-row.yes .mark { background: rgba(74, 222, 128, 0.18); color: var(--success); }
.principle-row.no  .mark { background: rgba(232, 121, 249, 0.18); color: var(--danger); }

.principle-row .principle-text {
  font-size: var(--s-detail);
  color: var(--text-dim);
  line-height: 1.45;
}

.principle-row .principle-text strong { color: var(--text); }

/* ============ Iconography ============
   Lucide-style icons: 2px stroke, round caps, currentColor, no fill.
   Slides can use `.icon-grid` for a tiled showcase. */

.slide svg.icon {
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
  flex-shrink: 0;
}

.slide svg.icon--sm { width: 32px;  height: 32px; }
.slide svg.icon--md { width: 48px;  height: 48px; }
.slide svg.icon--lg { width: 72px;  height: 72px; }
.slide svg.icon--xl { width: 112px; height: 112px; }

.icon-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.icon-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
}

.icon-tile svg.icon {
  color: var(--text);
  opacity: 0.92;
}

.icon-tile .icon-name {
  font-family: 'Space Mono', monospace;
  font-size: var(--s-detail);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

/* ============ Mobile sidebar only ============
   Slide interior is NOT responsive — it scales uniformly. Only the sidebar
   needs a mobile-specific behavior (it becomes an overlay). */

@media (max-width: 768px) {
  .sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 50;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
    width: 280px !important;
  }

  .sidebar.collapsed { margin-left: -280px; }
  .sidebar-resize-handle { display: none; }
  .course-title { display: none; }
  .progress-bar { display: none; }
  .keyboard-hint { display: none; }
}
