/* ============================================================
   demo_weekly_analysis.css
   LIGHT / CRITICAL-PATH STYLESHEET
   Loaded synchronously so the report is usable and legible the
   instant HTML parses. Contains ONLY what is needed to avoid a
   flash of unstyled content: tokens, reset, nav, cookie banner,
   loader, and a bare-bones layout skeleton. All "wow" visuals
   (paint textures, 3D tilt, spring physics, chart animation)
   live in /cdn/demo_weekly_analysis.css and are swapped in once
   that file finishes downloading. Nothing in here should be
   considered final polish — it just has to not look broken.
   ============================================================ */

/* ===== DARK MODE (default) ===== */
:root {
    --bg: #0a0e17;
    --surface: #111827;
    --surface-hover: #1a2332;
    --text: #e2e8f0;
    --text-secondary: #94a3b8;
    --accent: #3b82f6;
    --accent-light: #60a5fa;
    --accent-glow: rgba(59, 130, 246, 0.3);
    --gold: #f59e0b;
    --good: #22c55e;
    --border: #1e293b;
    --border-light: #334155;
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --max-width: 1180px;
    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== LIGHT MODE (activated by body.light-mode) ===== */
body.light-mode {
    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-hover: #f1f5f9;
    --text: #0f172a;
    --text-secondary: #475569;
    --accent: #2563eb;
    --accent-light: #3b82f6;
    --accent-glow: rgba(37, 99, 235, 0.25);
    --gold: #d97706;
    --good: #16a34a;
    --border: #e2e8f0;
    --border-light: #cbd5e1;
}
/* ===== RESET ===== */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
html{scroll-behavior:smooth;scroll-padding-top:90px;overflow-x:hidden;width:100%}
body{
    margin-top:40px;
    font-family:var(--font-sans);
    background:var(--bg);
    color:var(--text);
    line-height:1.6;
    width:100%;
    max-width:100vw;
    overflow-x:hidden;
    -webkit-font-smoothing:antialiased;
}
img{max-width:100%;display:block}
a{color:inherit}
ul{list-style:none}
button{font-family:inherit;cursor:pointer}
h1,h2,h3,h4{line-height:1.2;font-weight:700;letter-spacing:-0.01em}
h1{font-size:clamp(1.7rem,4.5vw,2.6rem)}
h2{font-size:clamp(1.3rem,3vw,1.9rem)}
h3{font-size:1.05rem}
p{color:var(--text-secondary)}
.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;
}

/* ===== CONTAINER / GRID SKELETON ===== */
.container{width:100%;max-width:var(--max-width);margin:0 auto;padding:0 5vw}
.report-section{padding:2.6rem 0;border-top:1px solid var(--border)}
.report-section:first-of-type{border-top:none}
.grid{display:grid;gap:1rem}
.grid-2{grid-template-columns:1fr}
.grid-3{grid-template-columns:1fr}
.grid-4{grid-template-columns:repeat(2,1fr)}
.grid-7{grid-template-columns:repeat(4,1fr)}
.section-head{margin-bottom:1.4rem}
.section-eyebrow{
    display:inline-flex;align-items:center;gap:.4rem;
    font-size:.7rem;text-transform:uppercase;letter-spacing:.08em;
    color:var(--accent-light);font-weight:700;margin-bottom:.35rem;
}
.section-sub{font-size:.85rem;color:var(--text-secondary)}

/* ===== BASIC CARD (unpainted, pre-CDN) ===== */
.card{
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:var(--radius-lg);
    padding:1.2rem;
    min-width:0;
}

