/* Dark sepia-inspired theme for Walter Steding tribute site */

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background-color: #1a0f0a; /* Deep, dark brown-black base */
    color: #f0e6d2; /* Creamy off-white text for warm contrast */
    line-height: 1.6;
}

.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: #2a1a10; /* Warmer, darker nav bg */
    padding: 10px 0;
    box-sizing: border-box;
    border-bottom: 1px solid #4a2a10; /* Subtle dark border */
    z-index: 100;
    display: flex;
    justify-content: center;
    flex-wrap: wrap; /* Allows wrapping on small screens */
    align-items: center; /* Vertically centers items */
}

.top-nav h2 {
    display: none; /* Hide "Gallery Menu" title on top nav */
}

.top-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex; /* Flexbox for horizontal layout */
    flex-direction: row; /* Explicitly horizontal */
    flex-wrap: wrap; /* Wrap to new row if needed */
    justify-content: center;
    align-items: center;
    gap: 0; /* No gaps between items */
    width: 100%; /* Full width for centering */
}

.top-nav li {
    margin: 0;
    flex: 1 1 auto; /* Grow/shrink as needed */
    min-width: 0; /* Allows shrinking below content size */
}

.top-nav a {
    display: block;
    padding: 8px 12px; /* Slightly tighter base padding */
    text-decoration: none;
    color: #f0e6d2; /* Light text */
    font-size: 14px; /* Slightly smaller for horizontal fit */
    border-right: 1px solid #4a2a10; /* Separator between items */
    transition: background-color 0.3s, color 0.3s;
    white-space: nowrap; /* Prevents text wrap in links */
    text-align: center; /* Centers text in links */
}

.top-nav a:last-child {
    border-right: none; /* No border on last item */
}

.top-nav a:hover {
    background-color: #4a2a10; /* Darker hover bg */
    color: #d4c4a8; /* Muted hover text */
}

.top-nav a.active {
    background-color: #4a2a10;
    color: #f0e6d2;
    font-weight: bold;
}

.main {
    margin: 0; /* No left margin anymore */
    padding: 125px 40px 40px; /* ~25% more top padding for header clearance */
    min-height: 100vh;
    background-color: #1a0f0a; /* Matches body bg */
    display: flex;
    flex-direction: column;
    align-items: center; /* Centers content horizontally */
}

.main h1 {
    color: #d4c4a8; /* Muted cream for headings */
    border-bottom: 2px solid #4a2a10; /* Darker underline */
    padding-bottom: 10px;
    font-size: 2em;
    margin-top: 0;
    margin-bottom: 20px; /* Space below h1 for portrait/gallery */
    text-align: center; /* Center headings */
    width: 100%;
    max-width: 800px;
}

.main p {
    font-size: 1.1em;
    max-width: 800px;
    text-align: center;
    margin: 10px 0;
}

/* Portrait image styling for index.html - centered below nav */
.portrait {
    max-width: 80%;
    height: auto;
    display: block;
    margin: 20px auto;
    border-radius: 10px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.6); /* Deeper shadow for drama */
    border: 2px solid #4a2a10; /* Dark frame */
}

/* Gallery styles for album pages */
.cert-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px 0;
    width: 100%;
    max-width: 1200px; /* Centers gallery */
    margin: 0 auto;
    justify-items: center; /* Centers items in grid cells */
}

.cert-item {
    background-color: #2a1a10; /* Dark bg for figures */
    padding: 5px; /* Reduced padding for tighter fit */
    border-radius: 5px;
    text-align: center;
    max-width: 100%; /* Prevents overflow */
    box-sizing: border-box; /* Includes padding in width calc */
}

.cert-item img {
    width: 100%;
    height: auto;
    border-radius: 5px;
    transition: transform 0.3s ease;
}

.cert-item a {
    color: inherit;
    text-decoration: none;
    display: block;
}

.cert-item a:hover img {
    transform: scale(1.05); /* Subtle zoom on hover */
}

.cert-item figcaption {
    color: #d4c4a8;
    text-align: center;
    font-style: italic;
    margin-top: 8px;
    font-size: 0.9em;
}

/* General link styling for consistency across pages */
a {
    color: #d4c4a8; /* Muted cream for external/internal links */
    text-decoration: none;
}

a:hover {
    color: #f0e6d2; /* Brighter on hover */
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .top-nav {
        padding: 5px 0;
    }
    
    .top-nav a {
        font-size: 12px; /* Larger for Samsung touch/readability */
        padding: 8px 10px; /* Wider buttons for better taps */
    }
    
    .top-nav li {
        flex: 1; /* Even distribution, encouraging 3 rows */
    }
    
    .main {
        padding: 110px 20px 20px; /* ~25% more top padding for nav clearance; tighter sides */
    }
    
    .portrait {
        max-width: 95%;
    }
    
    /* Gallery: Larger images, minimal gaps for Samsung (1–2 cols, tight spacing) */
    .cert-gallery {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); /* Larger min for bigger images */
        gap: 4px; /* Minimal gaps to eliminate wide spacing */
        padding: 10px 0;
        justify-items: center;
    }
    
    .main h1 {
        font-size: 1.5em;
    }
}

@media (max-width: 480px) {
    .top-nav ul {
        justify-content: space-around; /* Even spacing on tiny screens */
    }
    
    .top-nav a {
        font-size: 11px; /* Keep smaller on narrower phones */
        padding: 6px 8px;
    }
    
    .top-nav li {
        flex-basis: auto; /* Auto-size based on content */
    }
    
    .main {
        padding: 105px 10px 10px; /* Adjusted top for small screens */
    }
    
    .cert-gallery {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); /* Slightly smaller but still larger images */
        gap: 2px; /* Ultra-minimal for tiny screens */
        padding: 5px 0;
    }
}
