/* ==========================================================================
   LEGEND TOOLS - MASTER STYLESHEET
   High-performance, AdSense-ready, Mobile-first CSS
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS Variables & Theme Foundations
   -------------------------------------------------------------------------- */
:root {
  /* Dark Theme (Default) */
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-tertiary: #1f2937;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-card-hover: rgba(31, 41, 55, 0.85);
  --bg-glass: rgba(17, 24, 39, 0.65);
  --bg-elevated: #1e293b;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0b0f19;

  --accent-violet: #8b5cf6;
  --accent-violet-glow: rgba(139, 92, 246, 0.35);
  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.35);
  --accent-gold: #f59e0b;
  --accent-gold-glow: rgba(245, 158, 11, 0.35);
  --accent-green: #10b981;
  --accent-red: #ef4444;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.16);
  --border-focus: #8b5cf6;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 25px rgba(139, 92, 246, 0.25);

  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  --header-height: 72px;
  --max-width: 1240px;
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Light Theme overrides */
[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(248, 250, 252, 0.95);
  --bg-glass: rgba(255, 255, 255, 0.8);
  --bg-elevated: #ffffff;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #f8fafc;

  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-medium: rgba(0, 0, 0, 0.15);

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 20px rgba(139, 92, 246, 0.15);
}

/* --------------------------------------------------------------------------
   2. Reset & Base Styles
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Skip link for Accessibility */
.skip-link {
  position: absolute;
  top: -100px;
  left: 20px;
  background: var(--accent-violet);
  color: #ffffff;
  padding: 12px 20px;
  z-index: 99999;
  font-weight: 700;
  border-radius: var(--radius-sm);
  transition: top 0.2s ease;
  text-decoration: none;
}
.skip-link:focus {
  top: 15px;
}

