/* Reset and base styles */
:root {
    --color-primary: #3A3A3A; /* Slightly darker for better contrast with text */
    --color-secondary: #F5F5F5; /* Light grey for subtle backgrounds */
    --color-accent: #B08D57; /* Adjusted gold for a richer tone */
    --color-accent-darker: #8c7045; /* Darker accent for hover states */
    --color-text: #333333; /* Darker primary text for readability */
    --color-text-light: #FFFFFF;
    --color-text-muted: #666666; /* For less important text */
    --color-background: #FFFFFF;
    --color-border: #DDDDDD; /* For subtle borders */

    --font-primary: 'Exo', sans-serif;
    --font-heading: 'Libre Baskerville', serif; /* Main heading font */

    --spacing-unit: 1rem; /* Approx 16px */
    --spacing-xs: calc(var(--spacing-unit) * 0.5);  /* 8px */
    --spacing-sm: var(--spacing-unit);             /* 16px */
    --spacing-md: calc(var(--spacing-unit) * 1.5); /* 24px */
    --spacing-lg: calc(var(--spacing-unit) * 2);   /* 32px */
    --spacing-xl: calc(var(--spacing-unit) * 3);   /* 48px */

    --max-width: 1280px; /* Slightly reduced for better content flow on large screens */
    --border-radius: 4px; /* Subtle rounded corners for elements */
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); /* Softer box shadow */
    --transition-speed: 0.3s;
}

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

body {
    font-family: var(--font-primary);
    line-height: 1.7; /* Increased for better readability */
    color: var(--color-text);
    background-color: var(--color-background);
    -webkit-font-smoothing: antialiased; /* Smoother fonts on WebKit */
    -moz-osx-font-smoothing: grayscale; /* Smoother fonts on Firefox */
}

img, video {
    max-width: 100%;
    height: auto;
    display: block;
    object-fit: cover; /* Ensures images cover their containers well */
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--color-primary);
    line-height: 1.3;
    margin-bottom: var(--spacing-md);
}

h1 {
    font-size: 2.8rem; /* Approx 44.8px */
    font-weight: 700; /* Libre Baskerville bold */
}
h2 {
    font-size: 1.25rem; /* Approx 20px, for section subtitles like "ABOUT THE AUTHOR" */
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-accent);
    font-family: var(--font-primary); /* Using Exo for these subtitles for differentiation */
    font-weight: 600; /* Exo semi-bold */
    margin-bottom: var(--spacing-xs);
}
h3 { /* For main section titles like "Martin Wickramasinghe: A Literary Odyssey" */
    font-size: 2.2rem; /* Approx 35.2px */
    font-weight: 400; /* Libre Baskerville regular */
    color: var(--color-primary);
    margin-bottom: var(--spacing-md);
}


/* Base paragraph style */
p {
    font-size: 1rem; /* Approx 16px */
    line-height: 1.7;
    margin-bottom: var(--spacing-md);
    color: var(--color-text-muted);
}
.hero-content p.hero-subtitle { /* Specific styling for hero subtitle */
    font-family: var(--font-primary);
    font-size: 1.3rem; /* Approx 20.8px */
    font-weight: 300; /* Exo light */
    color: var(--color-text-light);
    opacity: 0.9;
    margin-top: var(--spacing-sm);
    display: block; /* Ensure it's a block element */
    clear: both; /* Clear any floating elements */
}

/* Links */
a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color var(--transition-speed) ease;
}
a:hover, a:focus {
    color: var(--color-accent-darker);
    text-decoration: underline;
}

/* Page Layout */
.page-wrapper {
    width: 100%;
    max-width: 100%; /* Allow full width for header/footer backgrounds */
    margin: 0 auto;
    position: relative;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

.container { /* For content that needs to be constrained */
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-lg); /* Default horizontal padding */
}


/* Header */
.main-header {
    background-color: var(--color-primary);
    padding: 0; /* Padding is handled by header-content */
    width: 100%;
    height: 122px; /* Desktop header height */
    overflow: visible;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky; /* Make header sticky */
    top: 0;
    z-index: 1000;
}

.header-content {
    max-width: var(--max-width);
    height: 100%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: relative;
}

.logo { /* Container for the logo image */
    display: flex;
    align-items: center;
    height: 100%;
    flex-shrink: 0; /* Prevent logo container from shrinking */
    margin-right: 20px; /* Minimum right margin at all resolutions */
}

.logo img { /* Desktop logo image style */
    height: 120px;
    width: auto;
    max-width: 240px;
    display: block;
    margin-top: 0;
}

/* Navigation */
.nav-menu {
    display: flex;
    gap: var(--spacing-sm); /* Spacing between nav items */
    height: 100%;
    align-items: center;
    flex-wrap: nowrap;
    justify-content: flex-end; /* Align nav to the right */
}

