/* css/style.css - 2DMikeP Reprogramming Reality */

/* ==========================================
   ROOT VARIABLES & RESET
   ========================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-cream: #E8D5B7;
    --dark-teal: #1B3A3A;
    --red-orange: #B85450;
    --medium-teal: #4A7C7E;
    --light-cream: #F4E8D0;
    --white: #FFFFFF;
    --black: #000000;
}

/* ==========================================
   BASE STYLES
   ========================================== */

body {
    font-family: 'Helvetica Neue', 'Arial', sans-serif;
    background: var(--bg-cream);
    color: var(--dark-teal);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

/* Grain overlay effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.03;
    z-index: 1;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 2;
}

/* ==========================================
   TYPOGRAPHY
   ========================================== */

h1, h2, h3, h4, h5, h6 {
    font-weight: 900;
    letter-spacing: -0.02em;
    text-transform: uppercase;
}

p {
    margin-bottom: 1rem;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ==========================================
   HERO SECTION
   ========================================== */

.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    background: var(--bg-cream);
}

.hero-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.hero-shape-1 {
    position: absolute;
    width: 400px;
    height: 400px;
    background: var(--red-orange);
    border-radius: 50%;
    top: -200px;
    left: -100px;
    opacity: 0.3;
}

.hero-shape-2 {
    position: absolute;
    width: 300px;
    height: 300px;
    background: var(--medium-teal);
    top: 60%;
    right: -150px;
    opacity: 0.3;
    transform: rotate(45deg);
}

.hero-content {
    position: relative;
    z-index: 2;
}

.logo {
    font-size: clamp(4rem, 10vw, 8rem);
    font-weight: 900;
    color: var(--dark-teal);
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.tagline {
    font-size: clamp(1rem, 2.5vw, 1.5rem);
    margin-bottom: 3rem;
    color: var(--medium-teal);
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.book-title {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    margin-bottom: 1rem;
    font-weight: 800;
    color: var(--red-orange);
    letter-spacing: -0.01em;
    text-transform: uppercase;
}

.book-subtitle {
    font-size: clamp(1rem, 2vw, 1.3rem);
    margin-bottom: 3rem;
    color: var(--dark-teal);
    font-weight: 400;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    letter-spacing: 0.02em;
}

/* ==========================================
   BUTTONS
   ========================================== */

.cta-button {
    display: inline-block;
    padding: 20px 50px;
    background: var(--dark-teal);
    color: var(--bg-cream);
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    position: relative;
    overflow: hidden;
}

.cta-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--red-orange);
    transition: left 0.3s ease;
    z-index: -1;
}

.cta-button:hover::before {
    left: 0;
}

.cta-button:hover {
    transform: translateY(-3px);
    color: var(--bg-cream);
}

/* ==========================================
   NAVIGATION
   ========================================== */

.navigation {
    position: fixed;
    top: 30px;
    right: 30px;
    z-index: 100;
}

.nav-toggle {
    background: var(--dark-teal);
    border: none;
    color: var(--bg-cream);
    padding: 15px;
    cursor: pointer;
    font-size: 1.3rem;
    transition: all 0.3s ease;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-toggle:hover {
    background: var(--red-orange);
}

.nav-menu {
    display: none;
    position: absolute;
    top: 60px;
    right: 0;
    background: var(--dark-teal);
    padding: 20px;
    min-width: 220px;
}

.nav-menu a {
    display: block;
    color: var(--bg-cream);
    text-decoration: none;
    padding: 12px 20px;
    transition: all 0.3s ease;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.9rem;
}

.nav-menu a:hover {
    background: var(--red-orange);
    transform: translateX(5px);
}

/* ==========================================
   PROGRESS BAR
   ========================================== */

.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 6px;
    background: var(--red-orange);
    z-index: 999;
    transition: width 0.3s ease;
}

/* ==========================================
   CHAPTERS SECTION
   ========================================== */

.chapters-section {
    padding: 100px 0;
    background: var(--dark-teal);
    position: relative;
}

.section-title {
    text-align: center;
    font-size: clamp(3rem, 6vw, 5rem);
    margin-bottom: 60px;
    font-weight: 900;
    color: var(--bg-cream);
    text-transform: uppercase;
    letter-spacing: -0.02em;
}

.chapters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    margin-bottom: 60px;
}

