/* ================================================================
   CHARLIE MUNGER INVESTMENT ANALYSIS - OPTIMIZED RETRO GREEN THEME
   Enhanced UX/UI with improved readability and user experience
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;600;700&family=Inter:wght@400;500;600;700&display=swap');

/* ================================================================
   CSS CUSTOM PROPERTIES - OPTIMIZED FOR UX
   ================================================================ */

:root {
  /* === REFINED RETRO GREEN PALETTE (DARK THEME) === */
  /* Enhanced contrast and readability */
  --bg-primary: #0a0f0d;           /* Deeper background for better contrast */
  --bg-secondary: #121610;         /* Card backgrounds */
  --bg-selection: #1a2f24;         /* Selection/hover states */
  --bg-accent: #0f1b14;            /* Subtle accent backgrounds */
  
  --green-primary: #4de68a;        /* Improved primary text contrast */
  --green-bright: #7df3a7;         /* Bright highlights - better visibility */
  --green-keyword: #00ff88;        /* Keywords/CTAs - high visibility */
  --green-muted: #2d6b4a;          /* Muted text - readable but subtle */
  --green-border: #1a8a5c;         /* Borders - visible but not harsh */
  --green-glow: #4de68a15;         /* Subtle glow effects */
  --green-hover: #4de68a25;        /* Hover state backgrounds */
  
  /* === ENHANCED TYPOGRAPHY === */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
  --font-size-xs: 12px;
  --font-size-sm: 14px;
  --font-size-base: 16px;
  --font-size-lg: 18px;
  --font-size-xl: 24px;
  --font-size-2xl: 32px;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.7;
  --letter-spacing-tight: -0.025em;
  --letter-spacing-normal: 0;
  --letter-spacing-wide: 0.025em;
  
  /* === OPTIMIZED SPACING === */
  --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;
  
  /* === IMPROVED LAYOUT === */
  --container-max: 1280px;
  --content-max: 75ch;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  
  /* === REFINED EFFECTS === */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-sm: 0 1px 2px rgba(77, 230, 138, 0.1);
  --shadow-md: 0 4px 6px rgba(77, 230, 138, 0.1), 0 2px 4px rgba(77, 230, 138, 0.06);
  --shadow-lg: 0 10px 15px rgba(77, 230, 138, 0.1), 0 4px 6px rgba(77, 230, 138, 0.05);
  --shadow-glow: 0 0 0 1px rgba(77, 230, 138, 0.1), 0 0 20px rgba(77, 230, 138, 0.1);
}

/* ================================================================
   LIGHT THEME OVERRIDE
   ================================================================ */

:root.light-theme {
  /* === RETRO GREEN LIGHT THEME PALETTE === */
  /* High contrast, paper-like background with retro green accents */
  --bg-primary: #f8fdf9;           /* Soft paper white with subtle green tint */
  --bg-secondary: #ffffff;         /* Pure white for cards */
  --bg-selection: #e8f5ea;         /* Light green selection background */
  --bg-accent: #f0f8f2;            /* Very subtle green accent background */
  
  --green-primary: #0d5f2a;        /* Dark forest green for primary text */
  --green-bright: #0a4d22;         /* Darker green for highlights */
  --green-keyword: #006b3c;        /* Medium green for keywords/CTAs */
  --green-muted: #6b8e7a;          /* Muted green-gray for secondary text */
  --green-border: #c1e0ca;         /* Light green borders */
  --green-glow: #4de68a20;         /* Subtle green glow for light theme */
  --green-hover: #d4f0dc;          /* Light green hover background */
  
  /* Enhanced shadows for light theme */
  --shadow-sm: 0 1px 3px rgba(13, 95, 42, 0.12), 0 1px 2px rgba(13, 95, 42, 0.06);
  --shadow-md: 0 4px 6px rgba(13, 95, 42, 0.1), 0 2px 4px rgba(13, 95, 42, 0.06);
  --shadow-lg: 0 10px 15px rgba(13, 95, 42, 0.1), 0 4px 6px rgba(13, 95, 42, 0.05);
  --shadow-glow: 0 0 0 1px rgba(13, 95, 42, 0.05), 0 0 10px rgba(77, 230, 138, 0.1);
}

