/* =========================================
   TILLY TALES - THEMED STYLESHEET
   ========================================= */

/* DEFAULT / WHITE THEME */
:root, .theme-white {
    --main-color: #ffffff;
    --glow-color: #ffffff;
    --border-color: #444444; /* Darker border for a subtle tech look */
    --bg-tint: #000000;
}
/* =========================================
   TILLY TALES - THEME ENGINE
   ========================================= */

/* Default (Red) is handled by :root */

/* BLUE THEME */
body.theme-blue {
    --main-color: #0088cc;
    --glow-color: #00ccff;
    --border-color: #002244;
    --bg-tint: #00050a;
}

/* GREEN THEME */
body.theme-green {
    --main-color: #008800;
    --glow-color: #00ff00;
    --border-color: #003300;
    --bg-tint: #000500;
}

/* PURPLE THEME */
body.theme-purple {
    --main-color: #8800cc;
    --glow-color: #cc00ff;
    --border-color: #330044;
    --bg-tint: #05000a;
}

/* GOLD/AMBER THEME (Classic Mainframe) */
body.theme-amber {
    --main-color: #cc8800;
    --glow-color: #ffaa00;
    --border-color: #442200;
    --bg-tint: #0a0500;
}
* { margin:0; padding: 0; box-sizing: border-box; }

