/*
 * Prerender All-Hands Slide System
 * Based on the Málaga Design System ("Clean Machine" aesthetic)
 *
 * Table of contents:
 *   1. Design tokens
 *   2. Reset and base
 *   3. Typography
 *   4. Slide system
 *   5. Hero slide
 *   6. Content components
 *   7. Presentation mode
 */


/* ==========================================================================
   1. DESIGN TOKENS
   ========================================================================== */

:root {
  --color-bg:              #f8fafb;
  --color-bg-alt:          #f1f5f9;
  --color-surface:         #ffffff;
  --color-surface-raised:  #ffffff;
  --color-border:          #e2e8f0;
  --color-border-subtle:   #f0f3f6;

  --color-text:            #0f172a;
  --color-text-secondary:  #475569;
  --color-text-tertiary:   #94a3b8;
  --color-text-inverse:    #f8fafc;

  --color-green-50:        #ecfdf5;
  --color-green-100:       #d1fae5;
  --color-green-200:       #a7f3d0;
  --color-green-300:       #6ee7b7;
  --color-green-400:       #34d399;
  --color-green-500:       #10b981;
  --color-green-600:       #059669;
  --color-green-700:       #047857;
  --color-green-800:       #065f46;
  --color-green-900:       #064e3b;
  --color-green-950:       #022c22;

  --color-accent:          #059669;
  --color-accent-hover:    #047857;
  --color-accent-light:    #ecfdf5;
  --color-accent-pop:      #2563eb;
  --color-accent-pop-light:#eff6ff;

  --color-positive:        #059669;
  --color-caution:         #d97706;
  --color-negative:        #dc2626;
  --color-info:            #2563eb;

  --font-display:          'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-body:             'DM Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono:             'IBM Plex Mono', 'SF Mono', 'Consolas', monospace;

  --text-xs:               0.75rem;
  --text-sm:               0.875rem;
  --text-base:             1rem;
  --text-lg:               1.125rem;
  --text-xl:               1.25rem;
  --text-2xl:              1.5rem;
  --text-3xl:              1.875rem;
  --text-4xl:              2.25rem;
  --text-5xl:              3rem;
  --text-6xl:              3.75rem;
  --text-7xl:              5rem;

  --weight-regular:        400;
  --weight-medium:         500;
  --weight-semibold:       600;
  --weight-bold:           700;
  --weight-extrabold:      800;

  --leading-none:          1;
  --leading-tight:         1.2;
  --leading-snug:          1.35;
  --leading-normal:        1.6;

  --tracking-tight:        -0.02em;
  --tracking-normal:       0;
  --tracking-wide:         0.025em;
  --tracking-wider:        0.05em;
  --tracking-widest:       0.1em;

  --space-0:  0;
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;

  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-xl:  16px;

  --shadow-sm:  0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md:  0 2px 8px rgba(15, 23, 42, 0.06);
  --shadow-lg:  0 4px 16px rgba(15, 23, 42, 0.08);

  --duration-fast:   100ms;
  --duration-normal: 150ms;
  --duration-slow:   300ms;
  --ease-out:        cubic-bezier(0.16, 1, 0.3, 1);
}


/* ==========================================================================
   2. RESET AND BASE
   ========================================================================== */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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


/* ==========================================================================
   3. TYPOGRAPHY
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text);
}

h1 { font-size: var(--text-4xl); font-weight: var(--weight-bold); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); font-weight: var(--weight-medium); }

p {
  margin-block-end: var(--space-4);
  max-width: 65ch;
}

p:last-child { margin-block-end: 0; }

strong { font-weight: var(--weight-semibold); }

.label {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--color-text-tertiary);
}

.mono {
  font-family: var(--font-mono);
  font-feature-settings: 'tnum' 1;
}


/* ==========================================================================
   4. SLIDE SYSTEM
   ========================================================================== */

.slide {
  min-height: 100vh;
  width: 100vw;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) 0;
  position: relative;
}

.slide + .slide {
  border-block-start: 1px solid var(--color-border-subtle);
}

.slide-inner {
  max-width: 1400px;
  width: 90vw;
  margin: 0 auto;
  padding: var(--space-8) var(--space-12);
  text-align: left;
}

.slide-progress {
  position: fixed;
  inset-block-end: var(--space-4);
  inset-inline-end: var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  z-index: 1000;
  display: none;
  user-select: none;
}


/* ==========================================================================
   5. HERO SLIDE
   ========================================================================== */

.hero-slide {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  position: relative;
}

.hero-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

.hero-slide > *:not(.hero-canvas) {
  position: relative;
  z-index: 1;
}

.hero-label {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--color-text-tertiary);
  margin-block-end: var(--space-8);
}

.hero-title {
  font-family: var(--font-display);
  font-size: var(--text-6xl);
  font-weight: var(--weight-extrabold);
  line-height: 1.3;
  letter-spacing: var(--tracking-tight);
  background: linear-gradient(135deg, var(--color-green-600), var(--color-green-400), var(--color-accent-pop));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-block-end: var(--space-6);
  padding-bottom: 0.15em;
}

