/*
Theme Name: The Journal
Theme URI: https://example.com/the-journal
Author: Antigravity
Description: A premium, horizontal-scroll blog theme with vintage aesthetics.
Version: 1.0
text-domain: the-journal
*/

@import url('https://fonts.googleapis.com/css2?family=Jost:ital,wght@0,300;0,400;0,700;1,300&display=swap');

:root {
    /* Colors */
    --bg-color: #E4DCD6;
    /* Users's Beige */
    --text-color: #313131;
    /* User's Dark Grey/Black */
    --accent-color: #313131;
    --card-bg: transparent;

    /* Typography */
    --font-main: 'Jost', sans-serif;
    --font-display: 'Jost', sans-serif;

    /* Spacing & Sizes */
    --sidebar-width: 320px;
    /* Increased massively to fix overlap and give space to vertical logo */
    --header-height: 0px;
    --card-width-desktop: 240px;
    /* Reduced massively (-40%) as requested */
    --card-width-mobile: 85vw;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    display: flex;
    /* Sidebar layout works fine here on Desktop */
    -webkit-font-smoothing: antialiased;
}

/* Sidebar Verticale */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    z-index: 100;
    background: var(--bg-color);
}

/* Logo Container */
.logo-container {
    display: flex;
    /* 
       Writing-mode: vertical-rl (Lines flow Right to Left).
       Rotated 180deg (Lines flow Left to Right).
       Flex-direction: column -> Stacks items in the Block Axis (Horizontal).
       Result: [The] [Journal] [Separator] [Subtitle] side-by-side.
    */
    flex-direction: column;
    align-items: center;
    /* Vertically centered */
    justify-content: center;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    gap: 1.5rem;
    text-align: center;
    margin-top: -4rem;
}

.brand-super {
    font-size: 2rem;
    font-weight: 300;
    font-family: var(--font-display);
    color: var(--text-color);
}

.brand-title {
    font-size: 6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: -2px;
    margin: 0;
    color: var(--text-color);
    transition: font-weight 0.3s ease;
    line-height: 0.85;
}

/* Vertical Separator Line */
.brand-separator {
    width: 1px;
    height: 60px;
    /* Length of the line */
    background-color: var(--text-color);
    opacity: 0.3;
    margin: 0 0.5rem;
    /* Additional spacing if needed */
}

.brand-subtitle {
    display: block;
    font-family: var(--font-display);
    font-weight: 300;
    font-style: normal;
    /* Ensure no italic unless requested */
    font-size: 1rem;
    letter-spacing: 3px;
    text-transform: lowercase;
    color: var(--text-color);
    opacity: 0.7;
    margin: 0;
    border: none;
    padding: 0;
    /* Ensure it doesn't break into multiple lines if possible, or allow naturally */
    white-space: nowrap;
}

/* Scroll Indicator */
.scroll-indicator {
    position: absolute;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 15px;
    margin-left: 20px;
    color: var(--text-color);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.6;
}

.scroll-indicator svg {
    animation: bounceRight 2s infinite;
}

@keyframes bounceRight {

    0%,
    100% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(10px);
    }
}

/* Logo Animation (Morph) */
@keyframes fontMorph {
    0% {
        font-weight: 300;
        font-style: normal;
    }

    33% {
        font-weight: 400;
        font-style: italic;
    }

    66% {
        font-weight: 700;
        font-style: normal;
    }

    100% {
        font-weight: 300;
        font-style: normal;
    }
}

.brand-title.animating {
    animation: fontMorph 3s infinite;
}

/* Main Horizontal Container */
.scroll-container {
    display: flex;
    flex-wrap: nowrap;
    height: 100vh;
    /* Added modest 6vh bottom padding to lift cards slightly above visual center */
    padding: 0 4rem 6vh calc(var(--sidebar-width) + 4rem);
    align-items: center;
    width: max-content;
    transform: translateX(0);
    will-change: transform;
    transition: transform 0.1s ease-out;
}

/* Article Card Minimal */
.article-card {
    position: relative;
    width: var(--card-width-desktop);
    margin-right: 6rem;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.card-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

/* Vintage Photo Effect Container */
.card-image-wrapper {
    width: 100%;
    aspect-ratio: 1/1;
    background: #000;
    margin-bottom: 5px;
    /* Reduced to 5px as requested */
    overflow: hidden;
    position: relative;
    box-shadow: 10px 10px 30px rgba(0, 0, 0, 0.15);
}

.card-image-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, rgba(0, 0, 0, 0.3) 100%),
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.2'/%3E%3C/svg%3E");
    pointer-events: none;
    mix-blend-mode: overlay;
    opacity: 0.6;
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: sepia(0.2) contrast(1.1) brightness(0.9);
    transition: transform 0.8s ease;
}

.article-card:hover .card-image {
    transform: scale(1.1);
    filter: sepia(0) contrast(1) brightness(1);
}

.card-content {
    color: var(--text-color);
}