/* Light theme body adjustments */
:root.light-theme body {
  background: var(--bg-primary);
  background-image: 
    radial-gradient(circle at 25% 25%, rgba(77, 230, 138, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 75% 75%, rgba(77, 230, 138, 0.03) 0%, transparent 50%);
  color: var(--green-primary);
}

/* Light theme navigation adjustments */
:root.light-theme .site-nav a:hover {
  text-shadow: 0 0 8px rgba(0, 107, 60, 0.3);
  box-shadow: 
    inset 0 0 20px rgba(77, 230, 138, 0.08),
    0 2px 10px rgba(13, 95, 42, 0.15);
}

/* Light theme button adjustments */
:root.light-theme .retro-button {
  background: var(--green-keyword);
  color: white;
  box-shadow: 0 2px 4px rgba(13, 95, 42, 0.2);
}

:root.light-theme .retro-button:hover {
  background: white;
  color: var(--green-keyword);
  box-shadow: 
    0 4px 8px rgba(13, 95, 42, 0.2),
    inset 0 0 0 2px var(--green-keyword);
}

/* Light theme stock price adjustments */
:root.light-theme .stock-price {
  background: var(--green-keyword);
  color: white;
  box-shadow: 0 2px 4px rgba(13, 95, 42, 0.2);
}

:root.light-theme .analysis-ticker {
  background: var(--green-keyword);
  color: white;
}

/* Light theme recommendations */
:root.light-theme .recommendation.buy {
  background: var(--green-keyword);
  color: white;
  box-shadow: 0 2px 4px rgba(13, 95, 42, 0.2);
}

:root.light-theme .recommendation.hold {
  background: var(--green-muted);
  color: white;
}

:root.light-theme .recommendation.sell {
  background: var(--bg-accent);
  color: var(--green-primary);
  border: 1px solid var(--green-border);
}

/* Light theme footer adjustments */
:root.light-theme .footer-content::before {
  background: linear-gradient(
    90deg,
    transparent,
    var(--green-keyword),
    var(--green-bright),
    var(--green-keyword),
    transparent
  );
}

/* Light theme code blocks */
:root.light-theme code {
  background: var(--bg-accent);
  color: var(--green-keyword);
  border: 1px solid var(--green-border);
}

/* Light theme blockquotes */
:root.light-theme blockquote {
  background: var(--bg-accent);
  border-left: 4px solid var(--green-keyword);
  color: var(--green-primary);
}

/* Light theme tables */
:root.light-theme table {
  background: var(--bg-secondary);
  border: 1px solid var(--green-border);
}

:root.light-theme th {
  background: var(--bg-selection);
  color: var(--green-bright);
}

:root.light-theme tr:hover {
  background: var(--green-hover);
}

/* Light theme selection */
:root.light-theme ::selection {
  background: var(--bg-selection);
  color: var(--green-bright);
}

/* ================================================================
   ENHANCED BASE STYLES
   ================================================================ */

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

* {
  margin: 0;
  padding: 0;
}

*:focus-visible {
  outline: 2px solid var(--green-keyword);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  /* Optimized background */
  background: var(--bg-primary);
  background-image: 
    radial-gradient(circle at 25% 25%, var(--green-glow) 0%, transparent 50%),
    radial-gradient(circle at 75% 75%, var(--green-glow) 0%, transparent 50%);
  
  /* Enhanced typography */
  font-family: var(--font-primary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  letter-spacing: var(--letter-spacing-normal);
  color: var(--green-primary);
  
  /* Improved text rendering */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  
  /* Layout */
  padding: var(--space-6);
  min-height: 100vh;
}

/* Subtle ambient animation - much reduced */
@keyframes ambient-glow {
  0%, 100% { 
    background-position: 25% 25%, 75% 75%;
  }
  50% { 
    background-position: 30% 30%, 70% 70%;
  }
}

body {
  animation: ambient-glow 10s ease-in-out infinite;
}

/* ================================================================
   IMPROVED LAYOUT COMPONENTS
   ================================================================ */

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  background: var(--bg-secondary);
  border: 1px solid var(--green-border);
  border-radius: var(--radius-lg);
  padding: var(--space-12);
  box-shadow: var(--shadow-glow);
  position: relative;
  overflow: hidden;
}

.container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--green-keyword),
    transparent
  );
  opacity: 0.5;
}

/* ================================================================
   ENHANCED TYPOGRAPHY
   ================================================================ */

h1 {
  font-family: var(--font-mono);
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--green-keyword);
  text-align: center;
  margin-bottom: var(--space-10);
  padding: var(--space-6);
  background: var(--bg-selection);
  border: 1px solid var(--green-border);
  border-radius: var(--radius-md);
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  position: relative;
  box-shadow: var(--shadow-md);
}

