/*
Theme Name:     T.R.U.S.T · AIGOS
Theme URI:      https://securedbyaigos.com
Author:         SecuredByAIGOS
Author URI:     https://securedbyaigos.com
Description:    Child theme for SecuredByAIGOS — homepage, AgentGuard, T.R.U.S.T (Traceable Reasoning, Usage & Source Telemetry), publications and contact. Built on Astra.
Version:        2.3.5
Template:       astra
Text Domain:    trust-aigos
*/

/* ============================================================
   GLOBAL TOKENS — derived from the SecuredByAIGOS brand guide
   Brand:  Root #0E4BD5 · Accent #FF6565 · Base #7F7F7F
   ============================================================ */
:root {
    /* ── Brand colours (verbatim from brand guide) ─────────── */
    --brand-blue:   #0E4BD5;          /* primary brand · solid surfaces, CTAs */
    --brand-coral:  #FF6565;          /* accent · critical/warning only */
    --brand-grey:   #7F7F7F;          /* neutral base · captions, dividers */

    /* ── Surfaces ──────────────────────────────────────────── */
    --bg-void:      #0A0F1C;
    --bg-deep:      #0F1729;
    --bg-card:      #16203A;
    --bg-card-hover:#1C2848;
    --bg-elevated:  #1F2A45;

    /* ── Functional accents (lightened brand-blue for legibility on dark) ── */
    --accent-primary:        #4A7FE3;
    --accent-primary-bright: #6B96E8;
    --accent-coral:          #FF6565;
    --accent-amber:          #E5A645;
    --accent-success:        #5DD39E;

    /* ── Backwards-compatible aliases for older per-page CSS ── */
    --accent-cyan:        var(--accent-primary);
    --accent-green:       var(--accent-success);
    --accent-red:         var(--accent-coral);
    --accent-purple:      var(--accent-primary);
    --accent-purple-soft: var(--accent-primary-bright);

    /* ── Text hierarchy ────────────────────────────────────── */
    --text-primary:   #E8EDF5;
    --text-secondary: #A8B0C0;
    --text-muted:     var(--brand-grey);
    --text-dim:       #4A5168;

    /* ── Borders ───────────────────────────────────────────── */
    --border:         rgba(74, 127, 227, 0.13);
    --border-strong:  rgba(74, 127, 227, 0.28);
    --border-purple:        var(--border);
    --border-purple-strong: var(--border-strong);

    /* ── Typography ────────────────────────────────────────── */
    --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-body:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-serif:   'IBM Plex Serif', 'Source Serif Pro', Georgia, serif;
    --font-mono:    'IBM Plex Mono', 'SF Mono', Consolas, monospace;
}

/* ============================================================
   RESET + BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--bg-void);
    color: var(--text-primary);
    overflow-x: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body::before {
    content: '';
    position: fixed; inset: 0;
    background-image:
        linear-gradient(rgba(74, 127, 227, 0.012) 1px, transparent 1px),
        linear-gradient(90deg, rgba(74, 127, 227, 0.012) 1px, transparent 1px);
    background-size: 64px 64px;
    pointer-events: none;
    z-index: 0;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ============================================================
   ASTRA OVERRIDES
   ============================================================ */
:root,
:root body,
:root.is-customize-preview {
    --ast-global-color-5: #0A0F1C !important;
    --ast-global-color-6: #0A0F1C !important;
    --ast-global-color-7: #0A0F1C !important;
}

html, body,
#page, .site, .hfeed,
.site-content,
.ast-container, .ast-container-fluid,
.ast-no-sidebar, .ast-separate-container,
.ast-plain-container, .ast-page-builder-template,
.ast-narrow-container, .ast-full-width-primary-content {
    background: var(--bg-void) !important;
    background-color: var(--bg-void) !important;
}

body { color: var(--text-primary) !important; }

.ast-container,
.site-content > .ast-container { max-width: none !important; padding: 0 !important; }
.site-content { padding: 0 !important; }

/* Astra Header Builder (HFB) and legacy header — kill them everywhere.
 * High-specificity prefix (html body) ensures these win over Astra's own
 * inline styles and component-scoped rules. Without this, Astra's HFB
 * renders below my .tg-nav, producing two stacked headers. */
