/* === AI Vanguard Custom Styles === */
/* Palette: FPT brand — orange #f37021, green #51b848, blue #034ea2 */

/* ----------------------------------------------------------------
    1. Theme Color Tokens — FPT brand palette
    ---------------------------------------------------------------
    FPT primary:   Orange #f37021  (accents, CTAs)
    FPT secondary: Blue  #034ea2  (links, info)
    FPT tertiary:  Green #51b848  (success, highlights)
    FPT navy:      #162670        (dark accents)
   ---------------------------------------------------------------- */
html:not([data-theme]),
html[data-theme="light"] {
    --nv-color-green: #f37021;
    --nv-color-green-2: #034ea2;
    --pst-color-primary: #034ea2;
    --pst-color-secondary: #f37021;
    --pst-color-accent: #f37021;
    --pst-color-link: #034ea2;
    --pst-color-link-hover: #162670;
    --cc-surface: #ffffff;
    --cc-surface-alt: #f8f9fa;
    --cc-border: #e2e5e9;
    --cc-text: #1a1a1a;
    --cc-text-muted: #666;
    --cc-primary: #f37021;
    --cc-primary-hover: #d4601a;
    --cc-hint: #034ea2;
    --cc-success: #51b848;
}

html[data-theme="dark"] {
    --nv-color-green: #f5924e;
    --nv-color-green-2: #f37021;
    --pst-color-primary: #f5924e;
    --pst-color-secondary: #5a9fd4;
    --pst-color-accent: #f5924e;
    --pst-color-link: #5a9fd4;
    --pst-color-link-hover: #7db8e8;
    --cc-surface: #111827;
    --cc-surface-alt: #1e2636;
    --cc-border: #2d3748;
    --cc-text: #f0f0f0;
    --cc-text-muted: #9ca3af;
    --cc-primary: #f5924e;
    --cc-primary-hover: #f37021;
    --cc-hint: #5a9fd4;
    --cc-success: #6bc962;
}

/* ----------------------------------------------------------------
   2. Typography — NVIDIA Sans (from theme), keep theme defaults
   ---------------------------------------------------------------- */

article h1,
article h2,
article h3,
article h4 {
    font-family: var(--pst-font-family-heading);
}

/* ----------------------------------------------------------------
   3. Global Layout
   ---------------------------------------------------------------- */

/* Hide redundant h1 on homepage (hero section has the title) */
#ai-vanguard > h1 {
    display: none;
}

article.bd-article {
    line-height: 1.75;
}

article.bd-article > section {
    max-width: 48rem;
}

article h2 {
    border-top: 1px solid var(--cc-border);
    padding-top: 1rem;
    margin-top: 2rem;
}