h1::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 2px;
  background: var(--green-keyword);
  border-radius: 1px;
}

h2 {
  font-family: var(--font-primary);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--green-bright);
  margin: var(--space-12) 0 var(--space-6) 0;
  position: relative;
  padding-left: var(--space-6);
}

h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 24px;
  background: var(--green-keyword);
  border-radius: 2px;
}

h3 {
  font-family: var(--font-primary);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-medium);
  color: var(--green-primary);
  margin: var(--space-8) 0 var(--space-4) 0;
  line-height: var(--line-height-tight);
}

p {
  margin: var(--space-4) 0;
  line-height: var(--line-height-relaxed);
  color: var(--green-primary);
  max-width: var(--content-max);
}

ul, ol {
  margin: var(--space-4) 0;
  padding-left: var(--space-6);
  line-height: var(--line-height-relaxed);
}

li {
  margin: var(--space-2) 0;
  color: var(--green-primary);
}

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

em {
  color: var(--green-muted);
  font-style: italic;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-accent);
  color: var(--green-keyword);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--green-border);
}

blockquote {
  background: var(--bg-selection);
  border: 1px solid var(--green-border);
  border-left: 4px solid var(--green-keyword);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  margin: var(--space-6) 0;
  color: var(--green-bright);
  font-style: italic;
  box-shadow: var(--shadow-sm);
  position: relative;
}

blockquote::before {
  position: absolute;
  top: -12px;
  left: var(--space-4);
  background: var(--bg-selection);
  padding: 0 var(--space-2);
  font-family: var(--font-mono);
  font-size: 1em;
  color: var(--green-keyword);
  font-weight: var(--font-weight-bold);
}

hr {
  border: none;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--green-border),
    transparent
  );
  margin: var(--space-10) 0;
}

/* ================================================================
   ENHANCED NAVIGATION WITH IMPROVED HOVER MENU
   ================================================================ */

.site-nav {
  background: var(--bg-accent);
  border: 1px solid var(--green-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-10);
  overflow: visible;
  box-shadow: var(--shadow-sm);
  position: relative;
  z-index: 100;
}

.site-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
}

.site-nav li {
  flex: 1;
  border-right: 1px solid var(--green-border);
  position: relative;
}

.site-nav li:last-child {
  border-right: none;
}

/* Enhanced navigation links with improved hover effects */
.site-nav a {
  display: block;
  padding: var(--space-4) var(--space-3);
  color: var(--green-primary);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  text-align: center;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
  border-bottom: 2px solid transparent;
}

/* Animated underline effect */
.site-nav a::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--green-keyword), var(--green-bright));
  transition: width var(--transition-base);
}

/* Glow effect background */
.site-nav a::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(77, 230, 138, 0.1),
    transparent
  );
  transition: left var(--transition-slow);
}

/* Hover states with enhanced visual feedback */
.site-nav a:hover {
  background: var(--green-hover);
  color: var(--green-bright);
  border-bottom-color: var(--green-keyword);
  box-shadow: 
    inset 0 0 20px rgba(77, 230, 138, 0.1),
    0 2px 10px rgba(77, 230, 138, 0.2);
  transform: translateY(-1px);
  text-shadow: 0 0 8px rgba(77, 230, 138, 0.5);
}

.site-nav a:hover::before {
  width: 100%;
}

.site-nav a:hover::after {
  left: 100%;
}

/* Active/pressed state */
.site-nav a:active {
  transform: translateY(0);
  transition-duration: 0.1s;
}

/* Focus state for accessibility */
.site-nav a:focus-visible {
  outline: 2px solid var(--green-keyword);
  outline-offset: -2px;
  background: var(--green-hover);
  color: var(--green-bright);
}

/* Dropdown menu styles for future extensibility */
.site-nav .dropdown {
  position: relative;
}

.site-nav .dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--green-border);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all var(--transition-base);
  z-index: 1000;
}

.site-nav .dropdown:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.site-nav .dropdown-menu a {
  border-right: none;
  border-bottom: 1px solid var(--green-border);
  border-radius: 0;
  text-align: left;
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-size-xs);
}

