/* ===== CSS CUSTOM PROPERTIES (COLOR PALETTE) ===== */
:root {
    --color-text-primary: #2c3e50; /* Dark Slate Blue */
    --color-text-secondary: #555e68; /* Cool Gray */
    --color-text-muted: #6c757d; /* Muted Gray */
    --color-text-on-dark: #ffffff;
    --color-text-link: #3B82F6; /* Tailwind Blue 500 */
    --color-text-link-hover: #2563EB; /* Tailwind Blue 600 */

    --color-bg-body: #f8f9fa; /* Light Gray */
    --color-bg-container: #ffffff; /* White */
    --color-bg-header: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%); /* Pale Yellow Gradient */
    --color-bg-footer: var(--color-text-primary);
    --color-bg-alt-section: #f1f3f5; /* Slightly darker gray for contrast if needed */

    --color-primary-accent: #3B82F6; /* Tailwind Blue 500 */
    --color-primary-accent-hover: #2563EB; /* Tailwind Blue 600 */
    --color-primary-accent-light: #DBEAFE; /* Tailwind Blue 100 - for subtle backgrounds/hovers */

    --color-secondary-accent: #F59E0B; /* Tailwind Amber 500 (similar to sun icon) */
    --color-secondary-accent-light: #FEF3C7; /* Tailwind Amber 100 */

    --color-border-primary: #E5E7EB; /* Tailwind Gray 200 */
    --color-border-secondary: #D1D5DB; /* Tailwind Gray 300 */

    --color-error-bg: #FEF2F2; /* Tailwind Red 50 */
    --color-error-text: #DC2626; /* Tailwind Red 600 */
    --color-error-border: #FECACA; /* Tailwind Red 300 */

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --border-radius-sm: 0.25rem; /* 4px */
    --border-radius-md: 0.5rem; /* 8px */
    --border-radius-lg: 0.75rem; /* 12px */
    --border-radius-xl: 1rem; /* 16px */
    --border-radius-full: 9999px; /* Pill shape */

    /* Typography */
    --font-family-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-family-serif: 'Crimson Text', serif;
    --font-size-base: 1rem; /* 16px */
    --font-size-sm: 0.875rem; /* 14px */
    --font-size-lg: 1.125rem; /* 18px */

    --line-height-base: 1.65;
    --line-height-heading: 1.3;
}

/* ===== CSS RESET & BASE STYLES ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
}

html {
    font-size: var(--font-size-base); /* Use variable */
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-family-sans); /* Use variable */
    font-weight: 400; /* Explicitly set base weight */
    line-height: var(--line-height-base); /* Use variable */
    color: var(--color-text-primary);
    background-color: var(--color-bg-body);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== ACCESSIBILITY & UTILITY CLASSES ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ===== HEADER ===== */
