/* ======================================================
   DESIGN TOKENS — GLOBAL SYSTEM (YOUR ORIGINAL SYSTEM)
   ====================================================== */
:root {
    /* Spacing Scale */
    --space-1: 16px;
    --space-2: 24px;
    --space-3: 32px;
    --space-4: 48px;
    --space-5: 72px;

    /* Typography */
    --font-body: 16px;
    --font-h1: 32px;
    --font-h2: 24px;
    --font-h3: 18px;

    /* Colors */
    --bg: #1b2027;
    --bg-card: rgba(255,255,255,0.05);
    --bg-card-strong: rgba(255,255,255,0.08);
    --border-card: 1px solid rgba(255,255,255,0.08);
    --text-main: #E4ECEF;
    --text-soft: #A0AEC0;
    --text-muted: #8A94A6;
    --accent-aqua: #32D5F2;
    --accent-purple: #A78BFA;

    /* Radii */
    --radius-card: 12px;
    --radius-soft: 8px;

    /* Shadows */
    --shadow-card: 0 2px 8px rgba(0,0,0,0.25);
    --shadow-card-hover: 0 6px 18px rgba(0,0,0,0.35);

    /* Max Widths */
    --max-narrow: 900px;
    --max-wide: 1080px;
}

/* ======================================================
   GLOBAL RESET & BASE
   ====================================================== */
html {
    overflow-y: scroll;
}

body, html {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text-main);
    font-family: system-ui, sans-serif;
    font-size: var(--font-body);
    line-height: 1.55;
}

h1, h2, h3 {
    margin-top: var(--space-3);
    margin-bottom: var(--space-1);
    font-weight: 600;
    color: #fff;
}
h1 { font-size: var(--font-h1); }
h2 { font-size: var(--font-h2); }
h3 { font-size: var(--font-h3); }

p { margin-bottom: var(--space-2); color: var(--text-soft); }
ul { margin-bottom: var(--space-2); color: var(--text-main); }

a { color: var(--accent-aqua); text-decoration: none; }
a:hover { opacity: 0.85; }

/* ======================================================
   LAYOUT CONTAINERS
   ====================================================== */
.section {
    max-width: var(--max-narrow);
    margin: var(--space-4) auto;
    padding: 0 var(--space-2);
}
.section-wide {
    max-width: var(--max-wide);
    margin: var(--space-4) auto;
    padding: 0 var(--space-2);
}
.section-tight {
    max-width: var(--max-narrow);
    margin: var(--space-3) auto;
    padding: 0 var(--space-2);
}

/* ======================================================
   CARD COMPONENT — (YOUR ORIGINAL SYSTEM)
   ====================================================== */
.card, .info-card, .analysis-card {
    background: var(--bg-card);
    border: var(--border-card);
    border-radius: var(--radius-card);
    padding: var(--space-2);
    box-shadow: var(--shadow-card);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.card:hover,
.info-card:hover,
.analysis-card:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-3px);
}

/* Compact cards */
.card-sm { padding: var(--space-1); }

/* ======================================================
   BUTTONS
   ====================================================== */
.button, .btn, .hero-btn, .secondary-btn {
    background: var(--accent-aqua);
    color: #0c141a !important;
    padding: 10px 18px;
    border-radius: var(--radius-soft);
    font-weight: 500;
    transition: background 0.2s ease, transform 0.2s ease;
}
.button:hover { background: #54e3ff; transform: translateY(-2px); }

/* ======================================================
   NAVIGATION
   ====================================================== */
.navbar {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    background: rgba(0,0,0,0.15);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    position: sticky;
    top: 0;
    z-index: 20;
    box-sizing: border-box;
}
.navbar a {
    padding: 8px 12px;
    border-radius: var(--radius-soft);
    color: var(--text-main);
    font-size: 0.9rem;
    white-space: nowrap;
}
.navbar a:hover {
    background: rgba(255,255,255,0.08);
    color: var(--accent-aqua);
}

/* Center nav links between logo and auth */
.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    justify-content: center;
}

/* Ensure every clickable item in the navbar has identical vertical sizing */
.nav-links > a,
.nav-links > .dropdown > .dropbtn {
    display: inline-flex;
    align-items: center;
    line-height: 1;
    height: 38px;
}