/* Article images */
article img {
    border-radius: 6px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Hide duplicate search icon */
.bd-header .search-button__button {
    display: none !important;
}

/* Navbar logo spacing */
.bd-header .navbar-brand img {
    height: 2.5rem;
    padding: 0.2rem 0;
    margin-right: 0.5rem;
}

/* Footer monochrome logo */
.footer-brand.logo {
    display: inline-block;
    margin-bottom: 0.5rem;
}

.footer-logo {
    height: 2rem;
    filter: grayscale(1) brightness(0.55) contrast(20);
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.footer-logo:hover {
    opacity: 1;
}

html[data-theme="dark"] .footer-logo {
    filter: grayscale(1) brightness(0.55) contrast(20) invert(1);
}

/* ----------------------------------------------------------------
   4. Tech Joke Terminal
   ---------------------------------------------------------------- */
.tech-joke {
    max-width: none;
    margin: 0 0 1.5rem 0;
    width: 100%;
}

.tech-joke__window {
    background: #111827;
    border-radius: 12px;
    border: 1px solid var(--cc-border);
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

html[data-theme="light"] .tech-joke__window {
    background: #1f2937;
}

.tech-joke__titlebar {
    background: #1f2937;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

html[data-theme="light"] .tech-joke__titlebar {
    background: #374151;
}

.tech-joke__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.tech-joke__dot--red {
    background: #ef4444;
}
.tech-joke__dot--yellow {
    background: #eab308;
}
.tech-joke__dot--green {
    background: #22c55e;
}

.tech-joke__filename {
    color: #9ca3af;
    font-size: 0.75rem;
    margin-left: 8px;
    font-family: var(--pst-font-family-monospace);
}

.tech-joke__body {
    padding: 14px 18px;
    font-family: var(--pst-font-family-monospace);
    font-size: 0.82rem;
    line-height: 1.6;
}

.tech-joke__cmd {
    color: var(--cc-primary);
}

html[data-theme="light"] .tech-joke__cmd {
    color: var(--cc-primary);
}

.tech-joke__comment {
    color: #6b7280;
    margin-top: 2px;
}

.tech-joke__output {
    color: #d1d5db;
    margin-top: 2px;
}

html[data-theme="light"] .tech-joke__output {
    color: #d1d5db;
}

/* ----------------------------------------------------------------
   5. Hero Section
   ---------------------------------------------------------------- */
.hero-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem 2rem;
    border-radius: 16px;
    margin-bottom: 1.5rem;
    color: white;
    min-height: 200px;
    position: relative;
    overflow: hidden;
}

.hero-section__bg {
    position: absolute;
    inset: 0;
    background: url("../img/hero-banner-light.jpg") center / cover no-repeat;
    z-index: 0;
}

html[data-theme="dark"] .hero-section__bg {
    background-image: url("../img/hero-banner-dark.jpg");
}

.hero-section__title {
    font-size: 3rem;
    font-weight: bold;
    line-height: 1.1;
    margin-bottom: 0.75rem;
    font-family: var(--pst-font-family-heading);
}

.hero-section__subtitle {
    font-size: 1.1rem;
    color: #d1d5db;
    margin-bottom: 1.25rem;
}

.hero-section__title,
.hero-section__subtitle,
.hero-section__cta {
    position: relative;
    z-index: 1;
}

.hero-section__cta {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ----------------------------------------------------------------
   6. Buttons — LearnFlow orange primary
   ---------------------------------------------------------------- */
.sd-btn-success,
.accent-card .sd-btn-success {
    background-color: var(--cc-primary) !important;
    border-color: var(--cc-primary) !important;
    color: #fff !important;
    font-family: var(--pst-font-family-heading);
    font-size: 0.9rem;
    border-radius: 12px;
}

.sd-btn-success:hover,
.accent-card .sd-btn-success:hover {
    background-color: var(--cc-primary-hover) !important;
    border-color: var(--cc-primary-hover) !important;
}

/* ----------------------------------------------------------------
   7. Cards
   ---------------------------------------------------------------- */
.sd-card {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    border-color: var(--cc-border);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s ease;
}

.sd-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Accent cards (orange left border) */
.accent-card.sd-card {
    border-left: 4px solid var(--cc-primary);
}

/* ----------------------------------------------------------------
   8. Admonitions
   ---------------------------------------------------------------- */
.admonition {
    border: none;
    border-left: 3px solid var(--pst-color-primary);
    background: var(--cc-surface-alt);
    border-radius: 0 12px 12px 0;
}

html[data-theme="dark"] .admonition {
    background: #1e293b;
}

.admonition.tip,
.admonition.hint {
    border-left-color: var(--cc-primary);
    background: var(--cc-surface-alt);
}

html[data-theme="dark"] .admonition.tip,
html[data-theme="dark"] .admonition.hint {
    background: var(--cc-surface-alt);
}

.admonition.warning,
.admonition.caution {
    border-left-color: #eab308;
    background: #fefce8;
}

html[data-theme="dark"] .admonition.warning,
html[data-theme="dark"] .admonition.caution {
    background: #1a1806;
}

.admonition.danger,
.admonition.error {
    border-left-color: #ef4444;
    background: #fef2f2;
}

html[data-theme="dark"] .admonition.danger,
html[data-theme="dark"] .admonition.error {
    background: #1f0a0a;
}

.admonition.note,
.admonition.important {
    border-left-color: #22c55e;
    background: #f0fdf4;
}

html[data-theme="dark"] .admonition.note,
html[data-theme="dark"] .admonition.important {
    background: #0a1f14;
}

/* ----------------------------------------------------------------
   9. Learning Path Steps
   ---------------------------------------------------------------- */
.learning-path {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.learning-path__step {
    background: var(--cc-surface-alt);
    padding: 0.4rem 0.75rem;
    border-radius: 9999px;
    text-align: center;
    font-size: 0.8rem;
    flex: 1;
    min-width: 80px;
}

.learning-path__step--active {
    background: var(--cc-primary);
    color: white;
    font-weight: 600;
}

.learning-path__arrow {
    color: var(--cc-text-muted);
    font-size: 0.75rem;
    flex-shrink: 0;
}

/* ----------------------------------------------------------------
   10. Page Metadata Header
   ---------------------------------------------------------------- */
.page-metadata {
    margin-bottom: 1rem;
}

.page-metadata__course-label {
    font-size: 0.7rem;
    color: var(--cc-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    font-family: var(--pst-font-family-heading);
    margin-bottom: 0.25rem;
}

.page-metadata__info {
    font-size: 0.85rem;
    color: var(--cc-text-muted);
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.page-metadata__separator {
    border: none;
    border-top: 1px solid var(--cc-border);
    margin: 0.75rem 0 0;
}

/* Prev/next position counter */
.prev-next-counter {
    text-align: center;
    background: var(--cc-surface-alt);
    padding: 0.3rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    color: var(--cc-text-muted);
    white-space: nowrap;
    display: block;
    margin: 0 auto 0.75rem;
    width: fit-content;
}

/* ----------------------------------------------------------------
   11. 404 Terminal Page
   ---------------------------------------------------------------- */
#page-not-found > h1 {
    display: none;
}

.not-found-wrapper {
    display: flex;
    justify-content: center;
    padding: 2rem 1rem;
}

.not-found-terminal {
    background: #111827;
    border: 1px solid #374151;
    border-radius: 12px;
    padding: 1.5rem 2rem;
    max-width: 420px;
    width: 100%;
    font-family: var(--pst-font-family-monospace);
    color: #9ca3af;
}

.not-found-dots {
    display: flex;
    gap: 6px;
    margin-bottom: 1rem;
}

.not-found-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.not-found-dot--red {
    background: #ef4444;
}
.not-found-dot--yellow {
    background: #eab308;
}
.not-found-dot--green {
    background: #22c55e;
}

.not-found-prompt {
    color: var(--cc-primary);
}

.not-found-code {
    color: var(--cc-primary);
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0.75rem 0 0.5rem;
    line-height: 1;
}

.not-found-error {
    color: #ef4444;
}

.not-found-hint {
    color: #6b7280;
    font-size: 0.85rem;
    margin-top: 1rem;
}

.not-found-hint a {
    color: var(--cc-primary);
    text-decoration: none;
}

.not-found-hint a:hover {
    text-decoration: underline;
}

/* ================================================================
   12. NGC-style Sidebar Navigation
   ================================================================ */

/* Push entire layout edge-to-edge */
.bd-page-width {
    max-width: 100%;
}

.bd-header .bd-header__inner {
    max-width: 100%;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.bd-sidebar-primary {
    padding-left: 0;
    padding-top: 4px !important;
    overflow: visible !important;
    z-index: 1000;
}

.bd-main {
    position: relative;
    z-index: 1;
}

.bd-footer {
    position: relative;
    z-index: 1001;
}

/* Hide default theme sidebar navigation */
.bd-sidebar .sidebar-primary-items__start-content .nav,
.bd-sidebar .sidebar-primary-items__start-content .sidebar-primary-items__title {
    display: none;
}

/* Sidebar nav container — scrollable with overlay scrollbar */
.sidebar-nav {
    padding: 0;
    max-height: calc(100vh - var(--pst-header-height, 3rem) - 8px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-gutter: stable;
}

/* Overlay scrollbar so it doesn't push content or create a gap before the flyout */
.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--cc-border);
    border-radius: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: var(--cc-text-muted);
}

/* Sidebar nav section divider */
.sidebar-nav-section {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--cc-border);
}

.sidebar-nav-section:first-child {
    margin-top: 0;
    padding-top: 6px;
    border-top: none;
}

.sidebar-nav-section__title {
    padding: 6px 16px 10px;
    font-size: 0.95rem;
    letter-spacing: 0;
    color: var(--cc-text-muted);
    font-weight: 700;
    font-family: var(--pst-font-family-heading);
}

.sidebar-nav-item__external {
    font-size: 14px;
    margin-left: auto;
    color: var(--cc-text-muted);
}

.bd-sidebar-primary .sidebar-primary-items__start .sidebar-primary-item {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* Nav item (top-level) — override theme link color */
.sidebar-nav a,
.sidebar-nav a:link,
.sidebar-nav a:visited {
    color: var(--cc-text-muted);
    text-decoration: none;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    min-height: 44px;
    box-sizing: border-box;
    color: var(--cc-text-muted);
    text-decoration: none;
    border-left: none;
    box-shadow: none;
    transition: background 0.15s ease, color 0.15s ease;
    font-size: 0.9rem;
    cursor: pointer;
}

.sidebar-nav-item:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--cc-text);
    text-decoration: none;
}

html[data-theme="dark"] .sidebar-nav-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

/* Active nav item (level 1) */
.sidebar-nav a.sidebar-nav-item--active,
.sidebar-nav a.sidebar-nav-item--active:link,
.sidebar-nav a.sidebar-nav-item--active:visited {
    color: var(--cc-primary);
}

.sidebar-nav-item--active {
    color: var(--cc-primary);
    background: rgba(243, 112, 33, 0.06);
    font-weight: 600;
    position: relative;
}

.sidebar-nav-item--active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    background: var(--cc-primary);
    border-radius: 2px;
}

.sidebar-nav-item--active:hover {
    color: var(--cc-primary);
    background: rgba(243, 112, 33, 0.1);
}

/* Icon */
.sidebar-nav-item__icon {
    font-size: 18px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

/* Chevron */
.sidebar-nav-item__chevron {
    margin-left: auto;
    font-size: 20px;
    transition: transform 0.15s ease;
    cursor: pointer;
    flex-shrink: 0;
}

.sidebar-nav-item[data-expanded="true"] .sidebar-nav-item__chevron {
    transform: rotate(180deg);
}

/* Sub-items container */
.sidebar-nav-subitems {
    overflow: visible;
}

/* Sub-item */
.sidebar-nav-subitem {
    display: block;
    padding: 7px 16px 7px 48px;
    color: var(--cc-text-muted);
    font-size: 0.82rem;
    text-decoration: none;
    border-left: none;
    box-shadow: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-nav-subitem:hover {
    background: rgba(0, 0, 0, 0.03);
    color: var(--cc-text);
    text-decoration: none;
}

html[data-theme="dark"] .sidebar-nav-subitem:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* Active sub-item (level 2) */
.sidebar-nav a.sidebar-nav-subitem--active,
.sidebar-nav a.sidebar-nav-subitem--active:link,
.sidebar-nav a.sidebar-nav-subitem--active:visited {
    color: var(--cc-primary);
}

.sidebar-nav-subitem--active {
    color: var(--cc-primary);
    font-weight: 600;
    position: relative;
}

.sidebar-nav-subitem--l2.sidebar-nav-subitem--active::before {
    content: "";
    position: absolute;
    left: 24px;
    top: 6px;
    bottom: 6px;
    width: 3px;
    background: var(--cc-primary);
    border-radius: 2px;
}

/* Active sub-item level 3 */
.sidebar-nav-subitem--l3.sidebar-nav-subitem--active::before {
    content: "";
    position: absolute;
    left: 48px;
    top: 5px;
    bottom: 5px;
    width: 3px;
    background: var(--cc-primary);
    border-radius: 2px;
}

/* Sub-item with children (level 2 expand) */
.sidebar-nav-subitem[data-has-children] {
    display: flex;
    align-items: center;
}

.sidebar-nav-subitem__label {
    flex: 1;
}

.sidebar-nav-subitem__chevron {
    font-size: 16px;
    margin-left: auto;
    transition: transform 0.15s ease;
}

.sidebar-nav-subitem[data-expanded="true"] .sidebar-nav-subitem__chevron {
    transform: rotate(180deg);
}

/* Level 3 sub-items (inline expand) */
.sidebar-nav-subitem--l3 {
    padding-left: 72px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
}

/* Flyout arrow on level 3 items with children */
.sidebar-nav-subitem__flyout-arrow {
    font-size: 14px;
    margin-left: auto;
}

/* Level 3 entry (flyout trigger) */
.sidebar-nav-l3-entry {
    position: relative;
}

/* Flyout panel (level 4) */
.sidebar-nav-flyout {
    display: none;
    position: fixed;
    left: 0;
    top: 0;
    min-width: 160px;
    background: var(--pst-color-background);
    border: 1px solid var(--cc-border);
    border-left: none;
    border-radius: 0 12px 12px 0;
    padding: 6px 0;
    box-shadow: 4px 4px 12px -2px rgba(0, 0, 0, 0.1);
    z-index: 9999;
}

html[data-theme="dark"] .sidebar-nav-flyout {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

.sidebar-nav-flyout.sidebar-nav-flyout--visible {
    display: block;
}

/* Flyout items */
.sidebar-nav-flyout__item,
.sidebar-nav-flyout__item:link,
.sidebar-nav-flyout__item:visited {
    display: block;
    padding: 7px 16px;
    color: var(--cc-text-muted) !important;
    font-size: 0.82rem;
    text-decoration: none !important;
    white-space: nowrap;
    border-left: 3px solid transparent;
    font-weight: 400;
}

.sidebar-nav-flyout__item:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--cc-text);
    text-decoration: none;
}

html[data-theme="dark"] .sidebar-nav-flyout__item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.sidebar-nav-flyout__item--active,
.sidebar-nav-flyout__item--active:link,
.sidebar-nav-flyout__item--active:visited {
    color: var(--cc-primary) !important;
    font-weight: 600;
    border-left: 3px solid var(--cc-primary);
}

/* ----------------------------------------------------------------
   13. "NEW" Superscript Badge
   ---------------------------------------------------------------- */
.badge-new {
    font-size: 0.5em;
    font-weight: 700;
    color: #fff;
    background: var(--cc-primary);
    padding: 0.15em 0.45em;
    border-radius: 4px;
    vertical-align: super;
    margin-left: 0.3em;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    line-height: 1;
    white-space: nowrap;
    display: inline-block;
    position: relative;
    top: -0.15em;
}
