/* =========================================
   1. CSS Variables (The Palette)
   ========================================= */
:root {
    /* Brand Colors */
    --primary: #8b5cf6;
    --primary-hover: #7c3aed;
    --accent: #ddd6fe;

    /* Theme Tokens: Premium Slate (Inspired by home3.md) */
    --bg-body: #f8fafc;      /* Slate-50 */
    --bg-alternate: #ffffff;  /* White */
    --bg-surface: #ffffff;    /* White */
    
    /* Typography Palette */
    --text-main: #0f172a;    /* Slate-900 (Bold Headers) */
    --text-muted: #475569;   /* Slate-600 (Balanced Body) */
    --text-light: #64748b;   /* Slate-500 (Clean Meta) */
    
    /* Decorative & Semantic */
    --bg-quote: #f8fafc;     /* Slate-50 */
    --border-color: rgba(226, 232, 240, 0.6); /* Slate-200 at 60% opacity */
    
    --code-bg: #1e293b;
    --code-text: #f1f5f9;
}

/* Dark Mode Overrides */
.theme-dark {
    /* Theme Tokens: Dark Mode Override */
    --bg-body: #020617;      /* Slate-950 */
    --bg-alternate: #0a0a0a;  /* Near black */
    --bg-surface: #0f172a;   /* Slate-900 */

    --text-main: #f8fafc;    /* Slate-50 */
    --text-muted: #cbd5e1;   /* Slate-300 */
    --text-light: #94a3b8;   /* Slate-400 */
    
    --bg-quote: #0f172a;     /* Slate-900 */
    --border-color: rgba(255, 255, 255, 0.1);

    /* Explicit Re-binding for Tailwind Semantic Tokens */
    --color-body: var(--bg-body);
    --color-alternate: var(--bg-alternate);
    --color-surface: var(--bg-surface);
    --color-main: var(--text-main);
    --color-muted: var(--text-muted);
    --color-light: var(--text-light);
    --color-theme: var(--border-color);
}

/* =========================================
   2. Base Styles (Apply Variables)
   ========================================= */
body {
    background-color: var(--bg-body);
    color: var(--text-muted);
    /* Changed from Main to Muted for body default */
    font-family: 'Outfit', sans-serif;
    line-height: 1.75;
    /* Increased for modern spacing */
    transition: background-color 0.3s, color 0.3s;
}

/* =========================================
   3. Typography System (Scoped to Content Pages)
   ========================================= */
.layout-content main h1,
.layout-content main h2,
.layout-content main h3,
.layout-content main h4 {
    color: var(--text-main);
    letter-spacing: -0.025em;
    /* Tighter tracking for headings */
    margin-top: 3rem;
}

.layout-content main h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 2rem;
    line-height: 1.2;
    margin-top: 0;
}

.layout-content main h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.layout-content main h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.layout-content main p,
.layout-content main li {
    color: var(--text-muted);
    font-size: 1.125rem;
    margin-bottom: 1.75rem;
    /* More breathing room */
}

.layout-content main strong {
    color: var(--text-main);
    font-weight: 700;
}

/* Links - Underline Logic */
.layout-content main a {
    color: var(--primary);
    text-decoration: none;
    border-bottom: 2px solid rgba(147, 51, 234, 0.2);
    /* Subtle underline */
    transition: all 0.2s;
    font-weight: 500;
}

.layout-content main a:hover {
    color: var(--primary-hover);
    border-bottom-color: var(--primary);
    background: rgba(147, 51, 234, 0.05);
    /* Slight highlight on hover */
}

/* Quotes */
.layout-content main blockquote {
    border-left: 4px solid var(--primary);
    background: var(--bg-quote);
    padding: 1.5rem 2rem;
    margin: 3rem 0;
    font-style: italic;
    color: var(--text-main);
    border-radius: 16px;
    /* Increased radius */
}

/* Lists */
.layout-content main ul {
    list-style-type: disc;
    list-style-position: outside;
    padding-left: 1.75rem;
    margin-bottom: 2rem;
}

.layout-content main ol {
    list-style-type: decimal;
    list-style-position: outside;
    padding-left: 1.75rem;
    margin-bottom: 2rem;
}

.layout-content main li::marker {
    color: var(--text-muted);
    font-weight: normal;
}

/* Images */
.layout-content main img {
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    /* Softer shadow */
    margin: 3rem 0;
    width: 100%;
    height: auto;
}

/* Code */
.layout-content main pre {
    background: var(--code-bg);
    color: var(--code-text);
    padding: 1.5rem;
    border-radius: 12px;
    overflow-x: auto;
    margin: 2rem 0;
    font-size: 0.9em;
}

/* =========================================
   4. Layout Constraints
   ========================================= */
.layout-content main {
    max-width: 680px;
    /* Slight narrow for better reading */
    margin: 0 auto;
    padding: 120px 24px 80px;
}

.layout-landing main {
    max-width: 100%;
    padding: 0;
}

/* =========================================
   5. Special Components & Animations
   ========================================= */

/* Hero Background Glow */
.hero-glow {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 150%;
    height: 100%;
    background: radial-gradient(circle at 50% 0%, rgba(139, 92, 246, 0.12) 0%, rgba(59, 130, 246, 0.05) 30%, transparent 70%);
    z-index: 0;
    pointer-events: none;
    display: none;
}

.theme-dark .hero-glow {
    background: radial-gradient(circle at 50% 0%, rgba(147, 51, 234, 0.15) 0%, rgba(59, 130, 246, 0.05) 40%, transparent 80%);
}

@media (min-width: 768px) {
    .hero-glow {
        display: block;
    }
}

/* Sound Wave Animation */
.animate-sound {
    animation: sound-wave 1s ease-in-out infinite alternate;
}

@keyframes sound-wave {
    0% { height: 4px; opacity: 0.4; }
    100% { height: 16px; opacity: 1; }
}

/* Font Utility */
.font-outfit {
    font-family: 'Outfit', sans-serif;
}

/* Lazy Section Performance */
.section-lazy {
    content-visibility: auto;
    contain-intrinsic-size: 1px 500px;
}
/* =========================================
   6. Custom Input & Selection Components
   ========================================= */

/* Range Slider (ROI Calculator) */
input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  background: transparent;
}

input[type=range]:focus {
  outline: none;
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 20px;
  width: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.3);
  margin-top: -6px;
  border: 2px solid white;
}

input[type=range]::-webkit-slider-runnable-track {
  width: 100%;
  height: 8px;
  cursor: pointer;
  background: #e2e8f0; /* Slate-200 */
  border-radius: 4px;
}

/* Dark Mode Overrides for Sliders */
.theme-dark input[type=range]::-webkit-slider-runnable-track {
    background: rgba(255, 255, 255, 0.1);
}

/* Selection Styling */
.theme-light ::selection {
    background: #f3e8ff; /* Purple-100 */
    color: #581c87;      /* Purple-900 */
}

.theme-dark ::selection {
    background: #9333ea;
    color: #ffffff;
}