.nav-item {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--color-text-light);
    font-family: var(--font-primary);
    font-size: 0.9rem; /* Approx 14.4px */
    padding: var(--spacing-xs) var(--spacing-sm);
    white-space: nowrap;
    transition: color var(--transition-speed) ease, background-color var(--transition-speed) ease;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-radius: var(--border-radius);
}

.nav-item:hover,
.nav-item.active,
.nav-item:focus {
    color: var(--color-accent);
    background-color: rgba(255,255,255,0.1); /* Subtle background on hover/active */
}

.nav-dropdown {
    position: relative;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px; /* Wider dropdown */
    background-color: var(--color-primary);
    z-index: 1001; /* Ensure dropdown is above other content */
    list-style: none;
    padding: var(--spacing-xs) 0 0 0; /* Removed bottom padding */
    margin: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: none; /* Remove top border as it connects to nav item */
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    box-shadow: var(--box-shadow);
}

.nav-dropdown:hover .dropdown-menu,
.nav-dropdown .nav-item[aria-expanded="true"] + .dropdown-menu { /* Show on hover or when expanded for accessibility */
    display: block;
}

.dropdown-menu li {
    list-style: none;
}

.dropdown-menu a {
    display: block;
    padding: var(--spacing-sm) var(--spacing-md);
    color: var(--color-text-light);
    text-decoration: none;
    font-family: var(--font-primary);
    font-size: 0.85rem; /* Slightly smaller font for dropdown items */
    white-space: nowrap;
    transition: color var(--transition-speed) ease, background-color var(--transition-speed) ease;
    text-transform: none; /* Normal case for dropdown items */
    background-color: rgba(0,0,0,0.1); /* Dark background like mobile */
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.dropdown-menu a:hover,
.dropdown-menu a:focus {
    color: var(--color-accent);
    background-color: rgba(0,0,0,0.2); /* Slightly darker background on hover like mobile */
    text-decoration: none;
}

.dropdown-menu li:last-child a {
    border-bottom: none; /* Remove border from last item like mobile */
}

/* Video Container */
.video-container {
    position: relative;
    height: 75vh; /* Responsive height */
    min-height: 400px;
    max-height: 650px;
    /* margin-top: -1px; /* Removed, as sticky header handles overlap */
    overflow: hidden;
    background-color: #000; /* Fallback background for video */
}

.video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

.hero-content {
    position: absolute;
    bottom: 5%;
    left: 5%;
    transform: none;
    text-align: left;
    color: var(--color-text-light);
    text-shadow: 0 2px 8px rgba(0,0,0,0.5); /* Enhanced text shadow */
    width: 90%;
    max-width: 800px; /* Max width for hero text */
    padding: 0 var(--spacing-md);
}

.hero-content h1 {
    font-family: var(--font-heading);
    font-size: 2.6rem; /* Reduced from 3rem for a slightly smaller size */
    line-height: 1.2;
    margin-bottom: var(--spacing-sm);
    font-weight: normal; /* Changed from bold (700) to normal */
    color: var(--color-text-light); /* Ensure H1 color is light here */
}


/* Hero Quote */
.hero-quote {
    background-color: var(--color-primary);
    padding: var(--spacing-lg) 0;
    text-align: center;
}

.quote-content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
    color: var(--color-text-light);
}
.quote-content p { /* Style the paragraph within quote-content */
    font-family: var(--font-primary);
    font-size: 1.3rem; /* Approx 20.8px */
    line-height: 1.5;
    opacity: 0.9;
    margin-bottom: 0; /* Remove bottom margin if it's a single line */
    color: var(--color-text-light); /* Ensure text is light */
}

/* Main Content Area */
.main-content {
    padding: var(--spacing-xl) 0; /* Add padding around the main content block */
}

/* Content Sections (About, Museum, Trust) */
.content-section {
    display: flex;
    align-items: center; /* Vertically align items */
    min-height: auto; /* Let content define height */
    padding: var(--spacing-xl) var(--spacing-lg); /* Consistent padding */
    gap: var(--spacing-xl); /* Gap between image and text */
    max-width: var(--max-width);
    margin: 0 auto var(--spacing-xl) auto; /* Center sections and add bottom margin */
}

.content-section:nth-child(odd) {
    background-color: var(--color-background);
}
.content-section:nth-child(even) {
    flex-direction: row-reverse; /* Alternate layout */
    background-color: var(--color-secondary); /* Subtle background for even sections */
}

/* Override nth-child rules for trust section to ensure it keeps its styling */
.trust-section {
    background-color: var(--color-primary) !important; /* Force dark background */
}
.content-section:last-of-type {
    margin-bottom: 0; /* Remove bottom margin from the last section before news/footer */
}