/* ===== BUTTONS ===== */
.btn{
    display:inline-flex;align-items:center;gap:.4rem;
    padding:.6rem 1.2rem;border-radius:var(--radius);
    font-weight:600;font-size:.82rem;border:2px solid transparent;
    text-decoration:none;white-space:nowrap;background:none;color:var(--text);
}
.btn-primary{background:var(--accent);color:#fff}
.btn-outline{border-color:var(--border-light);color:var(--text-secondary)}
.btn-icon{
    width:36px;height:36px;border-radius:50%;display:inline-flex;
    align-items:center;justify-content:center;border:1px solid var(--border-light);
    color:var(--text-secondary);background:var(--surface);flex-shrink:0;
}

/* ===== PAGE LOADER (user-supplied — dual ring + rotating text) ===== */
.page-loader{
    position:fixed;top:0;left:0;width:100%;height:100%;
    background:#0a0e17;display:flex;flex-direction:column;
    align-items:center;justify-content:center;z-index:99999;
    transition:opacity .5s ease,visibility .5s;
}
.loader-hidden{opacity:0;visibility:hidden}

.loader-pulse{width:60px;height:60px;position:relative}
.loader-pulse::before,.loader-pulse::after{
    content:'';position:absolute;inset:0;
    border-radius:50%;border:3px solid transparent;
}
.loader-pulse::before{
    border-top-color:#3b82f6;border-right-color:#3b82f6;
    animation:spinClockwise .8s linear infinite;
}
.loader-pulse::after{
    border-bottom-color:#60a5fa;border-left-color:#60a5fa;
    animation:spinCounterClockwise 1.2s linear infinite;
    inset:8px;
}
@keyframes spinClockwise{to{transform:rotate(360deg)}}
@keyframes spinCounterClockwise{to{transform:rotate(-360deg)}}

.loader-text-wrapper{
    margin-top:2rem;height:1.5rem;overflow:hidden;
    position:relative;width:280px;text-align:center;
}
.loader-text{
    font-family:system-ui,sans-serif;font-size:.95rem;
    letter-spacing:.04em;color:#93c5fd;
    position:absolute;width:100%;top:0;left:0;
    opacity:0;transform:translateY(20px);
    transition:opacity .4s ease,transform .4s ease;
}
.loader-text.active{opacity:1;transform:translateY(0)}
.loader-text.exit{opacity:0;transform:translateY(-20px)}

/* ===== SCROLL PROGRESS (base stub, animated version overridden by cdn css) ===== */
.scroll-progress{position:fixed;top:0;left:0;height:3px;width:0;background:var(--accent);z-index:10000}

/* ===== NAVBAR ===== */
/* ===== HEADER (STICKY, PILL) ===== */
.site-header {
    position: fixed;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 16px);
    max-width: calc(var(--max-width) - 16px);
    padding: 5px;
    z-index: 1000;
    border-radius: var(--radius-lg);
    background: rgba(10, 14, 23, 0.78);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: var(--transition);
}

body.light-mode .site-header {
    background: rgba(248, 250, 252, 0.85);
    border-color: rgba(0, 0, 0, 0.06);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    gap: 0.8rem;
    min-width: 0;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text);
    min-width: 0;
    flex-shrink: 0;
}

.logo-img {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    flex-shrink: 0;
}

.logo-text {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent-light);
    letter-spacing: -0.03em;
    white-space: nowrap;
}

/* Desktop nav */

.nav-links {
    display: flex;
    gap: 0.2rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    padding: 0.4rem 0.7rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
}

.nav-links a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.04);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.theme-toggle {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.4rem;
    border-radius: 50%;
    transition: var(--transition);
    display: flex;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--accent-light);
}

.mobile-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: var(--radius-sm);
}

.mobile-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: var(--transition);
}

.mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.mobile-overlay.active {
    opacity: 1;
    visibility: visible;
}

.nav-auth-mobile {
    display: none;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    border-top: 1px solid var(--border);
}

/* ===== MOBILE (< 640px) ===== */
@media (max-width: 639px) {
    .desktop-only {
        display: none !important;
    }
    .logo-text {
        display: none;
    }
    .mobile-toggle {
        display: flex;
        z-index: 1001;
    }
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: min(280px, 80vw);
        height: 100vh;
        height: 100dvh;
        background: var(--bg);
        flex-direction: column;
        padding: 5rem 1.2rem 2rem;
        z-index: 999;
        transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        border-left: 1px solid var(--border);
        gap: 0;
        overflow-y: auto;
    }
    .nav-links.active {
        right: 0;
    }
    .nav-links a {
        padding: 0.7rem 0.8rem;
        width: 100%;
        font-size: 0.9rem;
    }
    .nav-auth-mobile {
        display: flex;
    }
}

/* ===== TABLET & DESKTOP ===== */
@media (min-width: 640px) {
    .logo-text {
        display: inline;
    }
    .mobile-toggle {
        display: none;
    }
    .nav-auth-mobile {
        display: none;
    }
}

@media (min-width: 1024px) {
    .desktop-only {
        display: inline-flex !important;
    }
}

