:root {
    --bg-cream: #FAF8F2;
    --bg-parchment: #F2EBD4;
    --ink-primary: #2A1B12;
    --ink-secondary: #5D4037;
    --saffron: #FF9933;
    --maroon: #800000;
    --gold: #DAA520;
    --f-royal: 'Eczar', serif;
    --f-text: 'Lora', serif;
    --f-code: 'JetBrains Mono', monospace;
}

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

body {
    background-color: var(--bg-cream);
    color: var(--ink-primary);
    font-family: var(--f-text);
    height: 100vh;
    overflow: hidden;
    /* Default for Desktop */
}

/* === 1. CHARIOT === */
.chariot-track {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 65px;
    background: linear-gradient(to bottom, #F2EBD4 80%, transparent);
    z-index: 100;
    /* Highest Z-Index to stay on top */
    border-bottom: 1px dashed var(--gold);
    overflow: hidden;
}

.chariot-group {
    position: absolute;
    right: -200px;
    top: 15px;
    display: flex;
    align-items: flex-end;
    animation: ride-left 25s linear infinite;
    color: var(--maroon);
    font-size: 24px;
}

.horses {
    display: flex;
    order: 1;
    margin-right: -5px;
    z-index: 2;
}

.horses i {
    animation: gallop 0.5s infinite alternate;
    transform: scaleX(-1);
}

.chariot-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-left: 5px;
    order: 2;
    position: relative;
}

.chariot-cover {
    width: 35px;
    height: 22px;
    background: var(--saffron);
    border-radius: 8px 8px 0 0;
    border: 1px solid var(--ink-primary);
    position: relative;
    z-index: 2;
}

.flag {
    position: absolute;
    top: -15px;
    right: 5px;
    width: 0;
    height: 0;
    border-left: 10px solid var(--maroon);
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    animation: wave 0.5s infinite alternate;
}

.wheel {
    font-size: 22px;
    color: var(--ink-primary);
    margin-top: -8px;
    animation: spin-wheel 1s linear infinite;
    z-index: 3;
}

@keyframes ride-left {
    0% {
        right: -250px;
    }

    100% {
        right: 110%;
    }
}

@keyframes gallop {
    0% {
        transform: translateY(0) scaleX(-1);
    }

    100% {
        transform: translateY(-2px) scaleX(-1);
    }
}

@keyframes spin-wheel {
    0% {
        transform: rotate(360deg);
    }

    100% {
        transform: rotate(0deg);
    }
}

@keyframes wave {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(-10deg);
    }
}

/* === 2. TIJORI (Background) === */
.tijori-container {
    position: fixed;
    top: 50%;
    left: 60%;
    transform: translate(-50%, -50%);
    width: 90vh;
    height: 90vh;
    z-index: -1;
    opacity: 0.15;
    pointer-events: none;
    border-radius: 50%;
    box-shadow: 0 0 100px rgba(255, 153, 51, 0.1);
}

.tijori-rays {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: repeating-conic-gradient(from 0deg, transparent 0deg, transparent 10deg, rgba(218, 165, 32, 0.1) 10deg, rgba(218, 165, 32, 0.1) 20deg);
    animation: spin-slow 120s linear infinite;
}

.ring-wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 0 20px rgba(128, 0, 0, 0.05);
}

.ring-outer {
    width: 100%;
    height: 100%;
    border: 2px solid var(--ink-secondary);
    outline: 10px double rgba(218, 165, 32, 0.1);
    animation: spin-cw 100s linear infinite;
}

.ring-middle {
    width: 70%;
    height: 70%;
    border: 1px dashed var(--maroon);
    background: radial-gradient(transparent 60%, rgba(255, 153, 51, 0.05));
    animation: spin-ccw 70s linear infinite;
}

.ring-inner {
    width: 45%;
    height: 45%;
    border: 4px double var(--gold);
    background-image: radial-gradient(var(--maroon) 1px, transparent 1px);
    background-size: 20px 20px;
    animation: spin-cw 40s linear infinite;
}

.ring-char {
    position: absolute;
    height: 50%;
    transform-origin: bottom center;
    top: 0;
    left: 50%;
    font-family: var(--f-royal);
    font-size: 18px;
    font-weight: 800;
    color: var(--ink-primary);
    text-shadow: 1px 1px 0px rgba(255, 255, 255, 0.5);
}

.core-mandala {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: pulse-core 6s infinite alternate;
    z-index: 10;
}

.indic-symbol {
    font-family: 'Eczar', serif;
    font-size: 80px;
    font-weight: 800;
    color: var(--maroon);
    line-height: 1;
    display: block;
    text-shadow: 0 0 10px var(--saffron), 0 0 30px var(--gold), 2px 2px 0px rgba(42, 27, 18, 0.2);
}