.content-section .section-image {
    flex: 1 1 45%; /* Flex properties for image container */
    max-width: 45%;
}
.content-section .section-image img {
    width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.content-section .section-content {
    flex: 1 1 55%; /* Flex properties for text content */
    max-width: 55%;
    padding: 0; /* Remove redundant padding here, handled by section */
}

/* Specific section styles */
.trust-section {
    background-color: var(--color-primary); /* Keep original dark background for Trust */
}
.trust-section .section-content h2,
.trust-section .section-content h3 {
    color: var(--color-text-light); /* Light text for headings on dark bg */
}
.trust-section .section-content p {
    color: rgba(255,255,255,0.8); /* Light text for paragraphs on dark bg */
}
.trust-section .section-content .cta-button {
    background-color: var(--color-accent);
    color: var(--color-text-light);
}
.trust-section .section-content .cta-button:hover {
    background-color: var(--color-accent-darker);
}


/* Blockquote style */
.content-section blockquote {
    font-family: var(--font-primary);
    font-size: 1.1rem; /* Approx 17.6px */
    line-height: 1.8;
    color: var(--color-text-muted);
    margin: var(--spacing-lg) 0;
    font-style: italic;
    position: relative;
    padding-left: var(--spacing-lg);
    border-left: 3px solid var(--color-accent);
}

.content-section blockquote footer {
    font-size: 0.9rem; /* Approx 14.4px */
    color: var(--color-accent);
    margin-top: var(--spacing-sm);
    font-style: normal;
    font-family: var(--font-primary); /* Consistent font */
    font-weight: 600;
    display: block; /* Ensure footer is on its own line */
}
.content-section blockquote footer::before {
    content: "— "; /* Em dash for attribution */
}

/* Call to Action Button (replaces .more-link) */
.cta-button {
    display: inline-block;
    background-color: var(--color-accent);
    color: var(--color-text-light);
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--border-radius);
    text-decoration: none;
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: background-color var(--transition-speed) ease, transform var(--transition-speed) ease;
    margin-top: var(--spacing-md);
    border: none; /* Ensure no default border */
    cursor: pointer;
}
.cta-button:hover,
.cta-button:focus {
    background-color: var(--color-accent-darker);
    color: var(--color-text-light); /* Keep text color consistent */
    text-decoration: none; /* Remove underline on hover for buttons */
    transform: translateY(-2px); /* Subtle lift effect */
}


/* Latest News Section */
.latest-news {
    padding: var(--spacing-xl) 0;
    background-color: var(--color-secondary); /* Light background for news section */
}

.news-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end; /* Align items to bottom for better title/button alignment */
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md); /* Space below header before grid */
    border-bottom: 1px solid var(--color-border); /* Subtle separator */
}

.title-section .subtitle {
    color: var(--color-accent);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
    display: block;
}

.news-header h2 { /* This is the "Latest News & Articles" */
    font-size: 2.5rem; /* Larger heading for the section */
    line-height: 1.2;
    color: var(--color-primary);
    margin: 0; /* Reset margin as it's part of title-section */
    font-family: var(--font-heading);
    font-weight: 400; /* Regular weight for Libre Baskerville */
}

.view-all-button { /* Replaces .view-all */
    background-color: var(--color-primary);
    color: var(--color-text-light);
    text-decoration: none;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--border-radius);
    transition: background-color var(--transition-speed) ease, transform var(--transition-speed) ease;
    white-space: nowrap; /* Prevent button text from wrapping */
}
.view-all-button:hover,
.view-all-button:focus {
    background-color: var(--color-accent); /* Change to accent on hover */
    color: var(--color-text-light);
    text-decoration: none;
    transform: translateY(-2px);
}

.news-grid {
    display: grid; /* Using Grid for more robust layout */
    grid-template-columns: 2fr 1fr; /* Main article takes 2/3, side articles 1/3 */
    gap: var(--spacing-lg);
    align-items: stretch; /* Make columns equal height */
}

.news-item {
    background-color: var(--color-background);
    border-radius: var(--border-radius);
    overflow: hidden; /* To contain image hover effect and ensure rounded corners are applied */
    box-shadow: var(--box-shadow);
    transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

/* Override for main news item only */
.main-news-item {
    background-color: var(--color-background);
    box-shadow: var(--box-shadow);
    border-radius: var(--border-radius);
    padding: 0;
    display: block; /* Change to block to avoid flex stretching */
}

.main-news-item .news-item-link {
    display: block; /* Change to block to avoid flex stretching */
}

.main-news-item img {
    border-radius: var(--border-radius); /* Apply border radius directly to the image */
}
.news-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.12);
}

/* Custom hover for main news item */
.main-news-item:hover {
    box-shadow: none;
    transform: translateY(-3px);
}

