/* Global Styles - Theming & Minimalism */
:root {
    /* Default (Dark/Void) */
    --bg-core: #050A10;
    --text-core: #E6EAEF;
    --text-muted: #5C6B7F;
    --accent-focus: #FFFFFF;
    --border-subtle: rgba(230, 234, 239, 0.1);

    --font-rational: 'Inter', sans-serif;
    --font-code: 'Roboto Mono', monospace;
}

[data-theme="light"] {
    /* Light (Paper) - Authentic Academic */
    --bg-core: #FAFAFA;
    /* Pure Paper White */
    --text-core: #111111;
    /* Deep Ink Black */
    --text-muted: #555555;
    /* Pencil Gray */
    --accent-focus: #000000;
    /* Absolute Black */
    --border-subtle: rgba(0, 0, 0, 0.08);
}

[data-theme="gray"] {
    /* Gray (Stone) - Stoic Industrial */
    --bg-core: #2C3035;
    /* Warm Concrete */
    --text-core: #F0F0F0;
    /* Stone White */
    --text-muted: #A0A0A0;
    /* Light Stone */
    --accent-focus: #FFFFFF;
    --border-subtle: rgba(255, 255, 255, 0.08);
    /* Faint Highlight */
}

* {
    box-sizing: border-box;
    transition: background-color 0.5s ease, color 0.5s ease, border-color 0.5s ease;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-rational);
    background-color: var(--bg-core);
    color: var(--text-core);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

.main-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    /* On mobile, we enforce scroll snap if content overflows or logic dictates */
    overflow-x: hidden;
}

/* Header Section (45%) */
.header-section {
    flex: 45;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    border-bottom: 1px solid transparent;
}

/* Desktop Wrapper for Tools */
/* Takes up the remaining 55% of the screen (10% bar + 45% split) */
.content-wrapper {
    flex: 55;
    display: flex;
    flex-direction: column;
}

.main-heading {
    font-weight: 300;
    font-size: 3rem;
    letter-spacing: -0.5px;
    margin: 0;
    color: var(--text-core);
}

.sub-heading {
    font-family: var(--font-code);
    font-size: 0.7rem;
    letter-spacing: 4px;
    /* Spaciousness = Freedom */
    text-transform: uppercase;
    color: var(--text-muted);
    margin-top: 2rem;
}

.tagline {
    font-family: var(--font-rational);
    font-weight: 300;
    font-style: italic;
    font-size: 0.8rem;
    color: var(--text-muted);
    opacity: 0.6;
    margin-top: 0.8rem;
}

/* Functional Bar (10%) */
/* Functional Bar (Wrapper Child) */
/* On desktop, this needs to take up ~10% of the total height. 
   Total height is 100vh. Header is 45vh. Wrapper is 55vh.
   10vh is approx 18% of 55vh. */
.functional-bar {
    flex: 18;
    /* ~10% of total screen */
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.tool-connector {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 600px;
    justify-content: center;
    gap: 30px;
}

.connector-line {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-subtle), transparent);
    flex: 1;
}

.tool-singular {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: opacity 0.4s ease;
    cursor: pointer;
}

/* Vidya - Pure Text Interaction */
.tool-singular .tool-name {
    color: var(--text-core);
    opacity: 1;
    /* Stable Truth */
    transition: color 0.3s ease;
}

.tool-context {
    font-family: var(--font-code);
    font-size: 0.6rem;
    letter-spacing: 2px;
    color: var(--text-muted);

    /* Reactive Context: 60% to 100% */
    opacity: calc(0.6 + (var(--intensity, 0) * 0.4));
    transition: opacity 0.1s linear;
}

.tool-name {
    font-family: var(--font-code);
    font-size: 1.1rem;
    font-weight: 400;
    letter-spacing: 4px;
    color: var(--text-core);
    text-transform: uppercase;
}

/* Bottom Split (45%) */
/* Bottom Split (Wrapper Child) */
/* On desktop, this needs to take up ~45% of total height.
   45vh is approx 82% of 55vh. */
.content-split {
    flex: 82;
    /* ~45% of total screen */
    display: flex;
    flex-direction: row;
}