img, svg {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--accent-cyan);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover {
  color: var(--accent-violet);
  text-decoration: underline;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  line-height: 1.25;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

h1 { font-size: clamp(2rem, 4vw + 1rem, 3.25rem); }
h2 { font-size: clamp(1.5rem, 2.5vw + 0.5rem, 2.25rem); }
h3 { font-size: clamp(1.2rem, 1.8vw + 0.2rem, 1.6rem); }
h4 { font-size: 1.2rem; }

p {
  margin-bottom: 1.25rem;
  color: var(--text-secondary);
}

ul, ol {
  padding-left: 1.5rem;
  margin-bottom: 1.25rem;
  color: var(--text-secondary);
}
li {
  margin-bottom: 0.5rem;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* --------------------------------------------------------------------------
   3. Header & Navigation
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  height: var(--header-height);
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.header-container {
  max-width: var(--max-width);
  height: 100%;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}
.brand-logo:hover {
  text-decoration: none;
}

.main-nav {
  display: flex;
  align-items: center;
}

.nav-list {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-item {
  position: relative;
}

.nav-item > a {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all var(--transition-fast);
}

.nav-item > a:hover,
.nav-item > a.active {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
  text-decoration: none;
}
.nav-item > a.active {
  color: var(--accent-cyan);
}

/* Dropdown */
.arrow-icon {
  font-size: 0.65rem;
  transition: transform 0.2s ease;
}

.has-dropdown:hover .arrow-icon,
.has-dropdown:focus-within .arrow-icon {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 250px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.75rem 0;
  list-style: none;
  margin: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: all var(--transition-fast);
  z-index: 1010;
}

.has-dropdown:hover .dropdown-menu,
.has-dropdown:focus-within .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-menu li a {
  display: block;
  padding: 0.6rem 1.25rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.dropdown-menu li a:hover,
.dropdown-menu li a.active {
  background: var(--bg-tertiary);
  color: var(--accent-violet);
  text-decoration: none;
}

.dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 0.4rem 0;
}

.view-all-link {
  font-weight: 700 !important;
  color: var(--accent-cyan) !important;
}

/* Header action buttons */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.theme-toggle {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.15rem;
  transition: transform var(--transition-fast), background var(--transition-fast);
}
.theme-toggle:hover {
  transform: scale(1.08);
  border-color: var(--accent-violet);
}

[data-theme="dark"] .light-icon { display: block; }
[data-theme="dark"] .dark-icon { display: none; }
[data-theme="light"] .light-icon { display: none; }
[data-theme="light"] .dark-icon { display: block; }

.mobile-menu-toggle {
  display: none;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  padding: 10px;
  cursor: pointer;
  flex-direction: column;
  justify-content: space-between;
}

.hamburger-bar {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text-primary);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

/* Reading Progress Bar (Fixed on top) */
#reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-violet), var(--accent-cyan), var(--accent-gold));
  z-index: 10000;
  transition: width 0.1s linear;
}

/* --------------------------------------------------------------------------
   4. Buttons & Interactive Elements
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.8rem 1.6rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  min-height: 44px;
  min-width: 44px;
  transition: all var(--transition-normal);
}
.btn:hover {
  text-decoration: none;
  transform: translateY(-2px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-violet), #6d28d9);
  color: #ffffff;
  box-shadow: 0 4px 15px var(--accent-violet-glow);
}
.btn-primary:hover {
  box-shadow: 0 6px 20px var(--accent-violet-glow);
  color: #ffffff;
}

.btn-secondary {
  background: linear-gradient(135deg, var(--accent-cyan), #0891b2);
  color: #ffffff;
  box-shadow: 0 4px 15px var(--accent-cyan-glow);
}
.btn-secondary:hover {
  box-shadow: 0 6px 20px var(--accent-cyan-glow);
  color: #ffffff;
}

.btn-gold {
  background: linear-gradient(135deg, var(--accent-gold), #d97706);
  color: #0b0f19;
  font-weight: 700;
  box-shadow: 0 4px 15px var(--accent-gold-glow);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
}
.btn-outline:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.05);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  min-height: 38px;
}

.btn-link {
  background: transparent;
  color: var(--accent-cyan);
  padding: 0.4rem 0.8rem;
}
.btn-link:hover {
  color: var(--accent-violet);
  transform: none;
}

/* --------------------------------------------------------------------------
   5. Hero Section & 3D Canvas
   -------------------------------------------------------------------------- */
.hero-section {
  position: relative;
  padding: 5rem 0 4rem;
  overflow: hidden;
  background: radial-gradient(circle at 50% 20%, rgba(139, 92, 246, 0.12) 0%, transparent 60%);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  align-items: center;
  gap: 3rem;
}

.hero-tagline-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-full);
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: var(--accent-violet);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1.25rem;
}