.news-item-image { /* For main news item image */
    width: 100%;
    height: 400px; /* Fixed height for desktop */
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
    border-radius: var(--border-radius) var(--border-radius) 0 0; /* Round only top corners */
}
.news-item:hover .news-item-image {
    transform: scale(1.05); /* Subtle zoom on image hover */
}

.news-item-link { /* Link wrapping the main news item */
    display: block;
    text-decoration: none;
    color: inherit;
    position: relative; /* For overlay */
}

.news-content-below { /* For main news item text below image */
    padding: var(--spacing-md);
    display: block; /* Simple block layout */
    height: auto; /* Auto height based on content */
}

.news-content-below .news-meta {
    color: var(--color-text-muted); /* Darker color for meta text on light background */
    margin-bottom: var(--spacing-xs);
}

.news-meta {
    display: flex;
    gap: var(--spacing-sm);
    font-size: 0.8rem;
    color: rgba(255,255,255,0.8); /* Lighter meta text on overlay */
    margin-bottom: var(--spacing-xs);
    text-transform: uppercase;
}
.news-meta .date, .news-meta .comments {
    font-weight: 500;
}

.news-title-main { /* For main news item title */
    margin: 0;
    font-size: 1.5rem;
    line-height: 1.3;
    color: var(--color-primary); /* Match color scheme of secondary news items */
    font-family: var(--font-heading);
    font-weight: 700; /* Bold for title */
}

.right-news-items {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    height: 100%; /* Make the right column take full height */
    justify-content: space-between; /* Distribute items evenly */
}

.news-item-link-small { /* Link wrapping smaller news items */
    display: flex; /* For side-by-side image and text */
    gap: var(--spacing-md);
    text-decoration: none;
    color: inherit;
    padding: var(--spacing-md); /* Padding inside the card for small items */
    height: 100%; /* Take full height */
    position: relative; /* For potential overlay effects */
}
.news-item.right-news-items .news-item-link-small { /* Remove outer padding from card, add to link */
    padding: 0;
}
.right-news-items .news-item { /* Adjust padding for cards in right column */
    padding: 0;
    background-color: var(--color-background);
}


.image-container-small {
    flex-shrink: 0;
    width: 120px; /* Fixed width for small images */
    height: 90px; /* Fixed height for small images */
    overflow: hidden;
    border-radius: var(--border-radius);
}
.news-item-image-small {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.news-item:hover .news-item-image-small {
    transform: scale(1.05);
}

.content-small {
    display: flex;
    flex-direction: column;
    justify-content: center; /* Center content vertically if needed */
}
.content-small .news-meta {
    color: var(--color-text-muted); /* Darker meta text for items on light bg */
    font-size: 0.75rem;
}
.news-title-small {
    margin: 0;
    font-size: 1rem;
    line-height: 1.4;
    color: var(--color-primary);
    font-family: var(--font-heading);
    font-weight: 700;
}


/* Footer */
.site-footer {
    background-color: var(--color-primary);
    color: rgba(255,255,255,0.7); /* Base light text for footer */
    padding: var(--spacing-xl) 0 0;
    font-size: 0.9rem;
}

@media screen and (max-width: 960px) {
    .site-footer {
        padding: 20px 0 0; /* Reduced top padding in mobile */
    }

    /* Drastically reduce space between logo and intro text */
    .footer-logo {
        margin-bottom: 5px;
    }
    
    .footer-brand p {
        margin-bottom: 0;
        line-height: 1.4;
    }
}

.footer-content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
    display: flex;
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    gap: var(--spacing-xl); /* Gap between footer sections */
    justify-content: space-between;
}

.footer-brand {
    flex: 1 1 260px; /* Fine-tuned basis value for optimal layout */
    margin-bottom: var(--spacing-lg); /* Space below brand on wrap */
}

.footer-logo {
    width: 180px; /* Desktop size for footer logo */
    margin-bottom: var(--spacing-xs);
    /* Add filter for white version of logo if needed: filter: brightness(0) invert(1); */
}

.footer-brand p {
    color: rgba(255,255,255,0.7);
    line-height: 1.6;
    font-size: 0.85rem; /* Slightly smaller text in footer brand */
    margin-bottom: 0;
}

.footer-links-container { /* Wrapper for link sections */
    flex: 2 1 600px; /* Allow link sections to take more space */
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); /* Responsive columns for links */
    gap: var(--spacing-lg);
}

