/* Coffee-inspired Color Palette */
:root {
    --latte-light: #f5ebe0;
    --latte-medium: #e3d5ca;
    --coffee-accent: #d5bdaf;
    --text-dark: #4a3f35;
    --morph-opacity: 1; /* Controlled by JS */
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Arial, sans-serif;
    background-color: var(--latte-light);
    color: var(--text-dark);
}

/* --- HEADER CONTAINER --- */
#main-header {
    position: fixed;
    top: 0;
    width: 100%;
    height: 180px; 
    display: flex;
    align-items: center;
    transition: all 0.4s ease;
    z-index: 1000;
    overflow: visible; 
}

#main-header.shrunk {
    height: 80px;
    background-color: rgba(227, 213, 202, 0.95);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* --- BACKGROUND MORPHING --- */
.header-bg {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-size: cover;
    background-position: 27% 73%;
    z-index: 1;
    pointer-events: none;
}

.narrow-bg {
    background-image: linear-gradient(rgba(245,235,224,0.4), rgba(245,235,224,0.4)),
        url('https://shepherdsrock.org/coffee/assets/srbc-narrow-pencil.png');
    background-position: 27% 36%;    
    opacity: var(--morph-opacity);
}

.wide-bg {
    background-image: linear-gradient(rgba(245,235,224,0.4), rgba(245,235,224,0.4)),
        url('https://shepherdsrock.org/coffee/assets/srbc-wide-pencil.png');
    opacity: calc(1 - var(--morph-opacity));
}

/* --- HEADER CONTENT LAYOUT --- */
.header-content {
    position: relative;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

#header-title {
    margin: 0;
    font-size: 2rem;
    transition: font-size 0.4s;
}

#main-header.shrunk #header-title {
    font-size: 1.4rem;
}

/* --- NAVIGATION BUTTONS --- */
.header-nav {
    display: flex;
    gap: 15px;
}

.nav-btn {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: bold;
    padding: 8px 16px;
    border: 1px solid var(--text-dark);
    border-radius: 4px;
    transition: 0.3s;
    background: rgba(255,255,255,0.1);
}

.nav-btn:hover {
    background: var(--text-dark);
    color: #fff;
}

/* --- HAMBURGER MENU ICON --- */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 10px;
    z-index: 1002;
}

.bar {
    width: 25px;
    height: 3px;
    background-color: var(--text-dark);
    border-radius: 2px;
}

/* --- RESPONSIVE / MOBILE STYLES --- */
@media (max-width: 850px) {
    .menu-toggle { display: flex; }

    .header-nav {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        right: -5%;
        background-color: var(--latte-medium);
        width: 220px;
        padding: 20px;
        box-shadow: -5px 5px 15px rgba(0,0,0,0.2);
        z-index: 9999;
    }

    .header-nav.active {
        display: flex !important;
    }

    .nav-btn {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
    }
}

/* --- BODY CONTENT --- */
.content-container {
    padding: 220px 20px 80px;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
}

.toc-container {
    max-width: 900px;
    margin: auto;
    padding: 260px 20px 80px;
}

.toc-section {
    margin-bottom: 30px;
}

h1, h2 {
    color: #4b2e2e;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    background: white;
    border-radius: 6px;
    overflow: hidden;
}

th {
    background-color: #6f4e37;
    color: white;
    padding: 10px;
}

td {
    padding: 10px;
    border-bottom: 1px solid #ddd;
}

tr:hover {
    background-color: #f5eee6;
}

/* CURRENT STUDY HIGHLIGHT */
.current {
    background-color: #c8a27a !important;
    color: #fff;
    font-weight: bold;
}

/* STUDY TRACKER BADGE */
#study-tracker {
    position: fixed;
    top: 180px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 900px;
    background: #6f4e37;
    color: white;
    padding: 12px 16px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    font-weight: bold;
    text-align: center;
    z-index: 999;
    transition: top 0.4s ease;
}

#main-header.shrunk + #study-tracker {
    top: 80px;
}

#study-text {
    color: #ffd9a0;
}

/* --- FOOTER --- */
footer {
    background-color: var(--latte-medium);
    padding: 50px 20px;
    border-top: 2px solid var(--coffee-accent);
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    max-width: 1100px;
    margin: 0 auto;
}

.footer-links ul { list-style: none; padding: 0; }
.footer-links a { text-decoration: none; color: var(--text-dark); display: block; margin-bottom: 8px; }
.social-icons a { margin-right: 15px; text-decoration: none; font-weight: bold; color: var(--text-dark); }
.copyright { text-align: center; margin-top: 50px; border-top: 1px solid var(--coffee-accent); padding-top: 20px; }