/* --- base.css --- */
/* ==========================================================================
   1. Base Tokens, Reset & Main Container
   ========================================================================== */
:root {
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --bg-nav: #111827;
    --bg-hover: #374151;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-blue: #2563eb;
    --accent-blue-hover: #1d4ed8;
    --border-color: #334155;

    /* Shared Unified Font Variables */
    --font-nav-doc: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-size-nav: 1.05rem;
    --font-weight-nav: 500;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-nav-doc);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ==========================================================================
   Page Header & Container Spacing Section
   ========================================================================== */

/* Spacing and centering adjustments for the main container */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 3rem auto;          /* Added explicit top & bottom margins (Requirement 2) */
    padding: 0 1.5rem;
    flex: 1;
    text-align: center;         /* Ensures default center alignment across container elements */
}

/* Specific styling for the Page Header section */
.page-header-section {
    margin-top: 1.5rem;
    margin-bottom: 2.5rem;
    text-align: center;         /* All text explicitly centered (Requirement 1) */
}

/* Main title styling */
.page-header-section .page-main-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

/* Sub-message / tagline styling */
.page-header-section .page-sub-message {
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--text-secondary);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;         /* Centers the element horizontally if max-width restricts it */
    line-height: 1.5;
}



/* --- doc-selection.css --- */
/* ==========================================================================
   4. Documentation Section (Landing Page Cards & Lists)
   ========================================================================== */
.doc-section {
    margin: 3rem 0;
    padding: 2rem;
    background-color: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    text-align: left; /* Explicitly reset to left-adjusted layout inside card */
}

.doc-heading {
    font-family: var(--font-nav-doc);
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
    text-align: left;
}

/* Custom Styled Bulleted List */
.doc-list {
    list-style: none;
    padding-left: 0;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.doc-list-item {
    display: flex;
    align-items: center;
}

.doc-list-item::before {
    content: "•";
    color: var(--accent-blue);
    font-size: 1.5rem;
    line-height: 1;
    margin-right: 0.8rem;
}

/* Base Link Styling & Visited States */
.doc-link-item,
.doc-link-item:visited,
.doc-link-item:active {
    font-family: var(--font-nav-doc);
    font-size: var(--font-size-nav);
    font-weight: var(--font-weight-nav);
    color: var(--text-primary); /* Overrides browser default purple for visited links */
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    transition: color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.doc-link-item:hover {
    color: var(--accent-blue);
    background-color: rgba(255, 255, 255, 0.05);
    transform: translateX(4px);
}

.doc-arrow {
    font-size: 1rem;
    color: var(--text-secondary);
    transition: transform 0.2s ease, color 0.2s ease;
}

.doc-link-item:hover .doc-arrow {
    color: var(--accent-blue);
    transform: translateX(3px);
}


/* --- footer.css --- */
/* ==========================================================================
   6. Footer
   ========================================================================== */
footer {
    background-color: var(--bg-nav);
    text-align: center;
    padding: 1.8rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}


/* --- hero.css --- */
/* ==========================================================================
   Hero Section / Carousel Styles
   ========================================================================== */

/* --- Hero Section Outer Wrapper --- */
.hero-section {
    position: relative;
    width: 100%;
    margin: 0 auto 2rem auto;
    overflow: hidden;
    clear: both;
}

/* --- Carousel Container (Strict 16:9 Aspect Ratio) --- */
.carousel {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 500px;
    overflow: hidden;
    border-radius: 8px;
    /* Uses card background color from base.css */
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
}

.carousel-track {
    position: relative;
    width: 100%;
    height: 100%;
}

/* --- Slide Layering (Absolute Stacking) --- */
.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s ease-in-out, visibility 0.6s ease-in-out;
    display: flex;
    justify-content: center;
    align-items: center;
    /* Matches container background to prevent flashes during transitions */
    background-color: var(--bg-card); 
}

.carousel-slide.active {
    opacity: 1;
    visibility: visible;
    z-index: 1;
}

/* --- Image Fitting & Aspect Ratio Handling --- */
.carousel-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    /* Fits full image inside viewport without cropping */
    object-fit: contain;
    object-position: center;
    display: block;
}

/* --- Carousel Dot Navigation --- */
.carousel-nav {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.75rem;
    z-index: 10;
    /* Soft dark pill backdrop for navigation contrast */
    background-color: rgba(15, 23, 42, 0.6);
    padding: 0.4rem 0.8rem;
    border-radius: 9999px;
    backdrop-filter: blur(4px);
}

.carousel-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    background-color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    padding: 0;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.carousel-dot.active,
.carousel-dot:hover {
    background-color: #ffffff;
    transform: scale(1.25);
}


/* --- markdown.css --- */
/* ==========================================================================
   5. Markdown Documentation Reader (.markdown-body)
   ========================================================================== */