@keyframes spin-cw {
    from {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

@keyframes spin-ccw {
    from {
        transform: translate(-50%, -50%) rotate(360deg);
    }

    to {
        transform: translate(-50%, -50%) rotate(0deg);
    }
}

@keyframes spin-slow {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse-core {
    0% {
        transform: translate(-50%, -50%) scale(0.95);
        filter: brightness(1);
    }

    100% {
        transform: translate(-50%, -50%) scale(1.05);
        filter: brightness(1.2);
    }
}

/* === 3. SURYA === */
.surya-container {
    position: fixed;
    bottom: 40px;
    right: 40px;
    width: 100px;
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
    pointer-events: none;
    opacity: 0.2;
    transition: opacity 0.5s, transform 0.1s;
}

.surya-container.active {
    opacity: 1;
    transform: scale(1.2);
}

.surya-core {
    font-size: 40px;
    color: var(--maroon);
    background: var(--bg-cream);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--saffron);
    z-index: 2;
    box-shadow: 0 0 15px var(--gold);
}

.surya-rays {
    position: absolute;
    width: 100%;
    height: 100%;
    background: repeating-conic-gradient(from 0deg, var(--saffron) 0deg, var(--saffron) 10deg, transparent 10deg, transparent 20deg);
    border-radius: 50%;
    mask-image: radial-gradient(black 50%, transparent 100%);
    -webkit-mask-image: radial-gradient(black 40%, transparent 80%);
    z-index: 1;
}

/* === 4. LAYOUT === */
.layout-container {
    display: flex;
    width: 1200px;
    max-width: 100%;
    height: 100vh;
    margin: 0 auto;
}

.pillar {
    width: 300px;
    background: #FAF7E6;
    border-right: 4px double var(--gold);
    padding: 80px 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 5px 0 20px rgba(0, 0, 0, 0.05);
    z-index: 10;
    height: 100%;
}

.content-scroll {
    flex: 1;
    padding: 130px 70px 40px 70px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--saffron) var(--bg-cream);
}

.manuscript-section {
    margin-bottom: 150px;
    opacity: 0;
    transform: translateY(30px);
    transition: 0.8s ease;
    scroll-margin-top: 100px;
}

.manuscript-section.visible {
    opacity: 1;
    transform: translateY(0);
}

.portrait-frame {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    padding: 5px;
    border: 2px solid var(--saffron);
    background: white;
    margin-bottom: 20px;
}

.portrait {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    filter: sepia(0.1);
}

.royal-name {
    font-family: var(--f-royal);
    color: var(--maroon);
    font-size: 2rem;
    margin-bottom: 5px;
    text-align: center;
}

.royal-title {
    font-family: var(--f-code);
    font-size: 0.75rem;
    color: var(--ink-secondary);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    text-align: center;
}

.divider-ornament {
    color: var(--gold);
    margin: 25px 0;
    font-size: 1.5rem;
}

.scroll-nav {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: auto;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    text-decoration: none;
    color: var(--ink-primary);
    font-weight: bold;
    border-radius: 8px;
    border: 1px solid transparent;
    transition: 0.3s;
}

.nav-link:hover,
.nav-link.active {
    background: white;
    border-color: var(--gold);
    color: var(--maroon);
    box-shadow: 0 4px 10px rgba(42, 27, 18, 0.08);
}

.social-seal {
    display: flex;
    gap: 25px;
    font-size: 1.6rem;
    margin-top: 30px;
    margin-bottom: 20px;
}

.social-seal a {
    color: var(--ink-secondary);
    transition: 0.3s;
}

.social-seal a:hover {
    color: var(--saffron);
    transform: translateY(-3px);
}

.royal-btn {
    display: inline-block;
    padding: 12px 24px;
    border: 2px solid var(--maroon);
    background-color: transparent;
    color: var(--maroon);
    font-family: var(--f-royal);
    font-weight: bold;
    text-decoration: none;
    border-radius: 4px;
    transition: 0.3s;
    position: relative;
    overflow: hidden;
}

.royal-btn:hover {
    background-color: var(--maroon);
    color: var(--bg-cream);
    box-shadow: 0 5px 15px rgba(128, 0, 0, 0.2);
}

.heading-ornate {
    font-family: var(--f-royal);
    font-size: 2.8rem;
    color: var(--maroon);
    border-bottom: 3px solid var(--saffron);
    display: inline-block;
    margin-bottom: 35px;
    padding-bottom: 5px;
    position: relative;
}

.heading-ornate::after {
    content: '❖';
    position: absolute;
    right: -30px;
    top: 0;
    font-size: 1.5rem;
    color: var(--gold);
}

.parchment-card {
    background: var(--bg-parchment);
    padding: 40px;
    position: relative;
    box-shadow: 0 15px 35px rgba(42, 27, 18, 0.08);
    border: 1px solid #E0D0B0;
    margin-bottom: 25px;
    border-radius: 4px;
}

.corner-decor {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 3px solid var(--maroon);
}

.tl {
    top: 8px;
    left: 8px;
    border-right: none;
    border-bottom: none;
}

.br {
    bottom: 8px;
    right: 8px;
    border-left: none;
    border-top: none;
}

.code-ink {
    font-family: var(--f-code);
    font-size: 0.95rem;
    color: var(--ink-primary);
    line-height: 1.7;
}

.indent {
    margin-left: 25px;
}

.indent-2 {
    margin-left: 50px;
}

.indent-3 {
    margin-left: 75px;
}

.kwd {
    color: var(--maroon);
    font-weight: 700;
}

.cls {
    color: var(--saffron);
    font-weight: 700;
}

.str {
    color: #2E7D32;
}

.cmnt {
    color: var(--ink-secondary);
    font-style: italic;
    opacity: 0.8;
}

.key {
    color: var(--ink-primary);
    font-weight: bold;
}

.ink-text {
    font-size: 1.15rem;
    line-height: 1.9;
    color: var(--ink-secondary);
    max-width: 700px;
}

.grid-arsenal {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 30px;
}

.weapon-card {
    background: #FFF;
    text-decoration: none;
    border: 1px solid #E0D0B0;
    padding: 30px;
    position: relative;
    transition: 0.3s;
    text-align: center;
    border-radius: 8px;
}

.weapon-card:hover {
    transform: translateY(-5px);
    border-color: var(--saffron);
    box-shadow: 0 15px 30px rgba(255, 153, 51, 0.15);
}

.card-frame {
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border: 1px dashed var(--ink-secondary);
    opacity: 0.15;
    border-radius: 6px;
}

.card-symbol {
    font-size: 2.5rem;
    color: var(--saffron);
    margin-bottom: 15px;
}

.weapon-card h3 {
    font-family: var(--f-royal);
    font-size: 1.4rem;
    color: var(--ink-primary);
    margin-bottom: 8px;
}

.weapon-card p {
    color: var(--ink-secondary);
    font-size: 0.95rem;
    margin-bottom: 20px;
}

.stamp {
    background: var(--bg-parchment);
    color: var(--maroon);
    font-family: var(--f-code);
    font-size: 0.75rem;
    font-weight: bold;
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid rgba(128, 0, 0, 0.2);
}

.log-entry {
    display: flex;
    gap: 25px;
    align-items: flex-start;
    background: #FFF;
    padding: 30px;
    border: 1px solid #E0D0B0;
    border-radius: 8px;
    transition: 0.3s;
}

.log-entry:hover {
    border-color: var(--saffron);
}

.wax-seal {
    font-size: 2rem;
    color: var(--maroon);
    background: var(--bg-parchment);
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.05);
}