.site-nav .dropdown-menu a:last-child {
  border-bottom: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.site-nav .dropdown-menu a:hover {
  background: var(--bg-selection);
  transform: translateX(2px);
}

/* Dropdown indicator */
.site-nav .dropdown > a::after {
  content: '▼';
  font-size: 0.7em;
  margin-left: var(--space-1);
  opacity: 0.7;
  transition: transform var(--transition-fast);
}

.site-nav .dropdown:hover > a::after {
  transform: rotate(180deg);
}

/* ================================================================
   THEME TOGGLE BUTTON
   ================================================================ */

.theme-toggle {
  display: block;
  width: 100%;
  padding: var(--space-4) var(--space-3);
  background: transparent;
  border: none;
  color: var(--green-primary);
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
  border-bottom: 2px solid transparent;
}

.theme-toggle:hover {
  background: var(--green-hover);
  color: var(--green-bright);
  border-bottom-color: var(--green-keyword);
  box-shadow: 
    inset 0 0 20px rgba(77, 230, 138, 0.1),
    0 2px 10px rgba(77, 230, 138, 0.2);
  transform: translateY(-1px);
  text-shadow: 0 0 8px rgba(77, 230, 138, 0.5);
}

.theme-toggle:active {
  transform: translateY(0);
  transition-duration: 0.1s;
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--green-keyword);
  outline-offset: -2px;
  background: var(--green-hover);
  color: var(--green-bright);
}

/* Light theme toggle adjustments */
:root.light-theme .theme-toggle:hover {
  text-shadow: 0 0 8px rgba(0, 107, 60, 0.3);
  box-shadow: 
    inset 0 0 20px rgba(77, 230, 138, 0.08),
    0 2px 10px rgba(13, 95, 42, 0.15);
}

/* Enhanced mobile navigation */
@media (max-width: 768px) {
  .site-nav {
    overflow: hidden;
  }
  
  .site-nav ul {
    flex-direction: column;
  }
  
  .site-nav li {
    border-right: none;
    border-bottom: 1px solid var(--green-border);
  }
  
  .site-nav li:last-child {
    border-bottom: none;
  }
  
  .site-nav a:hover::after {
    left: 0;
    background: linear-gradient(
      0deg,
      transparent,
      rgba(77, 230, 138, 0.1),
      transparent
    );
  }
  
  .site-nav a:hover {
    transform: translateX(4px);
  }
  
  /* Mobile dropdown adjustments */
  .site-nav .dropdown-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: var(--bg-accent);
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-base);
  }
  
  .site-nav .dropdown:hover .dropdown-menu {
    max-height: 200px;
  }
  
  .site-nav .dropdown-menu a {
    padding-left: var(--space-8);
    background: var(--bg-accent);
    font-size: var(--font-size-xs);
  }
  
  .site-nav .dropdown-menu a:hover {
    transform: translateX(8px);
    background: var(--bg-selection);
  }
  
  /* Mobile theme toggle */
  .theme-toggle:hover {
    transform: translateX(4px);
  }
}

/* ================================================================
   OPTIMIZED PORTFOLIO CARDS
   ================================================================ */

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: var(--space-4);
  margin: var(--space-8) 0;
}

.stock-card {
  background: var(--bg-secondary);
  border: 1px solid var(--green-border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  transition: var(--transition-base);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  cursor: pointer;
}

.stock-card:hover {
  border-color: var(--green-keyword);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  background: var(--bg-selection);
}

.stock-info {
  flex: 1;
  min-width: 0; /* Prevent flex item overflow */
}

.stock-ticker {
  font-family: var(--font-mono);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-bold);
  color: var(--green-keyword);
  margin-bottom: var(--space-1);
  letter-spacing: var(--letter-spacing-wide);
}

.stock-description {
  color: var(--green-primary);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-normal);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-price {
  font-family: var(--font-mono);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--bg-primary);
  background: var(--green-keyword);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  min-width: 100px;
  text-align: center;
  border: 1px solid var(--green-keyword);
}

/* ================================================================
   REFINED RECOMMENDATION BADGES
   ================================================================ */

.recommendation {
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
  text-align: center;
  min-width: 70px;
  margin-left: var(--space-2);
}

.recommendation.buy {
  background: var(--green-keyword);
  color: var(--bg-primary);
  border: 1px solid var(--green-keyword);
}

.recommendation.hold {
  background: var(--green-muted);
  color: var(--green-bright);
  border: 1px solid var(--green-muted);
}

.recommendation.sell {
  background: var(--bg-accent);
  color: var(--green-muted);
  border: 1px solid var(--green-muted);
}

/* ================================================================
   ENHANCED ANALYSIS CARDS
   ================================================================ */

.analysis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: var(--space-5);
  margin: var(--space-8) 0;
}

.analysis-card {
  background: var(--bg-secondary);
  border: 1px solid var(--green-border);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  transition: var(--transition-base);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  display: block;
  position: relative;
  overflow: hidden;
}

