/* =========================================
   1. GLOBAL RESET & FONTS
   ========================================= */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    overflow-x: clip; 
}

@font-face {
    font-family: 'Montserrat';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('https://www.ensorium.com/fonts/MyFont-regular.woff2') format('woff2');
}

@font-face {
    font-family: 'Montserrat';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('https://www.ensorium.com/fonts/MyFont-medium.woff2') format('woff2');
}

@font-face {
    font-family: 'Montserrat';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('https://www.ensorium.com/fonts/MyFont-bold.woff2') format('woff2');
}

@font-face {
    font-family: 'OptimusPrinceps';
    font-style: normal;
    font-weight: normal;
    font-display: swap;
    src: url('https://www.ensorium.com/fonts/OptimusPrinceps.ttf') format('truetype');
}

/* =========================================
   2. BASE STYLING & CONTAINER
   ========================================= */

body, html {
    margin: 0;
    padding: 0;
    font-family: 'Montserrat', sans-serif;
    font-weight: 400;
    background-color: #0a0a0a;
    color: #cccccc;
    scroll-behavior: smooth; 
    scroll-padding-top: 100px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    max-width: 800px;
    margin: 80px auto 60px auto; 
    padding: 0 20px;
    line-height: 1.6;
}



p, li {
    -webkit-font-smoothing: auto;
    -moz-osx-font-smoothing: auto;
    letter-spacing: 0.2px; 
}

/* =========================================
   3. NAVIGATION BAR
   ========================================= */
#navbar {
    position: fixed;
    top: 0;
    left: 0; 
    width: 100vw; 
    padding: 15px 0;
    background-color: #050505; 
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 25px;
    border-bottom: 1px solid #222222;
}

#navbar a {
    text-decoration: none;
    color: #cccccc;
    font-weight: 500;
    text-transform: uppercase;
    font-size: 14px;
    transition: color 0.1s;
    letter-spacing: 0.5px;
}

#navbar a:hover { 
    color: #8A2BE2; 
}

#theme-toggle {
    background: transparent;
    border: none;
    color: #cccccc; 
    padding: 0; 
    cursor: pointer;
    transition: transform 0.2s ease, color 0.1s;
    margin-left: 20px;
    display: flex;
    align-items: center;
}

#theme-toggle:hover {
    transform: scale(1.15);
    color: #8A2BE2;
}

/* Default Dark Mode: Show Sun (switch to light), Hide Moon */
.icon-moon { display: none; }
.icon-sun { display: block; }

/* Light Mode: Show Moon (switch to dark), Hide Sun */
body.light-mode .icon-moon { display: block; }
body.light-mode .icon-sun { display: none; }

/* =========================================
   4. BANNER IMAGE
   ========================================= */
#title-block-header {
    width: 100%;
    margin-bottom: 10px; /* Reduces space after the abstract before the TOC */
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Renders the banner image as a block above the abstract */
#title-block-header::before {
    content: "";
    display: block;
    background-image: url('https://press.ensorium.com/vagabonds/cover/event_header_cursed_vagabonds_02.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 2px;
    border: 1px solid #222222;
    width: 100%;
    aspect-ratio: 16 / 5;
    margin-bottom: 30px; /* Space between the banner and the abstract text */
}

#title-block-header h1.title {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}


/* =========================================
   5. TABLE OF CONTENTS
   ========================================= */
#TOC {
    background-color: #111111; 
    border: 1px solid #222222; 
    border-radius: 2px;
    padding: 15px 25px;
    margin-top: 0px;
    margin-bottom: 40px;
}

#TOC > ul {
    margin: 0;
    padding-left: 0;
    list-style-type: none;
}

#TOC ul ul {
    padding-left: 20px;
    margin-top: 5px;
    list-style-type: none; 
}

#TOC li {
    margin-bottom: 8px;
}

#TOC a {
    display: block;
    text-decoration: none;
    color: #aaaaaa; 
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 0;
    margin-left: -12px; 
    border-left: 2px solid transparent; 
    transition: background-color 0.1s, border-color 0.1s, color 0.1s;
}

#TOC a:hover {
    color: #ffffff; 
    background-color: rgba(138, 43, 226, 0.15); 
    border-left: 2px solid #8A2BE2; 
}

