body {
    background-color: rgb(191, 162, 100);
    margin: 0;
    font-family: 'Georgia', serif;
    color: #111111;
    line-height: 1.6;
}

/* Main Content Container */
main, section {
    max-width: 950px;
    margin: 3rem auto;
    padding: 0 1.5rem;
}

/* General Header Styling */
.site-header {
    background-color: #111111;
    color: #C5A059;
    text-align: center;
    padding: 2.5rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-bottom: 5px solid #C5A059;
}

/* Edge-to-edge proportional banner bar */
.hero-image-container {
    order: -1;
    margin: -2.5rem -1rem 2rem -1rem; /* Pulls the image edge-to-edge across the header */
    width: calc(100% + 2rem);
    height: 250px; /* Adjust this height to make the banner bar thinner or thicker */
    overflow: hidden;
    position: relative;
    border-bottom: 3px solid #C5A059;
}

.hero-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 30%; /* Crops nicely from the top/bottom while keeping the center focused */
    display: block;
}

/* Header Text Content */
.header-content h1 a {
    color: #C5A059;
    text-decoration: none;
    font-size: 2.8rem;
    letter-spacing: 2px;
}

.header-content p {
    color: #f9f9f9;
    margin-top: 0.5rem;
    font-size: 1.1rem;
}

/* Sticky Navigation Styling */
.site-nav {
    display: flex;
    justify-content: center;
    background: #1c1c1c;
    padding: 0.75rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid #333;
}

.site-nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 0;
    padding: 0;
}

.site-nav a {
    color: #ffffff;
    text-decoration: none;
    font-family: sans-serif;
    font-size: 1.1rem;
    font-weight: bold;
    padding: 0.4rem 0.8rem;
    transition: color 0.2s ease;
}

.site-nav a:hover {
    color: #C5A059;
}

/* Section & Card Styling */
section h2 {
    font-size: 2.2rem;
    border-bottom: 2px solid #111;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
    color: #111;
}

.card {
    background: #ffffff;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.card.accent {
    border-left: 6px solid #111;
}

.card p {
    margin-bottom: 1rem;
}

.card p:last-child {
    margin-bottom: 0;
}

.committee-card {
    background: #ffffff;
    border-radius: 8px;
    padding: 1rem 1.25rem; /* Reduced internal card padding */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
    border-top: 4px solid #111111;
}

.committee-title {
    font-family: 'Georgia', serif;
    font-size: 1.15rem;
    color: #111111;
    margin-top: 0;
    margin-bottom: 0.25rem;
    padding-bottom: 0.25rem;
    border-bottom: 2px solid #111111;
    /* Forces all titles to take up exactly 2 lines so the name lists align horizontally */
    min-height: 2.8em; 
    display: flex;
    align-items: center;
}

.committee-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
}

.committee-item {
    font-size: 0.95rem;
    color: #333333;
    padding: 0.125rem 0;
    /* Very faint, thin line between names */
    border-bottom: 1px solid rgba(0, 0, 0, 0.05); 
}

/* Removes the border on the very last name for a clean card finish */
.committee-item:last-child {
    border-bottom: none;
}

/* Base Multi-Column Grid System */
.grid {
    display: grid;
    gap: 2rem;
    margin-top: 2rem;
    margin-bottom: 2.5rem;
    align-items: stretch;
}

/* Modifier: 2 Columns (for side-by-side content cards) */
.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

/* Modifier: 3 Columns (for 3-photo highlights) */
.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

/* Modifier: 4 Columns (for 4-photo room/furniture galleries) */
.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Specific override for the Saltire & Fr. Morrissey section */
#rector-welcome .grid {
    display: grid;
    grid-template-columns: 220px 1fr 180px;
    gap: 2rem;
    align-items: center;
    justify-items: center;
    text-align: left;
    margin-top: 1.5rem;
}

/* Uniform card/figure formatting inside grids */
.grid figure {
    margin: 0;
    display: flex;
    flex-direction: column;
}

.grid figure img {
    width: 100%;
    height: 180px; /* Adjusted slightly smaller for 4-column harmony */
    object-fit: cover;
    display: block;
}

.grid-3 figure img {
    height: 220px; /* Keeps the 3-column feature images taller and prominent */
}

.grid figure figcaption {
    margin-top: 0.8rem;
    font-size: 0.9rem;
    color: #111111;
    text-align: center;
}

.grid > img {
    width: auto;
    height: 250px;
    object-fit: cover;
    display: block;
    box-sizing: border-box;
}

/* Isolate gallery layout rules so other sections remain untouched */
#gallery .grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
    justify-content: space-between;
}

/* Make gallery images share a uniform height and stretch flush edge-to-edge */
#gallery .grid img {
    height: 250px; /* Adjust this uniform row height as needed */
    flex-grow: 1;
    object-fit: cover;
    display: block;
}

/* Footer Styling */
footer {
    background-color: #111111;
    color: #f9f9f9;
    text-align: center;
    padding: 2.5rem 1rem;
    margin-top: 4rem;
    border-top: 3px solid #C5A059;
}

.footer-title {
    font-family: 'Georgia', serif;
    font-size: 1.2rem;
    font-weight: bold;
    color: #C5A059;
    letter-spacing: 1px;
    margin: 0 0 1rem 0;
}

.footer-links {
    font-family: sans-serif;
    font-size: 0.95rem;
    margin: 0 0 1rem 0;
}

.footer-links a {
    color: #ffffff;
    text-decoration: none;
    font-weight: bold;
}

.footer-links a:hover {
    color: #C5A059;
    text-decoration: underline;
}

.footer-links .divider {
    color: #666666;
    margin: 0 0.75rem;
}

.footer-copy {
    font-family: sans-serif;
    font-size: 0.8rem;
    color: #999999;
    margin: 0;
}

/* Mobile Overrides */
@media screen and (max-width: 768px) {
    /* 1. Global Grids: Fall back to N-1 columns */
    .grid-4 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-2 {
        grid-template-columns: repeat(1, 1fr);
    }

    /* 2. Custom Welcome Section Grid (3 columns -> 2 columns) */
    #rector-welcome .grid {
        grid-template-columns: 1fr 1fr;
    }
    
    /* Make the middle text span across or stack cleanly if needed */
    #rector-welcome .grid p {
        grid-column: span 2;
    }

    /* 3. Gallery Grids: Keep flush height behavior, scale down slightly for mobile screens */
    #gallery .grid img {
        height: 180px; /* Scales down from 250px so they fit nicely side-by-side */
    }

    /* 4. Navigation Links: Make touch targets wrap and space nicely */
    .site-nav ul {
        justify-content: center;
        gap: 0.5rem;
    }
    
    .site-nav a {
        font-size: 0.95rem;
        padding: 0.3rem 0.5rem;
    }
}

/* Extra small devices (Phones under 480px): Drop 3-col down to 1-col for readability */
@media screen and (max-width: 480px) {
    .grid-4,
    .grid-3 {
        grid-template-columns: 1fr;
    }
    
    #rector-welcome .grid {
        grid-template-columns: 1fr;
    }
    
    #rector-welcome .grid p {
        grid-column: span 1;
    }

    #gallery .grid img {
        height: 220px; /* Give single/double wrapped images a bit more presence on tiny screens */
    }
}