.analysis-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    var(--green-keyword),
    var(--green-bright)
  );
  transform: scaleX(0);
  transition: var(--transition-base);
  transform-origin: left;
}

.analysis-card:hover {
  border-color: var(--green-keyword);
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  text-decoration: none;
  color: inherit;
}

.analysis-card:hover::before {
  transform: scaleX(1);
}

.analysis-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-4);
  gap: var(--space-3);
}

.analysis-ticker {
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  color: var(--bg-primary);
  background: var(--green-keyword);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  letter-spacing: var(--letter-spacing-wide);
  flex-shrink: 0;
}

.analysis-card h3 {
  color: var(--green-bright);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-tight);
  margin: 0 0 var(--space-3) 0;
}

.analysis-insight {
  color: var(--green-primary);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-relaxed);
  margin-bottom: var(--space-5);
}

.analysis-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--font-size-xs);
  color: var(--green-muted);
  border-top: 1px solid var(--green-border);
  padding-top: var(--space-3);
  gap: var(--space-3);
}

.analysis-date {
  font-family: var(--font-mono);
}

.analysis-status {
  color: var(--green-border);
  font-weight: var(--font-weight-medium);
}

/* ================================================================
   IMPROVED QUICK LINKS
   ================================================================ */

.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-4);
  margin: var(--space-8) 0;
}

.quick-link-card {
  background: var(--bg-secondary);
  border: 1px solid var(--green-border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  transition: var(--transition-base);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.quick-link-card:hover {
  border-color: var(--green-keyword);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
  color: inherit;
  background: var(--bg-selection);
}

.link-icon {
  font-size: 2rem;
  flex-shrink: 0;
  opacity: 0.8;
}

.link-content h3 {
  color: var(--green-bright);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  margin: 0 0 var(--space-1) 0;
}

.link-content p {
  color: var(--green-primary);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-normal);
  margin: 0;
}

/* ================================================================
   ENHANCED PRINCIPLES GRID
   ================================================================ */

.principles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-5);
  margin: var(--space-8) 0;
}

.principle-card {
  background: var(--bg-selection);
  border: 1px solid var(--green-border);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  text-align: center;
  transition: var(--transition-base);
  box-shadow: var(--shadow-sm);
}

.principle-card:hover {
  border-color: var(--green-keyword);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.principle-card h3 {
  color: var(--green-bright);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  margin: 0 0 var(--space-3) 0;
}

.principle-card p {
  color: var(--green-primary);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-relaxed);
  margin: 0;
}

/* ================================================================
   OPTIMIZED HERO QUOTE
   ================================================================ */

.hero-quote {
  text-align: center;
  margin: 0 0 var(--space-10) 0;
}

.hero-quote blockquote {
  max-width: 70ch;
  margin: 0 auto;
  font-size: var(--font-size-lg);
  background: var(--bg-selection);
  border: 1px solid var(--green-border);
  border-left: 4px solid var(--green-keyword);
  box-shadow: var(--shadow-md);
}

/* ================================================================
   ENHANCED TABLES
   ================================================================ */

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--green-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: var(--space-6) 0;
  box-shadow: var(--shadow-sm);
}

th {
  background: var(--bg-selection);
  color: var(--green-bright);
  padding: var(--space-4);
  font-family: var(--font-primary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  text-align: left;
  border-bottom: 1px solid var(--green-border);
}

td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--green-border);
  color: var(--green-primary);
  font-size: var(--font-size-sm);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover {
  background: var(--green-hover);
}

/* ================================================================
   REFINED BUTTONS
   ================================================================ */

.retro-button {
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  background: var(--green-keyword);
  color: var(--bg-primary);
  border: 1px solid var(--green-keyword);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-5);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
  min-width: 120px;
}

.retro-button:hover {
  background: var(--bg-primary);
  color: var(--green-keyword);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  transform: translateY(-1px);
}

.retro-button:active {
  transform: translateY(0);
}

/* ================================================================
   IMPROVED MENU CARDS
   ================================================================ */

.menu-card {
  background: var(--bg-selection);
  border: 1px solid var(--green-border);
  border-radius: var(--radius-md);
  padding: var(--space-8);
  margin: var(--space-8) 0;
  box-shadow: var(--shadow-sm);
}

/* ================================================================
   OPTIMIZED FOOTER LAYOUT
   ================================================================ */

.site-footer {
  margin-top: var(--space-20);
  border-top: 1px solid var(--green-border);
  padding-top: var(--space-12);
}