/* Floating Sidebar Logic */
@media (min-width: 1200px) {
    #TOC {
        position: fixed;
        top: 120px;
        right: 50%; /* Anchors to the center instead of the left */
        transform: translateX(-430px); /* Pushes it 400px (half the body) + 30px (gap) to the left */
        width: 280px;
        max-height: calc(100vh - 160px);
        overflow-y: auto;
        margin: 0; 
    }
    
    #TOC::-webkit-scrollbar { width: 6px; }
    #TOC::-webkit-scrollbar-track { background: transparent; }
    #TOC::-webkit-scrollbar-thumb { background: #333333; border-radius: 3px; }
    body.light-mode #TOC::-webkit-scrollbar-thumb { background: #cccccc; }
}

/* Active State for Scroll Spy */
#TOC a.active-toc {
    color: #ffffff; 
    background-color: rgba(138, 43, 226, 0.3); 
    border-left: 2px solid #8A2BE2; 
}

body.light-mode #TOC a.active-toc {
    color: #8A2BE2;
    background-color: #f4ebfe;
}

/* =========================================
   6. CONTENT STRUCTURE (Headings, Tables, Quotes)
   ========================================= */

.abstract {
    font-size: 18px;
    color: #ffffff;
    margin-bottom: 30px;
    line-height: 1.8;
}

.abstract-title {
    display: none; /* Hides the auto-generated word "Abstract" */
}

body.light-mode .abstract {
    color: #111111;
}

#guide-intro {
    font-size: 18px;
    color: #ffffff;
    margin-bottom: 30px;
    line-height: 1.8;
}

body.light-mode #guide-intro {
    color: #111111;
}

/* h1, h2, h3 {
    color: #ffffff;
}

h2 {
    font-size: 28px;
    margin-top: 60px;
    margin-bottom: 20px;
    font-weight: 700;
    border-bottom: 2px solid #222222; 
    padding-bottom: 10px;
}

h3 {
    font-size: 20px;
    margin-top: 40px;
    color: #cccccc;
}*/

h1, h2, h3 {
    color: #ffffff;
    font-family: 'OptimusPrinceps', serif;
    font-weight: normal;
    letter-spacing: 1px;
}

h2 {
    font-size: 32px; /* Slightly larger to compensate for the font's natural scale */
    margin-top: 60px;
    margin-bottom: 20px;
    border-bottom: 2px solid #222222; 
    padding-bottom: 10px;
}

h3 {
    font-size: 22px;
    margin-top: 40px;
    color: #cccccc;
}

blockquote {
    background-color: #111111;
    border-left: 4px solid #8A2BE2; 
    margin: 25px 0;
    padding: 15px 20px;
    border-radius: 0; 
}

blockquote p {
    margin: 0;
    font-style: normal; 
    color: #aaaaaa;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 30px 0;
    font-size: 16px;
}

th, td {
    border: 1px solid #222222;
    padding: 12px 15px;
    text-align: left;
}

th {
    background-color: #151515;
    font-weight: 700;
    color: #ffffff;
}

tr:nth-child(even) {
    background-color: #111111; 
}

img {
    max-width: 100%;
    height: auto;
    border-radius: 2px; 
    display: block;
    margin: 30px auto;
    box-shadow: none;
}

figcaption {
    font-size: 11px;
    color: #cccccc; 
    text-align: left;
    margin-top: 0px;
    font-style: italic;
}

body.light-mode figcaption {
    color: #777777; 
}

/* =========================================
   7. BACK TO TOP LINKS
   ========================================= */
.back-to-top {
    display: block;
    text-align: right;
    font-size: 14px;
    font-weight: 500;
    color: #666666; 
    text-decoration: none;
    margin-top: 30px;
    margin-bottom: 20px;
    transition: color 0.1s, transform 0.1s;
}

.back-to-top:hover {
    color: #8A2BE2;
    transform: translateY(-2px); 
}

/* =========================================
   8. FOOTER
   ========================================= */
footer {
    padding: 40px 20px;
    margin-top: 80px;
    border-top: 1px solid #222222;
    background-color: #0a0a0a;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

footer a {
    color: #aaaaaa;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.1s;
}

footer a:hover {
    color: #8A2BE2; 
}

footer p {
    margin: 0;
    font-size: 14px;
    color: #666666;
}
/*
.footer-lang a {
    color: #999999; 
    text-decoration: none;
    transition: color 0.3s;
    padding: 0 5px; 
}

.footer-lang a:hover { color: #8A2BE2; }
.footer-lang a.active-lang { color: #ffffff; font-weight: 700; }
*/

/* =========================================
   9. LIGHT MODE OVERRIDES
   ========================================= */
body.light-mode,
html:has(body.light-mode) {
    background-color: #ffffff;
    color: #333333;
}

body.light-mode #navbar {
    background-color: #ffffff;
    border-bottom: 1px solid #eaeaea;
}