.header {
    background: var(--color-bg-header);
    padding: 1.5rem 0;
    box-shadow: var(--shadow-sm);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sun-icon {
    width: 3rem;
    height: 3rem;
    /* Refined gradient using amber shades from Tailwind for consistency if desired, or keep current if specific look is intended */
    background: linear-gradient(135deg, var(--color-secondary-accent), #D97706 /* Tailwind Amber 600, slightly darker */);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 6px rgba(245, 158, 11, 0.2), 0 5px 12px rgba(245, 158, 11, 0.15); /* Softer, more diffuse shadow */
    transition: transform 0.3s ease-in-out;
}

.header:hover .sun-icon { /* Optional: subtle animation on header hover */
    transform: rotate(15deg) scale(1.05);
}

.sun-icon i {
    color: var(--color-text-on-dark);
    font-size: 1.5rem;
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.logo-main {
    font-family: var(--font-family-serif);
    font-size: 1.875rem; /* ~30px, slightly larger */
    font-weight: 400; /* Crimson Text regular */
    color: var(--color-text-primary);
    font-style: italic;
}

.logo-sub {
    font-family: var(--font-family-sans);
    font-size: var(--font-size-sm); /* 14px */
    font-weight: 600; /* Semibold */
    color: var(--color-text-secondary);
    letter-spacing: 0.075em; /* Slightly reduced */
    text-transform: uppercase;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    padding: 2.5rem 0 4rem; /* Adjusted top/bottom padding */
}

/* ===== TITLE SECTION ===== */
.title-section {
    margin-bottom: 3.5rem; /* Slightly reduced */
}

.main-title {
    font-family: var(--font-family-serif);
    font-size: clamp(2.25rem, 5vw, 3.25rem); /* Adjusted clamp */
    font-weight: 600; /* Crimson Text semibold */
    color: var(--color-text-primary);
    margin-bottom: 1.25rem; /* Slightly reduced */
    line-height: var(--line-height-heading);
}

.description {
    max-width: 800px;
    margin-top: 1.25rem; /* Added margin for separation from title */
}

.lead-text { /* This class seems unused in HTML, but styling it with vars */
    font-family: var(--font-family-sans);
    font-size: var(--font-size-lg); /* 18px */
    color: var(--color-text-secondary);
    margin-bottom: 1rem;
    font-style: italic;
    font-weight: 400;
}

.body-text {
    font-family: var(--font-family-sans);
    font-size: var(--font-size-lg); /* 18px, more readable */
    color: var(--color-text-secondary);
    line-height: var(--line-height-base);
}

.body-text strong {
    color: var(--color-text-primary);
    font-weight: 600; /* Semibold */
}

.disclaimer-text {
    font-family: var(--font-family-sans);
    font-size: var(--font-size-sm); /* 14px */
    color: var(--color-text-muted);
    font-style: italic;
    margin-top: 1.5rem; /* Increased margin */
    line-height: 1.5;
}

/* ===== SEARCH SECTION ===== */
.search-section {
    margin-bottom: 3.5rem; /* Increased slightly for more separation before results */
}

.section-title {
    font-family: var(--font-family-serif);
    font-size: 1.625rem; /* ~26px */
    font-weight: 600; /* Crimson Text semibold */
    color: var(--color-text-secondary);
    margin-bottom: 1.25rem; /* Slightly reduced */
    line-height: var(--line-height-heading);
}

/* ===== EXAMPLE QUESTIONS ===== */
.example-questions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem; /* Slightly reduced gap */
    margin-bottom: 2.5rem; /* Reduced margin */
}

.example-question-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem; /* Consistent with new gap */
    padding: 0.875rem 1.25rem; /* Adjusted padding for a tighter feel */
    background: var(--color-bg-container);
    border: 2px solid var(--color-border-primary);
    border-radius: var(--border-radius-lg);
    color: var(--color-text-link);
    font-family: var(--font-family-sans);
    font-size: var(--font-size-base);
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease-in-out; /* Refined transition */
    text-decoration: underline;
    box-shadow: var(--shadow-sm);
}

.example-question-btn:hover {
    border-color: var(--color-primary-accent-hover); /* Darker border on hover */
    background: var(--color-primary-accent-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: var(--color-primary-accent-hover); /* Darker text on hover */
}

.example-question-btn:focus, .example-question-btn:focus-visible {
    outline: 2px solid var(--color-primary-accent);
    outline-offset: 2px;
    border-color: var(--color-primary-accent); /* Ensure focus state also has distinct border */
    box-shadow: var(--shadow-sm), 0 0 0 2px var(--color-primary-accent-light); /* Add subtle focus ring */
}

.example-question-btn:active {
    transform: translateY(0);
    background: var(--color-primary-accent-light); /* Keep light bg on active */
    border-color: var(--color-primary-accent-hover);
    box-shadow: var(--shadow-sm); /* Reset shadow on active */
}

.example-question-btn i {
    color: var(--color-primary-accent); /* Icon color remains consistent initially */
    font-size: var(--font-size-sm);
}

.example-question-btn:hover i {
    color: var(--color-primary-accent-hover); /* Icon color changes with text on hover */
}

/* ===== SEARCH INPUT ===== */
.search-container {
    margin-bottom: 2.5rem; /* Standardized margin */
}

.search-input-wrapper {
    display: flex;
    max-width: 600px;
    background: var(--color-bg-container);
    border: 2px solid var(--color-border-secondary); /* Reduced border thickness */
    border-radius: var(--border-radius-full);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    padding: 0.25rem; /* Add a little inner padding for the button */
}

.search-input-wrapper:focus-within {
    border-color: var(--color-primary-accent);
    box-shadow: 0 0 0 3px var(--color-primary-accent-light), var(--shadow-md);
}

.search-input {
    flex: 1;
    padding: 0.875rem 1.25rem; /* Adjusted padding to match example buttons more closely */
    border: none;
    outline: none;
    font-family: var(--font-family-sans);
    font-size: var(--font-size-base); /* 16px */
    font-weight: 400;
    color: var(--color-text-primary);
    background: transparent;
}

.search-input::placeholder {
    color: var(--color-text-muted);
    font-style: italic;
    font-weight: 400;
}

.search-input:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.search-btn {
    width: 3.5rem;
    height: 3.5rem;
    background: var(--color-primary-accent);
    border: none;
    border-radius: var(--border-radius-full);
    color: var(--color-text-on-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease-in-out; /* Refined transition */
}

.search-btn:hover:not(:disabled) {
    background: var(--color-primary-accent-hover);
    transform: scale(1.05); /* Keep subtle scale */
    box-shadow: var(--shadow-sm); /* Add subtle shadow on hover */
}

.search-btn:disabled {
    opacity: 0.6; /* Slightly more visible when disabled */
    cursor: not-allowed;
    transform: none;
    background: var(--color-border-secondary); /* Grey out disabled button */
}

.search-btn:focus, .search-btn:focus-visible {
    outline: none; /* Remove default outline */
    box-shadow: 0 0 0 3px var(--color-bg-container), 0 0 0 5px var(--color-primary-accent); /* Custom focus ring */
}

.search-btn i {
    font-size: var(--font-size-base); /* 16px */
}

/* ===== RESULTS SECTION ===== */
.results-section {
    margin-top: 2.5rem; /* Slightly reduced */
}

/* ===== ERROR STATES ===== */
.error-message {
    background: var(--color-error-bg);
    border: 1px solid var(--color-error-border);
    border-radius: var(--border-radius-lg);
    padding: 1.25rem; /* Adjusted padding */
    color: var(--color-error-text);
    font-family: var(--font-family-sans);
    font-size: var(--font-size-base);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem; /* Reduced gap */
    margin-bottom: 2.5rem; /* Standardized margin */
    position: relative;
}

.error-message i {
    color: var(--color-error-text);
    margin-top: 0.25rem; /* Align icon better with text */
}

.error-close {
    position: absolute;
    top: 0.75rem; /* Adjusted position */
    right: 0.75rem; /* Adjusted position */
    background: none;
    border: none;
    color: var(--color-error-text);
    cursor: pointer;
    padding: 0.25rem;
}

.no-results {
    text-align: center;
    padding: 2.5rem 1.5rem; /* Adjusted padding */
    color: var(--color-text-secondary);
    margin-bottom: 2.5rem; /* Added margin for consistency */
}

.no-results i {
    font-size: 2.5rem; /* Slightly smaller icon */
    color: var(--color-border-secondary);
    margin-bottom: 1rem;
}

.no-results p {
    font-family: var(--font-family-sans);
    font-size: var(--font-size-lg); /* 18px */
}

/* ===== RESULTS CONTAINER ===== */
.results-container {
    background: var(--color-bg-container);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border: 1px solid var(--color-border-primary);
    margin-bottom: 2.5rem; /* Added margin for separation if multiple results containers were possible */
}

.results-header {
    background: var(--color-bg-alt-section);
    padding: 1.5rem 1.75rem; /* Adjusted padding */
    border-bottom: 1px solid var(--color-border-primary);
}

.results-meta {
    font-family: var(--font-family-sans);
    font-size: var(--font-size-base);
    color: var(--color-text-secondary);
    line-height: var(--line-height-base);
}

.query-text {
    font-weight: 600;
    color: var(--color-text-primary);
}

.similar-question {
    font-weight: 600;
    color: var(--color-text-link);
}

/* ===== ANSWER CONTAINER ===== */
.answer-container {
    padding: 1.75rem; /* Consistent padding */
}

.answer-label {
    font-family: var(--font-family-serif);
    font-size: 1.625rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 0.75rem; /* Slightly reduced margin */
    line-height: var(--line-height-heading);
}

.answer-text {
    font-family: var(--font-family-sans);
    font-size: var(--font-size-lg);
    line-height: var(--line-height-base);
    color: var(--color-text-primary);
    margin-bottom: 1.25rem; /* Slightly reduced */
}

.answer-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem; /* Adjusted gap */
    align-items: center;
    padding-top: 1.25rem; /* Adjusted padding */
    border-top: 1px solid var(--color-border-primary);
}

.source-info,
.similarity-score {
    display: flex;
    align-items: center;
    gap: 0.375rem; /* Reduced gap */
    font-family: var(--font-family-sans);
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

.source-info i,
.similarity-score i {
    color: var(--color-text-muted);
}

/* ===== ANSWERS NAVIGATION ===== */
.answers-navigation {
    background: var(--color-bg-alt-section);
    padding: 1.25rem 1.75rem; /* Adjusted padding */
    border-top: 1px solid var(--color-border-primary);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem; /* Reduced gap */
}

.answers-count {
    font-family: var(--font-family-sans);
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    margin: 0;
}

.answers-pagination {
    display: flex;
    gap: 0.375rem; /* Reduced gap */
}

.answer-nav-btn {
    width: 2.5rem;
    height: 2.5rem;
    border: 2px solid var(--color-border-secondary);
    background: var(--color-bg-container);
    border-radius: var(--border-radius-md);
    color: var(--color-text-secondary);
    font-family: var(--font-family-sans);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease-in-out; /* Refined transition */
    display: flex;
    align-items: center;
    justify-content: center;
}

.answer-nav-btn:hover {
    border-color: var(--color-primary-accent-hover);
    color: var(--color-primary-accent-hover);
    background: var(--color-primary-accent-light); /* Subtle bg on hover */
}

.answer-nav-btn.active {
    background: var(--color-primary-accent);
    border-color: var(--color-primary-accent);
    color: var(--color-text-on-dark);
    box-shadow: var(--shadow-sm); /* Add subtle shadow to active button */
}

.answer-nav-btn:focus, .answer-nav-btn:focus-visible {
    outline: none; /* Remove default outline */
    border-color: var(--color-primary-accent);
    box-shadow: 0 0 0 2px var(--color-bg-container), 0 0 0 4px var(--color-primary-accent); /* Custom focus ring */
}

.answer-nav-btn.active:focus, .answer-nav-btn.active:focus-visible {
    box-shadow: 0 0 0 2px var(--color-bg-container), 0 0 0 4px var(--color-primary-accent-hover); /* Darker ring for active focused */
}


/* ===== FOOTER ===== */
.footer {
    background: var(--color-bg-footer);
    color: var(--color-text-on-dark);
    padding: 2rem 0;
    margin-top: auto;
}

.footer-text {
    font-family: var(--font-family-sans);
    font-size: var(--font-size-sm); /* 14px */
    text-align: center;
    opacity: 0.9;
}

/* ===== LOADING STATES ===== */
.fa-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ===== PHOTO SIDEBAR STYLES ===== */

/* Results Layout with Sidebar */
.results-layout {
    display: flex;
    flex-direction: column;
    gap: 2.5rem; /* Standardized gap */
}

@media (min-width: 1024px) {
    .results-layout {
        display: grid;
        grid-template-columns: 1fr 340px; /* Consider minmax for sidebar if needed */
        gap: 2.5rem; /* Standardized gap */
        align-items: start;
    }
}

.results-main {
    min-width: 0; /* Prevent grid blowout */
}

/* Move existing .results-container inside .results-main */
.results-main .results-container {
    /* Your existing styles remain unchanged */
}

/* Photo Sidebar */
.photo-sidebar {
    background: var(--color-bg-container);
    border-radius: var(--border-radius-xl);
    padding: 1.25rem; /* Slightly reduced padding */
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--color-border-primary);
}

@media (min-width: 1024px) {
    .photo-sidebar {
        position: sticky;
        top: 2rem; /* Consider variable for sticky top */
        max-height: calc(100vh - 4rem); /* Consider variable for top offset */
        overflow-y: auto;
        scrollbar-width: thin;
        scrollbar-color: var(--color-border-secondary) transparent;
    }
    
    .photo-sidebar::-webkit-scrollbar {
        width: 6px;
    }
    
    .photo-sidebar::-webkit-scrollbar-track {
        background: transparent;
    }
    
    .photo-sidebar::-webkit-scrollbar-thumb {
        background: var(--color-border-secondary);
        border-radius: 3px;
    }
}

.sidebar-title {
    font-family: var(--font-family-serif);
    font-size: 1.375rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 1.25rem; /* Adjusted margin */
    padding-bottom: 0.625rem; /* Adjusted padding */
    border-bottom: 2px solid var(--color-secondary-accent);
    line-height: var(--line-height-heading);
}

/* Photo Gallery - Mobile Carousel */
.photo-gallery {
    display: flex;
    gap: 0.75rem; /* Reduced gap for tighter packing on mobile */
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.5rem; /* For scrollbar visibility if needed */
}

@media (min-width: 1024px) {
    .photo-gallery {
        flex-direction: column;
        overflow-x: visible;
        scroll-snap-type: none;
        gap: 1rem; /* Slightly larger gap for desktop column */
    }
}

.gallery-photo-item {
    flex: 0 0 250px;
    scroll-snap-align: start;
    background: var(--color-bg-container);
    border: none;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    text-align: left;
}

@media (min-width: 1024px) {
    .gallery-photo-item {
        flex: 1 1 auto;
    }
}

.gallery-photo-item:hover,
.gallery-photo-item:focus {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.gallery-photo-item:focus {
    outline: 2px solid var(--color-primary-accent);
    outline-offset: 2px;
}

/* Photo Container */
.photo-container {
    position: relative;
    width: 100%;
    height: 180px;
    background: var(--color-bg-alt-section);
    overflow: hidden;
}

.gallery-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0; 
    transition: opacity 0.4s ease-in-out; 
}

.gallery-thumbnail.thumbnail-loaded {
    opacity: 1;
}

/* Loading State */
.photo-skeleton {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-bg-alt-section);
    overflow: hidden;
}

.skeleton-shimmer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Error State */
.photo-error {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    font-size: 0.875rem;
    gap: 0.5rem;
}

.photo-error i {
    font-size: 2rem;
    opacity: 0.5;
}

/* Photo Info */
.photo-info {
    padding: 0.875rem; /* Adjusted padding */
}

.photo-caption {
    font-family: var(--font-family-sans);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-text-primary);
    line-height: 1.45;
    margin-bottom: 0.625rem; /* Adjusted margin */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.photo-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.relevance-indicator {
    font-family: var(--font-family-sans);
    font-size: 0.75rem; /* 12px */
    font-weight: 600; /* Semibold for badge-like appearance */
    padding: 0.25rem 0.75rem;
    border-radius: var(--border-radius-full); /* Pill shape */
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    line-height: 1; /* Ensure tight fit */
}

.relevance-indicator i {
    font-size: 0.625rem; /* 10px */
}

.highly-related {
    background: #D1FAE5; /* Tailwind Green 100 */
    color: #065F46; /* Tailwind Green 800 */
}

.related {
    background: var(--color-secondary-accent-light); /* Tailwind Amber 100 */
    color: #B45309; /* Tailwind Amber 700 */
}

.possibly-related {
    background: #F3F4F6; /* Tailwind Gray 100 */
    color: #4B5563; /* Tailwind Gray 600 */
}

/* Photo Indicator in Answer Meta */
.photo-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.95rem;
    color: var(--color-text-muted); /* Was #666 */
}

