/* === CognOS global tokens & base === */
:root {
    --bg: #0b0c10;
    --surface: #12141a;
    --surface-2: #171a22;
    --text: #e8eef6;
    --muted: #a7b1c2;
    --accent: #6ee7ff;
    --accent-2: #7c6fff;
    --ring: rgba(110,231,255,.3);
    --shadow: 0 10px 30px rgba(0,0,0,.35);
    --radius: 16px;
    
    /* Three Pillars colors */
    --pillar-orchestration: #3B82F6;
    --pillar-knowledge: #14B8A6;
    --pillar-events: #EC4899;
    
    /* Responsive breakpoints */
    --breakpoint-tablet: 768px;
    --breakpoint-desktop: 1024px;
    --breakpoint-large: 1440px;
    
    /* nudge Bootstrap defaults to our theme */
    --bs-body-bg: var(--bg);
    --bs-body-color: var(--text);
    --bs-link-color: inherit;
}

@media (prefers-color-scheme: light) {
    :root {
        --bg: #f8fafc;
        --surface: #fff;
        --surface-2: #f1f5f9;
        --text: #0f172a;
        --muted: #475569;
        --accent: #0ea5e9;
        --accent-2: #7c3aed;
        --ring: rgba(14,165,233,.25);
        --shadow: 0 8px 24px rgba(2,6,23,.08);
    }
}

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
}

a {
    color: inherit;
}

:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

h1:focus, h1:focus-visible {
    outline: none;
}




/* Use logical props so this auto-flips */
.page {
    margin-inline: auto;
}

.text-start {
    text-align: start;
}

.text-end {
    text-align: end;
}

.actions {
    margin-inline-start: auto;
}

/* Only the few things that need explicit RTL overrides */
[dir="rtl"] .ico-chevron {
    transform: scaleX(-1);
}
/* flip arrow icons */
[dir="rtl"] .breadcrumbs {
    direction: rtl;
}
/* or: flex-direction: row-reverse */
[dir="rtl"] .pager {
    flex-direction: row-reverse;
}

[dir="rtl"] .ms-auto {
    margin-inline-start: 0;
    margin-inline-end: auto;
}
/* example util */



/* Let hero text follow the reading direction */
.hero-card,
.hero-card :is(h1,h2,h3,h4,h5,h6,p,small,span) {
    text-align: start; /* flips to right in RTL, left in LTR */
}

/* If a previous rule forces left, bump specificity once */
.page .hero-card .title,
.page .hero-card .subtitle,
.page .hero-card .body {
    text-align: start !important;
}

/* Make any legacy utilities logical */
.text-left {
    text-align: start;
}

.text-right {
    text-align: end;
}


/* text inside the cards follows reading direction */
.is-grid .is-card :is(h1,h2,h3,h4,h5,h6,p,small,span) {
    text-align: start; /* left in LTR, right in RTL */
}

/* if something earlier forces left, bump specificity once */
.page .is-grid .is-card h3,
.page .is-grid .is-card p {
    text-align: start !important;
}


.brand {
    unicode-bidi: isolate;
    direction: ltr;
}
/* safe in both LTR/RTL */

/* Global code block styles */
.code-block {
    background: #0D1117;
    border: 1px solid color-mix(in oklab, var(--text) 10%, transparent);
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    color: #E6EDF3;
    margin: 16px 0;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

@media (min-width: 768px) {
    .code-block {
        padding: 20px;
        font-size: 14px;
    }
}

.code-block code {
    background: transparent;
    padding: 0;
    border: none;
    color: inherit;
}

/* TopNavBar styles */
.top-nav {
    position: sticky;
    top: 0;
    width: 100%;
    background: var(--bg);
    border-bottom: 1px solid color-mix(in oklab, var(--text) 10%, transparent);
    z-index: 1000;
    backdrop-filter: blur(8px);
}

.nav-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.nav-left {
    display: flex;
    align-items: center;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text);
}

.nav-logo {
    height: 32px;
    width: auto;
}

.brand {
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: 0.02em;
}

.nav-toggle {
    display: none;
}

.nav-toggle-label {
    display: none;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    padding: 8px;
}

.nav-toggle-label span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text);
    transition: transform 0.3s ease;
}

.nav-center {
    display: flex;
    align-items: center;
    gap: 28px;
    flex: 1;
    justify-content: center;
}

.nav-link {
    color: var(--muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s ease;
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--accent);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.icon-link {
    color: var(--muted);
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
}

.icon-link:hover {
    color: var(--accent);
}

/* Mobile styles - Tablet breakpoint */
@media (max-width: 767px) {
    .nav-toggle-label {
        display: flex;
    }

    .nav-center {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--surface);
        border-bottom: 1px solid color-mix(in oklab, var(--text) 10%, transparent);
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    .nav-toggle:checked ~ .nav-center {
        max-height: 500px; /* Increased for more nav items */
    }

    .nav-link {
        padding: 14px 24px; /* Adjusted for 44px+ touch target */
        min-height: 44px;
        display: flex;
        align-items: center;
        border-bottom: 1px solid color-mix(in oklab, var(--text) 8%, transparent);
    }

    .nav-toggle:checked ~ .nav-toggle-label span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .nav-toggle:checked ~ .nav-toggle-label span:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle:checked ~ .nav-toggle-label span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }

    .nav-right {
        gap: 12px;
    }
}