.pane {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.5s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    /* No background spotlight pseudo-element here */
}

.pane-inner {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 280px;
}

/* Gentle separation */
.left-pane {
    border-right: 1px solid var(--border-subtle);
}

.pane-title {
    font-weight: 300;
    font-size: 1.8rem;
    margin: 0 0 1.5rem 0;
    color: var(--text-core);
    opacity: 1;
    /* Stable Truth */
}

/* Smaller details */
.pane-subtitle {
    font-family: var(--font-code);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    display: block;

    /* Reveal: range 0.6 to 1.0 */
    opacity: calc(0.6 + (var(--intensity, 0) * 0.4));
    transition: opacity 0.1s linear;
}

.pane-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.8;
    font-weight: 300;

    /* Reveal: range 0.5 to 1.0 */
    opacity: calc(0.5 + (var(--intensity, 0) * 0.5));
    transition: opacity 0.1s linear;
}

/* Interaction: Focus (Peak state) */
.pane:hover .pane-title {
    color: var(--accent-focus);
    transition: color 0.3s ease;
}

/* Switcher Styles */
.theme-switcher {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    padding: 10px 20px;
    z-index: 100;
    opacity: 0.2;
    transition: opacity 0.3s ease;
}

.theme-switcher:hover {
    opacity: 1;
}

.theme-btn {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid var(--text-muted);
    background: transparent;
    cursor: pointer;
    padding: 0;
    transition: all 0.3s ease;
}

.theme-btn:hover {
    transform: scale(1.2);
    border-color: var(--accent-focus);
}

/* Specific button appearances representing the theme */
.theme-btn[data-set-theme="dark"] {
    background-color: #050A10;
}

.theme-btn[data-set-theme="gray"] {
    background-color: #2C3035;
}

.theme-btn[data-set-theme="light"] {
    background-color: #FAFAFA;
}