.nav-auth {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 180px;
    justify-content: flex-end;
}
.nav-auth .btn-get-started {
    background: var(--accent-aqua);
    color: #0c141a !important;
    padding: 8px 16px;
    border-radius: var(--radius-soft);
    font-weight: 600;
    white-space: nowrap;
}
.nav-auth .btn-get-started:hover {
    background: #54e3ff;
}

/* Dynamic auth state — avatar circle + dropdown */
.nav-avatar-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.nav-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--accent-aqua);
    color: #0c141a;
    font-weight: 700;
    font-size: 0.8rem;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: -0.3px;
    transition: box-shadow 0.2s ease;
}
.nav-avatar:hover {
    box-shadow: 0 0 0 2px rgba(50, 213, 242, 0.35);
}
.nav-avatar-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #1e2530;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-soft);
    min-width: 200px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 100000;
    overflow: hidden;
}
.nav-avatar-wrap.open .nav-avatar-dropdown {
    display: block;
}
.nav-avatar-dropdown .nav-avatar-email {
    padding: 12px 16px;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nav-avatar-dropdown a,
.nav-avatar-dropdown button {
    display: block;
    width: 100%;
    padding: 10px 16px;
    font-size: 0.88rem;
    color: var(--text-main);
    text-decoration: none;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease;
}
.nav-avatar-dropdown a:hover,
.nav-avatar-dropdown button:hover {
    background: rgba(255,255,255,0.06);
    color: var(--accent-aqua);
}

/* Logo */
.navbar .logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    text-decoration: none;
    margin-right: 8px;
    height: 38px;
    flex: 0 0 180px;
}
.navbar .logo:hover {
    background: transparent;
}
.logo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--accent-aqua);
    color: #0c141a;
    font-weight: 700;
    font-size: 0.85rem;
    border-radius: 6px;
    letter-spacing: -0.5px;
}
.logo-text {
    color: var(--text-main);
}

/* Dropdown */
.dropdown { position: relative; display: inline-flex; align-items: center; }
.dropbtn { cursor: pointer; }
.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    background: #0f1114;
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    min-width: 240px;
    padding: var(--space-1) 0;
}
.dropdown:hover .dropdown-content { display: block; }
.dropdown-content a {
    display: block;
    padding: 8px 14px;
    white-space: nowrap;
    color: var(--text-main);
}
.dropdown-content a:hover {
    background: rgba(255,255,255,0.08);
    color: var(--accent-aqua);
}

/* ======================================================
   HERO
   ====================================================== */
.hero {
    background: #2c343d;
    padding: var(--space-4) var(--space-2);
    border-radius: var(--radius-card);
    text-align: center;
    margin-top: var(--space-4);
    position: relative;
    overflow: hidden;
}
.hero-bg {
    position: absolute;
    top: -10%;
    left: -10%;
    width: 130%;
    height: 130%;
    background:
        radial-gradient(circle at 40% 40%, rgba(120,160,255,0.25), transparent 60%),
        radial-gradient(circle at 80% 70%, rgba(80,200,255,0.20), transparent 65%);
    filter: blur(40px);
}
.hero > * { position: relative; }

/* ======================================================
   GRID SYSTEM
   ====================================================== */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
}
.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-3);
}
@media (max-width: 768px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ======================================================
   CHART FRAMES
   ====================================================== */
.chart-frame {
    background: var(--bg-card);
    border: var(--border-card);
    border-radius: var(--radius-card);
    padding: var(--space-3);
    margin: var(--space-4) auto;
    max-width: var(--max-wide);
}

/* ======================================================
   FORMS
   ====================================================== */
input, textarea {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: var(--radius-soft);
    padding: var(--space-1);
    width: 100%;
    color: var(--text-main);
    margin-bottom: var(--space-2);
}

/* ======================================================
   FOOTER
   ====================================================== */
footer, .page-footer {
    text-align: center;
    margin-top: var(--space-4);
    margin-bottom: var(--space-4);
    color: var(--text-soft);
}

/* ======================================================
   FIX: Home solution card heading alignment
   ====================================================== */
/* Tighter heading alignment for home solution cards */
.home-solution-grid .card h3 {
    min-height: 32px;        /* reduced from 48px → fixes spacing */
    display: flex;
    justify-content: center;
    align-items: center;     /* center vertically instead of bottom */
    margin-top: 0;           /* ensure no extra spacing above */
}

/* ======================================================
   ===========================================
   V2 VISUALIZATION SYSTEM (SCOPED, SAFE)
   ===========================================
   ====================================================== */

/* Tight spacing scale for viz pages ONLY */
.viz-page {
    --viz-space-1: 4px;
    --viz-space-2: 8px;
    --viz-space-3: 12px;
    --viz-space-4: 16px;
    --viz-space-5: 24px;
    --viz-space-6: 32px;
    --viz-space-8: 48px;

    --viz-card-bg: rgba(255,255,255,0.05);
    --viz-card-border: 1px solid rgba(255,255,255,0.08);
    --viz-card-radius: 12px;
    --viz-card-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

/* Visualization grid */
.viz-page .grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--viz-space-4);
    align-items: start;
}
@media (max-width: 768px) {
    .viz-page .grid-3 { grid-template-columns: 1fr; }
}