.photo-indicator i {
    color: var(--color-text-muted);
}

/* Photo Modal */
.photo-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9); /* Standard dark overlay */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background: var(--color-bg-container);
    border-radius: var(--border-radius-xl);
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg); /* Use variable */
}

@media (min-width: 768px) {
    .modal-content {
        max-width: 800px;
        flex-direction: row;
    }
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.7);
    color: var(--color-text-on-dark);
    border: none;
    border-radius: 50%;
    width: 2.5rem;
    height: 2.5rem;
    cursor: pointer;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.modal-close:hover,
.modal-close:focus {
    background: rgba(0, 0, 0, 0.9);
    outline: 2px solid var(--color-text-on-dark);
    outline-offset: 2px;
}

.modal-image-container {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000; /* Keep black for image backdrop */
    flex: 1;
    min-height: 300px;
}

.modal-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

@media (min-width: 768px) {
    .modal-image {
        max-height: 80vh;
    }
}

.modal-info {
    padding: 1.25rem; /* Standardized padding */
    background: var(--color-bg-container);
}

@media (min-width: 768px) {
    .modal-info {
        width: 300px; /* This could be a percentage or flex-basis too */
        overflow-y: auto;
        padding: 1.5rem; /* Slightly more padding on desktop */
    }
}

.modal-caption {
    font-family: var(--font-family-serif);
    font-size: 1.375rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 0.75rem;
    line-height: var(--line-height-heading);
}

