/* =============================================================
   ScaleWise VA — main.css
   Design system: dark theme, blue/indigo accents, Sora + DM Sans
   ============================================================= */

/* ── Variables ─────────────────────────────────────────────── */
:root {
    --bg:            #080C14;
    --surface:       #0D1220;
    --card:          #0F1726;
    --primary:       #4F6EF7;
    --indigo:        #6366F1;
    --violet:        #818CF8;
    --lavender:      #C4B5FD;
    --text:          #F9FAFB;
    --text-2:        #CBD5E1;
    --text-3:        #94A3B8;
    --text-muted:    #64748B;
    --border:        rgba(255,255,255,0.07);
    --border-accent: rgba(79,110,247,0.3);
    --gradient:      linear-gradient(135deg, #4F6EF7 0%, #6366F1 100%);
    --gradient-text: linear-gradient(135deg, #4F6EF7 0%, #818CF8 50%, #C4B5FD 100%);
    --radius:        14px;
    --radius-sm:     8px;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Sora', sans-serif;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

a { color: inherit; }
img { display: block; max-width: 100%; }

/* ── Layout ────────────────────────────────────────────────── */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* ── Utility ───────────────────────────────────────────────── */
.gradient-text {
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-tag {
    display: inline-block;
    background: rgba(79,110,247,0.08);
    border: 1px solid rgba(79,110,247,0.2);
    color: var(--violet);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 0.3rem 0.85rem;
    border-radius: 100px;
    margin-bottom: 1.1rem;
}

.fade-up {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}
.fade-up.visible  { opacity: 1; transform: translateY(0); }
.fade-up.delay-1  { transition-delay: 0.1s; }
.fade-up.delay-2  { transition-delay: 0.2s; }
.fade-up.delay-3  { transition-delay: 0.3s; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 0.93rem;
    cursor: pointer;
    border: none;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--gradient);
    color: #fff;
    box-shadow: 0 4px 20px rgba(79,110,247,0.3);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(79,110,247,0.4);
}

.btn-outline {
    background: transparent;
    color: var(--text-2);
    border: 1px solid var(--border);
}
.btn-outline:hover {
    border-color: var(--border-accent);
    color: var(--text);
}

/* =================================================================
   NAVIGATION — iOS 26 Liquid Glass Pill
   ================================================================= */

/* Registered CSS properties for conic-gradient hue animation */
@property --nav-hue { syntax: '<angle>'; initial-value:   0deg; inherits: false; }
@property --mob-hue { syntax: '<angle>'; initial-value: 120deg; inherits: false; }

/* ── Floating pill ──────────────────────────────────────────────── */
#nav {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    padding: 7px 7px 7px 22px;
    display: flex;
    align-items: center;
    width: max-content;
    max-width: calc(100vw - 32px);
    border-radius: 100px;

    /* Liquid glass */
    background: rgba(8,12,20,0.52);
    backdrop-filter: blur(48px) saturate(200%) brightness(1.1);
    -webkit-backdrop-filter: blur(48px) saturate(200%) brightness(1.1);

    /* Layered specular system */
    box-shadow:
        0 8px 40px rgba(0,0,0,0.5),
        0 2px 8px rgba(0,0,0,0.4),
        inset 0 1.5px 0 rgba(255,255,255,0.17),
        inset 0 -1px 0 rgba(0,0,0,0.3),
        0 0 0 0.5px rgba(255,255,255,0.07);

    isolation: isolate;
    transition: box-shadow 0.3s;
}

/* Prismatic diffractive border ring */
#nav::before {
    content: '';
    position: absolute;
    inset: -0.5px;
    border-radius: 100px;
    padding: 1px;
    background: conic-gradient(
        from var(--nav-hue) at 50% 30%,
        rgba(79,110,247,0.55)   0deg,
        rgba(129,140,248,0.45) 55deg,
        rgba(196,181,253,0.5)  100deg,
        rgba(255,255,255,0.38) 145deg,
        rgba(224,231,255,0.3)  185deg,
        rgba(255,255,255,0.32) 220deg,
        rgba(165,180,252,0.42) 270deg,
        rgba(129,140,248,0.45) 315deg,
        rgba(79,110,247,0.55)  360deg
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: navDiffract 9s linear infinite;
    pointer-events: none;
    z-index: -1;
}

/* Inner surface sheen */
#nav::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 100px;
    background: linear-gradient(
        160deg,
        rgba(255,255,255,0.08) 0%,
        rgba(255,255,255,0.02) 35%,
        transparent 60%
    );
    pointer-events: none;
    z-index: -1;
}

@keyframes navDiffract { to { --nav-hue: 360deg; } }

/* Logo */
.nav-logo {
    font-family: 'Sora', sans-serif;
    font-weight: 700;
    font-size: 1.18rem;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}
.nav-logo span {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Nav links row */
.nav-links {
    display: flex;
    align-items: center;
    gap: 0;
    list-style: none;
    padding: 0 0.75rem;
}
.nav-links > li { padding: 0 0.875rem; }
.nav-links a {
    color: rgba(249,250,251,0.62);
    font-size: 0.88rem;
    font-weight: 500;
    transition: color 0.18s;
    text-decoration: none;
    white-space: nowrap;
}
.nav-links a:hover  { color: var(--text); }
.nav-links a.active { color: var(--text); }

/* CTA pill button */
.nav-cta-btn {
    background: var(--gradient);
    color: #fff;
    padding: 0.52rem 1.25rem;
    border-radius: 100px;
    font-weight: 600;
    font-size: 0.86rem;
    cursor: pointer;
    border: none;
    white-space: nowrap;
    box-shadow: 0 2px 16px rgba(79,110,247,0.38);
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}
.nav-cta-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 24px rgba(79,110,247,0.52);
}

/* ── Apps dropdown ──────────────────────────────────────────────── */
.nav-dropdown { position: relative; }
.nav-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    color: rgba(249,250,251,0.62);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    transition: color 0.18s;
    white-space: nowrap;
}
.nav-dropdown-btn:hover,
.nav-dropdown:hover .nav-dropdown-btn { color: var(--text); }
.nav-dropdown-btn svg { width: 11px; height: 11px; transition: transform 0.2s; }
.nav-dropdown:hover .nav-dropdown-btn svg { transform: rotate(180deg); }

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 18px);
    right: 0;
    min-width: 290px;
    background: rgba(8,12,20,0.78);
    backdrop-filter: blur(48px) saturate(200%);
    -webkit-backdrop-filter: blur(48px) saturate(200%);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 8px;
    box-shadow:
        0 20px 60px rgba(0,0,0,0.6),
        0 0 0 0.5px rgba(255,255,255,0.05),
        inset 0 1px 0 rgba(255,255,255,0.1);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity 0.2s, transform 0.2s;
    z-index: 200;
}
.nav-dropdown:hover .nav-dropdown-menu {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}
.nav-app-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none;
    transition: background 0.15s;
}
.nav-app-card:hover { background: rgba(255,255,255,0.05); }
.nav-app-icon {
    width: 38px; height: 38px;
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; flex-shrink: 0;
}
.nav-app-text { flex: 1; min-width: 0; }
.nav-app-name {
    font-size: .86rem; font-weight: 600; color: var(--text);
    display: flex; align-items: center; gap: 6px;
}
.nav-app-desc { font-size: .73rem; color: var(--text-3); margin-top: 2px; line-height: 1.45; }
.nav-app-badge {
    font-size: .6rem; font-weight: 700; letter-spacing: .05em;
    text-transform: uppercase; padding: 2px 7px; border-radius: 4px; line-height: 1.5;
}
.badge-live { background: rgba(34,197,94,.15); color: #22c55e; border: 1px solid rgba(34,197,94,.3); }
.badge-soon { background: rgba(217,119,6,.12); color: #fbbf24; border: 1px solid rgba(217,119,6,.3); }
.nav-dropdown-divider { height: 1px; background: rgba(255,255,255,0.06); margin: 6px 8px; }

/* ── Hamburger → X ──────────────────────────────────────────────── */
.nav-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 100px;
    padding: 0;
    width: 40px;
    height: 34px;
    flex-shrink: 0;
    transition: background 0.2s, border-color 0.2s;
}
.nav-hamburger:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.18);
}
.nav-hamburger span {
    display: block;
    width: 18px;
    height: 1.5px;
    background: rgba(249,250,251,0.85);
    border-radius: 2px;
    transform-origin: center;
    transition:
        transform  0.28s cubic-bezier(0.4,0,0.2,1),
        opacity    0.2s  cubic-bezier(0.4,0,0.2,1),
        background 0.2s;
}
/* Morphs into X */
.nav-hamburger.is-open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-hamburger.is-open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-hamburger.is-open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* ── Dimming overlay ────────────────────────────────────────────── */
.nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 997;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s, visibility 0s linear 0.3s;
}
.nav-overlay.open {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
    transition-delay: 0s;
}