/* Fix Title Spacing */
.card-content h2 {
    font-size: 1.5rem;
    margin-top: 0;
    /* Critical fix: Remove browser default top margin */
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.card-desc {
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
    font-weight: 300;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.read-more {
    display: inline-flex;
    align-items: center;
    font-size: 1rem;
    text-decoration: none;
    color: var(--text-color);
    font-weight: 400;
    border-bottom: 1px solid transparent;
    width: fit-content;
    transition: border-color 0.3s;
}

.read-more:hover {
    border-bottom-color: var(--text-color);
}

/* Audio Wave Visual + Play */
.card-audio-preview {
    display: flex;
    align-items: center;
    margin-top: 1rem;
    gap: 10px;
    opacity: 0.7;
    transition: opacity 0.3s;
    cursor: pointer;
}

.card-audio-preview:hover {
    opacity: 1;
}

.mini-play-btn {
    width: 30px;
    height: 30px;
    background: var(--text-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg-color);
}

.audio-wave-img {
    height: 20px;
    width: auto;
    stroke: var(--text-color);
}

/* Progress Line Bottom */
.progress-line {
    position: fixed;
    bottom: 2rem;
    left: calc(var(--sidebar-width) + 2rem);
    right: 2rem;
    height: 2px;
    background: rgba(0, 0, 0, 0.1);
    z-index: 50;
}

.progress-bar-fill {
    height: 100%;
    background: var(--text-color);
    width: 0%;
}

/* Article Page Helper */
body.article-page {
    flex-direction: column;
    overflow-y: auto;
    height: auto;
    width: 100%;
    display: block;
}

/* Article Specific Styles (Refined) */
.article-header {
    position: relative;
    width: 100%;
    height: 90vh;
    /* Increased height as requested (was 70vh) */
    overflow: hidden;
    background: var(--bg-color);
}

.article-cover-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
}

.article-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Reduced filter intensity to show image clearer */
    filter: grayscale(0.2) contrast(1.05) brightness(0.95);
}

.article-cover-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: linear-gradient(to top, var(--bg-color) 5%, transparent);
}

/* Audiobook Player - Refined */
.audiobook-player {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 100%;
    max-width: 500px;
    background: var(--bg-color);
    padding: 2rem 3rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    border-top-left-radius: 40px;
    box-shadow: -10px -10px 40px rgba(0, 0, 0, 0.05);
    z-index: 10;
}

.play-big-btn {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    /* Prevents distortion/squishing */
    border-radius: 50%;
    background: var(--text-color);
    color: var(--bg-color);
    border: 2px solid var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.play-big-btn:hover {
    background: transparent;
    color: var(--text-color);
    transform: scale(1.05);
}

.play-big-btn svg {
    margin-left: 2px;
    /* Visual center fix for play triangle */
}

.audio-meta h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.6;
    margin-bottom: 0.5rem;
}

.audio-meta p {
    font-size: 1.1rem;
    font-weight: 400;
    font-family: var(--font-display);
}

/* Article Content */
.article-body {
    max-width: 760px;
    margin: 5rem auto 8rem auto;
    padding: 0 2rem;
    font-size: 1.25rem;
    line-height: 1.8;
    font-weight: 300;
    color: var(--text-color);
}

.article-title-main {
    font-family: var(--font-display);
    font-size: 3.5rem;
    /* Reduced from 4.5rem */
    line-height: 1.1;
    margin-bottom: 3rem;
    margin-top: -2.5rem;
    position: relative;
    z-index: 5;
    color: var(--text-color);
}

/* WP Integration Helpers */
h2,
.chapter-title {
    font-family: var(--font-display);
    font-size: 2rem;
    margin-top: 4rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding-bottom: 1rem;
    display: inline-block;
    width: 100%;
}


.dropcap,
p.has-drop-cap:first-letter {
    float: left;
    font-size: 6rem;
    line-height: 0.8;
    margin-right: 1.5rem;
    margin-top: -0.5rem;
    font-family: var(--font-display);
    font-weight: 400;
}

.article-image-block,
.wp-block-image {
    width: 100%;
    margin: 4rem 0;
    position: relative;
}

.vintage-img,
.wp-block-image img {
    width: 100%;
    height: auto;
    display: block;
    filter: grayscale(1) contrast(1.1) brightness(0.95);
}

.image-caption,
.wp-block-image figcaption {
    font-size: 0.85rem;
    margin-top: 1rem;
    font-style: italic;
    text-align: center;
    opacity: 0.7;
}

/* Mobile Header Elements (Default Desktop State) */
.mobile-top-bar {
    position: static;
    /* Or absolute/fixed depending on need, but wrapper is best static 'ghost' */
    width: auto;
    height: auto;
    background: transparent;
    display: block;
}

.mobile-logo-text,
.mobile-logo-container {
    display: none;
    /* Hidden on Desktop */
}