.hero-subtitle {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  margin-block-end: var(--space-3);
}

.hero-meta {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  color: var(--color-text-tertiary);
}


/* ==========================================================================
   6. CONTENT COMPONENTS
   ========================================================================== */

/* --- Section slide header --- */
.slide-header {
  margin-block-end: var(--space-8);
  padding-block-end: var(--space-4);
  border-block-end: 2px solid var(--color-text);
}

.slide-header .label {
  margin-block-end: var(--space-2);
  display: block;
}

.slide-header h2 {
  margin-block-end: var(--space-2);
}

.slide-header p {
  color: var(--color-text-secondary);
  font-size: var(--text-lg);
}

/* --- Grids --- */
.grid { display: grid; gap: var(--space-6); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
  .grid--3, .grid--4 { grid-template-columns: repeat(2, 1fr); }
}

/* --- Cards --- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.card--accent {
  border-inline-start: 3px solid var(--color-accent);
}

.card--pop {
  border-inline-start: 3px solid var(--color-accent-pop);
}

.card--caution {
  border-inline-start: 3px solid var(--color-caution);
}

.card--negative {
  border-inline-start: 3px solid var(--color-negative);
}

.card__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  margin-block-end: var(--space-2);
}

.card__body {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: var(--leading-normal);
}

.card__body ul {
  padding-inline-start: var(--space-4);
  margin-block-start: var(--space-2);
}

.card__body li {
  margin-block-end: var(--space-1);
}

/* --- KPI --- */
.kpi {
  padding: var(--space-6);
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
}

.kpi__label {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--color-text-tertiary);
  margin-block-end: var(--space-2);
}

.kpi__value {
  font-family: var(--font-mono);
  font-size: var(--text-4xl);
  font-weight: var(--weight-bold);
  line-height: var(--leading-none);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text);
  font-feature-settings: 'tnum' 1;
}

.kpi__context {
  margin-block-start: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.kpi--accent { border-inline-start: 3px solid var(--color-accent); }
.kpi--pop    { border-inline-start: 3px solid var(--color-accent-pop); }

/* Large KPI for hero numbers */
.kpi--lg .kpi__value {
  font-size: var(--text-5xl);
}

/* --- Callout --- */
.callout {
  padding: var(--space-5) var(--space-6);
  border-inline-start: 3px solid var(--color-accent);
  background: var(--color-accent-light);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin-block-start: var(--space-6);
}

.callout p {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  max-width: none;
}

.callout--info {
  border-color: var(--color-info);
  background: var(--color-accent-pop-light);
}

.callout--caution {
  border-color: var(--color-caution);
  background: #fffbeb;
}

/* --- Agenda item --- */
.agenda-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-5);
  padding: var(--space-5) var(--space-6);
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
}

.agenda-num {
  font-family: var(--font-mono);
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  color: var(--color-green-400);
  line-height: var(--leading-none);
  flex-shrink: 0;
}

.agenda-content h3 {
  font-size: var(--text-xl);
  margin-block-end: var(--space-1);
}

.agenda-content p {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

/* --- Numbered item (for Engineering-style lists) --- */
.numbered-items {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.numbered-item {
  display: flex;
  gap: var(--space-5);
  align-items: flex-start;
  padding: var(--space-5) var(--space-6);
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
}

.numbered-item__num {
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--color-green-400);
  flex-shrink: 0;
  min-width: 2ch;
}

.numbered-item__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  margin-block-end: var(--space-1);
}

.numbered-item__desc {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

/* --- Values --- */
.value-card {
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  text-align: center;
}

.value-card__name {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--color-accent);
  margin-block-end: var(--space-2);
}

.value-card__desc {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

/* --- Welcome / bio card --- */
.welcome-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-10);
  align-items: center;
}

.welcome-name {
  font-family: var(--font-display);
  font-size: var(--text-5xl);
  font-weight: var(--weight-extrabold);
  background: linear-gradient(135deg, var(--color-green-600), var(--color-green-400));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-block-end: var(--space-6);
}

.welcome-fact,
.welcome-prerender {
  padding: var(--space-5) var(--space-6);
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  margin-block-end: var(--space-4);
}

.welcome-fact__label,
.welcome-prerender__label {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--color-text-tertiary);
  margin-block-end: var(--space-2);
}

.welcome-fact p,
.welcome-prerender p {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  line-height: var(--leading-normal);
}

/* --- Mistake / story card --- */
.mistake-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
}

.mistake-card__header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-block-end: var(--space-6);
}

.mistake-card__name {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
}

.mistake-card__section {
  margin-block-end: var(--space-5);
}

.mistake-card__section-label {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--color-accent);
  margin-block-end: var(--space-2);
}

.mistake-card__section p {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: var(--leading-normal);
  max-width: none;
}

/* --- Pipeline table (for Sales) --- */
.pipeline-table {
  width: 100%;
  border-collapse: collapse;
}