.footer-section h4 {
    color: var(--color-accent);
    margin-bottom: var(--spacing-md);
    font-size: 1.1rem; /* Slightly larger footer headings */
    font-family: var(--font-primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

@media screen and (max-width: 960px) {
    .footer-section:first-child h4 {
        margin-top: 0; /* Remove top margin from first heading */
    }
}

.footer-section nav {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.footer-section a,
.footer-section address a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: color var(--transition-speed) ease;
    font-size: 0.85rem;
}
.footer-section a:hover,
.footer-section address a:hover {
    color: var(--color-accent);
    text-decoration: underline;
}

.footer-section address {
    font-style: normal;
    line-height: 1.7;
}
.footer-section address br {
    margin-bottom: var(--spacing-xs); /* Space after line breaks in address */
}


.footer-bottom {
    margin-top: var(--spacing-xl);
    padding: var(--spacing-md) 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-bottom-content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    font-size: 0.8rem;
    color: rgba(255,255,255,0.6);
    height: 30px; /* Fixed height for consistent alignment */
}

.footer-bottom-content p {
    margin: 0;
    padding: 0;
}

.footer-legal {
    margin: 0;
    padding: 0;
}

.footer-legal {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
}

.footer-legal a {
    color: rgba(255,255,255,0.6);
    text-decoration: none;
}
.footer-legal a:hover {
    color: var(--color-accent);
    text-decoration: underline;
}
.footer-legal span { /* Separator */
    opacity: 0.5;
}

.footer-section nav a {
    display: block;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    padding: 5px 0;
    transition: color 0.3s ease;
}

.footer-section nav a:hover {
    color: var(--color-accent);
}

/* Social Media Links */
.social-links {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
}

.social-link:hover {
    background-color: rgba(176, 141, 87, 0.3); /* Semi-transparent gold */
    border: 1px solid var(--color-accent);
    color: white;
    transform: translateY(-3px);
}

/* Center social links in mobile view */
@media screen and (max-width: 960px) {
    .social-links {
        justify-content: center;
        margin-top: 5px;
        margin-bottom: 10px;
    }
}

/* --- Responsive Styles --- */

/* Tablets - Header specific styles */
@media screen and (max-width: 960px) {
    .main-header {
        height: 80px;
        padding: 0;
    }
    .logo {
        margin-right: 20px; /* Add right margin to prevent menu from getting too close */
    }
    .logo img {
        height: 70px; /* Changed from 80px as requested */
        width: auto;
        margin-top: 0; /* Changed from 8px as requested */
    }
    /* Override with !important for specific logo */
    img[alt="Martin Wickramasinghe Trust Logo"] {
        height: 70px !important; /* Match the regular logo height */
        width: auto !important;
        margin-top: 0 !important; /* No top margin as requested */
    }
    
    /* Footer adjustments for tablet mode */
    .footer-brand {
        margin-bottom: 0; /* Remove bottom margin in tablet view */
    }
}

/* Large Tablets and Small Desktops */
@media screen and (max-width: 1024px) {
    h1 { font-size: 2.5rem; }
    h3 { font-size: 2rem; }
    .hero-content h1 { font-size: 2.5rem; }
    .hero-quote .quote-content p { font-size: 1.15rem; }

    .content-section {
        gap: var(--spacing-lg);
        padding: var(--spacing-lg);
    }
    .content-section .section-image,
    .content-section .section-content {
        max-width: 100%; /* Allow them to stack */
    }
    
    /* Keep the desktop layout intact at this breakpoint */
    .news-grid {
        grid-template-columns: 2fr 1fr; /* Maintain desktop grid layout */
    }
}


/* Tablets */
@media screen and (max-width: 960px) {
    body { font-size: 15px; /* Adjust base font size for tablets */ }
    h1 { font-size: 2.2rem; }
    h3 { font-size: 1.8rem; }
    .hero-content h1 { font-size: 2rem; }
    .hero-quote .quote-content p { font-size: 1rem; }

    .container { padding: 0 var(--spacing-md); }
    
    /* Header responsive styles */
    .main-header {
        height: 65px; /* Mobile header height */
    }
    .header-content {
        padding: 0 15px; /* Horizontal padding for mobile */
    }
    .logo {
        margin-right: auto; /* Push toggle to the far right */
    }
    .logo img {
        height: 60px;
        width: auto;
        margin-top: 0px; /* No top margin */
        display: block;
    }
    .mobile-menu-toggle {
        align-self: center;
    }
    /* Override with !important for specific logo */
    img[alt="Martin Wickramasinghe Trust Logo"] {
        height: 60px !important;
        width: auto !important;
        margin-top: 0px !important;
    }

    .video-container { height: 60vh; min-height: 350px; }

    .content-section {
        flex-direction: column !important; /* Force column layout for all sections */
        padding: var(--spacing-lg) var(--spacing-md);
    }
    .content-section:nth-child(even) .section-image {
        order: -1; /* Ensure image is on top for even sections when stacked */
    }
    .content-section .section-image,
    .content-section .section-content {
        max-width: 100%;
        width: 100%; /* Ensure full width when stacked */
    }
    .content-section .section-image { margin-bottom: var(--spacing-lg); }


    .news-header {
        flex-direction: column;
        align-items: flex-start; /* Align title and button to start */
        gap: var(--spacing-md);
    }
    .news-header h2 { font-size: 2rem; }
    
    /* Reset custom footer alignment for mobile */
    .footer-bottom-content { height: auto; }
    .footer-bottom-content p { padding: 0; }
    
    /* News grid becomes a single column */
    .news-grid {
        grid-template-columns: 1fr; /* Full width for all news items */
        gap: var(--spacing-md);
    }
    
    /* Make main news item image responsive */
    .main-news-item .news-item-image {
        height: 300px; /* Adjusted height for tablets */
    }
    
    .right-news-items {
        gap: var(--spacing-md); /* Tighter spacing between items on mobile */
    }
    
    /* Keep the small news items with side-by-side layout on tablet */
    .news-item-link-small {
        display: flex;
        flex-direction: row;
    }
    
    /* Keep proper image size for small news items */
    .image-container-small {
        width: 120px;
        min-width: 120px;
        height: 90px;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 0;
        position: relative;
    }
    
    .footer-brand { 
        text-align: center;
        padding-bottom: 0;
        margin-bottom: 0; /* No bottom margin */
    }
    
    .footer-brand p {
        margin-bottom: 0;
        margin-top: 5px; /* Small consistent spacing after logo */
        font-size: 0.9rem;
        padding: 0 10px; /* Add some horizontal padding for text */
    }
    
    .footer-logo { 
        margin-left: auto; 
        margin-right: auto;
        width: 120px; /* Mobile size for footer logo */
    }
    
    .footer-links-container {
        grid-template-columns: 1fr; /* Stack footer link sections */
        text-align: center;
        margin-top: 0;
        padding-top: 0;
        border-top: none;
    }
    
    .footer-section nav { 
        align-items: center; 
    }
    
    .footer-section:first-child { 
        margin-top: 0;
    }
    
    /* QUICK LINKS title styling */
    .footer-section h4 {
        margin-bottom: 8px;
        margin-top: 0; /* Reset margin */
        color: #B08D57;
        font-weight: bold;
        font-size: 1rem; /* Consistent text size */
    }
    
    /* Create uniform compact spacing in mobile footer */
    @media (max-width: 767px) {
        .footer-links-container {
            margin-top: 5px; /* Minimal space after paragraph */
        }
        
        .site-footer {
            padding-top: 15px; /* Further reduced padding */
            padding-bottom: 10px;
        }
        
        /* Compact spacing between sections */
        .footer-section + .footer-section {
            margin-top: 5px; /* Minimal uniform spacing */
        }
        
        /* Tighter link spacing */
        .footer-section nav a {
            padding: 2px 0;
            font-size: 0.9rem; /* Consistent with paragraph text */
        }
        
        /* Reduce space between heading and links */
        .footer-section h4 {
            margin-bottom: 5px;
            margin-top: 5px;
        }
    }
    .footer-bottom-content {
        flex-direction: column;
        text-align: center;
        gap: var(--spacing-sm);
    }
}

/* Very small screens */
@media screen and (max-width: 320px) {
    .main-news-item .news-item-image {
        height: 180px;
    }
}

/* Mobile Phones */
@media screen and (max-width: 480px) {
    /* Set a specific height for mobile phones */
    .main-news-item .news-item-image {
        height: 220px;
    }
    
    body { font-size: 14px; }
    h1 { font-size: 1.8rem; }
    h2 { font-size: 1rem; } /* Section subtitles */
    h3 { font-size: 1.5rem; } /* Section titles */

    .hero-content h1 { font-size: 1.6rem; padding: 0; }
    .hero-content p.hero-subtitle { font-size: 1rem; display: block; margin-top: var(--spacing-xs); }
    .hero-quote { padding: var(--spacing-md); }
    .hero-quote .quote-content p { font-size: 0.9rem; }

    .container { padding: 0 var(--spacing-sm); }
    .content-section { padding: var(--spacing-md); }
    .content-section blockquote { padding-left: var(--spacing-md); font-size: 1rem;}
    
    /* Stack the image and text for smaller screens */
    .news-item-link-small {
        flex-direction: column;
    }
    
    /* Make images full width on mobile */
    .image-container-small {
        width: 100%;
        height: 140px;
        margin-bottom: var(--spacing-sm);
    }

    .cta-button, .view-all-button {
        font-size: 0.8rem;
        padding: var(--spacing-sm) var(--spacing-md);
    }

    .news-header h2 { font-size: 1.6rem; }
    .news-title-main { font-size: 1.2rem; }
    .news-title-small { font-size: 0.9rem; }
    .news-meta { font-size: 0.7rem; }
    .image-container-small { height: 150px; }
    


    .footer-logo { width: 140px; }
    .footer-section h4 { 
        font-size: 1rem;
        margin-bottom: var(--spacing-xs); /* Reduced bottom margin in mobile view */
        margin-top: 5px; /* Small top margin in mobile view */
    }
    .footer-section a, .footer-section address, .footer-brand p { font-size: 0.8rem; }
    .footer-bottom-content { font-size: 0.75rem; }
}


/* Accessibility: Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(171, 139, 60, 0.3); /* Similar to blockquote border */
}
.nav-item:focus-visible, .dropdown-menu a:focus-visible {
    color: var(--color-accent);
    background-color: rgba(255,255,255,0.15);
}
.cta-button:focus-visible, .view-all-button:focus-visible {
    background-color: var(--color-accent-darker);
}

/* ======= BOOKS PAGE STYLES ======= */

/* Styles for Books Hero Section - Aligned with index.html visual language */
.museum-hero-adapted {
    position: relative;
    width: 100%;
    height: 450px; /* Increased height for more impact */
    display: flex;
    align-items: flex-end;
    background: url('../images/books/Books-hero.jpg');
    background-size: cover;
    background-position: center 30%; /* Adjusted to better frame the books */
    color: var(--color-text-light);
    transition: all 0.5s ease;
    overflow: hidden;
}

.museum-hero-adapted::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70%;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.6) 40%, rgba(0,0,0,0.2) 80%, rgba(0,0,0,0) 100%);
    pointer-events: none;
}

