/* ==========================================================================
   Design Tokens & Root Variables
   ========================================================================== */
:root {
  --font-main: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  /* Color Palette (Light Mode Default) */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --border-color: #e2e8f0;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --accent-color: #8b5cf6; /* Violet */
  --accent-light: #ddd6fe;
  --accent-dark: #6d28d9;
  
  --success: #10b981; /* Emerald */
  --warning: #f59e0b; /* Amber */
  --danger: #ef4444;  /* Rose */
  
  --card-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --card-hover-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --border-radius: 16px;
  
  /* Glassmorphism settings */
  --glass-bg: rgba(255, 255, 255, 0.8);
  --glass-border: rgba(255, 255, 255, 0.5);
  --glass-blur: 12px;
}

/* Dark Mode Tokens */
[data-theme="dark"] {
  --bg-primary: #0b0f19;
  --bg-secondary: #161b26;
  --bg-tertiary: #1f2635;
  --border-color: #2d3748;
  
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  
  --accent-color: #a78bfa;
  --accent-light: #2e285c;
  --accent-dark: #c084fc;
  
  --card-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
  --card-hover-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.4);
  
  --glass-bg: rgba(22, 27, 38, 0.8);
  --glass-border: rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   Reset & Base Styles
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: var(--transition-smooth);
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  background-color: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--glass-border);
  transition: var(--transition-smooth);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-icon {
  font-size: 1.75rem;
}

.header-brand h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, var(--accent-color), var(--success));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-period {
  font-size: 0.75rem;
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  font-weight: 600;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.header-nav a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition-smooth);
  position: relative;
  padding: 0.25rem 0;
}

.header-nav a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--accent-color);
  transition: var(--transition-smooth);
}

.header-nav a:hover {
  color: var(--text-primary);
}

.header-nav a:hover::after {
  width: 100%;
}

.theme-toggle-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: 30px;
  cursor: pointer;
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition-smooth);
}

.theme-toggle-btn:hover {
  background: var(--border-color);
  transform: translateY(-1px);
}

/* ==========================================================================
   Main Layout & Sections
   ========================================================================== */
.report {
  max-width: 1400px;
  margin: 6rem auto 4rem auto;
  padding: 0 2rem;
}

.section {
  margin-bottom: 5rem;
  scroll-margin-top: 6rem;
}

.section-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 2rem;
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background-color: var(--accent-color);
}

/* ==========================================================================
   Hero Banner
   ========================================================================== */
.hero-banner {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.08) 0%, rgba(16, 185, 129, 0.05) 100%);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 4rem 3rem;
  margin-bottom: 3rem;
  position: relative;
  overflow: hidden;
}

.hero-banner::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.15) 0%, transparent 70%);
  filter: blur(50px);
  z-index: 0;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
}

.hero-subtitle {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--accent-color);
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.hero-title {
  font-size: 2.75rem;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: -0.04em;
  margin-bottom: 1.5rem;
}

.hero-desc {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 700px;
}

/* ==========================================================================
   KPI Cards
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 4rem;
}

.kpi-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1.75rem;
  box-shadow: var(--card-shadow);
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-hover-shadow);
  border-color: var(--accent-color);
}

.kpi-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.kpi-value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

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

.kpi-trend {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.kpi-trend.trend-up {
  color: var(--success);
}

/* ==========================================================================
   Summary Points
   ========================================================================== */
.summary-points {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 2.5rem;
  box-shadow: var(--card-shadow);
}

.summary-points h3 {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.summary-points ol {
  list-style: none;
  counter-reset: li-counter;
}

.summary-points li {
  position: relative;
  padding-left: 3rem;
  margin-bottom: 1.5rem;
  counter-increment: li-counter;
}

.summary-points li:last-child {
  margin-bottom: 0;
}

.summary-points li::before {
  content: counter(li-counter);
  position: absolute;
  left: 0;
  top: 0;
  width: 2rem;
  height: 2rem;
  background-color: rgba(139, 92, 246, 0.1);
  color: var(--accent-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
}

.summary-points li strong {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: var(--text-primary);
}

.summary-points li p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* ==========================================================================
   PESTLE Grid
   ========================================================================== */
.pestle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 1.5rem;
}

.pestle-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 2rem;
  box-shadow: var(--card-shadow);
  transition: var(--transition-smooth);
}

