/* ==========================================================================
   Bleeding Pages - Professional Modern Editorial Design System
   Theme: Warm Alabaster, Ink Charcoal, and Terracotta
   ========================================================================== */

/* Custom CSS Variables */
:root {
    /* Color Palette - Default Light Mode (Substack/Medium Inspired) */
    --color-bg-deep: #fffaf6;       /* Warm alabaster white */
    --color-bg-card: #ffffff;       /* Crisp white */
    --color-bg-card-hover: #fff6f2; /* Soft warm peach highlight */
    --color-border: #241c19;        /* Deep espresso ink for select outlines */
    --color-border-muted: #ebdcd3;  /* Soft sand-colored border */
    
    /* Terracotta Accents */
    --color-rust: #c2593f;          /* Refined modern terracotta red */
    --color-rust-hover: #a34129;    
    --color-rust-light: #fdeee6;    
    
    /* Text Colors */
    --color-text-main: #2b2421;      /* Deep ink charcoal (soft on eyes) */
    --color-text-muted: #786b66;     /* Warm slate-gray */
    --color-text-light: #fffaf6;
    
    /* Shapes & Shadows */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 2px 12px rgba(43, 36, 33, 0.04);
    --shadow-md: 0 8px 30px rgba(43, 36, 33, 0.06);
    --shadow-lg: 0 16px 48px rgba(43, 36, 33, 0.12);
    --glow-peach: 0 4px 20px rgba(194, 89, 63, 0.08);
    --glow-peach-strong: 0 8px 30px rgba(194, 89, 63, 0.15);
    
    /* Fonts */
    --font-serif-title: 'Lora', Georgia, serif;
    --font-serif-body: 'Lora', Georgia, serif;
    --font-sans: 'Plus Jakarta Sans', -apple-system, sans-serif;
    
    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    --transition-smooth: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-slow: 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Dark Inkwell Reading Theme Override */
body.dark-reading-mode {
    --color-bg-deep: #161514;       /* Inkwell charcoal */
    --color-bg-card: #201e1d;       /* Warm dark card */
    --color-bg-card-hover: #292625; 
    --color-border: #ebdcd3;        /* Soft cream border */
    --color-border-muted: #3a3735;
    --color-rust: #e26746;          /* Vibrant rust for dark contrast */
    --color-rust-hover: #f0896b;
    --color-text-main: #ebdcd3;      /* Warm white text */
    --color-text-muted: #a69a92;     /* Soft brown-gray */
    --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
    --glow-peach: 0 4px 20px rgba(226, 103, 70, 0.1);

    /* Vincent Van Gogh's Starry Night background */
    background-image: linear-gradient(rgba(22, 21, 20, 0.88), rgba(22, 21, 20, 0.88)), url('assets/starry_night.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

/* Antique Sepia Theme Override */
body.sepia-reading-mode {
    --color-bg-deep: #f2e6da;       /* Classical warm sepia parchment */
    --color-bg-card: #eae0d3;       
    --color-bg-card-hover: #e4d8c9;
    --color-border: #3d2c1f;        /* Deep espresso brown border */
    --color-border-muted: #d5c8b9;
    --color-rust: #a24e2c;          
    --color-rust-hover: #83391b;
    --color-text-main: #3d2c1f;      
    --color-text-muted: #6e5947;     
    --shadow-sm: 0 2px 12px rgba(61, 44, 31, 0.05);
    --shadow-md: 0 8px 30px rgba(61, 44, 31, 0.08);
}

/* Reset and Global Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--color-bg-deep);
    color: var(--color-text-main);
    font-family: var(--font-sans);
    font-size: 1.05rem;
    line-height: 1.65;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
    transition: background-color var(--transition-smooth), color var(--transition-smooth), border-color var(--transition-smooth);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--color-bg-deep);
}
::-webkit-scrollbar-thumb {
    background: var(--color-border-muted);
    border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--color-rust);
}

/* Layout Container */
.container {
    width: 90%;
    max-width: 1000px;
    margin: 0 auto;
}

/* Procedural Analog Paper Grain Texture Overlay */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 199;
    opacity: 0.022;                  /* Lower opacity to prevent greyishness */
    mix-blend-mode: multiply;        /* Blend noise into peach tone */
    background-image: 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.75' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

body.dark-reading-mode .noise-overlay {
    opacity: 0.04;
    mix-blend-mode: screen;          /* Lighten noise on dark mode */
}

/* Starry Sky Canvas Background */
#bg-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -2;
    opacity: 0;
    transition: opacity 1.5s cubic-bezier(0.16, 1, 0.3, 1);
}

body.dark-reading-mode #bg-particles {
    opacity: 1;
}

/* Header & Navigation (Sleek Glassmorphic Header) */
.main-header {
    background-color: rgba(255, 250, 246, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border-muted);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color var(--transition-smooth), border-color var(--transition-smooth);
}

body.dark-reading-mode .main-header {
    background-color: rgba(22, 21, 20, 0.85);
}

body.sepia-reading-mode .main-header {
    background-color: rgba(242, 230, 218, 0.85);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem 0;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    gap: 0.5rem;
    color: var(--color-text-main);
    transition: color var(--transition-fast);
}

.logo-icon {
    display: flex;
    align-items: center;
    line-height: 1;
}

.logo-svg {
    width: 24px;
    height: 24px;
    display: block;
    color: var(--color-text-main);
    transition: color var(--transition-fast);
}

.logo:hover .logo-svg {
    color: var(--color-rust);
}

.logo-text {
    font-family: var(--font-serif-title);
    font-weight: 700;
    font-size: 1.35rem;
    letter-spacing: -0.02em;
}

.logo:hover .logo-text {
    color: var(--color-rust);
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-link {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: color var(--transition-fast);
    padding: 0.25rem 0;
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--color-rust);
    transition: width var(--transition-fast);
}

.nav-link:hover, .nav-link.active {
    color: var(--color-text-main);
}

.nav-link.active::after {
    width: 100%;
}

.nav-separator {
    color: var(--color-border-muted);
    user-select: none;
}

/* Soundscapes Controls Panel inside Header */
.ambient-player-panel {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid var(--color-border-muted);
    padding: 0.3rem 0.75rem;
    border-radius: 30px;
    margin: 0 1rem;
    background: var(--color-bg-card);
}

.btn-ambient-control {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-rust);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.1rem;
    transition: all var(--transition-fast);
}