body.light-mode #navbar a { color: #333333; }
body.light-mode #navbar a:hover { color: #8A2BE2; }

body.light-mode #TOC {
    background-color: #fcfcfc;
    border-color: #eaeaea;
}

body.light-mode #TOC a { color: #555555; }
body.light-mode #TOC a:hover { 
    background-color: #f4ebfe; 
    border-left-color: #8A2BE2;
    color: #8A2BE2;
}

body.light-mode h1, 
body.light-mode h2, 
body.light-mode h3 {
    color: #111111;
}

body.light-mode h2 { 
    border-bottom-color: #eaeaea; 
}

body.light-mode blockquote {
    background-color: #fcfcfc;
}

body.light-mode blockquote p { 
    color: #333333; 
}

body.light-mode table th {
    background-color: #fcfcfc;
    color: #111111;
}

body.light-mode table th, 
body.light-mode table td {
    border-color: #eaeaea;
}

body.light-mode tr:nth-child(even) {
    background-color: #f9f9f9;
}

body.light-mode .game-banner { 
    border-color: #eaeaea; 
}

body.light-mode footer {
    background-color: #ffffff;
    border-top-color: #eaeaea;
}

body.light-mode .back-to-top {
    color: #999999;
}

body.light-mode .back-to-top:hover {
    color: #8A2BE2;
}

body.light-mode #theme-toggle { color: #333333; }
body.light-mode #theme-toggle:hover { color: #8A2BE2; }

/* =========================================
   10. IMAGE HOVER & ZOOM (LIGHTBOX)
   ========================================= */
figure img:not(.game-banner) {
    cursor: zoom-in;
    border: 2px solid transparent; 
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

figure img:not(.game-banner):hover {
    transform: scale(1.03); /* Enlarges the image by 3% */
    box-shadow: 0 8px 25px rgba(0,0,0,0.6);
    border-color: #8A2BE2; 
}

body.light-mode figure img:not(.game-banner):hover {
    transform: scale(1.03);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-color: #8A2BE2;
}

/* The invisible fullscreen overlay */
#lightbox-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background-color: rgba(5, 5, 5, 0.95);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

body.light-mode #lightbox-overlay {
    background-color: rgba(255, 255, 255, 0.95);
}

#lightbox-overlay.active {
    opacity: 1;
    pointer-events: auto;
    cursor: zoom-out;
}

#lightbox-image {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 2px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.8);
    transform: scale(0.95);
    transition: transform 0.15s ease;
}

#lightbox-overlay.active #lightbox-image {
    transform: scale(1);
}

/* =========================================
   11. BACKGROUND KEY ART (PARALLAX)
   ========================================= */
body::before {
    content: "";
    position: fixed;
    top: -5%; /* Hides the top edge during upward movement */
    left: 0;
    width: 100vw;
    height: 110vh; /* Oversized by 10% to provide tracking space */
    background-image: url('https://press.ensorium.com/vagabonds/cover/key_art_cursed_vagabonds_01.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -1; 
    pointer-events: none; 
    
    opacity: 0.25; /* Doubled visibility for dark mode */
    
    -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,0) 80%);
    mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,0) 80%);
    
    transform: translateY(var(--parallax-offset, 0px));
    will-change: transform; /* Hardware acceleration for smooth rendering */
}

body.light-mode::before {
    opacity: 0.15; /* Tripled visibility for light mode */
    filter: grayscale(100%); 
}

/* =========================================
   12. HUB PAGE GRID & CARDS
   ========================================= */
.guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.guide-card {
    background-color: #111111;
    border: 1px solid #222222;
    border-radius: 2px;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.guide-card:hover {
    transform: translateY(-4px);
    border-color: #8A2BE2;
    box-shadow: 0 8px 20px rgba(0,0,0,0.5);
}

.guide-card img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    margin: 0;
    border-bottom: 1px solid #222222;
    border-radius: 2px 2px 0 0;
}

.guide-info {
    padding: 20px;
}

.guide-info h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 20px;
}

.guide-info p {
    margin: 0;
    font-size: 14px;
    color: #aaaaaa;
}

/* Light Mode Overrides for Cards */
body.light-mode .guide-card {
    background-color: #fcfcfc;
    border-color: #eaeaea;
}

body.light-mode .guide-card:hover {
    border-color: #8A2BE2;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

body.light-mode .guide-card img {
    border-bottom-color: #eaeaea;
}

body.light-mode .guide-info p {
    color: #666666;
}