:root {
    --brand-primary: #2563eb;
    --brand-primary-light: #3b82f6;
    --brand-primary-hover: #1d4ed8;
    --brand-amber: #f59e0b;
    --brand-emerald: #10b981;
    --surface-black: #000000;
    --surface-dark: #06080f;
    --surface-dark-2: #0c1220;
    --surface-dark-3: #131c31;
    --bg-page: #f3f6fb;
    --surface-card: #ffffff;
    --text-heading: #0f172a;
    --text-body: #334155;
    --text-muted: #64748b;
    --border-subtle: rgba(15, 23, 42, 0.08);
    --shadow-sm: 0 4px 16px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 12px 32px -4px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 24px 48px -12px rgba(15, 23, 42, 0.14);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-page);
    color: var(--text-body);
    line-height: 1.65;
    overflow-x: clip;
    -webkit-font-smoothing: antialiased;
}

/* Scroll Progress Indicator */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, var(--brand-amber), var(--brand-primary-light), var(--brand-emerald));
    z-index: 1080;
    transition: width 0.08s linear;
}

/* Glassmorphic Sticky Navbar */
.site-navbar {
    background-color: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    transition: background-color 0.25s ease, box-shadow 0.25s ease;
    z-index: 1050;
}

.site-navbar.is-scrolled {
    background-color: rgba(6, 8, 15, 0.96);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.brand-logo {
    width: 36px;
    height: 36px;
    max-width: 36px;
    max-height: 36px;
    object-fit: cover;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.22);
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.navbar-brand:hover .brand-logo {
    transform: scale(1.06);
}

.brand-logo-sm {
    width: 26px;
    height: 26px;
    max-width: 26px;
    max-height: 26px;
    object-fit: cover;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.22);
    flex-shrink: 0;
}

.site-navbar .nav-link {
    color: rgba(255, 255, 255, 0.78);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.42rem 0.9rem;
    border-radius: 999px;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.site-navbar .nav-link:hover,
.site-navbar .nav-link.active {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.1);
}

/* Sticky Scroll Context Bar */
.nav-context-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.24rem 0.7rem 0.24rem 0.3rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #f8fafc;
    font-size: 0.78rem;
    font-weight: 600;
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    white-space: nowrap;
}