.back-nav {
    position: fixed;
    top: 3rem;
    /* Moved down slightly */
    left: 3rem;
    /* Moved right slightly */
    z-index: 9999;
    /* Ensure it's above everything */
    background: rgba(228, 220, 214, 0.9);
    /* Semi-transparent theme bg */
    backdrop-filter: blur(5px);
    border: 1px solid var(--text-color);
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.back-nav:hover {
    background: var(--text-color);
    color: var(--bg-color);
    transform: translateX(-5px);
}


/* Mobile Basic Support (Robust) */
@media (max-width: 1024px) {
    body {
        flex-direction: column;
        overflow-y: auto;
        width: 100%;
        height: auto;
        display: block;
    }

    /* --- HOME MOBILE --- */
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        /* Adjusted top padding to lift logo higher as requested (was 6rem) */
        padding: 3.5rem 1rem 2rem 1rem;
        flex-direction: column !important;
        align-items: center;
        border-bottom: 1px solid #ddd;
    }

    .logo-container {
        writing-mode: horizontal-tb !important;
        transform: none !important;
        height: auto;
        margin: 0;
        flex-direction: column !important;
        width: 100%;
    }

    /* Rotate separator for mobile (Horizontal Line) */
    .brand-separator {
        width: 40px !important;
        height: 1px !important;
        background-color: var(--text-color);
        margin: 10px auto !important;
        /* Centered */
    }

    .brand-title {
        font-size: 3rem;
        letter-spacing: -1px;
    }

    .brand-subtitle {
        writing-mode: horizontal-tb !important;
        transform: none !important;
        border: none;
        margin: 0;
    }

    /* Hide Scroll Indicator on Mobile */
    .scroll-indicator {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
    }

    .scroll-container {
        padding: 2rem 1.5rem;
        flex-direction: column;
        width: 100%;
        transform: none !important;
        height: auto;
    }

    .article-card {
        width: 100%;
        margin-right: 0;
        margin-bottom: 4rem;
    }

    .progress-line {
        display: none;
    }

    /* --- ARTICLE PAGE MOBILE --- */

    /* 1. Header is just a flex column container */
    .article-header {
        height: auto !important;
        /* Let content dictate height */
        display: flex;
        flex-direction: column;
    }

    /* 2. Top Bar (Logo + Back) */
    .mobile-top-bar {
        position: relative !important;
        /* In flow, pushing image down */
        width: 100%;
        height: auto;
        min-height: 70px;
        background-color: var(--bg-color);
        display: flex !important;
        align-items: center;
        padding: 1rem 1.5rem;
        /* Balanced padding */
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        flex-shrink: 0;
        z-index: 50;
        gap: 15px;
        /* Clear space between Back and Logo */
    }

    /* 3. Reset Back Button for Mobile Bar */
    .back-nav {
        position: static !important;
        /* Not fixed anymore */
        transform: none !important;
        background: transparent !important;
        backdrop-filter: none !important;
        border: 1px solid var(--text-color) !important;
        box-shadow: none !important;
        margin: 0 !important;
        /* Reset margin */
        padding: 0.5rem 1rem !important;
        font-size: 0.8rem !important;
    }

    /* 4. Mobile Logo Container (Stacked like Home) */
    .mobile-logo-container {
        display: flex !important;
        flex-direction: column;
        justify-content: center;
        align-items: flex-start;
        /* Align left next to button */
        line-height: 1;
    }

    .mobile-brand-super {
        font-family: var(--font-display);
        font-size: 0.8rem;
        font-weight: 300;
        text-transform: capitalize;
        color: var(--text-color);
        margin-bottom: 2px;
    }

    .mobile-brand-title {
        font-family: var(--font-display);
        font-size: 1.5rem;
        font-weight: 700;
        text-transform: uppercase;
        color: var(--text-color);
        letter-spacing: -0.5px;
    }

    .mobile-logo-text {
        display: none !important;
    }

    /* 5. Image Wrapper */
    .article-cover-wrapper {
        width: 100%;
        height: 50vh !important;
        /* Reduce height on mobile */
        position: relative;
    }

    .article-title-main {
        font-size: 2.2rem !important;
        margin-top: -1.5rem;
    }

    .audiobook-player {
        position: relative !important;
        /* Force into flow */
        bottom: auto !important;
        right: auto !important;
        padding: 1.5rem;
        flex-direction: row;
        gap: 1rem;
        width: 100%;
        background: var(--bg-color);
        /* Ensure background covers content behind */
        z-index: 100;
        /* Ensure clickable */
        box-shadow: none;
        /* Remove desktop shadow if distinct */
        border-radius: 0;
        /* Reset radius if needed or keep it */
        margin-top: -30px;
        /* Slight overlap with image for style, or 0 */
        border-top-left-radius: 30px;
        border-top-right-radius: 30px;
        /* Make it symmetrical on mobile */
    }

    .play-big-btn {
        width: 50px;
        height: 50px;
    }
}