/* ===== COOKIE CONSENT BANNER ===== */
.cookie-banner{
    position:fixed;left:12px;right:12px;bottom:12px;z-index:9998;
    max-width:560px;margin:0 auto;
    background:var(--surface);border:1px solid var(--border-light);
    border-radius:var(--radius-lg);padding:1rem 1.1rem;
    box-shadow:0 20px 45px rgba(0,0,0,.45);
    display:flex;flex-direction:column;gap:.7rem;
    transform:translateY(140%);transition:transform .5s cubic-bezier(.4,0,.2,1);
}
.cookie-banner.visible{transform:translateY(0)}
.cookie-banner p{font-size:.78rem;color:var(--text-secondary);line-height:1.55}
.cookie-banner strong{color:var(--text)}
.cookie-actions{display:flex;gap:.6rem;flex-wrap:wrap}
.cookie-actions .btn{flex:1;justify-content:center}

/* ===== MAIN OFFSET ===== */
main{padding-top:calc(var(--nav-h) + 1.4rem)}

/* ===== BACK TO TOP ===== */
.back-to-top{
    position:fixed;right:16px;bottom:16px;z-index:900;
    opacity:0;visibility:hidden;transform:translateY(10px);
    transition:opacity .3s,transform .3s,visibility .3s;
}
.back-to-top.visible{opacity:1;visibility:visible;transform:translateY(0)}

/* ===== PULSE MONITOR (functional base, pre-CDN) ===== */
.pulse-monitor{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);padding:1.3rem 1.1rem}
.pulse-bars{display:flex;align-items:flex-end;gap:4px;height:60px}
.pulse-bars span{flex:1;min-width:0;height:40%;background:var(--border-light);border-radius:3px 3px 0 0}
.pulse-readout{display:flex;align-items:center;gap:.5rem;margin-top:1rem;font-size:.78rem;color:var(--text-secondary)}
.pulse-dot{width:8px;height:8px;border-radius:50%;background:var(--good);flex-shrink:0}

/* ===== CHECKLIST (reused pattern) ===== */
.checklist{margin:1rem 0;display:flex;flex-direction:column;gap:.5rem}
.checklist li{display:flex;align-items:flex-start;gap:.5rem;font-size:.85rem;color:var(--text-secondary)}
.checklist li i{color:var(--accent);margin-top:.2rem;flex-shrink:0}

/* ===== PHONE NOTIFICATION MOCK (functional, pre-CDN) ===== */
.notify-preview-visual{display:flex;align-items:center;justify-content:center}
.phone-mock{
    width:100%;max-width:300px;background:var(--surface);border:1px solid var(--border);
    border-radius:22px;padding:1.2rem .9rem .9rem;position:relative;
}
.phone-status-bar{display:flex;justify-content:space-between;align-items:center;font-size:.65rem;color:var(--text-secondary);padding:0 .3rem .5rem}
.phone-status-icons{display:flex;gap:.35rem}
.phone-notch{width:60px;height:6px;border-radius:4px;background:var(--border-light);margin:0 auto 1rem}
.report-generated-note{font-size:.72rem;color:var(--text-secondary);margin-top:.6rem;display:flex;align-items:center;gap:.35rem}
.report-generated-note i{color:var(--good)}
.phone-notif{
    display:flex;align-items:flex-start;gap:.6rem;background:var(--bg);border:1px solid var(--border);
    border-radius:var(--radius);padding:.7rem .8rem;
}
.phone-notif-icon{
    width:28px;height:28px;border-radius:8px;background:var(--accent);color:#fff;
    display:flex;align-items:center;justify-content:center;font-size:.6rem;font-weight:800;flex-shrink:0;
}
.phone-notif-body{display:flex;flex-direction:column;gap:.2rem;flex:1;min-width:0}
.phone-notif-body strong{font-size:.78rem}
.phone-notif-body span{font-size:.75rem;color:var(--text-secondary);line-height:1.4}
.phone-notif-time{font-size:.65rem;color:var(--text-secondary);flex-shrink:0}

/* ===== WORD CLOUD (functional, pre-CDN) ===== */
.word-cloud{display:flex;flex-wrap:wrap;gap:.5rem}
.word-chip{
    background:var(--surface);border:1px solid var(--border);border-radius:50px;
    padding:.4rem .9rem;font-size:calc(.72rem + (var(--w,1) * .05rem));color:var(--text-secondary);
}

