/**
 * Hot Water - Reader Stylesheet
 * /Library/WebServer/Documents/hotwater.world/css/reader.css
 * 
 * Optimized for comfortable long-form reading
 */

/* Reader Container */
.reader-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Chapter Header */
.chapter-header {
    text-align: center;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(139, 115, 85, 0.3);
}

/* Full-bleed Hero Image */
.chapter-hero-fullbleed {
    position: relative;
    max-width: 1400px;
    margin: 0 auto 1rem;
}

.chapter-hero-fullbleed img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
}

.hero-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 3rem 2rem 1.5rem;
    background: linear-gradient(to top, rgba(61, 61, 61, 0.85) 0%, rgba(61, 61, 61, 0.4) 60%, transparent 100%);
    text-align: center;
    border-radius: 0 0 4px 4px;
}

.hero-overlay .chapter-type-label {
    color: #c4a35a;
    margin-bottom: 0.5rem;
}

.hero-overlay h1 {
    color: #f5f1e8;
    font-size: 2rem;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.hero-caption-fullbleed {
    text-align: center;
    font-size: 0.85rem;
    color: #8b7355;
    font-style: italic;
    padding: 0.5rem 2rem 1.5rem;
    max-width: 700px;
    margin: 0 auto;
}

/* Minimal header when hero image is present */
.chapter-header-minimal {
    text-align: center;
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid rgba(139, 115, 85, 0.3);
}

.chapter-header-minimal .chapter-info {
    margin: 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .hero-overlay {
        padding: 2rem 1rem 1rem;
    }
    
    .hero-overlay h1 {
        font-size: 1.5rem;
    }
}

/* Original hero styles (fallback) */
.chapter-hero-figure {
    margin: 0 0 2rem 0;
}

.chapter-hero {
    width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.hero-caption {
    text-align: center;
    font-size: 0.85rem;
    color: #8b7355;
    font-style: italic;
    margin-top: 0.75rem;
}

.chapter-type-label {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #8b7355;
    margin-bottom: 0.5rem;
}

.chapter-header h1 {
    font-size: 2.5rem;
    color: #4a6b7c;
    margin-bottom: 1rem;
}

.chapter-info {
    color: #8b7355;
    font-size: 0.9rem;
}

.chapter-info span {
    margin: 0 0.5rem;
}

/* Chapter Content */
.chapter-content {
    font-size: 1.125rem;
    line-height: 1.9;
    color: #3d3d3d;
}

.chapter-content p {
    margin-bottom: 1.5rem;
    text-align: justify;
    hyphens: auto;
}

.chapter-content p:first-of-type::first-letter {
    font-size: 3.5rem;
    float: left;
    line-height: 1;
    margin-right: 0.5rem;
    margin-top: 0.1rem;
    color: #4a6b7c;
    font-weight: 600;
}

.chapter-content h2 {
    font-size: 1.5rem;
    margin-top: 3rem;
    margin-bottom: 1.5rem;
    color: #4a6b7c;
}

.chapter-content h3 {
    font-size: 1.25rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #4a6b7c;
}

.chapter-content blockquote {
    margin: 2rem 0;
    padding: 1rem 1.5rem;
    border-left: 4px solid #c4a35a;
    background-color: rgba(196, 163, 90, 0.05);
    font-style: italic;
    color: #8b7355;
}

/* Scene break - whitespace only */
.chapter-content hr {
    border: none;
    height: 0;
    margin: 2.5rem 0;
}

/* Document and back matter - subtle line for clarity */
.document-style .chapter-content hr,
.back-matter-style .chapter-content hr {
    margin: 2rem 0;
    border-top: 1px solid rgba(139, 115, 85, 0.3);
}

/* Chapter end flourish - Pictish stone */
.chapter-end-flourish {
    text-align: center;
    margin: 4rem 0 2rem;
    padding-top: 2rem;
}

.chapter-end-flourish img {
    height: 75px;
    width: auto;
    opacity: 0.7;
}

.chapter-content em {
    font-style: italic;
}

.chapter-content strong {
    font-weight: 600;
    color: #4a6b7c;
}

/* Links in content */
.chapter-content a {
    color: #4a6b7c;
    text-decoration: underline;
    text-decoration-color: #c4a35a;
    text-underline-offset: 3px;
}

.chapter-content a:hover {
    color: #c4a35a;
    text-decoration-color: #4a6b7c;
}

.chapter-content a:visited {
    color: #6b5a4a;
}

/* Code blocks (for in-story technical documents) */
.chapter-content pre {
    background-color: #3d3d3d;
    color: #f5f1e8;
    padding: 1.5rem;
    border-radius: 4px;
    overflow-x: auto;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 2rem 0;
}

.chapter-content code {
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 0.9em;
    background-color: rgba(139, 115, 85, 0.1);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
}

.chapter-content pre code {
    background: none;
    padding: 0;
}

/* Chapter Navigation - handles long titles gracefully */
.chapter-nav {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 0.75rem;
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(139, 115, 85, 0.3);
}

.chapter-nav a,
.chapter-nav .disabled {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background-color: transparent;
    border: 2px solid #4a6b7c;
    border-radius: 4px;
    color: #4a6b7c;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    text-decoration: none;
}

.chapter-nav .prev,
.chapter-nav .next {
    flex: 1;
    max-width: 220px;
    min-width: 0;
    overflow: hidden;
}

.chapter-nav .prev span,
.chapter-nav .next span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chapter-nav .toc-link {
    flex-shrink: 0;
    border-color: #8b7355;
    color: #8b7355;
}

.chapter-nav a:hover {
    background-color: #4a6b7c;
    color: #f5f1e8;
}

.chapter-nav .toc-link:hover {
    background-color: #8b7355;
    color: #f5f1e8;
}

.chapter-nav .prev::before {
    content: '\2190';
    flex-shrink: 0;
}

.chapter-nav .next::after {
    content: '\2192';
    flex-shrink: 0;
}

.chapter-nav .disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* Gate Overlay */
.gate-overlay {
    text-align: center;
    padding: 4rem 2rem;
    background: linear-gradient(to bottom, transparent, #f5f1e8 30%);
    margin-top: -4rem;
    position: relative;
}

.gate-overlay h2 {
    color: #4a6b7c;
    margin-bottom: 1rem;
}

.gate-overlay p {
    color: #8b7355;
    margin-bottom: 2rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.gate-form {
    max-width: 400px;
    margin: 0 auto;
}

.gate-form input[type="email"] {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    border: 2px solid #8b7355;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.gate-form input[type="email"]:focus {
    outline: none;
    border-color: #4a6b7c;
}

.gate-form button {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 600;
    background-color: #4a6b7c;
    color: #f5f1e8;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.gate-form button:hover {
    background-color: #3d5a69;
}

.gate-privacy {
    font-size: 0.8rem;
    color: #8b7355;
    margin-top: 1rem;
}

/* Progress Indicator */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background-color: #c4a35a;
    z-index: 200;
    transition: width 0.1s ease;
}

/* Document Type Styles (journals, papers) */
.document-style {
    background-color: #fff;
    padding: 2rem;
    border: 1px solid rgba(139, 115, 85, 0.2);
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.document-style .chapter-content {
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    line-height: 1.7;
}

.document-style .chapter-content p:first-of-type::first-letter,
.back-matter-style .chapter-content p:first-of-type::first-letter,
.front-matter-style .chapter-content p:first-of-type::first-letter {
    font-size: inherit;
    float: none;
    margin: 0;
    color: inherit;
    font-weight: normal;
}

/* Interlude Styles (Darwin sections) */
.interlude-style .chapter-header {
    background-color: rgba(74, 107, 124, 0.05);
    margin: -2rem -1rem 3rem -1rem;
    padding: 3rem 2rem;
    border-radius: 4px;
}

.interlude-style .chapter-content {
    font-style: italic;
}

.interlude-style .chapter-content p:first-of-type::first-letter {
    font-style: normal;
}

/* Responsive */
@media (max-width: 768px) {
    .reader-container {
        padding: 1rem;
    }
    
    .chapter-header h1 {
        font-size: 1.75rem;
    }
    
    .chapter-content {
        font-size: 1rem;
        line-height: 1.8;
    }
    
    .chapter-content p:first-of-type::first-letter {
        font-size: 2.5rem;
    }
    
    .chapter-nav {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .chapter-nav .prev,
    .chapter-nav .next {
        max-width: 100%;
        width: 100%;
    }
    
    .chapter-nav .toc-link {
        width: 100%;
    }
}

/* Print Styles */
@media print {
    .site-header,
    .site-footer,
    .chapter-nav,
    .reading-progress {
        display: none;
    }
    
    .reader-container {
        max-width: 100%;
        padding: 0;
    }
    
    .chapter-content {
        font-size: 12pt;
        line-height: 1.6;
    }
}