.hero-headline {
  font-size: clamp(2.25rem, 5vw + 1rem, 3.8rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 1.25rem;
}

.gradient-text {
  background: linear-gradient(135deg, #ffffff 10%, var(--accent-cyan) 50%, var(--accent-violet) 90%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
[data-theme="light"] .gradient-text {
  background: linear-gradient(135deg, #0f172a 10%, #0891b2 50%, #6d28d9 90%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subheadline {
  font-size: 1.2rem;
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 600px;
  margin-bottom: 2rem;
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.hero-visual {
  position: relative;
  width: 100%;
  height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#hero-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
  pointer-events: none;
  z-index: 1;
}

/* Pure CSS 3D Fallback Animation if WebGL / Three.js is unavailable */
.css-3d-fallback {
  position: relative;
  width: 220px;
  height: 220px;
  perspective: 800px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 0;
}

.css-3d-cube {
  width: 120px;
  height: 120px;
  position: relative;
  transform-style: preserve-3d;
  animation: rotateCube 14s infinite linear;
}

.css-3d-face {
  position: absolute;
  width: 120px;
  height: 120px;
  border: 2px solid var(--accent-cyan);
  background: rgba(6, 182, 212, 0.1);
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.2);
  border-radius: var(--radius-sm);
}
.css-3d-face.f1 { transform: rotateY(0deg) translateZ(60px); }
.css-3d-face.f2 { transform: rotateY(90deg) translateZ(60px); }
.css-3d-face.f3 { transform: rotateY(180deg) translateZ(60px); }
.css-3d-face.f4 { transform: rotateY(-90deg) translateZ(60px); }
.css-3d-face.f5 { transform: rotateX(90deg) translateZ(60px); }
.css-3d-face.f6 { transform: rotateX(-90deg) translateZ(60px); }

.css-3d-ring {
  position: absolute;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  border: 1px dashed var(--accent-violet);
  transform-style: preserve-3d;
  animation: rotateRing 20s infinite linear reverse;
}

@keyframes rotateCube {
  0% { transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
  100% { transform: rotateX(360deg) rotateY(720deg) rotateZ(360deg); }
}

@keyframes rotateRing {
  0% { transform: rotateX(65deg) rotateY(0deg); }
  100% { transform: rotateX(65deg) rotateY(360deg); }
}

/* --------------------------------------------------------------------------
   6. Truthful Stats Strip & Badges
   -------------------------------------------------------------------------- */
.stats-strip {
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  padding: 2.25rem 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
  text-align: center;
}

.stat-item {
  padding: 0.5rem;
}

.stat-number {
  display: block;
  font-size: clamp(2rem, 3vw, 2.75rem);
  font-weight: 800;
  color: var(--accent-cyan);
  line-height: 1.1;
  margin-bottom: 0.35rem;
}

.stat-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* --------------------------------------------------------------------------
   7. Glassmorphism Cards & Grids
   -------------------------------------------------------------------------- */
.section {
  padding: 4.5rem 0;
}
.section-alt {
  background: var(--bg-secondary);
}

.section-header {
  text-align: center;
  max-width: 750px;
  margin: 0 auto 3.5rem;
}
.section-subtitle {
  color: var(--accent-cyan);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}
.section-title {
  margin-bottom: 1rem;
}
.section-desc {
  font-size: 1.1rem;
  color: var(--text-secondary);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
}

.tool-card, .post-card, .trust-card, .feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.tool-card::before, .post-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-violet), var(--accent-cyan));
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.tool-card:hover, .post-card:hover, .trust-card:hover, .feature-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  border-color: var(--border-medium);
}

.tool-card:hover::before, .post-card:hover::before {
  opacity: 1;
}

.card-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
  color: var(--accent-violet);
}

.card-title {
  font-size: 1.35rem;
  margin-bottom: 0.75rem;
}

.card-title a {
  color: var(--text-primary);
  text-decoration: none;
}
.card-title a:hover {
  color: var(--accent-cyan);
}

.card-text {
  flex-grow: 1;
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}
.badge-gold {
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent-gold);
  border-color: rgba(245, 158, 11, 0.3);
}
.badge-cyan {
  background: rgba(6, 182, 212, 0.12);
  color: var(--accent-cyan);
  border-color: rgba(6, 182, 212, 0.3);
}

/* --------------------------------------------------------------------------
   8. Calculator Interface Styles
   -------------------------------------------------------------------------- */
.calculator-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  margin: 2.5rem 0 3.5rem;
}

.calc-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 2.5rem;
  align-items: start;
}

.calc-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.currency-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 0.5rem;
}
.currency-bar label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  position: relative;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.form-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.input-hint {
  font-size: 0.8rem;
  font-weight: normal;
  color: var(--text-muted);
}

.form-input, .form-select {
  width: 100%;
  min-height: 44px;
  padding: 0.65rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-violet-glow);
}

.input-with-symbol {
  position: relative;
  display: flex;
  align-items: center;
}

.input-symbol {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  font-weight: 600;
  pointer-events: none;
}
.input-with-symbol .form-input {
  padding-left: 2.2rem;
}

.form-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.92rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.form-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-violet);
  cursor: pointer;
}

.field-error {
  color: var(--accent-red);
  font-size: 0.8rem;
  font-weight: 500;
  display: none;
  margin-top: 0.2rem;
}
.has-error .form-input {
  border-color: var(--accent-red);
}
.has-error .field-error {
  display: block;
}

.calc-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

/* Calculator Results Panel */
.calc-results-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: sticky;
  top: calc(var(--header-height) + 1.5rem);
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.75rem;
}