/* ===== ACCORDION (functional collapse, pre-CDN) ===== */
.accordion{display:flex;flex-direction:column;gap:.6rem}
.accordion-item{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius)}
.accordion-trigger{
    width:100%;display:flex;justify-content:space-between;align-items:center;
    padding:.9rem 1rem;background:none;border:none;color:var(--text);font-weight:600;font-size:.85rem;
}
.accordion-panel{display:none;padding:0 1rem 1rem;font-size:.85rem}
.accordion-item.is-open .accordion-panel{display:block}

/* ===== GROUP COMPARE LIST (functional, pre-CDN) ===== */
.group-compare-list{display:flex;flex-direction:column;gap:.5rem}
.group-compare-row{
    display:flex;align-items:center;gap:.6rem;background:var(--surface);
    border:1px solid var(--border);border-radius:var(--radius-sm);padding:.6rem .8rem;
}
.gc-avatar{
    width:28px;height:28px;border-radius:50%;background:var(--accent);color:#fff;
    font-size:.68rem;font-weight:700;display:flex;align-items:center;justify-content:center;flex-shrink:0;
}
.gc-name{flex:0 0 90px;font-size:.8rem;font-weight:600}
.gc-bar{flex:1;height:6px;border-radius:5px;background:var(--border);min-width:0}
.gc-bar span{display:block;height:100%;width:var(--pct,0%);border-radius:5px;background:var(--accent)}
.gc-pct{font-size:.78rem;font-weight:700;color:var(--text-secondary);width:36px;text-align:right}
.gc-rank{font-size:.75rem;font-weight:700;color:var(--text-secondary);width:16px}
.group-compare-footnote{font-size:.75rem;color:var(--text-secondary);margin-top:.8rem;display:flex;gap:.4rem;align-items:flex-start}

/* ===== PRIVACY NOTE ===== */
.privacy-note{
    display:flex;align-items:flex-start;gap:.8rem;background:var(--surface);
    border:1px solid var(--border);border-radius:var(--radius-lg);padding:1.1rem 1.3rem;
}
.privacy-icon{color:var(--accent-light);font-size:1.1rem;margin-top:.15rem;flex-shrink:0}
.privacy-note p{font-size:.82rem}
.privacy-note strong{color:var(--text)}

/* ===== BASE CHART / METER PLACEHOLDERS (unpainted) ===== */
.ring-meter{width:150px;height:150px;border-radius:50%;background:conic-gradient(var(--accent) 0deg,var(--border) 0deg)}
.bar-row{display:flex;align-items:flex-end;gap:6px;height:150px}
.bar{flex:1;background:var(--border-light);border-radius:4px 4px 0 0;min-height:4px}

/* ===== RESPONSIVE: MOBILE (<640px) — differs deliberately from desktop ===== */
@media(max-width:639px){
    .nav-toggle{display:flex}
    .profile-name{display:none}
    .grid-4{grid-template-columns:1fr 1fr}
    .grid-7{grid-template-columns:repeat(4,1fr)}
    .container{padding:0 4.5vw}
    .cookie-banner{left:10px;right:10px;bottom:10px}
}

/* ===== RESPONSIVE: TABLET (640–1023px) ===== */
@media(min-width:640px) and (max-width:1023px){
    .nav-toggle{display:flex}
    .grid-2{grid-template-columns:1fr 1fr}
    .grid-4{grid-template-columns:repeat(4,1fr)}
    .grid-7{grid-template-columns:repeat(7,1fr)}
}

/* ===== RESPONSIVE: DESKTOP (1024px+) — full inline nav, no hamburger ===== */
@media(min-width:1024px){
    :root{--nav-h:68px}
    .nav-toggle{display:none}
    .nav-links{
        position:static;width:auto;height:auto;flex-direction:row;
        background:none;border-left:none;padding:0;gap:.2rem;overflow:visible;
    }
    .nav-links a{padding:.5rem .8rem;font-size:.82rem}
    .nav-links-divider{display:none}
    .grid-2{grid-template-columns:1fr 1fr}
    .grid-3{grid-template-columns:repeat(3,1fr)}
    .grid-4{grid-template-columns:repeat(4,1fr)}
    .grid-7{grid-template-columns:repeat(7,1fr)}
    .container{padding:0 2rem}
    .cookie-banner{left:auto;right:20px;bottom:20px}
}