:root {
    --primary: #2563EB; /* Modern premium blue */
    --secondary: #F8FAFC; /* Softer clinical white */
    --text: #1E293B; /* Slate dark */
    --bg: #FFFFFF;
    --accent: #3B82F6;
    --border: #E2E8F0;
    --font-heading: 'Georgia', serif;
    --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body.dark-mode {
    --text: #F1F5F9;
    --bg: #0F172A;
    --secondary: #1E293B;
    --primary: #60A5FA;
    --accent: #93C5FD;
    --border: #334155;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

body.dark-mode .journal-entry,
body.dark-mode .quiz-container,
body.dark-mode .support-section,
body.dark-mode .citation-box,
body.dark-mode .card,
body.dark-mode header,
body.dark-mode .result-box,
body.dark-mode .ad-container-leaderboard {
    background-color: var(--secondary);
    border-color: var(--border);
    color: var(--text);
}

body.dark-mode header {
    background-color: rgba(30, 41, 59, 0.85); /* Glassmorphism dark */
}

body.dark-mode h1, body.dark-mode h2, body.dark-mode h3 {
    color: #F8FAFC;
}

body.dark-mode .citation-box {
    background-color: #0F172A;
    border-left-color: var(--primary);
}

body.dark-mode .ad-container-leaderboard span {
    color: #CBD5E1 !important; /* Increased contrast for A11y */
}

body.dark-mode .eeat-badge {
    background: rgba(16, 185, 129, 0.15) !important;
    border-color: rgba(16, 185, 129, 0.4) !important;
    color: #34D399 !important;
}

body.dark-mode .ymyl-disclaimer {
    background-color: #1E293B;
    color: #E2E8F0; /* Increased contrast for A11y */
    border-color: var(--border);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    line-height: 1.7;
    color: var(--text);
    background: var(--bg);
    background-image: radial-gradient(circle at 10% 10%, rgba(59, 130, 246, 0.03) 0%, transparent 40%),
                      radial-gradient(circle at 90% 90%, rgba(59, 130, 246, 0.03) 0%, transparent 40%);
    background-attachment: fixed;
    margin: 0;
    padding: 0;
    transition: background-color 0.3s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
}

body.dark-mode {
    background-image: radial-gradient(circle at 10% 10%, rgba(96, 165, 250, 0.03) 0%, transparent 40%),
                      radial-gradient(circle at 90% 90%, rgba(96, 165, 250, 0.03) 0%, transparent 40%);
}

header {
    background: rgba(248, 250, 252, 0.85); /* Glassmorphism light */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 1.2rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
    transition: background-color 0.3s ease;
}

/* Header Layout & Navigation Styles */
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.05em;
    font-family: var(--font-heading);
}

.logo:hover {
    color: var(--primary);
    text-decoration: none;
}

#main-nav {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

#main-nav a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.5rem 0;
    transition: color 0.2s;
}

#main-nav a:hover {
    color: var(--primary);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
}

/* Mobile Header Adjustments */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }

    #main-nav {
        display: none;
        width: 100%;
        flex-direction: column;
        gap: 0;
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid var(--border);
    }

    #main-nav.active {
        display: flex;
    }

    #main-nav a {
        padding: 0.75rem 0;
        width: 100%;
        border-bottom: 1px solid rgba(0,0,0,0.05);
    }

    body.dark-mode #main-nav a {
        border-bottom-color: rgba(255,255,255,0.05);
    }

    #theme-toggle {
        margin-top: 1rem;
        align-self: flex-start;
    }
}

h1, h2, h3 {
    font-family: var(--font-heading);
    color: var(--text);
    font-weight: 700;
}

h1 { font-size: 2.8rem; margin-bottom: 0.5rem; letter-spacing: -0.02em; line-height: 1.1; }
h2 { font-size: 1.8rem; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; margin-top: 2.5rem; letter-spacing: -0.01em; }
h3 { font-size: 1.4rem; color: var(--accent); margin-top: 1.5rem; }

a { color: var(--primary); text-decoration: none; font-weight: 600; transition: color 0.2s ease; }
a:hover { color: var(--accent); text-decoration: underline; }

/* Focus states for accessibility */
a:focus, button:focus, input:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.container { max-width: 900px; margin: 0 auto; padding: 0 20px; }

/* Journal Specific Styles */
.journal-entry {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 2.5rem;
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    margin-bottom: 2.5rem;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.journal-entry:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

body.dark-mode .journal-entry {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(255, 255, 255, 0.05);
}

.citation-box {
    background: rgba(37, 99, 235, 0.05);
    border-left: 4px solid var(--primary);
    padding: 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    font-family: var(--font-heading);
    border-radius: 0 8px 8px 0;
    font-size: 1.1rem;
    line-height: 1.8;
}

body.dark-mode .citation-box {
    background: rgba(96, 165, 250, 0.05);
    border-left-color: var(--primary);
}

.ymyl-disclaimer {
    background: #fff3cd;
    color: #856404;
    padding: 1rem;
    margin-top: 3rem;
    border: 1px solid #ffeeba;
    border-radius: 4px;
    font-size: 0.9rem;
    text-align: center;
}

/* Floating Action Button (Newsletter) */
.fab-newsletter {
    position: fixed;
    bottom: 20px;
    /* Position to the right on desktop so it doesn't overlap centered text */
    right: 20px;
    left: auto;
    background: var(--primary);
    color: white;
    padding: 12px 20px;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    z-index: 997; /* Just below mobile CTA */
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s, box-shadow 0.3s;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}

.fab-newsletter.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.fab-newsletter:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.6);
    color: white;
    text-decoration: none;
}