.museum-hero-adapted .hero-title-adapted {
    width: 100%;
    padding: var(--spacing-lg) var(--spacing-xl);
    position: relative;
    z-index: 2;
    color: var(--color-text-light);
    animation: fadeInUp 0.8s ease-out forwards;
}

.museum-hero-adapted .hero-title-adapted h1 {
    font-size: 2.2rem;
    font-weight: 500; /* Slightly bolder for more impact */
    margin: 0;
    letter-spacing: 0.03em;
    font-family: var(--font-heading);
    line-height: 1.2;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5); /* Text shadow for better readability */
    position: relative;
    padding-bottom: 10px; /* Space for decorative element */
    color: #ffffff; /* Pure white for maximum contrast */
}

.museum-hero-adapted .hero-title-adapted h1::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 80px;
    height: 3px;
    background-color: var(--color-accent); /* Gold accent line */
    transition: width 0.5s ease;

}

.museum-hero-adapted .hero-title-adapted p {
    font-size: 1.2rem;
    font-weight: 400; /* Slightly bolder for better readability */
    margin-top: var(--spacing-md);
    line-height: 1.6;
    font-family: var(--font-primary);
    max-width: 80%; /* Limit width for better readability */
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5); /* Enhanced text shadow */
    animation: fadeInUp 1s ease-out 0.3s forwards;
    transform: translateY(10px);
    opacity: 0;
    color: #f0f0f0; /* Very light gray for subtitle */
    letter-spacing: 0.01em; /* Slight letter spacing for elegance */
}