.btn-ambient-control:hover {
    color: var(--color-text-main);
    transform: scale(1.1);
}

.btn-ambient-control svg {
    width: 15px;
    height: 15px;
}

.ambient-slider-wrapper {
    display: flex;
    align-items: center;
}

#ambient-volume-slider {
    width: 65px;
    height: 3px;
    appearance: none;
    background: var(--color-border-muted);
    border-radius: 2px;
    outline: none;
}

#ambient-volume-slider::-webkit-slider-thumb {
    appearance: none;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--color-rust);
    cursor: pointer;
}

/* User profile triggers */
.user-profile-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
}

.profile-dropdown-wrapper {
    position: relative;
}

.btn-profile {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.9rem;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border-muted);
    border-radius: 30px;
}

.btn-profile:hover {
    border-color: var(--color-rust);
}

.avatar-letter {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-rust);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.user-display-name {
    font-weight: 600;
    font-size: 0.8rem;
}

.profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 200px;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border-muted);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 0.5rem 0;
    z-index: 110;
    animation: fadeInUp var(--transition-fast) forwards;
}

.dropdown-header {
    padding: 0.5rem 1.1rem;
}

.dropdown-user-name {
    font-weight: 700;
    font-size: 0.85rem;
}

.dropdown-user-username {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.dropdown-divider {
    border: none;
    border-top: 1px solid var(--color-border-muted);
    margin: 0.4rem 0;
}

.dropdown-item {
    display: block;
    padding: 0.45rem 1.1rem;
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--color-bg-card-hover);
    color: var(--color-text-main);
}