/* Typography Scale Variables (Typesetting Ratio ~1.25 Major Third) */
.markdown-body {
    --fs-h1: 2.25rem;  /* 36px */
    --fs-h2: 1.75rem;  /* 28px */
    --fs-h3: 1.35rem;  /* 21.6px */
    --fs-h4: 1.15rem;  /* 1j.4px */
    --fs-h5: 1.00rem;  /* 16px */
    --fs-h6: 0.875rem; /* 14px */

    background-color: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-top: 1.5rem;
    color: var(--text-primary);

    /* --- Standard A4 Print & Margin Constraints --- */
    /* Padding provides the inner margin headroom */
    padding: 3.5rem 4rem; 

    /* Cap width at 80 characters per line */
     max-width: calc(80ch + 8rem);

    /* Straight centered left/right margins */
    margin-left: auto; 
    margin-right: auto;

    /* Base Body Text Specs */
    font-size: 1.05rem;
    line-height: 1.75;
    letter-spacing: -0.011em;
}

/* --------------------------------------------------------------------------
   Paragraphs & Text Alignment
   -------------------------------------------------------------------------- */
.markdown-body p {
    margin-bottom: 1.4rem;
    color: var(--text-primary);
    
    /* Straight left and right edges (Justified layout) */
    text-align: justify;
    text-justify: inter-word;
    
    /* Enables clean word breaks at line edges */
    hyphens: auto;
    -webkit-hyphens: auto;
}

/* --------------------------------------------------------------------------
   Headings Hierarchy & Vertical Rhythm
   -------------------------------------------------------------------------- */
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    color: #ffffff;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.02em;
    text-align: left; /* Keep headers clean left-aligned */
}

/* H1: Document Primary Header */
.markdown-body h1 {
    font-size: var(--fs-h1);
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 1.2rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border-color);
}

/* H2: Section Headers */
.markdown-body h2 {
    font-size: var(--fs-h2);
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* H3: Sub-sections */
.markdown-body h3 {
    font-size: var(--fs-h3);
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

/* H4-H6: Minor Headings */
.markdown-body h4 { font-size: var(--fs-h4); margin-top: 1.75rem; margin-bottom: 0.5rem; }
.markdown-body h5 { font-size: var(--fs-h5); margin-top: 1.5rem; margin-bottom: 0.5rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-secondary); }
.markdown-body h6 { font-size: var(--fs-h6); margin-top: 1.25rem; margin-bottom: 0.5rem; color: var(--text-secondary); }

/* --------------------------------------------------------------------------
   Lists & Links
   -------------------------------------------------------------------------- */
.markdown-body ul,
.markdown-body ol {
    margin-top: 0;
    margin-bottom: 1.5rem;
    /* Increased from 1.8rem to give the bullet markers more room */
    padding-left: 2.5rem; 
}

.markdown-body li {
    margin-bottom: 0.8rem;
    
    /* 1. Creates a clean gap between the bullet marker and the text */
    padding-left: 0.5rem;
    
    /* 2. Forces a strict hanging indent so wrapped text doesn't flow under the bullet */
    list-style-position: outside;
    
    /* 3. Match paragraph typography */
    line-height: 1.75;
    color: var(--text-primary);
    
    /* 4. Match the paragraph justification and hyphenation for a cohesive look */
    text-align: justify;
    text-justify: inter-word;
    hyphens: auto;
    -webkit-hyphens: auto;
}

/* Optional: Soften the bullet markers so they don't overpower the text */
.markdown-body li::marker {
    color: rgba(255, 255, 255, 0.5); 
}

.markdown-body li > ul,
.markdown-body li > ol {
    margin-top: 0.6rem;
    margin-bottom: 0;
}

.markdown-body strong {
    color: #ffffff;
    font-weight: 600;
}

.markdown-body a {
    color: var(--accent-blue);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.markdown-body a:hover {
    color: #60a5fa;
    border-bottom-color: #60a5fa;
}

/* --------------------------------------------------------------------------
   Images & Visual Media
   -------------------------------------------------------------------------- */
.markdown-body img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.5rem auto; /* Centers the image and adds vertical spacing */
    border-radius: 6px;  /* Optional: keeps aesthetics consistent */
}

/* --------------------------------------------------------------------------
   Code & Technical Blocks
   -------------------------------------------------------------------------- */
.markdown-body :not(pre) > code {
    background-color: rgba(255, 255, 255, 0.08);
    color: #f1f5f9;
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.88em;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.markdown-body pre {
    background-color: #090d16;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    overflow-x: auto;
    margin-bottom: 1.6rem;
    text-align: left; /* Preformatted code remains left-aligned */
}

.markdown-body pre code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.9em;
    line-height: 1.6;
    color: #e2e8f0;
}

/* --------------------------------------------------------------------------
   Tables & Callouts
   -------------------------------------------------------------------------- */
.markdown-body blockquote {
    margin: 1.8rem 0;
    padding: 1rem 1.4rem;
    border-left: 4px solid var(--accent-blue);
    background-color: rgba(37, 99, 235, 0.08);
    border-radius: 0 8px 8px 0;
    color: var(--text-secondary);
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.8rem;
    font-size: 0.95rem;
}

.markdown-body table th,
.markdown-body table td {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    text-align: left;
}

.markdown-body table th {
    background-color: rgba(255, 255, 255, 0.04);
    font-weight: 600;
    color: #ffffff;
}

/* Responsive adjustments for narrower screens */
@media (max-width: 768px) {
    .markdown-body {
        --fs-h1: 1.85rem;
        --fs-h2: 1.45rem;
        --fs-h3: 1.2rem;
        padding: 1.5rem;
        text-align: left; /* Revert to left-aligned on small mobile screens */
    }
    
    .markdown-body p {
        text-align: left;
    }
}


/* --- navbar.css --- */
/* ==========================================================================
   2. Navbar & Navigation
   ========================================================================== */
.navbar {
    display: flex;
    align-items: center;
    background-color: var(--bg-nav);
    /* Scales padding from 0.5rem on mobile to 2rem on desktop */
    padding: 0.8rem clamp(0.5rem, 2vw, 2rem);
    width: 100%;
    box-sizing: border-box;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    border-bottom: 1px solid var(--border-color);
}

/* Brand Logo */
.nav-brand {
    display: flex;
    align-items: center;
    margin-right: clamp(0.5rem, 2.5vw, 2.5rem);
    flex-shrink: 0;
}

.nav-logo {
    /* Scales logo smoothly between 26px (mobile) and 40px (desktop) */
    height: clamp(26px, 2.5vw + 16px, 40px);
    width: auto;
    object-fit: contain;
    display: block;
}

/* Navigation Links - Left-Aligned next to Logo */
.nav-links {
    display: flex;
    align-items: center;
    gap: clamp(0.25rem, 1.2vw, 1.5rem);
    margin-right: auto;
    min-width: 0;
}

/* Top-level menu links and dropdown triggers */
.nav-links > a,
.nav-dropdown-toggle,
.dropbtn {
    font-family: var(--font-nav-doc);
    /* 
       FLUID FONT SCALING FORMULA:
       Min: 0.7rem (~11px on tiny mobile)
       Preferred: 0.6rem + 0.8vw (Scales smoothly with screen width)
       Max: 1.15rem (~18px on large desktop)
    */
    font-size: clamp(0.7rem, 0.6rem + 0.8vw, 1.15rem);
    font-weight: var(--font-weight-nav);
    color: var(--text-primary);
    text-decoration: none;
    padding: 0.5rem clamp(0.2rem, 0.6vw, 0.8rem);
    border-radius: 6px;
    transition: color 0.2s ease, background-color 0.2s ease;
    display: inline-flex;
    align-items: center;
    background: transparent;
    border: none;
    cursor: pointer;
    white-space: nowrap;
}

.nav-links > a:hover,
.nav-dropdown:hover .nav-dropdown-toggle,
.dropdown:hover .dropbtn {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.1);
}