/* Chapters page: full visual tiles with split overlays */
.chapter-tiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

.chapter-tile {
    background: var(--bg-cream);
    border: 3px solid transparent;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.chapter-tile:hover {
    transform: translateY(-6px);
    border-color: var(--red-orange);
    box-shadow: 0 18px 36px rgba(27,58,58,0.25);
}

.tile-media {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: var(--light-cream);
}

.tile-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tile-split {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    pointer-events: none; /* allow hover, but buttons handle clicks */
}

.tile-half {
    pointer-events: auto; /* re-enable on buttons */
    border: none;
    background: transparent;
    color: var(--bg-cream);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: clamp(0.8rem, 1.6vw, 1rem);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    isolation: isolate;
}

.tile-left::before,
.tile-right::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.25s ease;
    z-index: -1;
}

.tile-left::before {
    background: rgba(74, 124, 126, 0.60); /* blue/teal */
}

.tile-right::before {
    background: rgba(184, 84, 80, 0.60); /* red */
}

.tile-half:hover::before {
    opacity: 1;
}

.tile-half span {
    transform: translateY(6px);
    transition: transform 0.2s ease;
}

.tile-half:hover span { transform: translateY(0); }

.tile-meta {
    padding: 16px 18px 20px;
}

.chapter-card {
    background: var(--bg-cream);
    padding: 35px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    border: 3px solid transparent;
}

.chapter-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 30%, rgba(184, 84, 80, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none; /* don't block clicks */
}

.chapter-card:hover::before {
    opacity: 1;
}

.chapter-card:hover {
    transform: translateY(-8px);
    border-color: var(--red-orange);
    box-shadow: 0 20px 40px rgba(27, 58, 58, 0.3);
}

.chapter-number {
    font-size: 0.85rem;
    color: var(--red-orange);
    font-weight: 700;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

.chapter-title {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 12px;
    color: var(--dark-teal);
    text-transform: uppercase;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.chapter-paradox {
    font-size: 0.95rem;
    color: var(--medium-teal);
    margin-bottom: 18px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.chapter-description {
    font-size: 0.95rem;
    color: var(--dark-teal);
    line-height: 1.6;
    font-weight: 400;
}

/* Chapter card image block */
.chapter-card.has-image .chapter-image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9; /* keep a nice card-friendly ratio */
    overflow: hidden;
    border: 2px solid var(--dark-teal);
    background: var(--light-cream);
    margin-bottom: 18px;
}

.chapter-card .chapter-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover; /* auto-crop to fill nicely */
    object-position: center;
    transform: translateZ(0); /* help with rendering */
}

.chapter-card .chapter-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 40%;
    background: linear-gradient(to top, rgba(27,58,58,0.85), rgba(27,58,58,0));
    display: flex;
    align-items: end;
    justify-content: flex-end;
    padding: 10px 12px;
    color: var(--bg-cream);
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none; /* allow clicks to pass through */
}

.chapter-card:hover .chapter-overlay {
    opacity: 1;
}

.read-more {
    font-size: 0.9rem;
    font-weight: 700;
    background: rgba(184, 84, 80, 0.95);
    padding: 6px 10px;
    letter-spacing: 0.05em;
}

/* Chapter actions/buttons */
.chapter-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.chapter-btn {
    appearance: none;
    border: 2px solid var(--dark-teal);
    background: var(--dark-teal);
    color: var(--bg-cream);
    padding: 10px 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.chapter-btn:hover {
    transform: translateY(-2px);
    background: var(--red-orange);
    border-color: var(--red-orange);
}

.chapter-btn.preview-btn {
    background: transparent;
    color: var(--dark-teal);
}

.chapter-btn.preview-btn:hover {
    color: var(--bg-cream);
}

/* ==========================================
   MODAL
   ========================================== */

.chapter-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(27, 58, 58, 0.95);
    z-index: 1000;
    overflow-y: auto;
}