/* Reading Scroll Progress Bar */
.reading-progress-container {
    width: 100%;
    height: 2px;
    background: transparent;
    position: absolute;
    bottom: -1px;
    left: 0;
    z-index: 101;
}

.reading-progress-bar {
    width: 0%;
    height: 100%;
    background-color: var(--color-rust);
    transition: width 0.1s ease-out;
}

/* Modern Professional Buttons */
.btn {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.55rem 1.1rem;
    border: 1px solid var(--color-border-muted);
    border-radius: var(--radius-sm);
    background-color: var(--color-bg-card);
    color: var(--color-text-main);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.btn-primary {
    background-color: var(--color-rust);
    color: #fff;
    border-color: var(--color-rust);
    box-shadow: var(--glow-peach);
}

.btn-primary:hover {
    background-color: var(--color-rust-hover);
    border-color: var(--color-rust-hover);
    box-shadow: var(--glow-peach-strong);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--color-bg-card);
    border-color: var(--color-border-muted);
}

.btn-secondary:hover {
    background-color: var(--color-bg-card-hover);
    border-color: var(--color-rust);
}

.btn-outline {
    background-color: transparent;
    border-color: var(--color-border-muted);
}

.btn-outline:hover {
    border-color: var(--color-rust);
    color: var(--color-rust);
}

.btn-text {
    background-color: transparent;
    border-color: transparent;
    color: var(--color-text-muted);
}

.btn-text:hover {
    color: var(--color-text-main);
}

.btn-lg {
    padding: 0.75rem 1.75rem;
    font-size: 0.9rem;
    border-radius: 30px; /* Pill shaped buttons for premium Hero */
}

.btn-sm {
    padding: 0.35rem 0.8rem;
    font-size: 0.78rem;
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.8rem;
    transition: color var(--transition-fast);
}

.btn-back svg {
    width: 14px;
    height: 14px;
    transition: transform var(--transition-fast);
}

.btn-back:hover {
    color: var(--color-rust);
}

.btn-back:hover svg {
    transform: translateX(-3px);
}

/* Main Section Layout */
.main-content {
    flex: 1;
    padding-bottom: 4rem;
}

/* Modern Hero Section */
.hero-section {
    padding: 6rem 0 4rem 0;
    text-align: center;
    max-width: 800px !important;
}

.hero-tagline {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.8rem;
    color: var(--color-rust);
    margin-bottom: 0.8rem;
    display: inline-block;
}

.hero-title {
    font-family: var(--font-serif-title);
    font-size: 3.2rem;
    line-height: 1.15;
    font-weight: 800;
    margin-bottom: 1.25rem;
    letter-spacing: -0.03em;
}

.hero-description {
    font-size: 1.15rem;
    color: var(--color-text-muted);
    margin-bottom: 2.25rem;
    line-height: 1.65;
}

.hero-cta {
    display: flex;
    justify-content: center;
    gap: 1.2rem;
}

/* Sections Global */
.section-title {
    font-family: var(--font-serif-title);
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
}

.section-subtitle {
    font-size: 1rem;
    color: var(--color-text-muted);
    text-align: center;
    margin-bottom: 3rem;
}

.genre-selection {
    padding: 2rem 0 4rem 0;
}

/* Modern Rounded Cards (Substack/Medium Style) */
.genre-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2.2rem;
}

.genre-card {
    position: relative;
    height: 380px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border-muted);
    background-color: var(--color-bg-card);
    overflow: hidden;
    cursor: pointer;
    text-align: left;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-smooth), box-shadow var(--transition-smooth), border-color var(--transition-smooth);
}

.genre-card-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 190px;
    background-size: cover;
    background-position: center;
    border-bottom: 1px solid var(--color-border-muted);
    transition: transform var(--transition-slow);
}

.genre-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 190px;
    background: rgba(43, 36, 33, 0.05);
}