.footer-content {
  background: var(--bg-selection);
  border: 1px solid var(--green-border);
  border-radius: var(--radius-lg);
  padding: var(--space-12) var(--space-8);
  text-align: center;
  box-shadow: var(--shadow-md);
  max-width: 800px;
  margin: 0 auto;
  position: relative;
}

.footer-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--green-keyword),
    var(--green-bright),
    var(--green-keyword),
    transparent
  );
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.warning-box {
  background: rgba(77, 230, 138, 0.05);
  border: 1px solid var(--green-border);
  border-left: 3px solid var(--green-keyword);
  border-radius: var(--radius-sm);
  padding: var(--space-4);
  margin: var(--space-3) 0;
  position: relative;
}

.warning-box::before {
  position: absolute;
  top: -8px;
  left: var(--space-3);
  background: var(--bg-selection);
  padding: 0 var(--space-1);
  font-family: var(--font-mono);
  font-size: 0.8em;
  color: var(--green-keyword);
  font-weight: var(--font-weight-bold);
}

.disclaimer-section {
  margin-bottom: var(--space-8);
}

.disclaimer-section h3 {
  color: var(--green-keyword);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  margin: 0 0 var(--space-5) 0;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  justify-content: center;
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
}

.disclaimer-section h3::before {
  font-family: var(--font-mono);
  font-size: 1.2em;
  color: var(--green-keyword);
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { 
    transform: scale(1);
    filter: brightness(1);
  }
  50% { 
    transform: scale(1.05);
    filter: brightness(1.2);
  }
}

.footer-quote {
  text-align: center;
  max-width: 65ch;
  margin: var(--space-8) auto 0;
  position: relative;
}

.footer-quote::before {
  content: '';
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--green-border),
    transparent
  );
}

.footer-quote blockquote {
  background: transparent;
  border: none;
  padding: var(--space-5) var(--space-4);
  margin: 0;
  font-size: var(--font-size-base);
  color: var(--green-primary);
  box-shadow: none;
  font-style: italic;
  line-height: var(--line-height-relaxed);
  position: relative;
}

.footer-quote blockquote::before {
  display: none;
}

.footer-quote blockquote::after {
  content: '"';
  position: absolute;
  bottom: 0;
  right: var(--space-4);
  font-size: 2em;
  color: var(--green-muted);
  font-family: var(--font-mono);
  line-height: 1;
}

.footer-quote cite {
  display: block;
  margin-top: var(--space-4);
  font-style: normal;
  font-weight: var(--font-weight-medium);
  color: var(--green-bright);
  font-size: var(--font-size-sm);
  position: relative;
  padding-left: var(--space-8);
}

.footer-quote cite::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--green-keyword);
  font-weight: var(--font-weight-bold);
}

.retro-text {
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  color: var(--green-muted);
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
}

.powered-by {
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--green-border);
  opacity: 0.7;
}