.modal-description {
    font-family: var(--font-family-sans);
    font-size: var(--font-size-base);
    font-weight: 400;
    color: var(--color-text-secondary);
    margin-bottom: 0.875rem; /* Slightly adjusted */
    line-height: var(--line-height-base);
}

.modal-date {
    font-family: var(--font-family-sans);
    font-size: var(--font-size-sm);
    font-weight: 400;
    color: var(--color-text-muted);
    margin-bottom: 0.875rem; /* Adjusted */
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    .main-content {
        padding: 2rem 0;
    }
    
    .title-section {
        margin-bottom: 3rem;
    }
    
    .main-title {
        font-size: 2rem;
        margin-bottom: 1.5rem;
    }
    
    .lead-text {
        font-size: 1.1rem;
    }
    
    .body-text {
        font-size: 1rem;
    }
    
    .section-title {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .example-question-btn {
        padding: 0.875rem 1.25rem;
        font-size: 1rem;
    }
    
    .search-input {
        padding: 1rem 1.25rem;
        font-size: 1rem;
    }
    
    .search-btn {
        width: 3rem;
        height: 3rem;
    }
    
    .results-header,
    .answer-container {
        padding: 1.5rem;
    }
    
    .answers-navigation {
        padding: 1rem 1.5rem;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .answer-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    /* Photo Sidebar Mobile */
    .photo-sidebar {
        margin-top: 2rem;
    }
    
    .photo-gallery {
        margin: 0 -1.5rem;
        padding: 0 1.5rem 0.5rem;
    }
    
    .modal-content {
        margin: 1rem;
    }

}

@media (max-width: 480px) {
    .container {
        padding: 0 0.75rem;
    }
    
    .header {
        padding: 1rem 0;
    }
    
    .sun-icon {
        width: 2.5rem;
        height: 2.5rem;
    }
    
    .sun-icon i {
        font-size: 1.25rem;
    }
    
    .logo-main {
        font-size: 1.5rem;
    }
    
    .logo-sub {
        font-size: 0.75rem;
    }
    
    .main-title {
        font-size: 1.75rem;
    }
    
    .example-question-btn {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
        gap: 0.75rem;
    }
    
    .search-input-wrapper {
        border-radius: 40px;
    }
    
    .search-input {
        padding: 0.875rem 1rem;
        font-size: 0.95rem;
    }
    
    .search-btn {
        width: 2.75rem;
        height: 2.75rem;
    }
    
    .results-meta {
        font-size: 1rem;
    }
    
    .answer-text {
        font-size: 1rem;
    }
}

/* ===== FOCUS INDICATORS ===== */
@media (prefers-reduced-motion: no-preference) {
    .example-question-btn,
    .search-btn,
    .answer-nav-btn {
        transition: all 0.3s ease;
    }
    
    .example-question-btn:hover {
        transform: translateY(-2px);
    }
    
    .search-btn:hover:not(:disabled) {
        transform: scale(1.05);
    }
}

@media (prefers-reduced-motion: reduce) {
    .fa-spinner {
        animation: none;
    }
    
    .skeleton-shimmer {
        animation: none;
    }

    * {
        transition: none !important;
        animation: none !important;
    }
}

/* Hide header and footer banners when page is embedded in iframe */
body.in-iframe .header,
body.in-iframe .footer {
    display: none !important;
}

/* ===== SOURCE LIST & POPUP STYLES ===== */
.sources-list {
    margin-top: 1.25rem; /* Adjusted margin */
    padding-top: 1.25rem; /* Adjusted padding */
    border-top: 1px solid var(--color-border-primary);
}

.sources-title {
    font-family: var(--font-family-sans);
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 0.625rem; /* Adjusted margin */
}

.sources-list ul {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem; /* Slightly reduced gap */
}

.source-ref-button {
    background-color: var(--color-primary-accent-light);
    color: var(--color-primary-accent-hover);
    border: 1px solid var(--color-primary-accent);
    padding: 0.375rem 0.625rem; /* Adjusted padding */
    border-radius: var(--border-radius-sm);
    font-family: var(--font-family-sans);
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
    transition: all 0.2s ease-in-out; /* Refined transition */
}

.source-ref-button:hover {
    background-color: var(--color-primary-accent);
    border-color: var(--color-primary-accent-hover);
    color: var(--color-text-on-dark);
    transform: translateY(-1px); /* Subtle lift */
}
.source-ref-button:focus, .source-ref-button:focus-visible {
    background-color: var(--color-primary-accent);
    border-color: var(--color-primary-accent-hover);
    color: var(--color-text-on-dark);
    outline: none;
    box-shadow: 0 0 0 2px var(--color-bg-container), 0 0 0 4px var(--color-primary-accent); /* Custom focus ring */
}


.source-popup {
    position: absolute;
    background-color: var(--color-bg-container);
    border: 1px solid var(--color-border-secondary);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
    padding: 0.875rem; /* Adjusted padding */
    z-index: 100;
    min-width: 250px;
    max-width: 350px;
    font-family: var(--font-family-sans);
    font-size: var(--font-size-sm);
    line-height: 1.5;
}

.source-popup-content {
    display: flex;
    flex-direction: column;
    gap: 0.375rem; /* Adjusted gap */
}

.source-popup-title {
    font-family: var(--font-family-sans);
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0 0 0.25rem; /* Add small bottom margin */
    line-height: var(--line-height-heading);
}

.source-popup-title a {
    color: var(--color-text-link);
    text-decoration: none;
    font-weight: 600;
}

.source-popup-title a:hover {
    text-decoration: underline;
    color: var(--color-text-link-hover);
}

.source-popup-type,
.source-popup-date {
    font-family: var(--font-family-sans);
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    margin: 0 0 0.25rem; /* Add small bottom margin */
}

.source-popup-close {
    background-color: var(--color-border-primary);
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border-secondary);
    padding: 0.375rem 0.75rem;
    border-radius: var(--border-radius-sm);
    font-family: var(--font-family-sans);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-top: 0.75rem; /* Increased margin-top */
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.source-popup-close i {
    font-size: 0.75rem;
    transition: all 0.2s ease-in-out; /* Refined transition */
}

.source-popup-close:hover {
    background-color: var(--color-border-secondary);
    border-color: var(--color-text-muted);
    color: var(--color-text-primary); /* Darken text on hover */
}

.source-popup-close:focus, .source-popup-close:focus-visible {
    outline: none;
    border-color: var(--color-text-muted);
    box-shadow: 0 0 0 2px var(--color-bg-container), 0 0 0 4px var(--color-text-muted); /* Custom focus ring */
}