/* Animation keyframes for hero elements */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive hero adjustments */
@media (max-width: 1024px) {
    .museum-hero-adapted .hero-title-adapted h1 { 
        font-size: 1.9rem; 
    }
    .museum-hero-adapted .hero-title-adapted h1::after {
        width: 60px;
    }
}

@media (max-width: 960px) {
    .museum-hero-adapted { height: 350px; }
    .museum-hero-adapted .hero-title-adapted { 
        padding: var(--spacing-md) var(--spacing-lg);
    }
    .museum-hero-adapted .hero-title-adapted h1 { 
        font-size: 1.6rem; 
        padding-bottom: 8px;
    }
    .museum-hero-adapted .hero-title-adapted h1::after {
        width: 50px;
        height: 2px;
    }
    .museum-hero-adapted .hero-title-adapted p { 
        font-size: 1.1rem; 
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .museum-hero-adapted { height: 300px; }
    .museum-hero-adapted .hero-title-adapted { 
        padding: var(--spacing-md);
    }
    .museum-hero-adapted .hero-title-adapted h1 { 
        font-size: 1.6rem; 
        padding-bottom: 6px;
    }
    .museum-hero-adapted .hero-title-adapted h1::after {
        width: 40px;
        height: 2px;
    }
    .museum-hero-adapted .hero-title-adapted p { 
        font-size: 1rem; 
        margin-top: var(--spacing-sm);
    }
}

/* Books Navigation Section */
.books-nav-section {
    padding: var(--spacing-md) 0;
    background-color: var(--color-secondary);
    border-bottom: 1px solid var(--color-border);
}

.category-nav-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--spacing-xs);
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