.powered-by .retro-text {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

.powered-by .retro-text::before {
  content: '[';
  font-family: var(--font-mono);
  color: var(--green-keyword);
  font-weight: var(--font-weight-bold);
}

.powered-by .retro-text::after {
  content: ']';
  font-family: var(--font-mono);
  color: var(--green-keyword);
  font-weight: var(--font-weight-bold);
}

/* ================================================================
   RESPONSIVE DESIGN - ENHANCED MOBILE READING SUPPORT
   ================================================================ */

/* Mobile-first typography improvements */
@media (max-width: 768px) {
  body {
    padding: var(--space-3);
    font-size: var(--font-size-base);
    line-height: var(--line-height-relaxed);
  }
  
  .container {
    padding: var(--space-5);
    border-radius: var(--radius-md);
  }
  
  /* Enhanced mobile headings for better readability */
  h1 {
    font-size: var(--font-size-xl);
    padding: var(--space-4);
    line-height: var(--line-height-tight);
    letter-spacing: var(--letter-spacing-normal);
    text-align: center;
  }
  
  h2 {
    font-size: var(--font-size-lg);
    margin: var(--space-8) 0 var(--space-4) 0;
    line-height: var(--line-height-tight);
    padding-left: var(--space-4);
  }
  
  h3 {
    font-size: var(--font-size-base);
    margin: var(--space-6) 0 var(--space-3) 0;
    line-height: var(--line-height-normal);
  }
  
  /* Mobile-optimized text for better reading */
  p {
    font-size: var(--font-size-base);
    line-height: 1.6;
    margin: var(--space-4) 0;
    max-width: none;
    word-wrap: break-word;
    hyphens: auto;
  }
  
  /* Enhanced list spacing for mobile */
  ul, ol {
    margin: var(--space-4) 0;
    padding-left: var(--space-5);
    line-height: 1.6;
  }
  
  li {
    margin: var(--space-3) 0;
    word-wrap: break-word;
  }
  
  /* Mobile code blocks */
  code {
    font-size: var(--font-size-sm);
    padding: var(--space-2) var(--space-2);
    word-wrap: break-word;
    white-space: pre-wrap;
  }
  
  /* Mobile blockquotes */
  blockquote {
    padding: var(--space-4);
    margin: var(--space-4) 0;
    font-size: var(--font-size-base);
    line-height: 1.6;
  }
  
  .site-nav ul {
    flex-direction: column;
  }
  
  .site-nav li {
    border-right: none;
    border-bottom: 1px solid var(--green-border);
  }
  
  .site-nav li:last-child {
    border-bottom: none;
  }
  
  .portfolio-grid {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }
  
  /* Enhanced touch-friendly stock cards */
  .stock-card {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-4);
    text-align: center;
    padding: var(--space-6);
    min-height: 120px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  
  .stock-card:active {
    transform: scale(0.98);
    transition: transform 0.1s ease-out;
  }
  
  .stock-description {
    white-space: normal;
    font-size: var(--font-size-sm);
    line-height: 1.5;
  }
  
  .recommendation {
    margin-left: 0;
    align-self: center;
    padding: var(--space-2) var(--space-4);
    min-width: 80px;
    font-size: var(--font-size-xs);
  }
  
  .quick-links {
    grid-template-columns: 1fr;
  }
  
  /* Touch-optimized quick link cards */
  .quick-link-card {
    flex-direction: column;
    text-align: center;
    padding: var(--space-6);
    gap: var(--space-4);
    min-height: 100px;
    -webkit-tap-highlight-color: transparent;
  }
  
  .quick-link-card:active {
    transform: scale(0.98);
    transition: transform 0.1s ease-out;
  }
  
  .link-icon {
    font-size: 1.5rem;
  }
  
  .principles-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
  
  /* Enhanced mobile analysis cards */
  .analysis-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
  
  .analysis-card {
    padding: var(--space-5);
    -webkit-tap-highlight-color: transparent;
  }
  
  .analysis-card:active {
    transform: scale(0.98);
    transition: transform 0.1s ease-out;
  }
  
  .analysis-header {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
  }
  
  .analysis-ticker {
    align-self: flex-start;
    font-size: var(--font-size-xs);
  }
  
  .analysis-insight {
    font-size: var(--font-size-sm);
    line-height: 1.6;
  }
}

/* Small mobile devices - extra reading optimizations */
@media (max-width: 480px) {
  body {
    padding: var(--space-2);
    font-size: var(--font-size-sm);
  }
  
  .container {
    padding: var(--space-4);
    border-radius: var(--radius-sm);
  }
  
  /* Compact headings for small screens */
  h1 {
    font-size: var(--font-size-lg);
    padding: var(--space-3);
    margin-bottom: var(--space-6);
  }
  
  h2 {
    font-size: var(--font-size-base);
    margin: var(--space-6) 0 var(--space-3) 0;
  }
  
  h3 {
    font-size: var(--font-size-sm);
    margin: var(--space-4) 0 var(--space-2) 0;
  }
  
  /* Optimized text for very small screens */
  p {
    font-size: var(--font-size-sm);
    line-height: 1.6;
    margin: var(--space-3) 0;
  }
  
  /* Compact navigation */
  .site-nav a, .theme-toggle {
    padding: var(--space-3) var(--space-2);
    font-size: var(--font-size-xs);
  }
  
  .portfolio-grid {
    gap: var(--space-2);
  }
  
  .analysis-grid {
    gap: var(--space-3);
  }
  
  /* Compact cards for small screens */
  .stock-card, .analysis-card, .quick-link-card {
    padding: var(--space-4);
    gap: var(--space-3);
  }
  
  .retro-button {
    padding: var(--space-2) var(--space-4);
    font-size: var(--font-size-xs);
    min-width: 100px;
  }
  
  /* Tables on small screens */
  table {
    font-size: var(--font-size-xs);
  }
  
  th, td {
    padding: var(--space-2) var(--space-3);
  }
}

/* ================================================================
   MOBILE-SPECIFIC READING ENHANCEMENTS
   ================================================================ */

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
  /* Remove hover effects on touch devices */
  .stock-card:hover,
  .analysis-card:hover,
  .quick-link-card:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
  }
  
  /* Enhanced touch feedback */
  .stock-card:active,
  .analysis-card:active,
  .quick-link-card:active {
    transform: scale(0.98);
    background: var(--bg-selection);
  }
  
  /* Better button touch targets */
  .retro-button,
  .theme-toggle,
  .site-nav a {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* Landscape mobile optimizations */
@media (max-width: 768px) and (orientation: landscape) {
  .container {
    padding: var(--space-4) var(--space-6);
  }
  
  h1 {
    font-size: var(--font-size-lg);
    margin-bottom: var(--space-6);
  }
  
  .portfolio-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  }
  
  .analysis-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }
}

