/*
Theme Name: Cardux Theme (The Void)
Theme URI: https://blog.cardux.it
Author: Cardux + Antigravity
Description: A radical flashlight exploration theme.
Version: 3.0
License: MIT
Text Domain: cardux-theme
*/

:root {
    --bg-color: #000000;
    /* Pure Night Black */
    --text-color: #e0e0e0;
    --accent-red: #8a0000;
    /* Dried blood red */
    --light-size: 350px;
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Lato', sans-serif;

    /* Default cursor pos to center to avoid black screen on load */
    --cursor-x: 50vw;
    --cursor-y: 50vh;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;

    /* Variable Consumption */
    background-color: var(--bg-color, var(--dark-bg));
    color: var(--text-color, var(--dark-text));

    font-family: var(--font-body);
    font-size: 16px;
    overflow-x: hidden;
    cursor: crosshair;
    transition: background-color 0.5s ease, color 0.5s ease;
}

/* Light Theme Override */
body.theme-light {
    --bg-color: var(--light-bg);
    --text-color: var(--light-text);
    cursor: auto !important;
    /* Normal cursor in light mode */
}

/* Hide Flashlight in Light Mode */
body.theme-light .flashlight-overlay,
body.theme-light #lights-toggle,
body.theme-light .living-void {
    display: none !important;
}

/* --- THEME TOGGLE (Solar Orbit) --- */
.theme-toggle-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;

    background-color: var(--bg-color);
    /* Match theme background */
    padding: 10px 25px;
    border-radius: 50px;
    border: 1px solid rgba(128, 128, 128, 0.2);
    /* Subtle border */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);

    margin: 0;
    transition: background-color 0.5s ease, border-color 0.5s ease;
}

.toggle-icon {
    display: flex;
    align-items: center;
    color: #666;
    transition: color 0.5s ease, opacity 0.5s ease, transform 0.5s ease;
    opacity: 0.3;
}

.toggle-icon svg {
    width: 24px;
    height: 24px;
}