.genre-card-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 190px;
    padding: 1.5rem;
    background: var(--color-bg-card);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 3;
}

.genre-card-tag {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-rust);
}

.genre-card-title {
    font-family: var(--font-serif-title);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--color-text-main);
    margin-top: 0.2rem;
}

.genre-card-description {
    font-size: 0.88rem;
    color: var(--color-text-muted);
    line-height: 1.5;
    margin-bottom: 0.4rem;
}

.genre-card-action {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-rust);
    display: inline-block;
    transition: transform var(--transition-fast);
}

/* Card Hover actions */
.genre-card:hover {
    transform: translateY(-6px);
    border-color: var(--color-rust);
    box-shadow: var(--shadow-lg), var(--glow-peach);
}

.genre-card:hover .genre-card-bg {
    transform: scale(1.04);
}

.genre-card:hover .genre-card-action {
    transform: translateX(4px);
}

/* Feed Section */
.feed-section {
    padding: 2rem 0;
}

.feed-header-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-bottom: 2.25rem;
    border-bottom: 1px solid var(--color-border-muted);
    padding-bottom: 1.25rem;
}

.feed-title-area {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.feed-current-genre {
    font-family: var(--font-serif-title);
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.feed-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.search-box {
    position: relative;
    max-width: 360px;
    width: 100%;
}

.search-box input {
    width: 100%;
    padding: 0.55rem 0.8rem 0.55rem 2.2rem;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border-muted);
    border-radius: 30px; /* Modern rounded search bar */
    color: var(--color-text-main);
    font-family: var(--font-sans);
    font-size: 0.88rem;
    outline: none;
    transition: border-color var(--transition-fast);
}

.search-box input:focus {
    border-color: var(--color-rust);
}

.search-icon {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: var(--color-text-muted);
}

.genre-pills {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.pill {
    padding: 0.4rem 1rem;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border-muted);
    border-radius: 30px; /* Modern rounded pill-shape */
    color: var(--color-text-muted);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.8rem;
    transition: all var(--transition-fast);
}

.pill:hover, .pill.active {
    background: var(--color-rust);
    color: #fff;
    border-color: var(--color-rust);
    box-shadow: var(--glow-peach);
}

/* Stories Grid Layout */
.stories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

.story-card {
    background-color: var(--color-bg-card);
    border: 1px solid var(--color-border-muted);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 220px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: border-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.story-card:hover {
    transform: translateY(-3px);
    border-color: var(--color-rust);
    box-shadow: var(--shadow-md), var(--glow-peach);
}

.story-card-top {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.story-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.story-card-genre {
    color: var(--color-rust);
}

.story-card-time {
    color: var(--color-text-muted);
}

.story-card-title {
    font-family: var(--font-serif-title);
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.35;
}

.story-card-summary {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.story-card-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.25rem;
    border-top: 1px solid var(--color-border-muted);
    padding-top: 0.75rem;
}

.story-card-author {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.story-author-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-rust);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.story-author-name {
    font-size: 0.8rem;
    font-weight: 600;
}

.story-likes {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.story-likes svg {
    width: 12px;
    height: 12px;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 4rem 0;
    max-width: 400px;
    margin: 0 auto;
}

.empty-icon {
    font-size: 2.5rem;
    color: var(--color-rust);
    margin-bottom: 0.75rem;
}

.empty-title {
    font-family: var(--font-serif-title);
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.empty-desc {
    font-size: 0.95rem;
    color: var(--color-text-muted);
    margin-bottom: 1.5rem;
}

/* Focused Reader View & Typography */
.reader-section {
    padding: 2rem 0;
}

.reader-header-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--color-border-muted);
    padding-bottom: 0.75rem;
    margin-bottom: 2.25rem;
}

/* Floating Actions Toolbar (Sleek docked widget) */
.reader-controls {
    position: fixed;
    bottom: 30px; 
    left: 50%;
    transform: translateX(-50%);
    z-index: 140;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border-muted);
    border-radius: 50px;
    padding: 0.4rem 0.9rem;
    box-shadow: var(--shadow-lg), var(--glow-peach);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    animation: fadeInUp var(--transition-smooth) forwards;
}

.reader-controls .btn-sm {
    border-radius: 50%;
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-color: transparent;
}

.reader-controls svg {
    width: 14px;
    height: 14px;
}

.reader-article {
    max-width: 650px;
    margin: 0 auto;
}

.reader-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.story-genre-tag {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-rust);
}

.story-read-time {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    font-weight: 600;
}

.reader-title {
    font-family: var(--font-serif-title);
    font-size: 2.5rem;
    line-height: 1.15;
    font-weight: 700;
    margin-bottom: 1.25rem;
    letter-spacing: -0.02em;
}

.reader-author-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.75rem;
}