/* ── Mobile bottom glass popup ──────────────────────────────────── */
.nav-mobile {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(22px);
    width: calc(100vw - 32px);
    max-width: 420px;
    border-radius: 26px;
    z-index: 999;
    padding: 6px 6px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;

    /* Closed state — hidden with smooth transition */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
        opacity    0.35s cubic-bezier(0.4,0,0.2,1),
        transform  0.35s cubic-bezier(0.34,1.56,0.64,1),
        visibility 0s linear 0.35s;

    /* Liquid glass */
    background: rgba(8,12,20,0.7);
    backdrop-filter: blur(60px) saturate(220%) brightness(1.12);
    -webkit-backdrop-filter: blur(60px) saturate(220%) brightness(1.12);
    box-shadow:
        0 32px 80px rgba(0,0,0,0.7),
        0 8px 24px rgba(0,0,0,0.4),
        inset 0 1.5px 0 rgba(255,255,255,0.15),
        inset 0 -1px 0 rgba(0,0,0,0.3),
        0 0 0 0.5px rgba(255,255,255,0.07);
    isolation: isolate;
}
.nav-mobile.open {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
    transform: translateX(-50%) translateY(0);
    transition:
        opacity   0.35s cubic-bezier(0.4,0,0.2,1),
        transform 0.35s cubic-bezier(0.34,1.56,0.64,1),
        visibility 0s;
}

