/* ==============================
   PUBLIC PAGES — "Warm & Grounded"
   Shared styles for all non-authenticated pages.
   Scoped to .v2-public wrapper class.
   ============================== */

/* ===== Shell override — break out of dark app chrome ===== */
/* When the public shell is active, force the entire page warm */
body:has(.v2-public-shell) {
    background: #faf6f0 !important;
    color: #2c2417 !important;
}
/* Kill the sidebar layout styles */
.v2-public-shell {
    display: block !important;
    background: #faf6f0 !important;
}
.v2-public-shell .v2-mobile-header { display: none !important; }
.v2-public-shell .v2-md-nav { display: none !important; }
body:has(.v2-public-shell) .v2-theme-toggle-float { display: none !important; }
.v2-public-shell .v2-main {
    margin: 0 !important; padding: 0 !important;
    max-width: none !important; width: 100% !important;
}
.v2-public-shell .v2-main-inner {
    max-width: none !important; padding: 0 !important;
}

/* ===== Warm Palette Tokens ===== */
.v2-public {
    --md-bg: #faf6f0;
    --md-surface: #ece4d6;
    --md-surface-raised: #fff9f0;
    --md-surface-hover: #ebe4d8;
    --md-text: #2c2417;
    --md-text-secondary: #6b5d4f;
    --md-text-muted: #7a6c5c;
    --md-green: #2d5f3f;
    --md-green-light: #3a7a52;
    --md-green-dim: rgba(45, 95, 63, 0.08);
    --md-gold: #9e7f1f;
    --md-gold-light: #d4a84b;
    --md-gold-dim: rgba(184, 146, 45, 0.08);
    --md-gold-glow: rgba(184, 146, 45, 0.12);
    --md-gold-border: rgba(184, 146, 45, 0.25);
    --md-border: rgba(44, 36, 23, 0.08);
    --md-border-mid: rgba(44, 36, 23, 0.14);

    /* Verdict tiers (same values, work on light bg) */
    --md-emerald: #10b981;
    --md-discern: #06b6d4;
    --md-caution: #d97706;
    --md-avoid: #ef4444;

    /* Verdict tier dim backgrounds */
    --md-emerald-dim: rgba(16, 185, 129, 0.08);
    --md-discern-dim: rgba(6, 182, 212, 0.08);
    --md-caution-dim: rgba(217, 119, 6, 0.08);
    --md-avoid-dim: rgba(239, 68, 68, 0.08);

    /* Border radius scale */
    --md-radius-sm: 10px;
    --md-radius-md: 14px;
    --md-radius-lg: 16px;
    --md-radius-xl: 20px;
    --md-radius-pill: 50px;

    /* Shadow scale */
    --md-shadow-sm: 0 1px 3px rgba(44, 36, 23, 0.06);
    --md-shadow-md: 0 4px 16px rgba(44, 36, 23, 0.08);
    --md-shadow-lg: 0 8px 40px rgba(44, 36, 23, 0.1);

    /* Footer palette */
    --md-footer-bg: #1e3328;
    --md-footer-text: rgba(237, 232, 223, 0.6);
    --md-footer-text-hover: rgba(237, 232, 223, 0.9);
    --md-footer-text-dim: rgba(237, 232, 223, 0.4);

    /* Hero font size */
    --fs-hero: clamp(2.8rem, 2.2rem + 2.8vw, 4.8rem);

    /* Generous section spacing */
    --md-section: clamp(5rem, 4rem + 5vw, 10rem);
    --md-section-lg: clamp(6rem, 5rem + 6vw, 12rem);

    background: var(--md-bg);
    color: var(--md-text);
    font-family: 'Source Sans 3', 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: var(--fs-base);
    line-height: 1.65;
    overflow-x: hidden;
    min-height: 100vh;
}

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

/* Subtle paper noise texture */
.v2-public::after {
    content: '';
    position: fixed; inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
    background-size: 256px 256px;
    pointer-events: none;
    z-index: 0;
    opacity: 0.5;
}

/* Ensure content sits above noise */
.v2-public > * { position: relative; z-index: 1; }

/* ---------- Containers ---------- */
.v2-md-container { max-width: 1200px; margin: 0 auto; padding: 0 clamp(1.5rem, 3vw, 4rem); }
.v2-md-container-wide { max-width: 1400px; margin: 0 auto; padding: 0 clamp(1.5rem, 3vw, 4rem); }