/* Dropdown Wrapper & Floating Popup (.dropdown and .nav-dropdown) */
.dropdown,
.nav-dropdown {
    position: relative;
    display: inline-block;
}

.arrow {
    font-size: 0.75rem;
    margin-left: 0.3rem;
    transition: transform 0.2s ease;
}

.dropdown:hover .arrow,
.nav-dropdown:hover .arrow {
    transform: rotate(180deg);
}

.dropdown-content,
.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background-color: var(--bg-card);
    box-shadow: 0px 8px 24px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem 0;
    margin-top: 0.3rem;
    z-index: 1001;
}

.dropdown:hover .dropdown-content,
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.active .nav-dropdown-menu {
    display: flex;
    flex-direction: column;
}

.dropdown-content a,
.nav-dropdown-menu a {
    font-family: var(--font-nav-doc);
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--text-secondary);
    padding: 0.6rem 1.2rem;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.dropdown-content a:hover,
.nav-dropdown-menu a:hover {
    background-color: var(--bg-hover);
    color: #ffffff;
}

/* Right Controls (Language Switcher on Left, Login Button on Right) */
.nav-right {
    display: flex;
    align-items: center;
    gap: clamp(0.3rem, 1vw, 1rem);
    margin-left: auto;
    flex-shrink: 0;
}

.login-btn,
.btn-login {
    background-color: var(--accent-blue);
    color: #ffffff !important;
    padding: 0.5rem clamp(0.4rem, 0.8vw, 1.1rem);
    border-radius: 6px;
    font-family: var(--font-nav-doc);
    font-size: clamp(0.7rem, 0.6rem + 0.8vw, 1rem);
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

.login-btn:hover,
.btn-login:hover {
    background-color: var(--accent-blue-hover);
}

.lang-select {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.45rem clamp(0.3rem, 0.6vw, 0.8rem);
    font-family: var(--font-nav-doc);
    font-size: clamp(0.7rem, 0.6rem + 0.8vw, 1rem);
    border-radius: 6px;
    cursor: pointer;
    outline: none;
}
