/* Tweak Terminal Theme 
   A retro-futuristic style for the writer's workbench.
*/

:root {
    --bg-color: #0c0c0c;       /* Deep CRT Black */
    --text-primary: #33ff33;   /* Phosphor Green */
    --text-dim: #1a801a;       /* Dimmed Green for borders/meta */
    --cursor: #33ff33;         /* Solid cursor color */
    --font-stack: 'Consolas', 'Monaco', 'Courier New', monospace;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-stack);
    font-size: 16px;
    line-height: 1.6;
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    box-sizing: border-box;
    display: flex;             /* Flex column to push footer down */
    flex-direction: column;
}

/* --- CRT Scanline Effect Overlay --- */
body::before {
    content: " ";
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        to bottom,
        rgba(18, 16, 16, 0) 50%,
        rgba(0, 0, 0, 0.25) 50%
    );
    background-size: 100% 4px;
    z-index: 100;
    pointer-events: none;
}

/* --- Layout Containers --- */

/* New Top Header (Non-link) */
.terminal-header {
    max-width: 700px;
    width: 100%;
    margin: 0 auto 2rem auto;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--text-dim);
    
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-dim);
    opacity: 0.8;
}

/* Main Content Area */
main {
    max-width: 700px;
    width: 100%;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    flex: 1; /* Takes available space, pushing footer to bottom */
}

/* Footer (Previously Top Nav) */
footer {
    max-width: 700px;
    width: 100%;
    margin: 4rem auto 0 auto;
    padding-top: 1rem;
    border-top: 1px dashed var(--text-dim);
    
    font-size: 0.85rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    z-index: 1;
}

/* --- Typography --- */
h1, h2 {
    font-weight: normal;
    text-transform: uppercase;
    border-bottom: 2px solid var(--text-dim);
    padding-bottom: 10px;
    margin-bottom: 1.5rem;
    text-shadow: 0 0 5px rgba(51, 255, 51, 0.4);
    margin-top: 0;
}

p {
    margin-bottom: 1.5rem;
    text-align: justify;
}

/* --- Navigation & Links --- */
footer nav a {
    color: var(--text-dim);
    text-decoration: underline;
    font-weight: bold;
    border-bottom: none; /* Remove the dashed border from global links */
    margin-right: 10px;
}

footer nav a:hover {
    color: var(--text-primary);
    text-decoration: underline;
    background: none;
    box-shadow: none;
}

/* General Body Links */
a {
    color: var(--text-primary);
    text-decoration: none;
    border-bottom: 1px dashed var(--text-dim);
    transition: all 0.1s ease;
}

a:hover {
    background-color: var(--text-primary);
    color: var(--bg-color);
    box-shadow: 0 0 8px var(--text-primary);
    text-decoration: none;
    border-bottom: 1px solid var(--text-primary);
}

/* --- The Choice Menu --- */
.choices {
    list-style: none;
    padding: 0;
    margin-top: 3rem;
    border-top: 1px dashed var(--text-dim);
    padding-top: 1.5rem;
}

.choices li {
    margin-bottom: 1rem;
}

.choices a {
    display: block;
    padding: 12px 15px;
    border: 1px solid var(--text-dim);
    border-left: 5px solid var(--text-dim);
}

.choices a::before {
    content: "> ";
    margin-right: 10px;
    color: var(--text-dim);
}

.choices a:hover {
    border-color: var(--text-primary);
    background-color: var(--bg-color); 
    color: var(--text-primary);
    box-shadow: inset 0 0 10px rgba(51, 255, 51, 0.2);
    text-shadow: 0 0 5px var(--text-primary);
}

.choices a:hover::before {
    color: var(--text-primary);
}

/* --- Scrollbar (Webkit) --- */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg-color); }
::-webkit-scrollbar-thumb { background: var(--text-dim); }
::-webkit-scrollbar-thumb:hover { background: var(--text-primary); }

/* --- 1. KNOT-SPECIFIC THEMES (from :: color: value) --- */
body[data-theme="green"] {
    --text-primary: #55ff55;
    --bg-color: #051a05;
    border-top: 5px solid var(--text-primary);
}

body[data-theme="black"] {
    --text-primary: #444; 
    --bg-color: #000;
}

/* --- 2. STATE-BASED STYLING (from {set +tag}) --- */
body.state-ill {
    --text-primary: #bfff00; 
    filter: blur(0.5px) contrast(1.2);
    animation: pulse-sick 4s infinite;
}

body.state-rested {
    --text-primary: #00ffff; 
}

@keyframes pulse-sick {
    0% { opacity: 1; }
    50% { opacity: 0.8; }
    100% { opacity: 1; }
}