body { background-color: var(--bg-tint); color: #cccccc; font-family: Georgia, serif; display: flex; flex-direction: column; min-height: 100vh; }

/* 1. LAYOUT CONTROLS */
main { margin-left: 230px; padding: 40px; flex-grow: 1; }

.dashboard-layout { display: flex; gap: 40px; margin-top: 30px; }
.dashboard-col-left { flex: 2; }
.dashboard-col-right { flex: 1; border-left: 1px dashed var(--border-color); padding-left: 40px; }

/* 2. MAIN NAVIGATION */
.main-nav { width: 230px; height: 100vh; position: fixed; top: 0; left: 0; background-color: black; border-right: 2px solid var(--border-color); padding: 30px 20px; overflow-y: auto; z-index: 1000; }
.mobile-nav-header { display: none; }
.nav-container { 
    display: flex; 
    flex-direction: column; 
    height: auto; 
    justify-content: flex-start; 
}

.user-nav-block {
    margin-top: 20px; /* Smaller gap */
    padding-top: 0;
    border-top: none !important; /* Kills the dotted/dashed line */
}

/* De-emphasize the user menu text */
.user-nav-block summary, 
.user-nav-block a {
    color: #666 !important; /* Dim gray by default */
    font-size: 0.85rem !important; /* Slightly smaller than main links */
    text-transform: uppercase;
    letter-spacing: 1px;
}

.user-nav-block summary:hover, 
.user-nav-block a:hover {
    color: var(--glow-color) !important; /* Only glows on hover */
    text-shadow: 0 0 5px var(--glow-color);
}
.main-nav ul { list-style-type: none; }
.main-nav li a { display: block; padding: 15px 20px; text-decoration: none; color: white; border-bottom: 1px solid var(--border-color); transition: 0.3s; white-space: nowrap; }
/* Sidebar Text Highlight */
.main-nav li a:hover { 
    background-color: transparent !important; 
    color: var(--glow-color) !important; 
    text-shadow: 0 0 8px var(--glow-color); 
    padding-left: 30px; /* Kept the neat physical indentation effect! */
}

/* 3. TYPOGRAPHY & LINKS */
a { color: var(--main-color); text-decoration: none; transition: 0.2s; }
a:hover { color: var(--glow-color); text-shadow: 0 0 5px var(--glow-color); }
.site-title { color: var(--main-color); font-size: 3rem; margin-bottom: 5px; text-transform: uppercase; letter-spacing: 2px; }
.site-tagline { color: #666; font-size: 1rem; margin-top: 0; margin-bottom: 40px; font-style: italic; }
.section-title { color: var(--main-color); border-bottom: 1px solid var(--border-color); padding-bottom: 10px; font-size: 1.5rem; margin-top: 40px; }

/* 4. DASHBOARD PANELS */
.hero-banner { background-color: var(--bg-tint); border-bottom: 1px solid var(--border-color); margin: -40px -40px 50px -40px; padding: 80px 20px; text-align: center; }
.hero-banner h1 { color: var(--main-color); font-size: 4rem; letter-spacing: 4px; margin: 0; font-weight: normal; }
.hero-banner p { color: #888; font-size: 1.2rem; margin-top: 15px; font-style: italic; }
.story-card { background-color: var(--bg-tint); border: 1px dashed var(--border-color); padding: 20px; margin-bottom: 20px; transition: 0.3s; }

/* Glowing Story Cards */
.story-card:hover {
    border-color: var(--main-color);    /* Brightens the dashed border to theme color */
    box-shadow: 0 0 20px var(--glow-color); /* Large, diffuse glow that matches your target image */
}; 

.story-card h3 { margin-top: 0; color: var(--main-color); font-size: 1.4rem; }
.story-description { color: #aaa; line-height: 1.5; margin-bottom: 20px; }
.latest-release { background-color: var(--bg-tint); border: 1px solid var(--border-color); border-left: 3px solid var(--main-color); padding: 30px; margin-bottom: 60px; }
.latest-release h3 { color: #ccc; font-size: 1.5rem; margin-bottom: 10px; }
.latest-release p { color: #888; margin-bottom: 20px; }

/* 5. BUTTONS */
.read-btn { display: inline-block; background-color: transparent; color: var(--main-color); border: 1px solid var(--border-color); padding: 8px 16px; text-decoration: none; transition: 0.3s ease; }
.read-btn:hover { background-color: var(--main-color); color: black; }
.page-btn { background-color: transparent; color: var(--main-color); border: 1px solid var(--border-color); padding: 5px 15px; cursor: pointer; font-family: inherit; transition: 0.3s; }
.page-btn:hover { background-color: var(--main-color); color: black; box-shadow: 0 0 10px var(--glow-color); }

/* 6. BLOG */
.blog-preview { margin-bottom: 30px; padding-bottom: 20px; border-bottom: 1px dashed var(--border-color); }
.blog-preview:last-child { border-bottom: none; }
.blog-date { display: block; color: #666; font-size: 0.9rem; margin-bottom: 5px; font-family: 'Courier New', Courier, monospace; letter-spacing: 1px; }
.blog-preview h3 { margin: 0 0 10px 0; font-size: 1.4rem; }
.blog-preview h3 a { color: #ccc; text-decoration: none; transition: color 0.3s; }
.blog-preview h3 a:hover { color: white; }
.blog-preview p { color: #888; line-height: 1.6; margin-bottom: 10px; }
.read-more { color: var(--main-color); text-decoration: none; font-size: 0.9rem; transition: color 0.3s; }
.read-more:hover { color: var(--glow-color); }

/* 7. READING PANE CONTROLS */
.paginated-body { overflow: hidden; margin: 0; padding: 0; background-color: transparent; display: flex; flex-direction: column; height: 100vh; }
.book-container { flex-grow: 1; width: 100%; overflow: hidden; position: relative; padding-top: 20px; }
.book-content { column-width: 100vw; column-gap: 0; height: 100%; max-width: none !important; margin: 0 !important; padding: 0 !important; transition: transform 0.4s ease-in-out; }
.book-content p { text-indent: 2.5rem; margin-top: 0; margin-bottom: 0.5rem; }
.book-content p, .book-content h2, .rating-module { break-inside: avoid; padding: 0 40px; }
.pagination-controls { height: 60px; display: flex; justify-content: center; align-items: center; gap: 20px; background-color: var(--bg-tint); border-top: 1px solid var(--border-color); font-family: 'Courier New', Courier, monospace; }
.page-indicator { color: #888; font-size: 0.9rem; }
.story-text, .story-text * { color: #cccccc !important; background-color: transparent !important; }
.story-text h1, .story-text h2, .story-text h3 { color: var(--main-color) !important; }

/* 8. STAR RATING */
.star-rating-container { display: flex; flex-direction: row-reverse; justify-content: center; }
.star-rating-container input { display: none; }
.star-rating-container label { color: var(--border-color); font-size: 1.5rem; cursor: pointer; transition: 0.2s ease; margin: 0 2px; }
.star-rating-container input:checked ~ label, .star-rating-container label:hover, .star-rating-container label:hover ~ label { color: var(--main-color); text-shadow: 0 0 10px var(--glow-color); }

/* Glowing Text Highlight */
/* Glowing Text Highlight */
::selection { 
    background: var(--border-color); 
    color: var(--glow-color); 
    text-shadow: 0 0 5px var(--glow-color);
}

/* =========================================
   9. MOBILE RESPONSIVENESS OVERHAUL
   ========================================= */
@media (max-width: 768px) {
    /* Stack the page */
    body { flex-direction: column; }
    
    /* Turn Sidebar into Sticky Hamburger Header */
    .main-nav { width: 100%; height: auto; position: fixed; z-index: 2000; padding: 15px 20px; border-right: none; border-bottom: 2px solid var(--border-color); }
    .mobile-nav-header { display: flex; justify-content: space-between; align-items: center; }
    .hamburger-btn { background: transparent; color: var(--main-color); border: 1px solid var(--border-color); padding: 8px 15px; font-family: 'Courier New', monospace; font-weight: bold; cursor: pointer; transition: 0.2s; }
    .hamburger-btn:hover { background: var(--main-color); color: #000; }
    
    /* Hide menus by default, flex them when opened */
    .nav-container { display: none; height: auto; margin-top: 20px; border-top: 1px dashed var(--border-color); padding-top: 15px; }
    .nav-container.mobile-open { display: flex; }
    .main-nav li a { padding: 10px 15px; }

    /* Fix Main Content Margins */
    main { margin-left: 0; margin-top: 60px; padding: 20px; }
    .hero-banner { margin: -20px -20px 30px -20px; padding: 40px 20px; }
    .hero-banner h1 { font-size: 2.2rem; }
    
    /* Stack Dashboard Columns */
    .dashboard-layout { flex-direction: column; gap: 20px; }
    .dashboard-col-left, .dashboard-col-right { width: 100%; border-left: none; padding-left: 0; }
}
/* Forces the reading window to always sit above the mobile nav menu */
.modal-overlay {
    z-index: 3000 !important;
}
/* =========================================
   12. STANDARDIZED GLOW BUTTONS
   ========================================= */
.read-btn:hover,
.page-btn:hover,
.dashboard-btn:hover,
.hamburger-btn:hover,
.eval-button:hover {
    background-color: transparent !important;
    color: var(--glow-color) !important;
    border-color: var(--glow-color) !important;
    text-shadow: 0 0 8px var(--glow-color);
    box-shadow: none !important; /* Removes the heavy box fill */
}
/* =========================================
   LIGHT MODE EXCEPTIONS (For the Main Site)
   ========================================= */
body.light-mode .main-nav li a:hover {
    color: #000 !important;
    text-shadow: none !important;
    font-weight: bold;
}

body.light-mode ::selection {
    background: rgba(0, 0, 0, 0.1);
    color: #000;
    text-shadow: none;
}

body.light-mode .story-card:hover {
    border-color: #000;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.05);
}
/* --- TYPOGRAPHY LOCKDOWN --- */

/* This forces the Editor and the Reading Pane to ignore inline font styles */
.terminal-editor-pane *, 
.story-text *, 
.book-content * {
    font-family: inherit !important;
    font-size: inherit !important;
    line-height: inherit !important;
    color: inherit !important;
}

/* Ensure the Editor base matches your Reading Pane font */
.terminal-editor-pane {
    font-family: 'Georgia', serif !important;
    font-size: 1.1rem !important;
    line-height: 1.6 !important;
}
.ui-hidden .story-text {
    height: 90dvh !important;
    max-height: 90dvh !important;
    margin-top: 5dvh !important;
    width: 100% !important;
    padding: 10px 20px !important; 
    column-fill: auto;
    column-gap: 40px; 
    column-width: calc(100vw - 40px); /* This is the key to horizontal paging */
    box-sizing: border-box;
}