/* Amber diffractive border */
.nav-mobile::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 27px;
    padding: 1px;
    background: conic-gradient(
        from var(--mob-hue) at 50% 30%,
        rgba(217,119,6,0.65)    0deg,
        rgba(251,191,36,0.5)   55deg,
        rgba(255,255,255,0.35) 105deg,
        rgba(79,110,247,0.25)  155deg,
        rgba(196,181,253,0.3)  205deg,
        rgba(255,255,255,0.25) 260deg,
        rgba(251,191,36,0.45)  315deg,
        rgba(217,119,6,0.65)   360deg
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: mobDiffract 5s linear infinite;
    pointer-events: none;
    z-index: -1;
}
/* Inner amber sheen */
.nav-mobile::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 26px;
    background: linear-gradient(
        160deg,
        rgba(255,255,255,0.07) 0%,
        rgba(217,119,6,0.05)   45%,
        transparent 68%
    );
    pointer-events: none;
    z-index: -1;
}
@keyframes mobDiffract { to { --mob-hue: 480deg; } }

/* Header row (title + X close) */
.nav-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    margin-bottom: 2px;
}
.nav-mobile-title {
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(148,163,184,0.6);
}
.nav-mobile-close {
    width: 28px; height: 28px;
    border-radius: 100px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: rgba(249,250,251,0.7);
    transition: background 0.18s, color 0.18s, border-color 0.18s;
    flex-shrink: 0;
}
.nav-mobile-close:hover {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.2);
    color: var(--text);
}