/* Small mobile adjustments */
@media (max-width: 390px) {
    .nav-container {
        padding: 12px 16px;
    }

    .brand {
        font-size: 1.1rem;
    }

    .nav-logo {
        height: 28px;
    }
}

/* Button styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    min-height: 44px; /* iOS touch target minimum */
    border-radius: 10px;
    border: 1px solid transparent;
    font-weight: 600;
    transition: transform .06s ease, box-shadow .2s ease, border-color .2s ease, background-color .2s ease;
    cursor: pointer;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 6px var(--ring);
}

.btn.primary {
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    color: #fff;
}

.btn.ghost {
    background: transparent;
    border-color: color-mix(in oklab, var(--text) 14%, transparent);
    color: var(--text);
}

.btn.small {
    padding: 8px 14px;
    min-height: 36px;
    font-size: .85rem;
    border-radius: 8px;
}

@media (min-width: 768px) {
    .btn.small {
        padding: 6px 12px;
        min-height: 32px;
        background: linear-gradient(90deg, var(--accent), var(--accent-2));
        color: #fff;
    }
}

/* === Responsive Typography System === */
/* Mobile-first aggressive scaling */

/* Headings */
h1, .title {
    font-size: 2rem;
    line-height: 1.1;
    margin: 0 0 16px;
}

h2, .section-title {
    font-size: 1.5rem;
    line-height: 1.2;
    margin: 0 0 12px;
}

h3, .subsection-title {
    font-size: 1.25rem;
    line-height: 1.2;
    margin: 0 0 10px;
}

h4 {
    font-size: 1.125rem;
    line-height: 1.3;
    margin: 0 0 8px;
}

/* Tablet scaling */
@media (min-width: 768px) {
    h1, .title { font-size: 3rem; }
    h2, .section-title { font-size: 2rem; }
    h3, .subsection-title { font-size: 1.5rem; }
    h4 { font-size: 1.25rem; }
}

/* Desktop scaling */
@media (min-width: 1024px) {
    h1, .title { font-size: 3.5rem; }
    h2, .section-title { font-size: 2.5rem; }
    h3, .subsection-title { font-size: 1.75rem; }
    h4 { font-size: 1.5rem; }
}

/* Large desktop scaling */
@media (min-width: 1440px) {
    h1, .title { font-size: 4.2rem; }
    h2, .section-title { font-size: 3rem; }
    h3, .subsection-title { font-size: 2rem; }
    h4 { font-size: 1.75rem; }
}

/* Body text */
body, p {
    font-size: 1rem;
    line-height: 1.6;
}

@media (min-width: 1024px) {
    body, p { font-size: 1.125rem; }
}

.subtitle {
    font-size: 1rem;
    line-height: 1.5;
}

@media (min-width: 768px) {
    .subtitle { font-size: 1.125rem; }
}

@media (min-width: 1024px) {
    .subtitle { font-size: 1.25rem; }
}

small, .muted {
    font-size: 0.875rem;
    line-height: 1.4;
}

@media (min-width: 1024px) {
    small, .muted { font-size: 1rem; }
}

/* === Mobile-First Utilities === */

.mobile-only {
    display: block;
}

.tablet-up {
    display: none;
}

@media (min-width: 768px) {
    .mobile-only { display: none; }
    .tablet-up { display: block; }
}

.desktop-up {
    display: none;
}

@media (min-width: 1024px) {
    .desktop-up { display: block; }
}

/* Touch target enforcement */
.touch-target {
    min-width: 44px;
    min-height: 44px;
}

/* Responsive spacing */
.section-padding {
    padding: 48px 16px;
}

@media (min-width: 768px) {
    .section-padding { padding: 64px 24px; }
}

@media (min-width: 1024px) {
    .section-padding { padding: 80px 32px; }
}

@media (min-width: 1440px) {
    .section-padding { padding: 96px 48px; }
}

.container {
    width: min(1120px, 92%);
    margin-inline: auto;
}

/* === Performance Optimizations === */

/* Improve scroll performance on iOS */
* {
    -webkit-overflow-scrolling: touch;
}

/* Improve animation performance */
.nav-center, .nav-toggle-label span, .btn {
    will-change: transform;
}

/* Respect user preference for reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* === Debug: Breakpoint Indicator === */
/* TODO: Remove before production deployment */
body::after {
    content: 'Mobile (< 768px)';
    position: fixed;
    bottom: 8px;
    right: 8px;
    background: rgba(255, 0, 0, 0.9);
    color: white;
    padding: 6px 12px;
    font-size: 11px;
    border-radius: 4px;
    z-index: 9999;
    font-family: monospace;
    pointer-events: none;
}

@media (min-width: 768px) {
    body::after {
        content: 'Tablet (768px+)';
        background: rgba(0, 200, 0, 0.9);
    }
}

@media (min-width: 1024px) {
    body::after {
        content: 'Desktop (1024px+)';
        background: rgba(0, 100, 255, 0.9);
    }
}

@media (min-width: 1440px) {
    body::after {
        content: 'Large (1440px+)';
        background: rgba(255, 140, 0, 0.9);
    }
}