.modal-content {
    max-width: 800px;
    margin: 50px auto;
    background: var(--bg-cream);
    padding: 50px;
    position: relative;
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 2.5rem;
    color: var(--dark-teal);
    cursor: pointer;
    transition: color 0.3s ease;
    font-weight: 300;
}

.close-modal:hover {
    color: var(--red-orange);
}

.modal-chapter-title {
    font-size: 3rem;
    margin-bottom: 20px;
    color: var(--dark-teal);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: -0.02em;
}

.modal-paradox {
    font-size: 1.2rem;
    color: var(--red-orange);
    margin-bottom: 35px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.chapter-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--dark-teal);
}

.chapter-content p {
    margin-bottom: 20px;
}

/* ==========================================
   INTERACTIVE ELEMENTS
   ========================================== */

.interactive-elements {
    margin: 35px 0;
    padding: 30px;
    background: var(--medium-teal);
    position: relative;
    color: var(--bg-cream);
}

.interactive-elements::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
    background: var(--red-orange);
}

.reflection-prompt {
    font-weight: 700;
    color: var(--bg-cream);
    margin-bottom: 15px;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.interactive-elements p {
    color: var(--bg-cream);
    line-height: 1.7;
}

.thought-exercise {
    background: var(--dark-teal);
    padding: 30px;
    margin: 30px 0;
    color: var(--bg-cream);
    position: relative;
}

.thought-exercise strong {
    display: block;
    margin-bottom: 15px;
    font-size: 1.1rem;
    color: var(--red-orange);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ==========================================
   DECORATIVE ELEMENTS
   ========================================== */

.decorative-circle {
    position: fixed;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: var(--red-orange);
    opacity: 0.05;
    pointer-events: none;
    animation: float 20s infinite ease-in-out;
}

.decorative-circle:nth-child(1) {
    top: 10%;
    left: 5%;
    animation-delay: 0s;
}

.decorative-circle:nth-child(2) {
    bottom: 10%;
    right: 5%;
    animation-delay: -10s;
    background: var(--medium-teal);
}

/* ==========================================
   ANIMATIONS
   ========================================== */

@keyframes float {
    0%, 100% { 
        transform: translateY(0) scale(1); 
    }
    50% { 
        transform: translateY(-30px) scale(1.1); 
    }
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

.fade-in {
    animation: fadeIn 0.8s ease-out;
}

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */

@media (max-width: 768px) {
    .chapter-tiles-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .chapters-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        margin: 20px;
        padding: 30px;
    }
    
    .hero {
        padding: 40px 0;
    }

    .modal-chapter-title {
        font-size: 2rem;
    }
    
    .nav-menu {
        width: 100vw;
        right: -30px;
    }
    
    .hero-shape-1 {
        width: 250px;
        height: 250px;
    }
    
    .hero-shape-2 {
        width: 200px;
        height: 200px;
    }
    
    .interactive-elements {
        padding: 20px;
        margin: 30px -15px;
    }
    
    .thought-exercise {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 3rem;
    }
    
    .book-title {
        font-size: 2rem;
    }
    
    .section-title {
        font-size: 2.5rem;
    }
    
    .chapter-card {
        padding: 25px;
    }
    
    .modal-content {
        padding: 20px;
    }
}

/* ==========================================
   PRINT STYLES
   ========================================== */

@media print {
    .navigation,
    .progress-bar,
    .decorative-circle {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .hero {
        min-height: auto;
        padding: 50px 0;
    }
    
    .chapters-section {
        background: white;
    }
    
    .section-title {
        color: black;
    }
}

/* ==========================================
   UTILITIES
   ========================================== */

.text-center {
    text-align: center;
}

.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mt-3 { margin-top: 3rem; }

.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }
.mb-3 { margin-bottom: 3rem; }

.hidden {
    display: none;
}

.visible {
    display: block;
}