.pestle-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-hover-shadow);
}

.pestle-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.pestle-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.pestle-letter {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 8px;
  background-color: var(--accent-color);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 800;
}

/* Give different letters different background tints */
.pestle-card:nth-child(2) .pestle-letter { background-color: var(--success); }
.pestle-card:nth-child(3) .pestle-letter { background-color: var(--warning); }
.pestle-card:nth-child(4) .pestle-letter { background-color: var(--accent-dark); }
.pestle-card:nth-child(5) .pestle-letter { background-color: #3b82f6; } /* Blue */
.pestle-card:nth-child(6) .pestle-letter { background-color: #06b6d4; } /* Cyan */

.pestle-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.pestle-icon {
  font-size: 1.5rem;
}

.pestle-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.pestle-tag {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.tag-opportunity {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.tag-threat {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.pestle-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.pestle-bullet {
  margin-bottom: 0.75rem;
  padding-left: 0.75rem;
  position: relative;
}

.pestle-bullet:last-child {
  margin-bottom: 0;
}

.pestle-bullet::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--accent-color);
  font-weight: 800;
}

/* ==========================================================================
   Chart Grid & Cards
   ========================================================================== */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
  gap: 2rem;
}

@media (max-width: 768px) {
  .chart-grid {
    grid-template-columns: 1fr;
  }
}

.chart-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 2rem;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
}

.chart-card.full-width {
  grid-column: 1 / -1;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.chart-info h3 {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
}

.chart-info p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.chart-wrap {
  position: relative;
  width: 100%;
  margin-bottom: 1.5rem;
}

.chart-medium {
  height: 300px;
}

.chart-tall {
  height: 400px;
}

.chart-side-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
}

/* Toggle Buttons for Charts */
.toggle-group {
  display: flex;
  background-color: var(--bg-tertiary);
  padding: 0.25rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.toggle-btn {
  background: none;
  border: none;
  padding: 0.4rem 0.8rem;
  font-family: var(--font-main);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 6px;
  transition: var(--transition-smooth);
}

.toggle-btn.active {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* ==========================================================================
   Insight & Synthesis Layouts
   ========================================================================== */
.insight-banner {
  background-color: rgba(139, 92, 246, 0.05);
  border-left: 4px solid var(--accent-color);
  padding: 1.25rem 1.5rem;
  border-radius: 0 12px 12px 0;
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

.synthesis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.synthesis-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1.75rem;
  box-shadow: var(--card-shadow);
}

.synthesis-card h3 {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 1.25rem;
  color: var(--text-primary);
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.synthesis-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.synthesis-item {
  font-size: 0.88rem;
}

.synthesis-item strong {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
  font-weight: 700;
}

.synthesis-item p {
  color: var(--text-secondary);
}

/* ==========================================================================
   Simulator Card
   ========================================================================== */
.simulator-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 2.5rem;
  box-shadow: var(--card-shadow);
}

.sim-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
}

@media (max-width: 768px) {
  .sim-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

.sim-controls {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.control-group {
  display: flex;
  flex-direction: column;
}

.control-group label {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.control-group label span {
  color: var(--accent-color);
  font-size: 1.1rem;
}

.control-group input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-tertiary);
  outline: none;
  margin: 0.5rem 0;
}

.control-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-color);
  cursor: pointer;
  transition: transform 0.1s ease;
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.range-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.sim-results {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  justify-content: center;
}

.result-box {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem;
  position: relative;
}

.result-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.result-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.result-value.highlight {
  color: var(--success);
}

.result-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.3;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--border-color);
  padding: 3rem 0;
  text-align: center;
  background-color: var(--bg-secondary);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.site-footer p {
  margin-bottom: 0.5rem;
}

/* ==========================================================================
   Category Share Switch Button
   ========================================================================== */
.chart-switch-wrap {
  display: flex;
  background-color: var(--bg-tertiary);
  padding: 0.25rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.switch-btn {
  background: none;
  border: none;
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.switch-btn:hover {
  color: var(--text-primary);
}

.switch-btn.active {
  background-color: var(--bg-secondary);
  color: var(--accent-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Preset Buttons in Simulator */
.preset-btn {
  transition: var(--transition-smooth);
}
.preset-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}
.preset-btn:active {
  transform: translateY(0) !important;
}