/* Nav link rows */
.nav-mobile a {
    display: flex;
    align-items: center;
    padding: 13px 14px;
    border-radius: 16px;
    color: rgba(203,213,225,0.85);
    font-size: 0.97rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.nav-mobile a:hover,
.nav-mobile a:active {
    background: rgba(255,255,255,0.06);
    color: var(--text);
}
.nav-mobile .btn {
    justify-content: center;
    margin-top: 8px;
    border-radius: 100px !important;
}

/* Apps sub-section */
.nav-mobile-apps-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(100,116,139,0.7);
    padding: 6px 14px 2px;
}
.nav-mobile-apps {
    display: flex; flex-direction: column;
    gap: 0; border-left: none; padding-left: 0; margin-top: 0;
}
.nav-mobile-apps a {
    font-size: 0.88rem !important;
    color: rgba(148,163,184,0.8) !important;
    padding: 9px 14px !important;
}

/* ── Page content wrapper ──────────────────────────────────── */
/* Used by dynamic DB pages rendered through Router::serveDbPage() */
.page-content {
    margin-top: 2rem;
    color: var(--text-2);
    line-height: 1.8;
    font-size: 1.0625rem;
}

.page-content h1,
.page-content h2,
.page-content h3,
.page-content h4 {
    color: var(--text);
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.page-content p      { margin-bottom: 1.1rem; }
.page-content ul,
.page-content ol     { padding-left: 1.5rem; margin-bottom: 1.1rem; }
.page-content li     { margin-bottom: 0.35rem; }
.page-content a      { color: var(--primary); text-decoration: underline; }
.page-content a:hover{ color: var(--violet); }

/* ── Page header (section intro) ──────────────────────────── */
.page-header {
    padding: 10rem 0 5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.page-header::before {
    content: '';
    position: absolute;
    top: -200px; left: 50%;
    transform: translateX(-50%);
    width: 700px; height: 700px;
    background: radial-gradient(circle, rgba(79,110,247,0.1) 0%, transparent 65%);
    pointer-events: none;
}
.page-header-inner { position: relative; z-index: 1; }
.page-header h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    margin-bottom: 1rem;
}
.page-header p {
    color: var(--text-3);
    font-size: 1.1rem;
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.7;
}

/* ── Footer ────────────────────────────────────────────────── */
footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 4rem 0 2rem;
}

.footer-top {
    display: grid;
    grid-template-columns: 1.8fr repeat(3, 1fr);
    gap: 3rem;
    margin-bottom: 3rem;
    padding-bottom: 3rem;
    border-bottom: 1px solid var(--border);
}

.footer-brand .nav-logo {
    display: inline-block;
    margin-bottom: 1rem;
}
.footer-brand p {
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.7;
    max-width: 260px;
}

.footer-col h4 {
    font-family: 'Sora', sans-serif;
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-3);
    margin-bottom: 1.1rem;
}
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 0.6rem; }
.footer-col a {
    color: var(--text-muted);
    font-size: 0.875rem;
    text-decoration: none;
    transition: color 0.2s;
}
.footer-col a:hover { color: var(--text); }

.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-copy {
    color: var(--text-muted);
    font-size: 0.83rem;
}

.footer-social { display: flex; gap: 0.75rem; }

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.875rem;
    text-decoration: none;
    transition: border-color 0.2s, color 0.2s;
}
.social-link:hover {
    border-color: var(--border-accent);
    color: var(--primary);
}

/* ── Spinner ───────────────────────────────────────────────── */
.spinner {
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: none;
}
.spinner.show { display: block; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .footer-top { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    /* Pill nav — smaller on mobile, just logo + hamburger */
    #nav {
        top: 12px;
        padding: 7px 7px 7px 18px;
        gap: 12px;
    }
    .nav-links { display: none; }
    .nav-hamburger { display: flex; }
    .container { padding: 0 1.25rem; }
    .footer-top { grid-template-columns: 1fr; gap: 2rem; margin-bottom: 2rem; padding-bottom: 2rem; }
    .footer-brand p { max-width: 100%; }
    .footer-bottom { flex-direction: column; text-align: center; }
}