.site-navbar.is-scrolled .nav-context-pill {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.nav-context-pill img {
    width: 20px;
    height: 20px;
    max-width: 20px;
    max-height: 20px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

/* Seamless Home Hero (Cover melts into #000000 backdrop) */
.hero-seamless {
    position: relative;
    background: linear-gradient(180deg, var(--surface-black) 0%, var(--surface-black) 62%, var(--surface-dark) 100%);
    color: #ffffff;
    overflow: hidden;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.hero-cover-stage {
    position: relative;
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    overflow: hidden;
    transition: transform 0.35s ease, opacity 0.35s ease;
}

.hero-cover-stage img {
    width: 100%;
    height: auto;
    display: block;
}

/* Edge-feathering overlay so black cover photo blends invisibly on all viewports */
.hero-cover-stage::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, #000000 0%, rgba(0, 0, 0, 0) 8%, rgba(0, 0, 0, 0) 92%, #000000 100%),
        linear-gradient(180deg, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0) 14%, rgba(0, 0, 0, 0) 68%, #020306 100%);
}

.hero-seamless.is-scroll-compressed .hero-cover-stage {
    transform: scale(0.985);
    opacity: 0.9;
}

.hero-copy-band {
    position: relative;
    z-index: 2;
    margin-top: clamp(-2.5rem, -4vw, -0.5rem);
    padding-bottom: clamp(2rem, 4vw, 3.25rem);
}

.hero-title {
    font-weight: 800;
    letter-spacing: -0.03em;
    font-size: clamp(1.5rem, 2.3vw + 0.75rem, 2.45rem);
    line-height: 1.2;
}

.hero-subtitle {
    font-size: clamp(0.95rem, 0.6vw + 0.8rem, 1.12rem);
}

/* Collapsible Inner-Page Hero Banner */
.hero-shell {
    position: relative;
    background:
        radial-gradient(ellipse 80% 60% at 50% 0%, rgba(37, 99, 235, 0.2), transparent 70%),
        radial-gradient(ellipse 60% 50% at 85% 20%, rgba(245, 158, 11, 0.12), transparent 65%),
        linear-gradient(180deg, var(--surface-black) 0%, var(--surface-dark-2) 100%);
    color: #ffffff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.hero-collapsible {
    display: grid;
    grid-template-rows: 1fr;
    transition: grid-template-rows 0.4s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease, margin 0.3s ease;
}

.hero-collapsible-inner {
    overflow: hidden;
    min-height: 0;
}

.hero-shell.is-banner-collapsed .hero-collapsible {
    grid-template-rows: 0fr;
    opacity: 0;
    margin-bottom: 0 !important;
}

.hero-shell.is-scroll-compressed .cover-frame {
    transform: scale(0.985);
    opacity: 0.92;
}

.cover-frame {
    max-width: 900px;
    margin: 0 auto;
    border-radius: 1.1rem;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 22px 48px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.cover-frame--side {
    max-width: 400px;
    margin: 0 0 0 auto;
    border-radius: 0.95rem;
}

.cover-frame img {
    width: 100%;
    height: auto;
    display: block;
}

.banner-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.76rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    padding: 0.3rem 0.85rem;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.banner-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

.banner-toggle-btn i {
    transition: transform 0.3s ease;
}

.hero-shell.is-banner-collapsed .banner-toggle-btn i {
    transform: rotate(180deg);
}

/* Hero Badges */
.studio-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.32rem 0.82rem;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.14);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: #fbbf24;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

/* App Icon in Split Hero */
.app-icon-hero {
    width: 64px;
    height: 64px;
    max-width: 64px;
    max-height: 64px;
    object-fit: cover;
    border-radius: 16px;
    background: #ffffff;
    padding: 4px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
    flex-shrink: 0;
}

/* Bento Feature Strip */
.bento-tile {
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: 1.15rem;
    padding: clamp(1.15rem, 2vw, 1.5rem);
    box-shadow: var(--shadow-sm);
    height: 100%;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.bento-tile:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.bento-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-bottom: 0.85rem;
}

.bento-icon--blue {
    background: #eff6ff;
    color: #2563eb;
}

.bento-icon--amber {
    background: #fffbeb;
    color: #d97706;
}

.bento-icon--emerald {
    background: #ecfdf5;
    color: #059669;
}

/* Clean Logo + Description App Cards (No cover image on index) */
.app-card {
    background-color: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: 1.25rem;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.25s ease, border-color 0.25s ease;
}

.app-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(37, 99, 235, 0.22);
}

.app-icon-card {
    width: clamp(56px, 8vw, 68px);
    height: clamp(56px, 8vw, 68px);
    max-width: 68px;
    max-height: 68px;
    object-fit: cover;
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
    flex-shrink: 0;
}

.section-title {
    font-size: clamp(1.35rem, 1.5vw + 0.9rem, 1.85rem);
}

.section-title,
.app-title,
.policy-title,
.content-card h2,
.content-card h3 {
    color: var(--text-heading);
    font-weight: 800;
    letter-spacing: -0.02em;
}

.feature-badge {
    background-color: #f1f5f9;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    font-weight: 600;
    font-size: 0.75rem;
}

/* Content Cards & Policy Layout */
.content-card {
    background-color: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: 1.25rem;
    box-shadow: var(--shadow-md);
}

.policy-section {
    scroll-margin-top: 5.5rem;
    padding-top: 1.5rem;
    margin-top: 1.5rem;
    border-top: 1px solid var(--border-subtle);
}

.policy-section:first-of-type {
    border-top: 0;
    padding-top: 0;
    margin-top: 0;
}

.policy-section-badge {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: #eff6ff;
    color: var(--brand-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.content-card h2 {
    font-size: clamp(1.08rem, 0.5vw + 0.95rem, 1.22rem);
    margin: 0;
}

.content-card h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-top: 1.2rem;
}

/* Sticky Table of Contents */
.toc-card {
    position: sticky;
    top: 5rem;
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: 1.15rem;
    padding: 1.15rem;
    box-shadow: var(--shadow-sm);
}

.toc-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.7rem;
    border-radius: 0.6rem;
    color: var(--text-body);
    text-decoration: none;
    font-size: 0.86rem;
    font-weight: 600;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.toc-link:hover,
.toc-link.is-active {
    background-color: #eff6ff;
    color: var(--brand-primary);
}

/* Code & Permissions */
code {
    color: #1e40af;
    background-color: #eff6ff;
    padding: 0.14rem 0.42rem;
    border-radius: 0.35rem;
    font-size: 0.85em;
    font-weight: 600;
    word-break: break-word;
}

li {
    margin-bottom: 0.45rem;
}

.back-link {
    color: var(--brand-primary);
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.back-link:hover {
    text-decoration: underline;
}

/* Buttons */
.btn-brand {
    background: linear-gradient(135deg, var(--brand-primary), #1d4ed8);
    border: 0;
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.25);
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.btn-brand:hover {
    color: #ffffff;
    filter: brightness(1.06);
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.34);
}

/* CTA Banner */
.cta-panel {
    background: linear-gradient(135deg, var(--surface-black) 0%, var(--surface-dark-3) 100%);
    border-radius: 1.35rem;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: var(--shadow-lg);
}

/* Floating Back-to-Top */
.back-to-top {
    position: fixed;
    right: 1.15rem;
    bottom: 1.15rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--surface-dark);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease, background-color 0.2s ease;
    z-index: 1040;
}

.back-to-top.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.back-to-top:hover {
    background: var(--brand-primary);
}

/* Safe Scroll Reveal */
html.has-js [data-reveal] {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1), transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

html.has-js [data-reveal].is-revealed {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 767.98px) {
    .cover-frame--side {
        max-width: 100%;
        margin: 0 auto;
    }
    .hero-copy-band {
        margin-top: 0.25rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    html.has-js [data-reveal] {
        opacity: 1;
        transform: none;
        transition: none;
    }
    .hero-collapsible,
    .app-card,
    .hero-cover-stage {
        transition: none;
    }
}

/* Footer */
.site-footer {
    background-color: var(--surface-black);
    color: #94a3b8;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.site-footer a {
    color: #cbd5e1;
    text-decoration: none;
    transition: color 0.15s ease;
}

.site-footer a:hover {
    color: #ffffff;
}