.primary-result-box {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.12), rgba(6, 182, 212, 0.12));
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: center;
}

.primary-result-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.primary-result-val {
  font-size: clamp(2rem, 3.5vw, 2.6rem);
  font-weight: 800;
  color: var(--accent-cyan);
  line-height: 1.1;
}

.results-metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.metric-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
}

.metric-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.2rem;
}

.metric-val {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Results Breakdown Table */
.results-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.results-table th, .results-table td {
  padding: 0.65rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

.results-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
}

.results-table td.val-col {
  text-align: right;
  font-weight: 600;
  color: var(--text-primary);
}

/* Custom Canvas/SVG Chart Container */
.chart-box {
  width: 100%;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 1px solid var(--border-subtle);
}

.chart-canvas {
  width: 100%;
  max-width: 320px;
  height: 160px;
  display: block;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin-top: 0.75rem;
  font-size: 0.8rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.legend-color {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

/* Verification Note */
.verification-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.verification-badge a {
  color: var(--accent-gold);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   9. Educational Content & Blog Typography
   -------------------------------------------------------------------------- */
.content-wrapper {
  max-width: 860px;
  margin: 0 auto;
  padding: 2.5rem 0 4rem;
}

.article-header {
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 2rem;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.article-meta-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Table of Contents */
.toc-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-medium);
  border-left: 4px solid var(--accent-violet);
  border-radius: var(--radius-md);
  padding: 1.5rem 2rem;
  margin: 2rem 0 2.5rem;
}

.toc-title {
  font-size: 1.15rem;
  margin-bottom: 0.75rem;
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-list li {
  margin-bottom: 0.5rem;
}

.toc-list li a {
  color: var(--text-secondary);
  font-size: 0.95rem;
  text-decoration: none;
}
.toc-list li a:hover {
  color: var(--accent-cyan);
  text-decoration: underline;
}

.article-body h2 {
  margin-top: 2.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.article-body h3 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: var(--accent-cyan);
}

.article-body p {
  font-size: 1.05rem;
  line-height: 1.75;
  margin-bottom: 1.5rem;
}

.article-body ul, .article-body ol {
  font-size: 1.05rem;
  line-height: 1.75;
  margin-bottom: 1.75rem;
}

.callout {
  background: var(--bg-tertiary);
  border-left: 4px solid var(--accent-cyan);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 1.25rem 1.75rem;
  margin: 2rem 0;
}
.callout-warning {
  border-left-color: var(--accent-gold);
  background: rgba(245, 158, 11, 0.08);
}
.callout-title {
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

/* Worked Example Box */
.example-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin: 1.5rem 0 2rem;
}
.example-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  color: var(--accent-gold);
  margin-bottom: 0.75rem;
}

/* Data Table in Articles */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  margin: 2rem 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  text-align: left;
}

.data-table th, .data-table td {
  padding: 0.9rem 1.2rem;
  border-bottom: 1px solid var(--border-subtle);
}

.data-table th {
  background: var(--bg-tertiary);
  font-weight: 700;
  color: var(--text-primary);
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* FAQ Section Accordion */
.faq-section {
  margin: 3.5rem 0;
}

.faq-item {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  margin-bottom: 1rem;
  overflow: hidden;
  transition: border-color var(--transition-fast);
}

.faq-item:hover {
  border-color: var(--border-medium);
}

.faq-question {
  width: 100%;
  padding: 1.25rem 1.5rem;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.faq-icon {
  font-size: 1.2rem;
  transition: transform 0.25s ease;
  color: var(--accent-cyan);
}

.faq-item.active .faq-icon {
  transform: rotate(45deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0, 1, 0, 1);
  padding: 0 1.5rem;
}

.faq-item.active .faq-answer {
  max-height: 1000px;
  padding: 0 1.5rem 1.25rem;
}

/* Author Box */
.author-box {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin: 3.5rem 0;
}

.author-avatar {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent-violet), var(--accent-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  font-weight: 800;
  color: #ffffff;
  flex-shrink: 0;
}

.author-info h4 {
  margin-bottom: 0.25rem;
}

.author-role {
  font-size: 0.85rem;
  color: var(--accent-cyan);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.author-bio {
  font-size: 0.9rem;
  margin: 0;
}

/* --------------------------------------------------------------------------
   10. Breadcrumbs & Ad Slots
   -------------------------------------------------------------------------- */
.breadcrumbs {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  font-size: 0.85rem;
}

.breadcrumb-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.breadcrumb-item a {
  color: var(--text-muted);
  text-decoration: none;
}
.breadcrumb-item a:hover {
  color: var(--accent-cyan);
}

.breadcrumb-item + .breadcrumb-item::before {
  content: "›";
  margin-right: 0.5rem;
  color: var(--text-muted);
}

.breadcrumb-item.active {
  color: var(--text-primary);
  font-weight: 600;
}

/* AdSense Reusable Container - Zero CLS */
.ad-slot {
  width: 100%;
  margin: 2.5rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px;
}

.ad-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 6px;
  user-select: none;
}

.ad-content-placeholder {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Specific heights to preserve layout */
.ad-slot-top {
  min-height: 90px;
}
.ad-slot-in-content {
  min-height: 250px;
}
.ad-slot-footer {
  min-height: 90px;
}
.ad-slot-sidebar {
  min-height: 600px;
}

/* --------------------------------------------------------------------------
   11. Footer & Cookie Banner
   -------------------------------------------------------------------------- */
.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  padding: 4.5rem 0 2rem;
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 3.5rem;
}

.brand-col .footer-tagline {
  margin: 1.25rem 0;
  font-size: 0.95rem;
  max-width: 320px;
}

.footer-heading {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li {
  margin-bottom: 0.65rem;
}

.footer-links a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-decoration: none;
  transition: color var(--transition-fast);
}
.footer-links a:hover {
  color: var(--accent-cyan);
  text-decoration: underline;
}

.footer-bottom {
  border-top: 1px solid var(--border-subtle);
  padding-top: 2rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer-bottom a {
  color: var(--text-secondary);
}

.disclaimer-note {
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text-muted);
  max-width: 900px;
  margin: 0;
}

/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 25px;
  right: 25px;
  width: 46px;
  height: 46px;
  border-radius: var(--radius-full);
  background: var(--accent-violet);
  color: #ffffff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 15px var(--accent-violet-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(15px);
  transition: all var(--transition-normal);
  z-index: 999;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.back-to-top:hover {
  background: #7c3aed;
  transform: translateY(-3px);
}

/* Cookie Banner */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border-medium);
  padding: 1.25rem 0;
  z-index: 100000;
  box-shadow: var(--shadow-lg);
}

.cookie-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.cookie-text p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.cookie-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   12. Scroll Reveal & Animations
   -------------------------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   13. Responsive Media Queries
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .hero-grid {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 2rem;
  }
  .hero-subheadline {
    margin-left: auto;
    margin-right: auto;
  }
  .hero-ctas {
    justify-content: center;
  }
  .hero-visual {
    height: 320px;
  }
  .calc-grid {
    grid-template-columns: 1fr;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
  }
}

@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
  }
  .mobile-menu-toggle {
    display: flex;
  }
  .main-nav {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    padding: 2rem 1.5rem;
    flex-direction: column;
    align-items: flex-start;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    overflow-y: auto;
  }
  .main-nav.open {
    transform: translateX(0);
  }
  .nav-list {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    gap: 1rem;
  }
  .dropdown-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    background: var(--bg-tertiary);
    width: 100%;
    border-radius: var(--radius-sm);
    margin-top: 0.5rem;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .cookie-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  .cookie-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .footer-grid {
    grid-template-columns: 1fr;
  }
  .calculator-wrapper {
    padding: 1.5rem;
  }
  .calc-actions {
    flex-direction: column;
  }
}

/* Reduced Motion preference */
@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;
  }
  .css-3d-cube, .css-3d-ring {
    animation: none !important;
  }
  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
}
