/*
Theme Name: ELKZ-YuraraStories
Theme URI: https://focusphere.net/
Author: Antigravity & User
Description: Custom theme for Focusphere Stories. Modern, distraction-free, and immersive.
Version: 2.1.0 (The Velvet Forest Fixes)
*/

@import url('https://fonts.googleapis.com/css2?family=Garamond&family=Cinzel+Decorative:wght@400;700&family=Fraunces:ital,wght@0,300;0,400;0,600;1,400&family=Merriweather:ital,wght@0,300;0,400;0,700;1,400&family=Outfit:wght@300;400;500&display=swap');

:root {
    /* --- Palette: The Velvet Forest (Organic) --- */
    --color-bg-body: #F4F1EA;
    /* Old Parchment (Darker) */
    --color-bg-paper: #FDFBF7;
    /* Cream Paper (Main) */
    --color-bg-velvet: #1E2626;
    /* Deepest Forest Green */

    --color-text-main: #2A2A2A;
    /* Soft Charcoal Ink */
    --color-text-muted: #6B5E55;
    /* Sepia/Earth */
    --color-text-on-dark: #F2EFE9;
    /* Light Cream */

    /* Accents from the Woods */
    --color-accent-primary: #3E5641;
    /* Sage/Pine Green */
    --color-accent-secondary: #A27035;
    /* Bronze/Ocre */
    --color-accent-gold: #D8BD8A;
    /* Tarnished Gold */
    --color-accent-alert: #B55038;
    /* Rust Red (for alerts/buttons) */

    --color-border: #E8E5DE;
    /* Paper Edge */

    /* --- Typography: Literary & Expressive --- */
    --font-body: 'Lora', serif;
    /* Highly readable serif */
    --font-cv: 'Cormorant Garamond', serif;
    /* Variable serif for personality */
    --font-display: 'Cormorant Garamond', serif;
    /* Magic/Fantasy Titles */
    --font-ui: 'Outfit', sans-serif;
    /* Modern UI (Meta, Nav) */

    --text-base: 19px;
    --text-line-height: 1.85;
    /* Relaxed reading */

    /* --- Spacing & Layout --- */
    --spacing-container: 50px;
    --width-reading: 740px;
    /* Narrower for focus */
    --width-wide: 1150px;

    /* --- Visual Texture & Organic Feel --- */
    --shadow-soft: 0 15px 35px -5px rgba(60, 80, 60, 0.12);
    /* Green-tinted shadow */
    --shadow-deep: 0 25px 50px -12px rgba(30, 40, 30, 0.25);

    --radius-sm: 3px;
    --radius-md: 4px;
    --radius-organic: 255px 15px 225px 15px / 15px 225px 15px 255px;
    /* Hand-drawn feel */
    --radius-paper: 2px;
    /* Sharp corners like pages */

    /* Z-Index Layers */
    --z-header: 1000;
    --z-dropdown: 999;
    --z-hero: 10;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    background-color: var(--color-bg-body);
    /* Subtle Grain Texture Overlay can be added via ::before if desired, sticking to color for now */
    background-image: linear-gradient(to bottom, #F4F1EA 0%, #FDFBF7 100%);
    background-attachment: fixed;
    color: var(--color-text-main);
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: var(--text-line-height);
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-cv);
    font-weight: 400;
    /* Lighter weight */
    color: var(--color-accent-primary);
    line-height: 1.3;
    margin-top: 3rem;
    margin-bottom: 1.5rem;
}

h1 {
    font-family: var(--font-display);
    font-size: 3.2rem;
    letter-spacing: -0.01em;
    /* Tighten back up */
    color: var(--color-text-main);
}

h2 {
    font-size: 2.4rem;
}

h3 {
    font-size: 1.8rem;
    font-family: var(--font-ui);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-accent-secondary);
    font-weight: 600;
}

a {
    color: var(--color-accent-primary);
    text-decoration: none;
    border-bottom: 1px solid rgba(62, 86, 65, 0.3);
    transition: all 0.3s ease;
}

a:hover {
    color: var(--color-accent-secondary);
    border-bottom-color: var(--color-accent-secondary);
    background: rgba(162, 112, 53, 0.05);
    /* Subtle highlight */
}

img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
}

/* --- Layout --- */
.site-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.site-main {
    flex: 1;
    width: 100%;
    max-width: var(--width-wide);
    margin: 0 auto;
    padding: 60px 20px;
    position: relative;
    z-index: 20;
}