/* ---------- Navigation ---------- */
.v2-md-nav {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-md) clamp(1.5rem, 3vw, 4rem);
    max-width: 1400px; margin: 0 auto;
}
.v2-md-nav-brand {
    font-family: 'Lora', Georgia, serif;
    font-size: var(--fs-lg); font-weight: 500;
    color: var(--md-green);
    text-decoration: none; letter-spacing: -0.01em;
    display: inline-flex; align-items: center; gap: 0.4rem;
}
.v2-md-nav-brand i {
    opacity: 0.6; color: var(--md-gold);
    font-size: 0.75em;
}
.v2-md-nav-links {
    display: flex; align-items: center; gap: var(--space-md);
}
.v2-md-nav-links a:not(.v2-btn-apple) {
    font-size: var(--fs-sm); color: var(--md-text-secondary);
    text-decoration: none; font-weight: 400;
    transition: color 0.2s;
}
.v2-md-nav-links a:not(.v2-btn-apple):hover { color: var(--md-text); }
.v2-md-nav-links a:not(.v2-btn-apple).active {
    color: var(--md-green); font-weight: 600;
}
/* Hamburger toggle — hidden on desktop */
.v2-md-nav-toggle {
    display: none; background: none; border: none; cursor: pointer;
    color: var(--md-text); font-size: 1.25rem; padding: 0.25rem;
    line-height: 1;
}

@media (max-width: 767px) {
    .v2-md-nav { position: relative; }
    .v2-md-nav-toggle { display: block; order: 2; }
    .v2-md-nav-links {
        display: none; flex-direction: column; gap: var(--space-sm);
        position: absolute; top: 100%; left: 0; right: 0;
        background: rgba(250, 246, 240, 0.98);
        backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
        border-bottom: 1px solid var(--md-border-mid);
        padding: var(--space-md) clamp(1.5rem, 3vw, 4rem);
        box-shadow: 0 4px 16px rgba(44, 36, 23, 0.08);
        z-index: 100;
    }
    .v2-md-nav-links.open { display: flex; }
    .v2-md-nav-links a:not(.v2-btn-apple) {
        display: block; font-size: var(--fs-base); padding: var(--space-xs) 0;
    }
}

