/* ==========================================================================
   ANIMAL HELPERS - BASE STYLES & FOUNDATION
   Stage: 1920x1080 Fixed Canvas Scaled to Viewport
   Palette: Forest Green, Deep Woodland, Warm Cream, Sage, Honey Gold, Terracotta, Muted Brown, Soft Sky
   ========================================================================== */

:root {
  /* Core Palette */
  --color-forest-green: #203D32;
  --color-deep-woodland: #152B25;
  --color-warm-cream: #F5EBD5;
  --color-sage: #A9C3A0;
  --color-honey-gold: #EBC56D;
  --color-terracotta: #C87952;
  --color-muted-brown: #82684E;
  --color-soft-sky: #BDD9D5;

  /* Derived Surface & Tint Variables */
  --color-text-light: #F5EBD5;
  --color-text-dark: #1A3027;
  --color-text-muted-light: #C2D4BE;
  --color-text-muted-dark: #584A3B;
  --color-border-subtle: rgba(169, 195, 160, 0.25);
  --color-border-warm: rgba(130, 104, 78, 0.35);
  --color-gold-glow: rgba(235, 197, 109, 0.3);

  /* Dynamic Vitality Driven Variable (0.1 to 1.0) */
  --forest-vitality: 0.15;
  --bg-gradient: linear-gradient(135deg, #152B25 0%, #203D32 60%, #17332A 100%);

  /* Typography */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'DM Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Spacing Scale (for 1920x1080 design stage) */
  --space-xs: 8px;
  --space-sm: 16px;
  --space-md: 24px;
  --space-lg: 36px;
  --space-xl: 48px;
  --space-2xl: 64px;
  --space-3xl: 96px;

  /* Global Safe Area (1920x1080 stage: 120px left/right, 80px top/bottom) */
  --safe-x: 120px;
  --safe-y: 80px;
  --safe-width: 1680px;
  --safe-height: 920px;

  /* Transition timings */
  --transition-fast: 180ms ease-out;
  --transition-normal: 320ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 600ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* --------------------------------------------------------------------------
   Font Definitions
   -------------------------------------------------------------------------- */
@font-face {
  font-family: 'Fraunces';
  src: url('../fonts/fraunces.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'DM Sans';
  src: url('../fonts/dmsans.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'JetBrains Mono';
  src: url('../fonts/jetbrainsmono.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

/* --------------------------------------------------------------------------
   Global Reset & Viewport Container
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.25;
}

svg {
  display: block;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #0E1B17;
  color: var(--color-warm-cream);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
}

#viewport {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  background-color: #0d1a16;
}

/* --------------------------------------------------------------------------
   Stage 1920 x 1080 Design Canvas
   -------------------------------------------------------------------------- */
#stage {
  width: 1920px;
  height: 1080px;
  min-width: 1920px;
  min-height: 1080px;
  position: relative;
  overflow: hidden;
  background: var(--color-forest-green);
  transform-origin: center center;
  box-shadow: 0 0 100px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
}

/* Paper Grain Texture Overlay */
.paper-grain-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 90;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* Ambient Vitality Glow Gradient in Background */
.stage-ambient-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(circle at 50% 70%, rgba(235, 197, 109, calc(var(--forest-vitality) * 0.18)), transparent 60%);
  transition: background var(--transition-slow);
}

/* Slide Mount Point */
#slide-mount {
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 10;
}

/* --------------------------------------------------------------------------
   Persistent Bottom Bar (Navigation & Indicator)
   -------------------------------------------------------------------------- */
#bottom-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 64px;
  padding: 0 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 100;
  pointer-events: auto;
  background: linear-gradient(to top, rgba(14, 27, 23, 0.85) 0%, rgba(14, 27, 23, 0) 100%);
  transition: opacity 0.5s ease;
  font-family: var(--font-body);
}

#bottom-bar.idle-fade {
  opacity: 0.25;
}

#bottom-bar.hidden {
  display: none;
}

.bottom-bar-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.bottom-project-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--color-warm-cream);
  letter-spacing: 0.05em;
  opacity: 0.9;
}

.bottom-section-pill {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-honey-gold);
  background: rgba(235, 197, 109, 0.12);
  border: 1px solid rgba(235, 197, 109, 0.3);
  padding: 4px 12px;
  border-radius: 999px;
}

.bottom-bar-center {
  flex: 1;
  max-width: 600px;
  margin: 0 36px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.progress-track {
  flex: 1;
  height: 6px;
  background: rgba(245, 235, 213, 0.15);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--color-sage), var(--color-honey-gold));
  border-radius: 999px;
  transition: width 300ms ease;
}

.vitality-indicator {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-sage);
  display: flex;
  align-items: center;
  gap: 6px;
}

.vitality-leaf-icon {
  width: 14px;
  height: 14px;
  fill: var(--color-sage);
}

.bottom-bar-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.slide-counter {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--color-warm-cream);
}

.slide-counter span.total {
  opacity: 0.5;
}

.bar-btn {
  background: rgba(245, 235, 213, 0.08);
  border: 1px solid rgba(245, 235, 213, 0.2);
  color: var(--color-warm-cream);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.bar-btn:hover {
  background: rgba(245, 235, 213, 0.18);
  border-color: var(--color-honey-gold);
  color: var(--color-honey-gold);
}

/* --------------------------------------------------------------------------
   Overview Overlay (triggered with 'O' key)
   -------------------------------------------------------------------------- */
#overview-modal {
  position: absolute;
  inset: 0;
  background: rgba(13, 26, 21, 0.94);
  backdrop-filter: blur(12px);
  z-index: 200;
  display: none;
  flex-direction: column;
  padding: 48px 64px;
  animation: fadeIn 0.2s ease;
}

#overview-modal.open {
  display: flex;
}

.overview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--color-border-subtle);
  padding-bottom: 20px;
}

.overview-title {
  font-family: var(--font-display);
  font-size: 32px;
  color: var(--color-warm-cream);
}

.overview-hint {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--color-sage);
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 20px;
  overflow-y: auto;
  padding-bottom: 24px;
}

.overview-card {
  background: rgba(32, 61, 50, 0.7);
  border: 1px solid var(--color-border-subtle);
  border-radius: 10px;
  padding: 18px;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 120px;
}

.overview-card:hover {
  transform: translateY(-4px);
  border-color: var(--color-honey-gold);
  background: rgba(40, 75, 62, 0.9);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.overview-card.current {
  border-color: var(--color-honey-gold);
  background: rgba(235, 197, 109, 0.15);
  box-shadow: 0 0 16px rgba(235, 197, 109, 0.25);
}

.card-num {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--color-honey-gold);
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.card-title {
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--color-warm-cream);
  line-height: 1.3;
}

.card-section {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--color-sage);
  margin-top: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* --------------------------------------------------------------------------
   Transitions & Animations
   -------------------------------------------------------------------------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes floatGentle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes swaySubtle {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(2deg); }
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.85; }
}

/* Reduced Motion Mode */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
