/* Reset & Variables */
:root {
    --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --text-color: #333;
    --accent-color: #0056b3;
    --bg-color: #fff;
    --max-width: 800px;
    --row-height: 180px;
}

@media (max-width: 600px) {
    :root {
        --row-height: 120px;
    }
}

body {
    font-family: var(--font-main);
    color: var(--text-color);
    background: var(--bg-color);
    line-height: 1.6;
    margin: 0;
    padding: 0 20px;
}

a { color: var(--accent-color); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout Structure */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding-top: 20px;
    padding-bottom: 60px;
}

.container-photo {
    max-width: 1200px;
    margin: 0 auto;
    padding-top: 20px;
    padding-bottom: 60px;
}

header {
    display: flex;
    justify-content: center;
    align-items: baseline;
    margin-bottom: 0px;
    border-bottom: 1px solid #e4e4e4;
    padding-bottom: 20px;
}

h4 {
    margin-bottom: 5px;
    padding-bottom: 5px;
}

/* Navigation styles */
header nav {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    width: 100%;
}
nav a { color: #666; font-size: 0.9rem; }
nav a:hover { color: #000; }

/* Responsive navigation for narrow viewports */
@media (max-width: 480px) {
    header nav {
        flex-wrap: wrap;
        gap: 0.5rem 0;
        justify-content: space-around;
    }
    nav a {
        font-size: 0.85rem;
        flex: 0 0 33.33%;
        text-align: center;
    }
}

/* Homepage Dashboard */
.intro { margin-bottom: 40px; }

.dashboard {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Two columns */
    gap: 40px;
    margin-top: 40px;
}

@media (max-width: 600px) {
    .dashboard { grid-template-columns: 1fr; } /* Stack on mobile */
}

.item-small { margin-bottom: 10px; }
.view-all { display: block; margin-top: 15px; font-size: 0.9rem; font-weight: bold;}

/* Standard Blog List */
.blog-list { list-style: none; padding: 0; }
.blog-list li { margin-bottom: 10px; }
.blog-list .date { 
    display: inline-block; 
    width: 100px; 
    color: #888; 
    font-family: monospace; 
}

footer {
    margin-top: 40px;
    border-top: 1px solid #eee;
    padding-top: 20px;
    font-size: 0.9rem;
    color: #777;
}

h2.main-header {
    text-align: center;
    font-weight: normal;
}

div.research-text p {
    margin-top: 0px;
}

div.research-image {
    margin-top: 20px;
}

section.research-section h3 {
    text-align: center;
}

div.pub-list {
    margin-bottom: 1.5em;
}

/* --- Photography --- */
.photo-gallery {
    padding: 2rem;
}

/* Category Grid */
.category-grid {
    display: grid;
    /* Creates a responsive grid that autofills based on card width */
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 0.5rem;
    margin-top: 2rem;
}

/* Featured row: Latest Work + Favorites */
.featured-grid {
    grid-template-columns: repeat(2, minmax(300px, 350px));
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

@media (max-width: 600px) {
    .featured-grid {
        grid-template-columns: 1fr;
    }
}

.featured-card {
    aspect-ratio: 16/9;
}

.featured-card h2 {
    font-size: 1.8rem;
}

.cat-card {
    display: block;
    position: relative;
    text-decoration: none;
    color: white;
    border-radius: 2px;
    overflow: hidden;
    aspect-ratio: 4/3; /* Enforces a standard shape for category cards */
    transition: transform 0.1s ease;
}

.cat-card:hover {
    opacity: 0.9;
}

.cat-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: filter 0.3s ease;
}

/* Dark gradient overlay so text is readable */
.cat-card::after {
    content: "";
    position: absolute;
    bottom: 0; left: 0; width: 100%; height: 50%;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
}

.cat-card h2 {
    position: absolute;
    bottom: 1rem;
    left: 1.5rem;
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    z-index: 2;
}

/* Masonry Gallery Layout */
.masonry-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 2rem;
}

.photo-item {
    position: relative;
    overflow: hidden;
    border-radius: 0px;
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: zoom-in;
    transition: opacity 0.2s;
}

.photo-item:hover img {
    opacity: 0.9;
}

/* Embedded Images (Markdown Hook) */
.embedded-image {
    margin: 0 0 1rem 0;
}

.embedded-image-center {
    margin-left: auto;
    margin-right: auto;
}

.image-caption {
    font-style: italic;
    text-align: center;
    font-size: 0.9em;
    color: #666;
    margin-top: 0.3rem;
}

@media (max-width: 600px) {
    .embedded-image {
        float: none !important;
        margin: 1rem 0 !important;
        width: 100% !important; /* Override inline width for small screens */
    }
}