.author-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--color-rust);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
}

.author-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.publish-date {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.reader-divider {
    border: none;
    border-top: 1px solid var(--color-border-muted);
    margin: 2rem 0;
}

/* Scholarly Drop Cap / Initials & Lora paragraph text */
.reader-content {
    font-family: var(--font-serif-body);
    font-size: 1.15rem;
    line-height: 1.85;
}

.reader-content p {
    margin-bottom: 1.5rem;
}

.reader-content p:first-of-type::first-letter {
    font-family: var(--font-serif-title);
    font-size: 3.5rem;
    float: left;
    line-height: 0.9;
    margin-right: 0.6rem;
    margin-top: 0.1rem;
    color: var(--color-rust);
    font-weight: 700;
}

.reader-footer {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

.reader-footer svg {
    width: 14px;
    height: 14px;
}

/* Bookmark Active print states */
.bookmark-icon {
    transition: fill var(--transition-fast), color var(--transition-fast);
}

#bookmark-story-btn.active .bookmark-icon {
    fill: var(--color-rust);
    color: var(--color-rust);
}

/* Inkwell Comments board */
.comments-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border-muted);
}

.comments-title {
    font-family: var(--font-serif-title);
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    color: var(--color-text-main);
}

.comment-form {
    margin-bottom: 2rem;
}

.comment-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.comment-input-wrapper textarea {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border-muted);
    border-radius: var(--radius-sm);
    color: var(--color-text-main);
    padding: 0.7rem 0.9rem;
    font-family: var(--font-sans);
    font-size: 0.92rem;
    min-height: 80px;
    outline: none;
    transition: border-color var(--transition-fast);
}

.comment-input-wrapper textarea:focus {
    border-color: var(--color-rust);
}

.comment-form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.comment-auth-hint {
    font-size: 0.78rem;
    color: var(--color-text-muted);
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.comment-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border-muted);
    border-radius: var(--radius-md);
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.comment-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
}

.comment-card-author-info {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.comment-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-rust);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.comment-author-name {
    font-weight: 600;
    color: var(--color-text-main);
}

.comment-author-handle {
    color: var(--color-text-muted);
}

.comment-date {
    color: var(--color-text-muted);
}

.comment-body {
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Bookshelf view container */
.bookshelf-section {
    padding: 2rem 0;
}

/* Editor Form (Writer Panel) */
.editor-section {
    padding: 2rem 0;
}

.editor-header {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--color-border-muted);
    padding-bottom: 0.75rem;
}

.editor-view-title {
    font-family: var(--font-serif-title);
    font-size: 2rem;
    font-weight: 700;
}

.editor-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 800px;
    margin: 0 auto;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-row.split {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 1.25rem;
}

label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-rust);
}

.editor-form input[type="text"],
.editor-form select,
.editor-form textarea {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border-muted);
    border-radius: var(--radius-sm);
    color: var(--color-text-main);
    padding: 0.65rem 0.8rem;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    outline: none;
    transition: border-color var(--transition-fast);
}

.editor-form textarea {
    font-family: var(--font-serif-body);
}

.editor-form select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c2593f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.8rem center;
    background-size: 12px;
    padding-right: 2rem;
}