/* --- Drop Cap (Lettrine) --- */
.first-letter::first-letter,
.entry-content>p:first-of-type::first-letter {
    font-family: var(--font-display);
    font-size: 3.8rem;
    line-height: 0.8;
    float: left;
    margin-right: 0.15em;
    padding-top: 0.1em;
    color: var(--color-accent-secondary);
    text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.05);
}

/* --- Header: The "Cozy" Bar --- */
.site-header {
    padding: 0;
    /* Let inner spacing handle it */
    background: var(--color-bg-velvet);
    /* Dark Velvet */
    color: var(--color-text-on-dark);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    position: relative;
    z-index: var(--z-header);
}

.site-header .container {
    max-width: var(--width-wide);
    margin: 0 auto;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

/* Branding */
.site-branding {
    display: flex;
    flex-direction: column;
}

.site-title {
    font-family: var(--font-ui);
    font-size: 1.4rem;
    font-weight: 300;
    margin: 0;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.site-title a {
    color: var(--color-text-on-dark);
    border: none;
}

.site-title a:hover {
    color: var(--color-accent-gold);
}

.site-description {
    font-family: var(--font-body);
    font-style: italic;
    opacity: 0.7;
    font-size: 0.85rem;
}

/* --- Navigation --- */
.main-navigation ul {
    position: relative;
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 30px;
    z-index: var(--z-dropdown);
}

.main-navigation li {
    font-family: var(--font-ui);
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: relative;
    /* For dropdown positioning */
}

.main-navigation a {
    color: var(--color-text-on-dark);
    opacity: 0.8;
    display: block;
    padding: 10px 0;
}

.main-navigation a:hover {
    color: var(--color-accent-gold);
    opacity: 1;
    border: none;
}

/* Dropdown Sub-menus */
.main-navigation ul ul {
    display: none;
    /* Hidden by default */
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--color-bg-velvet);
    flex-direction: column;
    min-width: 220px;
    padding: 10px 0;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    gap: 0;
    /* No gap in dropdown list */
}

/* Show on hover */
.main-navigation ul li:hover>ul,
.main-navigation ul li:focus-within>ul {
    display: flex;
}

.main-navigation ul ul li {
    width: 100%;
    margin: 0;
}

.main-navigation ul ul a {
    padding: 12px 20px;
    text-transform: none;
    /* Submenus can be standard case */
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.main-navigation ul ul a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-accent-gold);
}

/* --- Hero Image --- */
.site-hero {
    width: 100%;
    height: 110px;
    background-size: cover;
    background-position: center;
    position: relative;
    margin-bottom: -80px;
    /* Overlap effect */
    z-index: var(--z-hero);
}

.site-hero .hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(40, 48, 48, 0.2), rgba(40, 48, 48, 0.9));
}

/* Adjust page title if hero is present */
.site-hero+.content-container .page-title,
.site-hero+.site-main h1:first-child {
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    position: relative;
    z-index: 25;
}

/* --- Card Components --- */
.card-style,
.bbp-topic-content.card-style {
    background: var(--color-bg-paper);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-soft);
    padding: 40px;
    border: 1px solid var(--color-border);
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin-bottom: 30px;
}

.card-style::before,
.bbp-topic-content.card-style::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--color-accent-primary);
    border-radius: 4px 4px 0 0;
    opacity: 0.6;
}

.card-style:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-deep);
}

/* --- bbPress Specifics --- */
.card-grid-wrapper .bbp-topics {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    padding: 0;
    margin: 0;
}

/* Force list items to behave in grid */
.bbp-topics>li {
    list-style: none !important;
    margin: 0;
    height: 100%;
}