.pipeline-table th {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--color-text-tertiary);
  text-align: left;
  padding: var(--space-3) var(--space-4);
  border-block-end: 2px solid var(--color-border);
}

.pipeline-table td {
  padding: var(--space-3) var(--space-4);
  border-block-end: 1px solid var(--color-border-subtle);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.pipeline-table .mono {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--color-text);
}

/* --- Misc list --- */
.misc-item {
  padding: var(--space-5) var(--space-6);
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
}

.misc-item + .misc-item {
  margin-block-start: var(--space-3);
}

.misc-item__title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  margin-block-end: var(--space-1);
}

.misc-item__desc {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

/* --- Tags --- */
.tag {
  display: inline-block;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  padding: 2px var(--space-2);
  border-radius: 9999px;
  background: var(--color-accent-light);
  color: var(--color-accent);
}

.tag--pop {
  background: var(--color-accent-pop-light);
  color: var(--color-accent-pop);
}

/* --- Pillar layout (for CS) --- */
.pillars {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: var(--space-8);
  align-items: start;
}

.pillar-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.pillar-list li {
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

/* --- Two-column layout --- */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-8); align-items: start; }
.split--wide-left  { grid-template-columns: 3fr 2fr; }
.split--wide-right { grid-template-columns: 2fr 3fr; }


/* ==========================================================================
   7. PRESENTATION MODE
   ========================================================================== */

html.presentation .slide {
  display: none;
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
}

html.presentation .slide.slide--active {
  display: flex;
}

html.presentation .slide + .slide {
  border: none;
}

html.presentation .slide-progress {
  display: block;
}

html.presentation body {
  overflow: hidden;
}

html.presentation .nav-back-fixed,
html.presentation #export-pdf {
  display: none;
}

/* ==========================================================================
   7a. PDF EXPORT MODE
   ========================================================================== */

html.exporting-pdf .hero-title {
  -webkit-text-fill-color: initial;
  background: none;
  -webkit-background-clip: initial;
  background-clip: initial;
  color: var(--color-green-600);
}

html.exporting-pdf .nav-back-fixed,
html.exporting-pdf #admin-bar {
  display: none;
}

/* ==========================================================================
   7b. BACK LINK & PRESENT TOGGLE
   ========================================================================== */

.nav-back-fixed {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 9999;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  text-decoration: none;
  transition: color var(--duration-normal) var(--ease-in-out);
}

.nav-back-fixed:hover {
  color: var(--color-text-secondary);
}

#admin-bar {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 9999;
  display: flex;
  gap: 6px;
}

.admin-btn {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--color-text-tertiary);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 4px 12px;
  cursor: pointer;
  transition: color var(--duration-normal) var(--ease-in-out),
              border-color var(--duration-normal) var(--ease-in-out);
}

.admin-btn:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
}

.admin-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}


/* ==========================================================================
   8. PRESENTER CONTROL BAR
   ========================================================================== */

#presenter-bar {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9998;
  display: flex;
  align-items: center;
  gap: 0;
  font-family: var(--font-body);
  font-size: 13px;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.1);
  overflow: hidden;
  user-select: none;
  transition: transform 200ms ease, opacity 200ms ease;
}

.pb-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: background 100ms ease, color 100ms ease;
  white-space: nowrap;
}

.pb-btn:hover {
  background: var(--color-bg-alt);
  color: var(--color-text);
}

.pb-counter {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--color-text);
  min-width: 70px;
  justify-content: center;
}

.pb-divider {
  width: 1px;
  height: 24px;
  background: var(--color-border-subtle);
  flex-shrink: 0;
}

#presenter-bar.pb-hidden {
  transform: translateX(-50%) translateY(calc(100% + 20px));
  pointer-events: none;
}

#presenter-restore {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(calc(100% + 20px));
  z-index: 9997;
  width: 12px;
  height: 12px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--color-accent);
  box-shadow: 0 0 6px rgba(5, 150, 105, 0.5);
  cursor: pointer;
  transition: transform 200ms ease, opacity 200ms ease;
  opacity: 0;
  pointer-events: none;
  animation: glow-pulse 2s ease-in-out infinite;
}

@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 6px rgba(5, 150, 105, 0.4); }
  50% { box-shadow: 0 0 14px rgba(5, 150, 105, 0.7); }
}

#presenter-restore.pb-restore--visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

#presenter-restore:hover {
  transform: translateX(-50%) translateY(0) scale(1.4);
  box-shadow: 0 0 16px rgba(5, 150, 105, 0.8);
}

/* Slide dropdown */
#presenter-dropdown {
  position: fixed;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.12);
  padding: 6px 0;
  max-height: 320px;
  overflow-y: auto;
  min-width: 280px;
  font-family: var(--font-body);
}

.pd-item {
  display: block;
  width: 100%;
  padding: 6px 16px;
  background: transparent;
  border: none;
  text-align: left;
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
  color: var(--color-text-secondary);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pd-item:hover {
  background: var(--color-bg-alt);
}

.pd-item--active {
  background: var(--color-bg-alt);
  font-weight: 600;
  color: var(--color-accent);
}