/* ---------- Auth Nav (logged-in user elements) ---------- */
.v2-md-nav-user {
    display: inline-flex; align-items: center; gap: 0.4rem;
}
.v2-md-nav-avatar {
    width: 28px; height: 28px; border-radius: 50%;
    background: linear-gradient(135deg, var(--md-green), #1a4a2e);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 0.7rem; font-weight: 600;
    overflow: hidden; flex-shrink: 0;
}
.v2-md-nav-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.v2-md-nav-username {
    font-size: var(--fs-sm); color: var(--md-text); font-weight: 500;
}
.v2-md-nav-logout {
    font-size: var(--fs-sm); color: var(--md-text-muted);
    text-decoration: none; transition: color 0.2s;
}
.v2-md-nav-logout:hover { color: var(--md-avoid); }

@media (max-width: 767px) {
    .v2-md-nav-user { padding: var(--space-xs) 0; }
    .v2-md-nav-logout { padding: var(--space-xs) 0; }
}

/* ---------- Buttons ---------- */
.v2-public .v2-btn-apple,
.v2-public a.v2-btn-apple {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    background: #000; color: #fff;
    font-family: -apple-system, 'SF Pro Text', 'Helvetica Neue', sans-serif;
    font-size: 16px; font-weight: 500; letter-spacing: 0.01em;
    padding: 0 1.5rem; height: 44px; min-width: 200px;
    border-radius: 12px; border: none;
    cursor: pointer; text-decoration: none;
    transition: all 0.25s ease;
}
.v2-public .v2-btn-apple:hover,
.v2-public a.v2-btn-apple:hover {
    background: #1a1a1a; color: #fff; transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    text-decoration: none;
}
.v2-btn-apple-lg { font-size: 18px; height: 52px; min-width: 260px; padding: 0 2rem; }
.v2-btn-apple svg { flex-shrink: 0; position: relative; top: 1px; }

.v2-public .v2-btn-primary {
    display: inline-flex; align-items: center; gap: 0.5rem;
    background: var(--md-green); color: #fff;
    font-family: 'Source Sans 3', sans-serif; font-size: var(--fs-sm); font-weight: 600;
    padding: 0.75rem 1.75rem; border-radius: 10px; border: none;
    cursor: pointer; text-decoration: none;
    transition: all 0.25s ease;
    box-shadow: 0 2px 8px rgba(45, 95, 63, 0.2);
}
.v2-public .v2-btn-primary:hover {
    background: var(--md-green-light); color: #fff;
    transform: translateY(-1px); text-decoration: none;
    box-shadow: 0 4px 16px rgba(45, 95, 63, 0.25);
}

.v2-public .v2-btn-outline {
    display: inline-flex; align-items: center; gap: 0.5rem;
    background: transparent; color: var(--md-text-secondary);
    font-family: 'Source Sans 3', sans-serif; font-size: var(--fs-sm); font-weight: 500;
    padding: 0.75rem 1.75rem; border-radius: 10px;
    border: 1px solid var(--md-border-mid);
    cursor: pointer; text-decoration: none;
    transition: all 0.25s ease;
}
.v2-public .v2-btn-outline:hover {
    color: var(--md-text); border-color: var(--md-gold-border);
    text-decoration: none;
}

.v2-auth-buttons { display: flex; gap: var(--space-sm); flex-wrap: wrap; align-items: center; }

/* ---------- Sticky CTA Bar ---------- */
.v2-sticky-cta {
    position: fixed; top: 0; left: 0; right: 0;
    background: rgba(250, 246, 240, 0.92);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--md-border-mid);
    z-index: 9999; transform: translateY(-100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    padding: var(--space-sm) 0;
}
.v2-sticky-cta.visible { transform: translateY(0); }
.v2-sticky-cta .v2-md-container-wide { display: flex; justify-content: space-between; align-items: center; }
.v2-sticky-cta-text {
    color: var(--md-text-secondary); font-size: var(--fs-sm);
    font-weight: 500; display: none;
}
.v2-sticky-cta-text i { color: var(--md-gold); }
@media (min-width: 768px) { .v2-sticky-cta-text { display: inline; } }

/* ---------- Typography ---------- */
.v2-public h1, .v2-public h2, .v2-public h3 {
    font-family: 'Lora', Georgia, serif;
    font-weight: 600; color: var(--md-text);
}

.v2-section-eyebrow {
    font-family: 'Source Sans 3', sans-serif;
    font-size: var(--fs-xs); font-weight: 600;
    color: var(--md-gold); letter-spacing: 0.1em; text-transform: uppercase;
    margin-bottom: var(--space-sm);
    display: flex; align-items: center; gap: 0.5rem;
}
.v2-section-eyebrow::before {
    content: ''; width: 16px; height: 1px; background: var(--md-gold);
}

.v2-section-heading {
    font-family: 'Lora', Georgia, serif;
    font-size: var(--fs-2xl); font-weight: 600;
    color: var(--md-text); margin: 0 0 clamp(1rem, 1.5vw, 2rem);
    line-height: 1.2; letter-spacing: -0.01em;
}
.v2-section-heading-sm {
    font-family: 'Lora', Georgia, serif;
    font-size: var(--fs-xl); font-weight: 600;
    color: var(--md-text); margin: 0 0 clamp(1rem, 1.5vw, 2rem);
    line-height: 1.25;
}

.v2-section-sub {
    font-size: var(--fs-md); color: var(--md-text-secondary);
    margin: 0 0 var(--space-sm); max-width: 540px; line-height: 1.7;
}

/* ---------- Gold Divider ---------- */
.v2-gold-rule {
    height: 1px; border: none; margin: 0;
    background: linear-gradient(90deg, transparent 0%, var(--md-gold-border) 20%, var(--md-gold) 50%, var(--md-gold-border) 80%, transparent 100%);
    opacity: 0.7;
}

/* ---------- Scripture Blocks ---------- */
.v2-scripture-quote {
    max-width: 860px; margin: 0 auto clamp(1rem, 1.5vw, 1.5rem); padding: 0;
    font-family: 'Lora', Georgia, serif;
    font-size: var(--fs-xl); font-style: italic; font-weight: 400;
    color: var(--md-text); line-height: 1.55;
    text-align: center;
}
.v2-scripture-cite {
    font-family: 'Source Sans 3', sans-serif;
    font-size: var(--fs-sm); font-style: normal;
    color: var(--md-gold); font-weight: 600;
    display: flex; align-items: center; justify-content: center; gap: 0.5rem;
    letter-spacing: 0.03em;
}
.v2-scripture-cite::before,
.v2-scripture-cite::after {
    content: ''; width: 32px; height: 1px;
    background: var(--md-gold-border);
}

/* Inline scripture block (in cards) */
.v2-md-scripture-block {
    background: var(--md-gold-dim);
    border-left: 2px solid var(--md-gold);
    border-radius: 0 var(--radius-sm, 8px) var(--radius-sm, 8px) 0;
    padding: var(--space-sm) var(--space-md);
}
.v2-md-scripture-block .v2-md-scripture-ref {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.7rem; font-weight: 600; color: var(--md-gold);
    letter-spacing: 0.04em; text-transform: uppercase;
    margin: 0 0 3px;
}
.v2-md-scripture-block .v2-md-scripture-text {
    font-family: 'Lora', Georgia, serif;
    font-size: var(--fs-xs); color: var(--md-text-secondary);
    font-style: italic; line-height: 1.55; margin: 0;
}

/* ---------- Cards ---------- */
.v2-public .v2-md-card {
    background: var(--md-surface-raised);
    border: 1px solid var(--md-border-mid);
    border-radius: var(--md-radius-lg);
    box-shadow: var(--md-shadow-sm);
    transition: all 0.3s ease;
}
.v2-public .v2-md-card:hover {
    border-color: var(--md-gold-border);
    transform: translateY(-2px);
    box-shadow: var(--md-shadow-md);
}

/* ---------- Verdict Tags ---------- */
.v2-verdict-list { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.v2-verdict-tag {
    font-size: var(--fs-xs); font-weight: 600;
    padding: 0.35rem 0.8rem; border-radius: 50px;
}
.v2-verdict-tag-listen { color: var(--md-emerald); background: var(--md-emerald-dim); }
.v2-verdict-tag-discern { color: var(--md-discern); background: var(--md-discern-dim); }
.v2-verdict-tag-caution { color: var(--md-caution); background: var(--md-caution-dim); }
.v2-verdict-tag-avoid { color: var(--md-avoid); background: var(--md-avoid-dim); }

/* ---------- Beta Badge ---------- */
.v2-beta-badge {
    display: inline-flex; align-items: center; gap: 0.4rem;
    background: var(--md-gold-dim);
    border: 1px solid var(--md-gold-border);
    color: var(--md-gold); font-size: var(--fs-xs); font-weight: 600;
    padding: 0.4rem 1rem; border-radius: 50px;
    margin-bottom: var(--space-md);
}
.v2-beta-badge i { font-size: 0.7rem; }

/* ---------- Accordion ---------- */
.v2-accordion-item {
    background: var(--md-surface-raised);
    border: 1px solid var(--md-border-mid);
    border-radius: var(--md-radius-md); margin-bottom: var(--space-sm); overflow: hidden;
    transition: border-color 0.3s;
}
.v2-accordion-item.open { border-color: var(--md-gold-border); }
.v2-accordion-btn {
    width: 100%; background: none; border: none; padding: var(--space-md);
    text-align: left; font-family: 'Source Sans 3', sans-serif;
    font-size: var(--fs-sm); font-weight: 600; color: var(--md-text);
    cursor: pointer; display: flex; justify-content: space-between; align-items: center;
    transition: color 0.2s;
}
.v2-accordion-btn:hover { color: var(--md-green); }
.v2-accordion-btn::after {
    content: '+'; font-size: var(--fs-lg); color: var(--md-text-muted);
    font-weight: 300; flex-shrink: 0; margin-left: var(--space-sm);
}
.v2-accordion-item.open .v2-accordion-btn::after { content: '\2212'; }
.v2-accordion-body { max-height: 0; overflow: hidden; transition: max-height 0.35s ease; }
.v2-accordion-item.open .v2-accordion-body { max-height: 2000px; }
.v2-accordion-content {
    padding: 0 var(--space-md) var(--space-md);
    font-size: var(--fs-sm); color: var(--md-text-secondary); line-height: 1.7;
}
.v2-accordion-content a { color: var(--md-green); text-decoration: underline; }

/* ---------- Trust / Icon Points ---------- */
.v2-trust-points { display: flex; flex-direction: column; gap: var(--space-md); }
.v2-trust-point { display: flex; gap: var(--space-md); align-items: flex-start; }
.v2-trust-point-icon { flex-shrink: 0; font-size: 1.5rem; line-height: 1; }
.v2-trust-point h4 {
    font-family: 'Source Sans 3', sans-serif;
    font-size: var(--fs-sm); font-weight: 600; color: var(--md-text); margin: 0 0 0.25rem;
}
.v2-trust-point p { font-size: var(--fs-sm); color: var(--md-text-secondary); margin: 0; line-height: 1.6; }

/* ---------- Footer ---------- */
.v2-public-footer {
    background: var(--md-footer-bg);
    border-top: none;
    padding: clamp(2.5rem, 4vw, 4rem) 0 clamp(2rem, 3vw, 3rem);
    text-align: center;
}
.v2-public-footer-links {
    display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-md);
    margin-bottom: var(--space-md);
}
.v2-public-footer-links a {
    font-size: var(--fs-xs); color: var(--md-footer-text);
    text-decoration: none; transition: color 0.2s;
}
.v2-public-footer-links a:hover { color: var(--md-footer-text-hover); }
.v2-public-footer-icon {
    color: var(--md-gold-light); opacity: 0.35; font-size: 1rem;
    margin-bottom: var(--space-sm); display: block;
}
.v2-public-footer-copy {
    font-size: var(--fs-xs); color: var(--md-footer-text-dim);
}
.v2-public-footer .v2-provider-badge {
    color: var(--md-footer-text-dim);
}

/* ---------- Provider Attribution ---------- */
.v2-provider-attribution {
    display: flex; justify-content: center; gap: var(--space-lg);
    padding: var(--space-md) 0;
    font-size: var(--fs-xs); color: var(--md-text-muted);
}
.v2-provider-badge { display: inline-flex; align-items: center; gap: 0.4rem; }

/* ---------- Animations ---------- */
@keyframes v2-fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes v2-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes v2-cardReveal {
    from { opacity: 0; transform: translateX(40px) scale(0.96); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}

.v2-fade-in {
    opacity: 0; transform: translateY(20px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}
.v2-fade-in.visible { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
    .v2-fade-in { opacity: 1; transform: none; transition: none; }
    .v2-public [style*="animation"] { animation: none !important; opacity: 1 !important; }
    .v2-sticky-cta { transition: none; }
}

/* ---------- Accessibility ---------- */
.v2-sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.v2-public .v2-btn-apple:focus-visible,
.v2-public a.v2-btn-apple:focus-visible,
.v2-public .v2-btn-primary:focus-visible,
.v2-public .v2-btn-outline:focus-visible {
    outline: 2px solid var(--md-green); outline-offset: 2px;
}
.v2-accordion-btn:focus-visible {
    outline: 2px solid var(--md-gold); outline-offset: -2px;
}
.v2-md-nav-links a:focus-visible {
    outline: 2px solid var(--md-green); outline-offset: 2px;
}
.v2-md-nav-toggle:focus-visible {
    outline: 2px solid var(--md-green); outline-offset: 2px;
}

/* ---------- Page-Level Layout (for secondary pages) ---------- */
.v2-public-page {
    padding: var(--space-xl) 0 var(--md-section);
}
.v2-public-page-header {
    text-align: center;
    margin-bottom: var(--space-xl);
}
.v2-public-page-header h1 {
    font-family: 'Lora', Georgia, serif;
    font-size: var(--fs-2xl); font-weight: 600;
    color: var(--md-text); margin: 0 0 var(--space-xs);
}
.v2-public-page-header p {
    font-size: var(--fs-md); color: var(--md-text-secondary);
    margin: 0;
}

/* Content blocks for legal/text pages */
.v2-public-content {
    max-width: 760px; margin: 0 auto;
}
.v2-public-content h2 {
    font-family: 'Lora', Georgia, serif;
    font-size: var(--fs-xl); font-weight: 600;
    color: var(--md-text); margin: var(--space-xl) 0 var(--space-sm);
}
.v2-public-content h3 {
    font-family: 'Source Sans 3', sans-serif;
    font-size: var(--fs-md); font-weight: 600;
    color: var(--md-text); margin: var(--space-lg) 0 var(--space-xs);
}
.v2-public-content p, .v2-public-content li {
    font-size: var(--fs-sm); color: var(--md-text-secondary);
    line-height: 1.75; margin: 0 0 var(--space-sm);
}
.v2-public-content ul, .v2-public-content ol {
    padding-left: 1.5rem; margin: 0 0 var(--space-md);
}
.v2-public-content a { color: var(--md-green); text-decoration: underline; }
.v2-public-content a:hover { color: var(--md-green-light); }
.v2-public-content strong { color: var(--md-text); }