/* Styles for category buttons - matched to index.html's CTA button style */
.category-nav-container .category-button {
    display: inline-block;
    padding: var(--spacing-sm) var(--spacing-md);
    margin: var(--spacing-xs);
    cursor: pointer;
    background-color: var(--color-background);
    color: var(--color-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease, transform var(--transition-speed) ease;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: var(--font-primary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.category-nav-container .category-button.active {
    background-color: var(--color-accent);
    color: var(--color-text-light);
    font-weight: 600;
    border-color: var(--color-accent);
}

.category-nav-container .category-button:hover:not(.active) {
    background-color: var(--color-secondary);
    transform: translateY(-2px);
}

/* Main content styling aligned with index.html */
.main-content {
    padding: var(--spacing-xl) 0;
    background-color: var(--color-background);
}

.books-grid-section {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

.no-books-message {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--color-text-muted);
    font-family: var(--font-primary);
    font-size: 1.1rem;
}

.no-books-message.hidden {
    display: none;
}

/* Updated Book Grid Styles - Using index.html's card styling approach */
.books-grid {
    display: grid;
    gap: var(--spacing-lg);
    margin-top: var(--spacing-lg);
    grid-template-columns: repeat(4, 1fr); /* Desktop: 4 columns */
}

.book-card {
    background-color: var(--color-background);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.12);
}

.book-image-container {
    position: relative;
    width: 100%;
    padding-top: 150%; /* 3:2 aspect ratio for book covers */
    overflow: hidden;
}

.book-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.book-card:hover .book-image {
    transform: scale(1.05);
}

.book-content {
    padding: var(--spacing-md);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.book-title {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    line-height: 1.3;
    margin-bottom: var(--spacing-xs);
    color: var(--color-primary);
    font-weight: 700;
}

.book-author {
    font-family: var(--font-primary);
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-xs);
}

.book-category {
    font-family: var(--font-primary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-accent);
    margin-top: auto;
    padding-top: var(--spacing-sm);
}

/* Modal styling aligned with index.html's design language */
.book-modal {
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
}

.modal-content {
    background-color: var(--color-background);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    margin: 0;
    color: var(--color-primary);
    font-weight: 700;
}

.close-modal {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0 var(--spacing-xs);
    line-height: 1;
    transition: color var(--transition-speed) ease;
}

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

.modal-body {
    display: flex;
    padding: var(--spacing-lg);
    gap: var(--spacing-lg);
    overflow-y: auto;
}

.modal-cover {
    flex: 0 0 250px;
}

.modal-cover img {
    width: 100%;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.synopsis-content {
    flex: 1;
    padding-right: var(--spacing-sm);
    max-height: 60vh;
    overflow-y: auto;
}

.synopsis-content h3 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    color: var(--color-primary);
    margin-top: 0;
    margin-bottom: var(--spacing-sm);
}

.synopsis-content p {
    font-family: var(--font-primary);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-md);
}

.book-meta {
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--color-border);
}

.meta-item {
    display: flex;
    margin-bottom: var(--spacing-xs);
}

.meta-label {
    font-weight: 600;
    min-width: 120px;
    color: var(--color-primary);
}

/* Modal animation effects */
.modal-fade-enter { opacity: 0; transform: scale(0.95); }
.modal-fade-enter-active { opacity: 1; transform: scale(1); transition: opacity 300ms, transform 300ms; }
.modal-fade-leave { opacity: 1; transform: scale(1); }
.modal-fade-leave-active { opacity: 0; transform: scale(0.95); transition: opacity 300ms, transform 300ms; }

/* Scrollbar styling for modal content */
.synopsis-content::-webkit-scrollbar { width: 8px; }
.synopsis-content::-webkit-scrollbar-track { background: var(--color-secondary); border-radius: var(--border-radius); }
.synopsis-content::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: var(--border-radius); }
.synopsis-content::-webkit-scrollbar-thumb:hover { background: var(--color-text-muted); }

/* Responsive adjustments for book grid */
@media (max-width: 1200px) {
    .books-grid {
        grid-template-columns: repeat(3, 1fr); /* Tablet: 3 columns */
    }
    
    .modal-body {
        flex-direction: column;
    }
    
    .modal-cover {
        flex: 0 0 auto;
        max-width: 200px;
        margin: 0 auto;
    }
}

@media (max-width: 960px) {
    .books-grid {
        grid-template-columns: repeat(2, 1fr); /* Mobile: 2 columns */
        gap: var(--spacing-md);
    }
    
    .modal-content {
        max-height: 95vh;
    }
    
    .modal-header h2 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .books-grid {
        grid-template-columns: repeat(1, 1fr); /* Small Mobile: 1 column */
        gap: var(--spacing-md);
    }
    
    .modal-header {
        padding: var(--spacing-sm);
    }
    
    .modal-body {
        padding: var(--spacing-md);
        gap: var(--spacing-md);
    }
    
    .modal-header h2 {
        font-size: 1.3rem;
    }
}