/* Icons active state */
.toggle-icon.icon-moon {
    color: #fff;
    /* Moon glows in dark */
    opacity: 1;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

body.theme-light .toggle-icon.icon-moon {
    color: #999;
    opacity: 0.3;
    transform: scale(0.8);
    text-shadow: none;
}

body.theme-light .toggle-icon.icon-sun {
    color: #e67e22;
    /* Sun glows orange in light */
    opacity: 1;
    transform: scale(1.2);
}

.theme-toggle-wrapper {
    position: relative;
    /* Removed fixed positioning */
}

.theme-toggle-checkbox {
    display: none;
}

.theme-toggle-label {
    display: block;
    width: 50px;
    height: 26px;
    background-color: #333;
    border-radius: 50px;
    position: relative;
    cursor: pointer;
    border: 1px solid #555;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.toggle-pill {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background-color: #fff;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Checked State (Light Mode active) */
.theme-toggle-checkbox:checked+.theme-toggle-label {
    background-color: #e0e0e0;
    border-color: #ccc;
}

.theme-toggle-checkbox:checked+.theme-toggle-label .toggle-pill {
    transform: translateX(24px);
    background-color: #fff;
}

/* --- THE FLASHLIGHT OVERLAY --- */
/* This fixed layer sits on top of everything and creates the darkness */
.flashlight-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    background: radial-gradient(circle var(--light-size) at var(--cursor-x) var(--cursor-y),
            transparent 0%,
            rgba(0, 0, 0, 0.5) 40%,
            rgba(0, 0, 0, 0.98) 100%);
    mix-blend-mode: multiply;
    transition: opacity 0.8s ease, background 0.1s ease;
    opacity: 1;
    /* Default on */
}

/* Mobile override: remove flashlight */
.touch-device .flashlight-overlay {
    background: rgba(0, 0, 0, 0.5);
    /* Just a dim overlay */
}

@media (max-width: 900px) {
    .flashlight-overlay {
        display: none;
        /* Disable on mobile completely for performance */
    }
}

/* Lights On State */
body.lights-on .flashlight-overlay {
    opacity: 0;
    pointer-events: none;
}

body.lights-on {
    cursor: default;
    /* Normal cursor when lights are on */
}

/* Toggle Button */
.lights-toggle {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 10000;
    background: transparent;
    border: 1px solid #444;
    color: #444;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.lights-toggle:hover,
body.lights-on .lights-toggle {
    border-color: #fff;
    color: #fff;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

/* --- THE LIVING VOID (Dynamic Nebula) --- */
.living-void {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    /* Behind everything */
    background:
        radial-gradient(circle at 50% 50%, rgba(20, 0, 0, 0.3), transparent 60%),
        radial-gradient(circle at 80% 20%, rgba(5, 10, 30, 0.4), transparent 50%),
        radial-gradient(circle at 20% 80%, rgba(30, 0, 10, 0.2), transparent 50%);
    background-size: 200% 200%;
    animation: drift 20s ease-in-out infinite alternate;
    opacity: 0.6;
}

@keyframes drift {
    0% {
        background-position: 0% 50%;
        opacity: 0.5;
    }

    50% {
        opacity: 0.8;
    }

    100% {
        background-position: 100% 50%;
        opacity: 0.5;
    }
}

/* Mobile: Just static dark background */
@media (max-width: 900px) {
    .living-void {
        background: radial-gradient(circle at 50% 50%, #0a0a10, #000);
        animation: none;
        opacity: 1;
    }
}

/* --- LAYOUT --- */
.site {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    padding: 2rem;
    max-width: 900px;
    margin: 0 auto;
}



/* --- TYPOGRAPHY & CONTENT --- */
h1,
h2,
h3 {
    color: var(--text-color);
    /* Was #fff */
    font-family: var(--font-heading);
    font-weight: 700;
}

a {
    text-decoration: none;
    border-bottom: 1px solid #444;

    /* Bloody Trail Effect */
    /* Use --text-color for the non-hover state */
    background-image: linear-gradient(to right, var(--accent-red) 50%, var(--text-color) 50%);
    background-size: 200% 100%;
    background-position: 100% 0;
    /* Hidden (White/Text side) */
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    /* Hide actual text color */

    transition: background-position 0.5s ease-out;
}

a:hover {
    background-position: 0 0;
    /* Slide in Red */
    border-bottom-color: var(--accent-red);
    /* Removed text-shadow as it conflicts with background-clip sometimes, or keep it subtle */
    text-shadow: none;
}

/* Header */
.site-header {
    margin-bottom: 5rem;
    text-align: center;
    padding-top: 4rem;
    /* Reduced from 10vh */
}

.site-title {
    font-size: 5rem;
    line-height: 0.9;
    letter-spacing: -0.05em;
    margin: 0;
    text-transform: uppercase;
}

.site-description {
    font-family: monospace;
    opacity: 0.8;
    /* Use opacity instead of fixed color */
    letter-spacing: 0.2em;
    font-size: 0.9rem;
    margin-top: 1rem;
}

/* Posts */
article.post {
    margin-bottom: 8rem;
    border-left: 1px solid #222;
    padding-left: 2rem;
}

@media (max-width: 768px) {
    article.post {
        border-left: none;
        padding-left: 0;
        margin-bottom: 4rem;
    }

    .site {
        padding: 1rem;
    }
}

.entry-meta {
    font-family: monospace;
    color: var(--accent-red);
    font-size: 0.8rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
}

.entry-title {
    font-size: 3rem;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
}

.entry-content {
    font-size: 1.1rem;
    color: var(--text-color);
    /* Was #ccc */
    font-weight: 300;
    line-height: 1.8;
}

/* Footer */
.site-footer {
    text-align: center;
    padding: 5rem 0;
    font-family: monospace;
    font-size: 0.8rem;
    color: #444;
}



/* --- ANIMATIONS --- */
@keyframes flicker {
    0% {
        opacity: 1;
    }

    5% {
        opacity: 0.8;
    }

    10% {
        opacity: 0.9;
    }

    15% {
        opacity: 0.5;
    }

    20% {
        opacity: 1;
    }

    100% {
        opacity: 1;
    }
}

.site-title {
    animation: flicker 6s infinite;
}

/* --- THEME VISIBILITY UTILITIES --- */

/* Show ONLY in Light Mode (Hidden in Dark/Default) */
.only-light-mode {
    display: none !important;
}

body.theme-light .only-light-mode {
    display: block !important;
}

/* Show ONLY in Dark Mode (Hidden in Light) */
.only-dark-mode {
    display: block !important;
}

body.theme-light .only-dark-mode {
    display: none !important;
}