@media (max-width: 768px) {

    /* Lock the Viewport Frame for In-App Browsers */
    html,
    body {
        height: 100%;
        width: 100%;
        margin: 0;
        padding: 0;
        overflow: hidden;
        /* Prevent body scroll, force main-layout to scroll */
    }

    /* Hide scrollbar broadly for all elements on mobile */
    * {
        scrollbar-width: none !important;
        /* Firefox */
    }

    *::-webkit-scrollbar {
        display: none !important;
        /* Chrome, Safari */
    }

    /* Global Scroll Snap for Mobile */
    .main-layout {
        overflow-y: scroll;
        scroll-snap-type: y mandatory;
        height: 100dvh;
        /* Use dynamic viewport height */
        width: 100%;
        overscroll-behavior-y: none;
        scrollbar-width: none;
        /* Firefox */
        position: relative;
        /* Establish stacking context */
    }

    .main-layout::-webkit-scrollbar {
        display: none;
        /* Chrome, Safari */
    }

    /* Page 1: Header - Full Screen Snap */
    .header-section {
        flex: 0 0 100dvh;
        /* Rigid sizing */
        /* Force full height */
        scroll-snap-align: start;
        border-bottom: none;
        /* Clean look */
    }

    .main-heading {
        font-size: 2.2rem;
    }

    .sub-heading {
        font-size: 0.6rem;
        /* Scaled down */
    }

    /* Page 2: Tools - Full Screen Snap Wrapper */
    .content-wrapper {
        flex: 0 0 100dvh;
        /* Rigid sizing */
        scroll-snap-align: start;
        display: flex;
        flex-direction: column;
        justify-content: space-evenly;
        /* Spread items evenly */
        /* Shift Upwards */
        padding-top: 10vh;
        gap: 0;
        padding-bottom: 80px;
        position: relative;
        /* For the Spine */
    }

    /* FULL SPINE: One Line with Middle Gap (for Vidya) */
    .content-wrapper::before {
        content: '';
        position: absolute;
        top: 15vh;
        /* Start below header/title area */
        bottom: 80px;
        /* End before pager */
        left: 50%;
        transform: translateX(-50%);
        width: 1.9px;
        /* Complex Gradient: 
           0-10%: Fade In
           10-35%: Solid Top Line
           35-45%: Soft Fade OUT (approaching Vidya)
           45-55%: GAP (Transparent for Vidya)
           55-65%: Soft Fade IN (leaving Vidya)
           65-90%: Solid Bottom Line
           90-100%: Fade Out
        */
        background: linear-gradient(180deg,
                transparent 1%,
                var(--border-subtle) 21%,
                transparent 40%,
                transparent 54%,
                var(--border-subtle) 70%,
                transparent);
        z-index: 0;
    }

    /* Top of Page 2 - Compact Header (Vidya) */
    .functional-bar {
        margin: 0;
        flex: 0 0 auto;
        padding: 2rem 0;
        /* Vertical breathing room */
        position: relative;
        width: 100%;
        order: 2;
        /* PLACE IN CENTER */
        background: var(--bg-core);
        /* Mask the spine behind it? User said "Vidya in middle" */
        /* Let's use a radial gradient mask or background to highlight it */
        /* Actually user wants "Vidya at center of screen". */
    }

    /* TIMELINE CONNECTOR: Vidya is on the spine, no connector needed? 
       Or maybe a small horizontal crossbar?
       Let's keep it clean for now.
    */
    .functional-bar::after {
        display: none;
    }


    /* NO SCHEMATIC LINES - Pure Clean Layout */

    .connector-line {
        display: block;
        /* Re-enable for Fading Line style */
    }

    .tool-connector {
        width: 85%;
        /* Prevent hitting edges */
        gap: 15px;
        /* Tighter gap for mobile */
    }

    /* Bottom of Page 2 - Priority Content (Zig-Zag Timeline) */
    /* Bottom of Page 2 - flattened */
    .content-split {
        display: contents;
        /* UNWRAP THE CHILDREN to mix with Vidya */
    }

    /* Remove old spine if any, now handled by wrapper */


    /* CENTRAL SPINE: The Timeline Backbone */
    .content-split::before {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 1px;
        background: linear-gradient(180deg, var(--border-subtle) 0%, var(--border-subtle) 80%, transparent 100%);
        z-index: 0;
    }

    .pane {
        width: 50%;
        /* Half width to sit on one side */
        padding: 20px;
        position: relative;
        z-index: 1;
        box-sizing: border-box;
    }

    /* ETHICS (Top Node) */
    .left-pane {
        order: 1;
        /* FIRST */
        align-self: flex-start;
        text-align: right;
        padding-right: 2rem;
        /* Space from spine */
        border-right: none;
        border-bottom: none;
        margin-bottom: 0;
        /* Remove fixed margin, let flex handle it */
    }

    /* ETHICS CONNECTOR: Horizontal Line to Spine */
    .left-pane::after {
        content: '';
        position: absolute;
        top: 50%;
        right: 0;
        /* Connect to spine */
        width: 2rem;
        /* Reach the spine */
        height: 1px;
        /* Fade IN from Left (Text) to Right (Spine) */
        background: linear-gradient(90deg, transparent 0%, var(--border-subtle) 100%);
    }

    /* HRP (Bottom Node) */
    .right-pane {
        order: 3;
        /* LAST */
        align-self: flex-end;
        text-align: left;
        padding-left: 2rem;
        width: 50%;
    }

    /* HRP CONNECTOR: Horizontal Line to Spine */
    .right-pane::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 0;
        /* Connect to spine */
        width: 2rem;
        /* Reach the spine */
        height: 1px;
        /* Fade OUT from Left (Spine) to Right (Text) */
        background: linear-gradient(90deg, var(--border-subtle) 0%, transparent 100%);
    }

    .pane-title {
        font-size: 1.2rem;
        /* Smaller for horizontal fit */
        margin-bottom: 0.5rem;
    }

    .pane-subtitle {
        font-size: 0.5rem;
    }

    .pane-desc {
        display: block;
        font-size: 0.65rem;
    }

    /* Mobile Interaction: Static Reveal */
    .pane-subtitle,
    .pane-desc,
    .tool-context {
        opacity: 0.8 !important;
    }
}