.log-content h3 {
    font-family: var(--f-royal);
    font-size: 1.5rem;
    color: var(--ink-primary);
    margin-bottom: 5px;
}

.log-content p {
    color: var(--ink-secondary);
    margin-bottom: 15px;
    line-height: 1.6;
}

.read-link {
    color: var(--saffron);
    font-weight: bold;
    text-decoration: none;
    font-family: var(--f-code);
    border-bottom: 2px dotted var(--saffron);
}

.royal-footer {
    margin-top: 100px;
    text-align: center;
    font-family: var(--f-code);
    font-size: 0.85rem;
    color: var(--ink-secondary);
    opacity: 0.6;
}

/* === MOBILE OPTIMIZATIONS === */
@media (max-width: 768px) {

    /* 1. Allow page scroll */
    body {
        overflow-y: auto;
        height: auto;
    }

    /* 2. Layout Stack */
    .layout-container {
        flex-direction: column;
        height: auto;
        width: 100%;
        overflow-x: hidden;
        /* Prevent horizontal scroll */
    }

    /* 3. Pillar (Sidebar) Adjustments */
    .pillar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 2px solid var(--gold);
        padding: 90px 20px 40px 20px;
        position: relative;
    }

    /* 4. Content Area Adjustments */
    .content-scroll {
        width: 100%;
        height: auto;
        padding: 40px 20px 100px 20px;
        overflow: visible;
    }

    /* 5. FIX: Force Visibility & Remove Animation on Mobile */
    /* This ensures content is never hidden, even if JS fails */
    .manuscript-section {
        opacity: 1 !important;
        transform: none !important;
        margin-bottom: 80px;
        scroll-margin-top: 80px;
    }

    /* 6. FIX: Force Arsenal Grid to Stack */
    .grid-arsenal {
        grid-template-columns: 1fr;
        /* Single column */
        gap: 20px;
    }

    /* 7. Adjust Visuals */
    .chariot-track {
        height: 50px;
    }

    .chariot-group {
        transform: scale(0.8);
        top: 10px;
        right: -250px;
    }

    .tijori-container {
        width: 85vw;
        height: 85vw;
        top: 40%;
        left: 50%;
        opacity: 0.08;
    }

    .surya-container {
        bottom: 20px;
        right: 20px;
        transform: scale(0.8);
    }

    .surya-container.active {
        transform: scale(1);
    }

    /* Typography */
    .heading-ornate {
        font-size: 2rem;
    }

    .royal-name {
        font-size: 1.8rem;
    }

    .code-ink {
        font-size: 0.8rem;
    }

    .parchment-card {
        padding: 25px 20px;
    }

    /* Stack Log Entries */
    .log-entry {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .log-content {
        width: 100%;
    }

    .wax-seal {
        margin-bottom: 15px;
    }
}