/* Visualization cards */
.viz-page .card,
.card--viz {
    background: var(--viz-card-bg);
    border: var(--viz-card-border);
    border-radius: var(--viz-card-radius);
    padding: var(--viz-space-4);
    box-shadow: var(--viz-card-shadow);
    display: flex;
    flex-direction: column;
}
.viz-page .card h3,
.card--viz h3 {
    margin: 0 0 var(--viz-space-2);
}

/* Tight interpretation cards */
.card--viz-compact {
    padding: var(--viz-space-4) !important;
}
.card--viz-compact h3 {
    margin-bottom: var(--viz-space-2) !important;
}
.card--viz-compact p {
    margin-top: 0 !important;
}

/* Chart container */
.viz-page .chart-container {
    width: 100%;
    height: 700px;
    padding: var(--viz-space-4);
    background: var(--viz-card-bg);
    border: var(--viz-card-border);
    border-radius: var(--viz-card-radius);
    box-shadow: var(--viz-card-shadow);
    margin: var(--viz-space-6) 0;
}

/* Reduce whitespace around charts */
.viz-page canvas {
    padding-top: var(--viz-space-2);
    padding-bottom: var(--viz-space-2);
}

/* Utilities */
.viz-center { text-align:center; }
.viz-mb-0 { margin-bottom:0!important; }
.viz-mt-0 { margin-top:0!important; }

/* Match Deterministic Engine pipeline cards to Architecture card tightness */
.deterministic-pipeline-card {
    padding: var(--space-1) var(--space-2) !important; /* 16px top/bottom, 24px left/right */
}

/* Centroids Page — Compact Chart Frame (final size fix) */
.chart-frame.compact {
    /* tighter spacing */
    padding: var(--space-1) var(--space-2) !important;
    margin-top: var(--space-2) !important;
    margin-bottom: var(--space-3) !important;

    /* critical fix: prevent container from becoming huge */
    max-width: 700px !important;
    margin-left: auto !important;
    margin-right: auto !important;

    border-radius: var(--radius-card);
}

/* Control the SVG diagram height for proper proportion */
.chart-frame.compact svg {
    max-height: 300px;   /* increase from earlier 260px */
    width: 100%;
    height: auto;
    object-fit: contain;
}

/* ======================================================
   LIVE DEMOS OVERVIEW — MATCH CHARTS OVERVIEW LAYOUT
   ====================================================== */

/* 1. Match container width (Charts uses same setting) */
.live-demos-page .section,
.live-demos-page .section-wide {
    max-width: var(--max-wide) !important;
}

/* 2. Match appearance of `.card` used on Charts Overview */
.live-demos-page .card {
    background: var(--bg-card) !important;
    border: var(--border-card) !important;
    border-radius: var(--radius-card) !important;
    box-shadow: var(--shadow-card) !important;
    padding: var(--space-2) !important;
    text-align: center !important;
}

/* 3. Chart Overview cards have an inline flex layout — mirror that */
.live-demos-page .card {
    display: flex !important;
    flex-direction: column !important;
    gap: var(--space-1) !important;
}

/* 5. Match heading spacing above grid */
.live-demos-page h2 {
    margin-bottom: var(--space-3) !important;
}

/* 6. Match bottom “Fit” card width */
.live-demos-page .fit-card {
    max-width: 900px !important;
    margin: 0 auto !important;
}

/* 7. Correct card spacing to match Charts Overview (gap: space-3) */
.live-demos-page .grid-3 {
    gap: var(--space-3) !important; /* match Charts exactly */
    justify-content: center !important;
}

/* === FIXED NAVBAR (V2) — APPLY ACROSS ALL PAGES === */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 9999;
    background: rgba(16, 24, 32, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding: 14px 24px;
    box-sizing: border-box;
    overflow: visible;
    /* Constrain navbar contents to align with page content */
    max-width: 100%;
}