/* Inside the card (rendered by loop-single-topic) */
.bbp-topic-content.card-style {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* --- Footer --- */
.site-footer {
    padding: 60px 0;
    background: var(--color-bg-velvet);
    text-align: center;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    color: var(--color-text-on-dark);
    opacity: 0.9;
    border-top: 5px solid var(--color-accent-primary);
    margin-top: 100px;
}

.site-footer a {
    color: var(--color-accent-gold);
    font-weight: 600;
}

.site-footer .sep {
    margin: 0 10px;
    opacity: 0.5;
}

/* --- Mobile Tweak --- */
@media (max-width: 768px) {
    .site-header .container {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }

    .main-navigation ul {
        flex-direction: column;
        gap: 0;
        width: 100%;
    }

    .main-navigation ul ul {
        position: static;
        box-shadow: none;
        background: rgba(255, 255, 255, 0.05);
        padding-left: 0;
        min-width: 100%;
    }

    .main-navigation ul ul a {
        padding-left: 30px;
    }

    .card-style {
        padding: 25px;
    }

    .site-hero {
        height: 250px;
    }
}

/* --- Dynamic Story Colors --- */
[id^="bbp-topic-"] {
    background-color: var(--story-bg-color, var(--color-bg-paper));
    background-image: var(--story-bg-image, none);
    color: var(--story-text-color, inherit);
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
}

/* --- Pagination (Numeric) --- */
.elkz-pagination ul {
    display: flex;
    justify-content: center;
    list-style: none;
    padding: 0;
    gap: 10px;
    margin-top: 50px;
}

.elkz-pagination a,
.elkz-pagination span {
    display: block;
    padding: 10px 15px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text-main);
    background: #fff;
    transition: all 0.2s ease;
}

.elkz-pagination li.active a,
.elkz-pagination a:hover {
    background: var(--color-accent-primary);
    color: #fff;
    border-color: var(--color-accent-primary);
    text-decoration: none;
}

.elkz-pagination li.active span {
    /* Current Page Span */
    background: var(--color-accent-primary);
    color: #fff;
    border-color: var(--color-accent-primary);
}

/* --- Vignette Layout (Offset Floating Style) --- */
.card-vignette {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    overflow: visible;
    /* Allow image to float out */
    padding-left: 0;
}

.vignette-image {
    flex: 0 0 220px;
    max-width: 220px;
    /* The "Décalé" Effect */
    margin-left: -40px;
    margin-top: -10px;
    position: relative;
    z-index: 5;
}

.vignette-image a {
    display: block;
    box-shadow: var(--shadow-deep);
    /* Deeper shadow for floating effect */
    border-radius: var(--radius-sm);
    transition: transform 0.3s ease;
}

.vignette-image img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    /* Organic or soft */
    display: block;
}

.vignette-image:hover a {
    transform: translateY(-5px) scale(1.02);
}

.vignette-content {
    flex: 1;
    padding-top: 10px;
    padding-left: 20px;
    /* Added padding */
}

/* Metadata in Loop */
.entry-meta {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    font-family: var(--font-ui);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.entry-meta .sep {
    opacity: 0.5;
    margin: 0 5px;
}


/* --- Mobile Tweak for Vignettes --- */
@media (max-width: 768px) {
    .card-vignette {
        flex-direction: column;
        /* Stack on mobile */
        gap: 20px;
    }

    .vignette-image {
        flex: 0 0 auto;
        max-width: 100%;
        width: 100%;
        margin-left: 0;
        /* Reset offset */
        margin-top: 0;
        margin-bottom: 20px;
    }

    .vignette-image img {
        height: 250px;
        /* Landscape on mobile */
    }

    .vignette-content {
        padding-left: 0;
    }
}

/* --- Login Modal --- */
.elkz-modal-overlay {
    display: none;
    /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(30, 38, 38, 0.8);
    /* Dark velvet semi-transparent */
    z-index: 9999;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.elkz-modal-overlay.active {
    display: flex;
    /* Flex to center */
    opacity: 1;
}

.elkz-modal-content {
    background: var(--color-bg-paper);
    padding: 0;
    /* No padding on container, handled inside */
    width: 90%;
    max-width: 400px;
    border-radius: var(--radius-md);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    /* Deep shadow */
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.elkz-modal-overlay.active .elkz-modal-content {
    transform: translateY(0);
}

.modal-header {
    background: var(--color-accent-primary);
    color: #fff;
    padding: 20px;
    text-align: center;
    font-family: var(--font-display);
    font-size: 1.5rem;
}

.modal-body {
    padding: 30px;
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.8;
}

.close-modal:hover {
    opacity: 1;
}

/* WP Login Form Styles inside Modal */
.login-username,
.login-password {
    margin-bottom: 15px;
}

.login-username label,
.login-password label {
    display: block;
    margin-bottom: 5px;
    font-family: var(--font-ui);
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.login-submit {
    text-align: center;
    margin-top: 20px;
}