.editor-form input[type="text"]:focus,
.editor-form select:focus,
.editor-form textarea:focus {
    border-color: var(--color-rust);
}

.textarea-wrapper {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--color-border-muted);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.editor-toolbar {
    background: var(--color-bg-card-hover);
    border-bottom: 1px solid var(--color-border-muted);
    padding: 0.5rem 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toolbar-hint {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    font-style: italic;
}

.word-count {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--color-rust);
}

.textarea-wrapper textarea {
    border: none;
    min-height: 350px;
    line-height: 1.7;
    resize: vertical;
}

.editor-form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.editor-status {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    font-style: italic;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(31, 28, 26, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border-muted);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 400px;
    padding: 2.2rem;
    position: relative;
    box-shadow: var(--shadow-lg);
}

.modal-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0.2rem;
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.modal-close-btn:hover {
    color: var(--color-text-main);
    background-color: var(--color-bg-card-hover);
}

.modal-close-btn svg {
    width: 16px;
    height: 16px;
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-bottom: 1px solid var(--color-border-muted);
    margin-bottom: 1.5rem;
}

.auth-tab-btn {
    padding: 0.5rem;
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: color var(--transition-fast);
    position: relative;
}

.auth-tab-btn::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--color-rust);
    transition: width var(--transition-fast);
}

.auth-tab-btn.active {
    color: var(--color-text-main);
}

.auth-tab-btn.active::after {
    width: 100%;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.auth-title {
    font-family: var(--font-serif-title);
    font-size: 1.35rem;
    font-weight: 700;
}

.auth-subtitle {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-top: -0.5rem;
}

.auth-form input {
    background: var(--color-bg-deep);
    border: 1px solid var(--color-border-muted);
    border-radius: var(--radius-sm);
    color: var(--color-text-main);
    padding: 0.65rem 0.8rem;
    outline: none;
    font-family: var(--font-sans);
    font-size: 0.88rem;
    transition: border-color var(--transition-fast);
}

.auth-form input:focus {
    border-color: var(--color-rust);
}

.auth-error-msg {
    color: var(--color-rust);
    font-size: 0.75rem;
    font-weight: 600;
}

/* Modern Footer styling */
.main-footer {
    border-top: 1px solid var(--color-border-muted);
    padding: 2rem 0;
    margin-top: auto;
    background: var(--color-bg-card);
}

.footer-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-logo {
    font-family: var(--font-serif-title);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--color-text-main);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.footer-logo .logo-svg {
    width: 20px;
    height: 20px;
    color: var(--color-text-main);
}

.footer-copy {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* Helpers */
.hidden {
    display: none !important;
}

.show {
    display: block !important;
}

/* Featured Creative Prompt Banner */
.featured-prompt-banner {
    position: relative;
    margin-bottom: 2.5rem;
    border-radius: var(--radius-lg, 12px);
    overflow: hidden;
    padding: 2.5rem 3rem;
    background-image: url('assets/starry_night.jpg');
    background-size: cover;
    background-position: 50% 35%;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-smooth), box-shadow var(--transition-smooth), border-color var(--transition-smooth);
    border: 1px solid var(--color-border-muted);
    text-align: left;
}

.featured-prompt-banner:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.featured-prompt-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(22, 21, 20, 0.92) 0%, rgba(22, 21, 20, 0.72) 100%);
    z-index: 1;
}

.featured-prompt-content {
    position: relative;
    z-index: 2;
    color: var(--color-text-main);
    max-width: 650px;
}

.featured-badge {
    display: inline-block;
    background: rgba(226, 103, 70, 0.15);
    color: var(--color-rust);
    border: 1px solid rgba(226, 103, 70, 0.3);
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.8rem;
}

.featured-title {
    font-family: var(--font-serif-title, 'Cinzel', serif);
    font-size: 1.6rem;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 0.6rem;
    color: #ffffff;
}

body.dark-reading-mode .featured-title {
    color: var(--color-text-main);
}