.fab-icon {
    font-size: 1.2rem;
}

@media (max-width: 768px) {
    .fab-newsletter {
        bottom: 80px; /* Stay above sticky CTA */
        right: 20px;
        padding: 10px 16px;
        font-size: 0.85rem;
    }
    .fab-newsletter.visible {
        transform: translateY(0);
    }
}

/* Store / Custom Page Styles */
.store-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin: 3rem 0;
    align-items: center; /* Center items for scaling the middle tier */
}
.product-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 16px; /* Increased border radius for modern look */
    padding: 2.5rem 2rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

/* Highlighted middle tier */
.product-card.premium-tier {
    transform: scale(1.05);
    border-color: var(--primary);
    border-width: 2px;
    box-shadow: var(--shadow-lg);
    z-index: 10;
}

.product-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: var(--shadow-lg);
}
.product-card.premium-tier:hover {
    transform: translateY(-5px) scale(1.05);
}

.product-title {
    font-size: 1.6rem;
    font-family: var(--font-heading);
    color: var(--text);
    margin-bottom: 0.5rem;
    font-weight: 700;
}
.product-price {
    font-size: 3rem;
    font-weight: 800;
    color: var(--primary);
    margin: 1rem 0;
    letter-spacing: -0.05em;
}
.product-features {
    list-style: none;
    padding: 0;
    margin: 0 0 2rem 0;
    text-align: left;
    color: var(--text);
}
.product-features li {
    margin-bottom: 1rem;
    padding-left: 2rem;
    position: relative;
    font-size: 0.95rem;
}
.product-features li::before {
    content: '✓';
    color: #10B981; /* Success green checkmarks */
    position: absolute;
    left: 0;
    font-weight: bold;
    font-size: 1.1rem;
    background: rgba(16, 185, 129, 0.1);
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.best-value-badge {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: var(--primary);
    color: white;
    padding: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

@media (max-width: 768px) {
    .product-card.premium-tier {
        transform: scale(1); /* Reset scale on mobile */
    }
    .product-card.premium-tier:hover {
        transform: translateY(-5px);
    }
}

.quiz-container {
    background: var(--bg);
    padding: 2.5rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    max-width: 800px;
    margin: 2rem auto;
    box-shadow: var(--shadow-md);
}
.question { margin-bottom: 2rem; }
.options label {
    display: block;
    margin-bottom: 0.8rem;
    cursor: pointer;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
    background: var(--secondary);
    display: flex;
    align-items: center;
}
.options label:hover {
    border-color: var(--primary);
    transform: translateX(4px);
}
.options input[type="radio"] {
    margin-right: 1rem;
    transform: scale(1.2);
}
.result-box { display: none; background: var(--secondary); padding: 2rem; margin-top: 2rem; border: 1px solid var(--border); border-radius: 8px;}
.btn-submit { background: var(--primary); color: white; border: none; padding: 12px 24px; cursor: pointer; font-size: 1rem; font-weight: bold; border-radius: 8px; transition: background 0.2s; min-height:48px;}
.btn-submit:hover { background: var(--accent); }

/* Lexicon */
.lexicon-list dt { font-weight: bold; font-size: 1.2rem; color: var(--primary); margin-top: 1.5rem; font-family: var(--font-heading);}
.lexicon-list dd { margin-left: 0; margin-bottom: 1rem; padding-left: 1rem; border-left: 2px solid var(--border); }

/* Monetization Elements */
.btn-payment {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #0070ba; /* Keep Trust-Blue for PayPal recognizable conversion */
    color: #ffffff !important;
    padding: 12px 24px;
    border-radius: 8px; /* Modern rounding */
    font-weight: 600;
    min-height: 48px; /* Enhanced touch target */
    min-width: 48px;
    text-align: center;
    transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
    box-shadow: var(--shadow-sm);
    border: none;
    cursor: pointer;
}
.btn-payment:hover {
    background-color: #005ea6;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}
.btn-payment:active {
    transform: translateY(0);
}

.ad-container-leaderboard {
    background: #f0f0f0;
    min-height: 90px;
    margin: 2rem 0;
    display: flex;
    justify-content: center;
    align-items: center;
}
@media (max-width: 768px) {
    .ad-container-leaderboard {
        min-height: 250px; /* Pre-allocate space for responsive ads on mobile to prevent CLS */
    }
}

/* Enhanced Typography */
article p:first-of-type::first-letter {
    float: left;
    font-size: 3.5rem;
    line-height: 0.8;
    margin-right: 0.5rem;
    color: var(--primary);
    font-family: var(--font-heading);
    font-weight: 700;
}

blockquote {
    background: #f9f9f9;
    border-left: 5px solid var(--accent);
    margin: 1.5em 10px;
    padding: 0.5em 10px;
    font-style: italic;
    font-family: var(--font-heading);
}

body.dark-mode blockquote {
    background: #2c313d;
    color: #e2e8f0;
}