/* Dark mode mobile adjustments */
@media (max-width: 768px) {
  :root.light-theme {
    /* Slightly increased contrast for mobile light theme */
    --green-primary: #0a4d1f;
    --green-bright: #084119;
    --shadow-md: 0 4px 6px rgba(13, 95, 42, 0.15), 0 2px 4px rgba(13, 95, 42, 0.08);
  }
}

/* Reading mode enhancements */
.reading-mode {
  line-height: 1.8;
  font-size: 1.1em;
  max-width: 70ch;
  margin: 0 auto;
}

.reading-mode p {
  margin-bottom: var(--space-5);
  text-align: left;
}

.reading-mode h2, .reading-mode h3 {
  margin-top: var(--space-8);
  margin-bottom: var(--space-5);
}

/* Mobile device specific styles */
.mobile-device {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

.mobile-device * {
  /* Prevent text inflation on mobile */
  max-height: 999999px;
}

/* Better mobile table handling */
@media (max-width: 768px) {
  table {
    width: 100%;
    overflow-x: auto;
    display: block;
    white-space: nowrap;
  }
  
  thead, tbody, th, td, tr {
    display: block;
  }
  
  thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }
  
  tr {
    border: 1px solid var(--green-border);
    margin-bottom: var(--space-2);
    padding: var(--space-3);
    border-radius: var(--radius-sm);
  }
  
  td {
    border: none;
    padding: var(--space-2) 0;
    position: relative;
    padding-left: 30%;
    white-space: normal;
    text-align: left;
  }
  
  td:before {
    content: attr(data-label) ": ";
    position: absolute;
    left: 6px;
    width: 25%;
    padding-right: var(--space-2);
    white-space: nowrap;
    font-weight: var(--font-weight-semibold);
    color: var(--green-bright);
  }
}

/* Scroll behavior for mobile */
@media (max-width: 768px) {
  html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--space-8);
  }
  
  /* Better text selection on mobile */
  ::selection {
    background: var(--green-hover);
    color: var(--green-bright);
  }
  
  /* Improved focus indicators for mobile */
  :focus-visible {
    outline: 3px solid var(--green-keyword);
    outline-offset: 3px;
  }
}

/* ================================================================
   ACCESSIBILITY & PERFORMANCE
   ================================================================ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  body {
    animation: none;
  }
}

@media (prefers-contrast: high) {
  :root {
    --green-primary: #00ff88;
    --green-bright: #ffffff;
    --bg-primary: #000000;
    --green-border: #00ff88;
  }
}

@media (prefers-color-scheme: light) {
  /* Optional light mode overrides */
  .container {
    box-shadow: var(--shadow-md);
  }
}

/* ================================================================
   FOCUS STATES - ENHANCED ACCESSIBILITY
   ================================================================ */

.stock-card:focus-visible,
.analysis-card:focus-visible,
.quick-link-card:focus-visible,
.retro-button:focus-visible {
  outline: 2px solid var(--green-keyword);
  outline-offset: 2px;
}

/* ================================================================
   PRINT STYLES
   ================================================================ */

@media print {
  body {
    background: white;
    color: black;
    font-size: 12pt;
    line-height: 1.4;
    animation: none;
  }
  
  .container {
    border: 1px solid black;
    box-shadow: none;
    background: white;
  }
  
  .container::before {
    display: none;
  }
  
  .site-nav,
  .retro-button {
    display: none;
  }
  
  .stock-card,
  .analysis-card,
  .quick-link-card {
    border-color: black;
    box-shadow: none;
    break-inside: avoid;
    background: white;
  }
  
  h1, h2, h3 {
    break-after: avoid;
    color: black;
  }
  
  h1::after {
    background: black;
  }
  
  .analysis-card::before {
    display: none;
  }
}