/* Inner constraint — keeps logo aligned with body content */
.navbar-inner {
    display: flex;
    align-items: center;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
    position: relative;
}

/* Adjust navbar links so spacing works with fixed layout */
.navbar a,
.navbar .dropbtn {
    padding: 10px 14px;
    font-size: 0.88rem;
}

/* Dropdown stays above content */
.dropdown-content {
    z-index: 99999;
}

/* === PREVENT CONTENT FROM SITTING UNDER THE NAV === */
body,
.viz-page,
.live-demos-page,
.static-page {
    padding-top: 80px;   /* matches navbar height + safe breathing room */
}

.chart-note {
    text-align: center;
    color: var(--text-soft);
    font-size: 0.95rem;
    margin-top: 14px;
    margin-bottom: 28px;
}

/* --------------------------------------------- */
/* HERO SECTION REFINEMENTS */
/* --------------------------------------------- */

/* Base subtle note style */
.device-note {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    opacity: 0.75;
    letter-spacing: 0.1px;
    margin: 0; /* hero-note will control spacing */
}

/* CTA spacing for hero */
.cta-group {
    margin-top: 34px;   /* spacing above buttons */
    text-align: center;
}

.cta-group .hero-btn {
    margin: 0 6px;      /* even horizontal spacing between buttons */
}

/* Device note spacing ONLY inside hero */
.hero .hero-note {
    margin-top: 24px;    /* spacing below CTA group */
    margin-bottom: 28px; /* spacing above profile block */
}

/* Constrain the main hero framing paragraph width */
.hero-sub {
    max-width: 800px;    /* ideal readability width for your layout */
    margin-left: auto;
    margin-right: auto;
}

/* --------------------------------------------- */
/* FEATURE CARD TEXT WIDTH (BOTTOM SECTIONS) */
/* --------------------------------------------- */

.section-wide .card p,
.section-wide .info-card p,
.card--viz p {
    max-width: 800px;    /* match hero-sub width for balanced visual rhythm */
    margin-left: auto;
    margin-right: auto;
}

/* --------------------------------------------- */
/* CTA BUTTON ENHANCEMENT (site-wide) */
/* --------------------------------------------- */

.button {
    padding: 10px 20px;  /* slight premium feel */
}

/* Reduce bottom margin of card paragraphs (prevents crowding above CTA) */
.section-wide .card p {
    margin-bottom: 18px;   /* tighter spacing above button */
}

/* Improve spacing around CTA buttons inside section cards */
.section-wide .cta-card {
    margin-top: 24px;     /* space above button */
    margin-bottom: 16px;  /* space below button (centers visually) */
    text-align: center;
}

/* ======================================================
   GLOBAL FOOTER & DISCLAIMER FIX
   ====================================================== */

footer,
.page-footer {
    max-width: 900px;          /* consistent readable width */
    margin-left: auto;
    margin-right: auto;
    line-height: 1.45;
}

/* Optional class if you need to wrap standalone disclaimers */
.disclaimer-text {
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
}

.page-footer {
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
    line-height: 1.45;
}

.page-footer { font-size: 0.85rem !important; }

.page-footer a {
    color: var(--text-muted);
    text-decoration: none;
}

.page-footer a:hover {
    color: var(--text-soft);
}


/* ============================================================
   FINAL UNIFIED CARD SPACING — FOR BOTH OVERVIEW PAGES
   ============================================================ */

/* tighten heading spacing */
.card--overview h3 {
    margin-bottom: 6px !important;
}

/* tighten description spacing */
.card--overview p {
    margin-bottom: 12px !important;
}

/* add breathing room under buttons */
.card--overview .button {
    margin-top: 4px !important;
    margin-bottom: 16px !important;
}

/* unify internal padding and flex layout */
.card--overview {
    padding: 18px 20px !important;
    gap: 8px !important;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
}

/* Beta feedback banner — hidden by default, shown for logged-in users */
.beta-banner {
    display: none;
    background: rgba(50, 213, 242, 0.08);
    border-bottom: 1px solid rgba(50, 213, 242, 0.15);
    text-align: center;
    padding: 10px 24px;
    font-size: 0.85rem;
    color: var(--text-soft);
}

.beta-banner a {
    color: var(--accent-aqua);
    text-decoration: none;
    font-weight: 600;
}

.beta-banner a:hover {
    text-decoration: underline;
}







