/* ============================================
   TYPOGRAPHY.CSS - Sacred Verses
   Font system and responsive text sizing
   ============================================ */

/* ===========================================
   FONT FACE DECLARATIONS - Testing Setup
   =========================================== */

/* Source Sans 3 - New Primary Font */
@font-face {
  font-family: 'Source Sans 3';
  src: url('../fonts/source-sans-3-v18-latin-regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Source Sans 3';
  src: url('../fonts/source-sans-3-v18-latin-italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'Source Sans 3';
  src: url('../fonts/source-sans-3-v18-latin-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* Source Serif 4 - New Serif Font */
@font-face {
  font-family: 'Source Serif 4';
  src: url('../fonts/source-serif-4-v13-latin-regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Source Serif 4';
  src: url('../fonts/source-serif-4-v13-latin-italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'Source Serif 4';
  src: url('../fonts/source-serif-4-v13-latin-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ===========================================
   FONT VARIABLES & SETTINGS - Updated for Testing
   =========================================== */
   
/* FIND AND REPLACE this entire :root block */
:root {
  /* Font families - Simplified to Source fonts only */
  --font-primary: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-secondary: 'Source Sans 3', system-ui, sans-serif;
  --font-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  
  /* Font sizes - keep all existing values */
  --font-size-xs: 0.75rem;    /* 12px */
  --font-size-sm: 0.875rem;   /* 14px */
  --font-size-base: 1rem;     /* 16px */
  --font-size-lg: 1.125rem;   /* 18px */
  --font-size-xl: 1.25rem;    /* 20px */
  --font-size-2xl: 1.5rem;    /* 24px */
  --font-size-3xl: 1.875rem;  /* 30px */
  --font-size-4xl: 2.25rem;   /* 36px */
  --font-size-5xl: 3rem;      /* 48px */
  --font-size-6xl: 3.75rem;   /* 60px */
  --font-size-7xl: 4.5rem;    /* 72px */
  
  /* Line heights - keep all existing values */
  --line-height-tight: 1.25;
  --line-height-snug: 1.375;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.625;
  --line-height-loose: 2;
  
  /* Letter spacing - keep all existing values */
  --letter-spacing-tighter: -0.05em;
  --letter-spacing-tight: -0.025em;
  --letter-spacing-normal: 0em;
  --letter-spacing-wide: 0.025em;
  --letter-spacing-wider: 0.05em;
  --letter-spacing-widest: 0.1em;
  
  /* Font weights - keep all existing values */
  --font-weight-thin: 100;
  --font-weight-light: 300;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;
  --font-weight-black: 900;
}

/* ===========================================
   ADAPTIVE FONT SIZING SYSTEM
   =========================================== */

/* Base typography setup */
html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

body {
  font-family: var(--font-primary);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  letter-spacing: var(--letter-spacing-normal);
  font-weight: var(--font-weight-normal);
  
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
  font-variant-ligatures: common-ligatures;
}

/* ===========================================
   VERSE TEXT ADAPTIVE SIZING
   =========================================== */

.verse-text {
  font-size: clamp(1.5rem, 4vw, 3rem);
  line-height: var(--line-height-tight);
  font-weight: var(--font-weight-normal);
  letter-spacing: var(--letter-spacing-normal);
  
  text-align: center;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: auto;
  
  font-size: var(--adaptive-font-size, clamp(1.5rem, 4vw, 3rem));
  transition: font-size 0.3s ease-out;
}

/* Word count adaptive sizing via CSS custom properties */
.verse-text[data-word-count="1-10"] {
  --adaptive-font-size: clamp(2.5rem, 6vw, 4rem);
  line-height: var(--line-height-tight);
}

.verse-text[data-word-count="11-20"] {
  --adaptive-font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: var(--line-height-snug);
}

.verse-text[data-word-count="21-30"] {
  --adaptive-font-size: clamp(1.75rem, 4.5vw, 3rem);
  line-height: var(--line-height-normal);
}

.verse-text[data-word-count="31-40"] {
  --adaptive-font-size: clamp(1.5rem, 4vw, 2.5rem);
  line-height: var(--line-height-normal);
}

.verse-text[data-word-count="41+"] {
  --adaptive-font-size: clamp(1.25rem, 3.5vw, 2rem);
  line-height: var(--line-height-relaxed);
}

/* ===========================================
   REFERENCE & META TEXT
   =========================================== */

.verse-reference {
  font-family: var(--font-serif);
  font-size: clamp(1rem, 2.5vw, 1.5rem);
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-wide);
  line-height: var(--line-height-normal);
  color: var(--text-secondary);
}

/* ===========================================
   NAVIGATION TYPOGRAPHY
   =========================================== */

.nav-btn {
  font-family: var(--font-primary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-wide);
}

.progress-counter {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--letter-spacing-wide);
  font-variant-numeric: tabular-nums;
}

/* ===========================================
   THEME INDICATOR TYPOGRAPHY
   =========================================== */

.theme-indicator {
  font-family: var(--font-primary);
}

.theme-name-text {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-normal);
  line-height: var(--line-height-tight);
}

/* ===========================================
   HELP & UI TYPOGRAPHY
   =========================================== */

.shortcuts-help h2 {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--letter-spacing-tight);
  line-height: var(--line-height-tight);
}

.shortcuts-help h3 {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-normal);
  line-height: var(--line-height-snug);
}

.shortcut-item {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
}

kbd {
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-normal);
}

/* ===========================================
   RESPONSIVE TYPOGRAPHY
   =========================================== */

/* Mobile devices */
@media (max-width: 768px) {
  :root {
    --font-size-base: 0.875rem; /* 14px */
  }
  
  .verse-text {
    font-size: clamp(1.25rem, 6vw, 2rem);
    line-height: var(--line-height-snug);
  }
  
  .verse-reference {
    font-size: clamp(0.875rem, 4vw, 1.25rem);
  }
  
  .verse-text[data-word-count="1-10"] {
    --adaptive-font-size: clamp(1.75rem, 7vw, 2.5rem);
  }
  
  .verse-text[data-word-count="11-20"] {
    --adaptive-font-size: clamp(1.5rem, 6vw, 2.25rem);
  }
  
  .verse-text[data-word-count="21-30"] {
    --adaptive-font-size: clamp(1.25rem, 5vw, 2rem);
  }
  
  .verse-text[data-word-count="31-40"] {
    --adaptive-font-size: clamp(1.125rem, 4.5vw, 1.75rem);
  }
  
  .verse-text[data-word-count="41+"] {
    --adaptive-font-size: clamp(1rem, 4vw, 1.5rem);
  }
}

/* Tablet devices */
@media (min-width: 769px) and (max-width: 1024px) {
  .verse-text {
    font-size: clamp(1.5rem, 4.5vw, 2.75rem);
  }
}

/* Large screens */
@media (min-width: 1200px) {
  .verse-text {
    font-size: clamp(2rem, 3.5vw, 3.5rem);
  }
  
  .verse-text[data-word-count="1-10"] {
    --adaptive-font-size: clamp(3rem, 4vw, 4.5rem);
  }
}

/* Very large screens */
@media (min-width: 1600px) {
  .verse-text {
    max-width: 1600px;
    margin: 0 auto;
  }
  
  .verse-text[data-word-count="1-10"] {
    --adaptive-font-size: clamp(3.5rem, 4vw, 5rem);
  }
}

/* ===========================================
   ACCESSIBILITY
   =========================================== */

/* High contrast mode */
@media (prefers-contrast: high) {
  .verse-text,
  .verse-reference {
    font-weight: var(--font-weight-semibold);
    text-shadow: none;
    letter-spacing: var(--letter-spacing-wide);
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .verse-text {
    transition: none;
  }
}

/* Print styles */
@media print {
  .verse-text {
    font-size: 2rem !important;
    line-height: var(--line-height-relaxed) !important;
    color: black !important;
  }
  
  .verse-reference {
    font-size: 1.25rem !important;
    color: #666 !important;
  }
}

/* ===========================================
   SPLIT TEXT SUPPORT
   =========================================== */

/* Character and word styling for GSAP SplitText */
.split-text .char,
.split-text .word {
  display: inline-block;
  position: relative;
}

.split-text .char {
  transform-origin: center bottom;
  backface-visibility: hidden;
  perspective: 1000px;
}

.split-text .word {
  transform-origin: center center;
  white-space: nowrap;
}

.split-text .line {
  display: block;
  overflow: hidden;
}

/* ===========================================
   LOADING STATES
   =========================================== */

.verse-text.loading {
  opacity: 0;
  visibility: hidden;
}

.verse-text.loaded {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease-out;
}

/* ===========================================
   THEME-SPECIFIC TYPOGRAPHY
   =========================================== */

/* Classic theme */
[data-theme="classic"] .verse-text {
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1, "swsh" 1;
}

/* Gruvbox themes */
[data-theme^="gruvbox"] .verse-text {
  font-feature-settings: "kern" 1, "liga" 0;
  letter-spacing: var(--letter-spacing-normal);
}

/* Catppuccin themes */
[data-theme^="catppuccin"] .verse-text {
  font-weight: var(--font-weight-normal);
  letter-spacing: var(--letter-spacing-tight);
}

[data-theme="dawn-awakening"] .verse-text {
  font-weight: 400;
  letter-spacing: 0.01em;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
}

[data-theme="catppuccin-macchiato"] .verse-text {
  overflow: visible;
  max-width: 100%;
  transform: none !important;
}

[data-theme="catppuccin-macchiato"] .verse-container {
  overflow: visible;
}

/* ===========================================
   ELEGANT LIST STYLES
   =========================================== */

/* Reset default list styling */
.verse-text ul {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.verse-text li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.5rem;
  line-height: var(--line-height-relaxed);
}

/* ===========================================
   STYLE OPTIONS - Choose one by uncommenting
   =========================================== */

/* Option 1: Subtle Chevron (modern, clean) - FIXED FOR GSAP */
.verse-text li::before {
  content: '·';
  position: absolute;
  left: 0;
  top: 0.25em;
  color: var(--accent-primary);
  font-weight: var(--font-weight-bold);
  font-size: 1.1em;
  line-height: 1;
  opacity: var(--bullet-opacity, 0.7);
  transform: translateX(var(--bullet-x, 0));
  transition: none;
}

/* ===========================================
   RESPONSIVE ADJUSTMENTS
   =========================================== */

/* Mobile adjustments */
@media (max-width: 768px) {
  .verse-text li {
    padding-left: 1.25rem;
    margin-bottom: 0.4rem;
  }
  
  .verse-text li::before {
    font-size: 0.9em;
  }
}

/* ===========================================
   ACCESSIBILITY & THEME SUPPORT
   =========================================== */

/* High contrast mode - FIXED FOR GSAP */
@media (prefers-contrast: high) {
  .verse-text li::before {
    opacity: var(--bullet-opacity, 1);
    font-weight: var(--font-weight-bold);
  }
}

/* Reduced motion - FIXED FOR GSAP */
@media (prefers-reduced-motion: reduce) {
  .verse-text li::before {
    transition: none;
  }
}

/* ===========================================
   THEME-SPECIFIC CUSTOMIZATIONS
   =========================================== */

/* Classic theme - golden elegance */
[data-theme="classic"] .verse-text li::before {
  color: var(--accent-primary);
}

/* Modern themes (Catppuccin, Gruvbox) - clean chevron */
[data-theme^="catppuccin"] .verse-text li::before,
[data-theme^="gruvbox"] .verse-text li::before {
  content: '›';
  font-weight: var(--font-weight-medium);
}

/* ===========================================
   NESTED LISTS (if needed) - FIXED FOR GSAP
   =========================================== */

.verse-text ul ul {
  margin: 0.25rem 0;
  padding-left: 1.5rem;
}

.verse-text ul ul li::before {
  opacity: var(--bullet-opacity, 0.4);
  font-size: 0.8em;
}