:root {
    /* Warm Creme & Brown Palette */
    --bg-color: #F7F3F0; 
    --bg-accent: #EFE9E4; 
    --text-dark: #3E2F28; 
    --text-light: #6D5B52; 
    --accent-color: #A68A64; 
    
    /* Glassmorphism Variables */
    --glass-bg: rgba(255, 255, 255, 0.4);
    --glass-border: rgba(255, 255, 255, 0.6);
    --glass-highlight: rgba(255, 255, 255, 0.8);
    --liquid-shadow: 0 30px 60px rgba(62, 47, 40, 0.12), 0 0 0 1px rgba(255, 255, 255, 0.4);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Ensure the Web Component wrapper doesn't disrupt the layout flow or sticky positioning */
site-header {
    display: contents;
}

body {
    background-color: var(--bg-color);
    background: radial-gradient(circle at top left, #FDFCFB 0%, #F7F3F0 100%);
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: var(--text-dark);
    line-height: 1.7;
    min-height: 100vh;
    overflow-x: hidden;
}

/* --- Glass Header --- */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2.5rem;
    background: var(--glass-bg);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 24px;
    transition: width 0.4s cubic-bezier(0.165, 0.84, 0.44, 1), 
                opacity 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    white-space: nowrap;
    overflow: hidden;
}

.home-btn {
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid var(--glass-border);
    color: var(--text-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border-radius: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    flex-shrink: 0;
}

.home-btn:hover {
    background: var(--glass-highlight);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    color: var(--accent-color);
}

header h1 {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
    letter-spacing: -0.02em;
    flex-shrink: 0;
}

/* --- Search Input Container --- */
.search-container {
    flex: 0 1 400px;
    position: relative;
    display: flex;
    justify-content: flex-end;
    transition: flex 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.search-bar {
    width: 100%;
    padding: 12px 48px 12px 24px;
    border-radius: 100px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.2);
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-dark);
    outline: none;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    backdrop-filter: blur(4px);
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.05),
        0 1px 0 rgba(255, 255, 255, 0.6);
}

.search-bar:focus {
    background: rgba(255, 255, 255, 0.8);
    border-color: var(--accent-color);
    box-shadow: 
        0 0 0 4px rgba(166, 138, 100, 0.1),
        inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.search-icon-btn {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s;
}

.search-icon-btn:hover {
    color: var(--accent-color);
}

/* Dropdown */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    width: 100%;
    background: var(--glass-highlight);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--liquid-shadow);
    overflow: hidden;
    z-index: 2000;
    display: flex;
    flex-direction: column;
}

.dropdown-item {
    padding: 12px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: background 0.2s;
    text-align: left;
    background: transparent;
    border-left: none; border-right: none; border-top: none;
    font-family: inherit;
    width: 100%;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.9);
}

.see-more-btn {
    padding: 12px;
    background: rgba(166, 138, 100, 0.1);
    color: var(--accent-color);
    font-weight: 600;
    font-family: inherit;
    border: none;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.see-more-btn:hover {
    background: var(--accent-color);
    color: #fff;
}

/* --- Search Result Elements --- */
.result-excerpt {
    font-size: 0.9rem;
    color: var(--text-dark);
    margin-bottom: 4px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.result-docname {
    font-size: 0.75rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

mark {
    background-color: rgba(166, 138, 100, 0.3);
    color: var(--text-dark);
    border-radius: 2px;
    padding: 0 2px;
    font-weight: 600;
}

/* --- Utilities --- */
.divider {
    width: 60px;
    height: 3px;
    background: var(--accent-color);
    margin: 3rem auto;
    border-radius: 2px;
    opacity: 0.6;
}

/* --- Responsive (Mobile Search Fix) --- */
@media (max-width: 768px) {
    header {
        padding: 1rem 1.5rem;
    }
    
    .search-container {
        flex: 0 0 auto;
    }
    
    .search-input-wrapper {
        width: auto;
    }
    
    .search-bar {
        width: 0;
        padding: 0;
        opacity: 0;
        border-color: transparent;
        pointer-events: none;
        background: transparent;
    }
    
    .search-icon-btn {
        position: relative;
        right: 0;
        background: rgba(255, 255, 255, 0.3);
        border: 1px solid var(--glass-border);
        padding: 10px;
        border-radius: 12px;
        color: var(--text-dark);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    }
    
    /* When user taps search on mobile */
    header.mobile-search-active .header-left {
        width: 0;
        opacity: 0;
        gap: 0;
    }
    
    header.mobile-search-active .search-container {
        flex: 1;
    }
    
    header.mobile-search-active .search-input-wrapper {
        width: 100%;
    }
    
    header.mobile-search-active .search-bar {
        width: 100%;
        padding: 12px 48px 12px 20px;
        opacity: 1;
        border-color: rgba(255, 255, 255, 0.5);
        pointer-events: auto;
        background: rgba(255, 255, 255, 0.2);
    }
    
    header.mobile-search-active .search-icon-btn {
        position: absolute;
        right: 8px;
        background: none;
        border: none;
        box-shadow: none;
        padding: 4px;
    }
}