html body header#masthead,
html body header.site-header,
html body .site-header,
html body div[id="masthead"],
html body .ast-hfb-header,
html body .site-primary-header,
html body .site-primary-header-wrap,
html body .site-pre-header-wrap,
html body .site-below-header-wrap,
html body .site-above-header-wrap,
html body .ast-primary-header,
html body .ast-primary-header-bar,
html body .main-header-bar,
html body .main-header-bar-wrap,
html body .ast-mobile-header,
html body .ast-mobile-header-wrap,
html body .ast-above-header,
html body .ast-above-header-wrap,
html body .ast-below-header,
html body .ast-below-header-wrap,
html body .ast-builder-grid-row,
html body .ast-builder-grid-row-container,
html body .ast-builder-header-content,
html body .ast-builder-html-element,
html body .site-header-builder-active .site-header,
html body .site-header-section,
html body [class^="ast-hb-"],
html body [class*=" ast-hb-"],
html body [id^="ast-desktop-header"],
html body [id^="ast-mobile-header"],
html body [data-section="section-primary-header-builder"],
html body [data-section^="section-above-header-builder"],
html body [data-section^="section-below-header-builder"],
html body [class*="header-builder"]:not(.tg-nav):not(#tg-nav):not(.tg-nav-links):not(.tg-nav-toggle),
html body [class*="ast-builder-header-bar"] {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    pointer-events: none !important;
    opacity: 0 !important;
    z-index: -1 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.entry-header, .entry-footer,
.ast-pagination, .post-navigation { display: none !important; }

.entry-content,
.ast-article-post, .ast-article-single,
.ast-article-inner,
.ast-no-sidebar .entry-content {
    padding: 0 !important;
    max-width: none !important;
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
    border: none !important;
}

/* ============================================================
   NAVIGATION
   ============================================================ */
.tg-nav {
    position: sticky; top: 0;
    z-index: 1000;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 56px;
    height: 84px;
    background: rgba(10, 15, 28, 0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

/* Logo container: explicit width AND height from CSS custom properties.
 * Without explicit width here, the flex container collapses to its image's
 * natural width, which produces a 48x48 square if the source file is the
 * favicon crop instead of the wide wordmark. Explicit dimensions decouple
 * the rendered container size from the source image. The custom properties
 * (--tg-logo-w, --tg-logo-h) are emitted via inline <style> by
 * trust_aigos_logo_inline_css() in functions.php and configured in
 * Customizer → T.R.U.S.T Site Options. */
.tg-nav-logo,
html body .tg-nav-logo {
    display: flex !important;
    align-items: center !important;
    width: var(--tg-logo-w, 140px) !important;
    height: var(--tg-logo-h, 48px) !important;
    flex-shrink: 0 !important;
}

.tg-nav-logo a,
html body .tg-nav-logo a {
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
    height: 100% !important;
}

/* Logo image: fills the container, scaled with object-fit: contain so
 * aspect ratio is preserved and no distortion occurs regardless of whether
 * the source file is square or wide. !important wins over any inline width
 * Astra (or anything else) may try to inject. */
.tg-nav-logo-img,
html body .tg-nav-logo-img,
html body .tg-nav-logo a img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    object-fit: contain !important;
    object-position: left center !important;
    display: block !important;
    aspect-ratio: auto !important;
}

.tg-nav-links {
    display: flex; align-items: center; gap: 40px;
    list-style: none;
}

.tg-nav-links a {
    font-family: var(--font-body);
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color 0.15s;
}

.tg-nav-links a:hover,
.tg-nav-links a.active,
.tg-nav-links li.current-menu-item > a,
.tg-nav-links li.current-menu-parent > a,
.tg-nav-links li.current_page_parent > a {
    color: var(--text-primary);
}

.tg-nav-cta {
    padding: 9px 20px !important;
    background: var(--brand-blue) !important;
    border: 1px solid var(--brand-blue) !important;
    color: #ffffff !important;
    border-radius: 4px;
    font-size: 0.88rem !important;
    font-weight: 500 !important;
    transition: background 0.15s, border-color 0.15s !important;
}

.tg-nav-cta:hover {
    background: #0A3DB0 !important;
    border-color: #0A3DB0 !important;
    color: #ffffff !important;
}

/* ============================================================
   FOOTER
   ============================================================ */
.tg-footer {
    padding: 56px 56px 32px;
    border-top: 1px solid var(--border);
    position: relative;
    z-index: 1;
    background: var(--bg-deep);
}

.tg-footer-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 40px;
    flex-wrap: wrap;
    gap: 32px;
}

.tg-footer-brand { max-width: 360px; }

.tg-footer-logo-img,
html body .tg-footer-logo-img,
html body .tg-footer-brand a img {
    height: 36px !important;
    width: auto !important;
    max-width: 240px !important;
    min-width: 0 !important;
    object-fit: contain !important;
    object-position: left center !important;
    display: block !important;
    aspect-ratio: auto !important;
    margin-bottom: 18px;
    opacity: 0.95;
}

.tg-footer-tagline {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.65;
}

.tg-footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.tg-footer-copy {
    font-family: var(--font-body);
    font-size: 0.82rem;
    color: var(--text-muted);
}

.tg-footer-nav {
    display: flex; gap: 28px; list-style: none; padding: 0; margin: 0;
}

.tg-footer-nav a {
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: color 0.15s;
}

.tg-footer-nav a:hover { color: var(--text-primary); }

/* ============================================================
   BREADCRUMB
   ============================================================ */
.tg-breadcrumb {
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 32px;
    display: flex; align-items: center; gap: 8px;
    position: relative;
}

.tg-breadcrumb a { color: var(--text-muted); transition: color 0.15s; }
.tg-breadcrumb a:hover { color: var(--accent-primary); }
.tg-breadcrumb span { color: var(--text-secondary); }

/* ============================================================
   BUTTONS
   ============================================================ */
.tg-btn-primary {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 13px 28px;
    background: var(--brand-blue);
    color: #ffffff;
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.95rem;
    border: 1px solid var(--brand-blue);
    border-radius: 4px;
    transition: background 0.15s, border-color 0.15s;
    cursor: pointer;
    text-decoration: none;
}

.tg-btn-primary:hover {
    background: #0A3DB0;
    border-color: #0A3DB0;
    color: #ffffff;
}

.tg-btn-secondary {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 13px 28px;
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.95rem;
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    cursor: pointer;
    text-decoration: none;
}

.tg-btn-secondary:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary-bright);
    background: rgba(74, 127, 227, 0.05);
}