.featured-desc {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--color-text-muted);
    margin-bottom: 1.25rem;
}

#featured-prompt-write-btn {
    border-radius: 50px;
    padding: 0.5rem 1.25rem;
    font-weight: 600;
}

/* Modals in Dark Mode */
body.dark-reading-mode .modal-card {
    background-image: linear-gradient(rgba(32, 30, 29, 0.92), rgba(32, 30, 29, 0.92)), url('assets/starry_night.jpg');
    background-size: cover;
    background-position: center;
}

/* Mobile Bottom Navigation Bar */
.mobile-bottom-nav {
    display: none; /* Hidden by default on desktop */
}

/* Responsive Grid / Scaling Adjustments */
@media(max-width: 992px) {
    .hero-title {
        font-size: 2.6rem;
    }
}

@media(max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: 0.75rem;
    }
    .ambient-player-panel {
        margin: 0.4rem 0;
    }
    .ambient-slider-wrapper {
        display: none !important; 
    }
    .nav-menu {
        width: 100%;
        justify-content: center;
    }
    .hero-section {
        padding: 4rem 0 3rem 0;
    }
    .hero-title {
        font-size: 2rem;
    }
    .hero-cta {
        flex-direction: column;
        align-items: center;
        width: 100%;
    }
    .hero-cta .btn {
        width: 100%;
        max-width: 300px;
    }
    .footer-container {
        flex-direction: column;
        text-align: center;
    }
}

/* Mobile Screens <= 600px Optimization */
@media(max-width: 600px) {
    body {
        padding-bottom: 75px !important;
    }

    .nav-menu {
        display: none !important;
    }
    
    .header-container {
        flex-direction: row !important;
        justify-content: space-between;
        padding: 0.7rem 0;
    }
    
    .ambient-player-panel {
        margin: 0;
    }

    /* Render Mobile Bottom Tab Bar */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 60px;
        background: var(--color-bg-card);
        border-top: 1px solid var(--color-border-muted);
        box-shadow: 0 -2px 10px rgba(0,0,0,0.04);
        z-index: 150;
        justify-content: space-around;
        align-items: center;
        padding: 0.25rem 0.5rem;
    }

    .mobile-nav-btn {
        background: none;
        border: none;
        outline: none;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        flex: 1;
        height: 100%;
        color: var(--color-text-muted);
        font-family: var(--font-sans);
        font-size: 0.68rem;
        font-weight: 600;
        cursor: pointer;
        transition: color var(--transition-fast), transform var(--transition-fast);
        -webkit-tap-highlight-color: transparent;
        user-select: none;
    }

    .mobile-nav-btn svg {
        width: 18px;
        height: 18px;
        margin-bottom: 2px;
        stroke: currentColor;
    }

    .mobile-nav-btn.active {
        color: var(--color-rust);
    }

    /* Modals bottom-sheets on mobile */
    .modal-overlay {
        align-items: flex-end;
    }

    .modal-card {
        max-width: 100% !important;
        width: 100%;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        margin: 0;
        padding: 2rem 1.25rem 3rem 1.25rem;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
        border-left: none;
        border-right: none;
        border-bottom: none;
    }

    /* Floating Reader Controls docked on mobile */
    .reader-controls {
        position: fixed;
        bottom: 80px; 
        left: 50%;
        transform: translateX(-50%);
        z-index: 140;
        background: var(--color-bg-card);
        border: 1px solid var(--color-border-muted);
        padding: 0.35rem 0.75rem;
        border-radius: 30px;
        box-shadow: var(--shadow-lg), var(--glow-peach);
        display: flex;
        align-items: center;
        gap: 0.3rem;
    }

    .reader-header-nav {
        border-bottom: none;
        margin-bottom: 1rem;
    }

    .main-content {
        padding-top: 0.5rem;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-section {
        padding: 2.5rem 0;
    }

    .reader-title {
        font-size: 2rem;
    }

    .form-row.split {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
}