/* ============================================================
   SECTION TYPOGRAPHY
   ============================================================ */
.tg-section-tag {
    font-family: var(--font-body);
    font-size: 0.78rem;
    color: var(--accent-primary);
    letter-spacing: 0.04em;
    font-weight: 500;
    margin-bottom: 16px;
    text-transform: uppercase;
}

.tg-section-title {
    font-family: var(--font-heading);
    font-size: clamp(1.85rem, 3.4vw, 2.6rem);
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 18px;
    color: var(--text-primary);
    letter-spacing: -0.015em;
}

.tg-section-sub {
    font-size: 1.02rem;
    color: var(--text-secondary);
    max-width: 680px;
    margin-bottom: 56px;
    line-height: 1.7;
}

.tg-section { padding: 96px 56px; position: relative; z-index: 1; }

/* ============================================================
   .tg-reveal — kept as a no-op class for backward compatibility.
   Earlier versions of this theme used JS to fade these in on scroll,
   but that introduced a critical failure mode where the JS would be
   stripped by caching/minification/security plugins for non-logged-in
   visitors, leaving content invisible. We've removed the JS dependency
   entirely. Content is always visible. Class is preserved so existing
   templates don't need to be edited.
   ============================================================ */
.tg-reveal { /* no-op — always visible */ }

/* ============================================================
   PUBLICATION CATEGORY TAGS
   ============================================================ */
.tg-pub-tag {
    padding: 4px 11px;
    border-radius: 3px;
    font-family: var(--font-body);
    font-size: 0.72rem;
    letter-spacing: 0.02em;
    font-weight: 500;
    display: inline-block;
}

.tg-pub-tag-research  { background: rgba(74, 127, 227, 0.10); color: var(--accent-primary); }
.tg-pub-tag-advisory  { background: rgba(229, 166, 69, 0.10); color: var(--accent-amber); }
.tg-pub-tag-blog      { background: rgba(168, 176, 192, 0.10); color: var(--text-secondary); }
.tg-pub-tag-threat    { background: rgba(255, 101, 101, 0.10); color: var(--accent-coral); }
.tg-pub-tag-technique { background: rgba(93, 211, 158, 0.10); color: var(--accent-success); }
.tg-pub-tag-default   { background: rgba(74, 127, 227, 0.10); color: var(--accent-primary); }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.tg-empty-state {
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: 8px;
    padding: 80px 32px;
    text-align: center;
}

.tg-empty-icon {
    width: 56px; height: 56px;
    color: var(--text-dim);
    margin: 0 auto 20px;
}

.tg-empty-title {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    letter-spacing: -0.01em;
}

.tg-empty-text {
    font-size: 0.95rem;
    color: var(--text-secondary);
    max-width: 460px;
    margin: 0 auto;
    line-height: 1.65;
}

/* ============================================================
   MOBILE NAV TOGGLE
   ============================================================ */
.tg-nav-toggle {
    display: none;
    background: transparent;
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0;
    transition: border-color 0.15s, background 0.15s;
}

.tg-nav-toggle:hover {
    border-color: var(--accent-primary);
    background: rgba(74, 127, 227, 0.05);
}

.tg-nav-toggle svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
}

.tg-nav-toggle .tg-nav-toggle-close { display: none; }
.tg-nav.is-open .tg-nav-toggle .tg-nav-toggle-open { display: none; }
.tg-nav.is-open .tg-nav-toggle .tg-nav-toggle-close { display: block; }


/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .tg-section { padding: 72px 40px; }
    .tg-nav, .tg-footer { padding-left: 40px; padding-right: 40px; }
}

@media (max-width: 768px) {
    .tg-nav {
        padding: 0 20px;
        height: 68px;
    }
    .tg-section { padding: 56px 20px; }
    .tg-footer { padding: 40px 20px 24px; }

    .tg-nav-logo,
    html body .tg-nav-logo {
        width: var(--tg-logo-w-mobile, 110px) !important;
        height: var(--tg-logo-h-mobile, 38px) !important;
    }

    /* Hide desktop links, show toggle */
    .tg-nav-links {
        position: fixed;
        top: 68px;
        left: 0;
        right: 0;
        background: rgba(10, 15, 28, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 8px 20px 24px;
        border-bottom: 1px solid var(--border);
        max-height: calc(100vh - 64px);
        overflow-y: auto;
        transform: translateY(-12px);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.18s, transform 0.18s;
        z-index: 999;
    }

    .tg-nav.is-open .tg-nav-links {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }

    .tg-nav-links li {
        list-style: none;
        border-bottom: 1px solid var(--border);
    }
    .tg-nav-links li:last-child { border-bottom: none; }

    .tg-nav-links a {
        display: block;
        padding: 16px 4px;
        font-size: 1rem;
        min-height: 44px;
    }

    .tg-nav-links .tg-nav-cta,
    .tg-nav-links a.tg-nav-cta {
        margin-top: 12px;
        text-align: center;
        padding: 14px 20px !important;
        border-radius: 4px;
    }

    .tg-nav-toggle { display: inline-flex; }

    .tg-section-title { font-size: clamp(1.55rem, 6vw, 2rem); }
    .tg-section-sub { font-size: 0.96rem; margin-bottom: 36px; }

    /* Footer stacks */
    .tg-footer-top { flex-direction: column; gap: 24px; }
    .tg-footer-bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    .tg-footer-nav {
        flex-wrap: wrap;
        gap: 16px 20px;
        width: 100%;
    }

    /* Buttons stack and full-width on small screens */
    .tg-btn-primary, .tg-btn-secondary {
        padding: 14px 24px;
        font-size: 0.95rem;
        min-height: 48px;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .tg-nav, .tg-section, .tg-footer {
        padding-left: 16px; padding-right: 16px;
    }
}


/* ============================================================
   GENERIC PAGE FALLBACK (page.php)
   ============================================================ */
.tg-page-generic {
    max-width: 760px;
    margin: 0 auto;
}

.tg-page-generic-content {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    line-height: 1.75;
    color: var(--text-secondary);
    margin-top: 32px;
}

.tg-page-generic-content h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 1.8em 0 0.6em;
    letter-spacing: -0.01em;
}

.tg-page-generic-content h3 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 1.4em 0 0.5em;
}

.tg-page-generic-content p { margin-bottom: 1.4em; }

.tg-page-generic-content a {
    color: var(--accent-primary);
    text-decoration: underline;
    text-decoration-color: rgba(74, 127, 227, 0.3);
}

.tg-page-generic-content a:hover {
    text-decoration-color: var(--accent-primary);
}

.tg-page-generic-content ul,
.tg-page-generic-content ol {
    margin: 1.2em 0 1.4em 1.4em;
}

.tg-page-generic-content li {
    margin-bottom: 0.5em;
}
