/* CSS Variables for Light/Dark Theme (Oxidized Steel & Forest) */
:root {
    --text-main: #171717;
    --text-muted: #525252;
    --bg-color: #F9F8F6;
    --accent: #C05621;
    --border-color: #E5E5E5;
    --card-bg: #ffffff;
    --img-bg: #F5F5F5;
    --img-border: #D4D4D4;
    --spacing: 2rem;
    --shadow: rgba(0, 0, 0, 0.05);
}

/* Dark Mode Override */
[data-theme="dark"] {
    --text-main: #F5F5F5;
    --text-muted: #A3A3A3;
    --bg-color: #121614;
    --accent: #ED8936;
    --border-color: #2A3630;
    --card-bg: #1A211D;
    --img-bg: #121614;
    --img-border: #3A4A41;
    --shadow: rgba(0, 0, 0, 0.3);
}

/* Base Styles with SVG Noise Texture */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-main);
    background-color: var(--bg-color);
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' opacity='0.04' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    max-width: 800px;
    margin: 0 auto;
    padding: 0 var(--spacing);
    transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4 {
    font-weight: 600;
    line-height: 1.2;
    margin-top: 0;
    margin-bottom: 1rem;
}

h1 { font-size: 2.5rem; margin-top: 0; }
h2 { font-size: 1.75rem; margin-top: 3rem; border-bottom: 1px solid var(--border-color); padding-bottom: 0.5rem;}
h3 { font-size: 1.25rem; margin-top: 0; margin-bottom: 0.25rem;}

p { margin-top: 0; margin-bottom: 1rem; color: var(--text-muted); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a.active { color: var(--accent); text-decoration: underline; }

.badge {
    background-color: var(--border-color);
    color: var(--text-muted);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
    white-space: nowrap;
    display: inline-block;
}
/* Sticky Header */
header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: var(--bg-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

header::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' opacity='0.04' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: -1;
}

nav {
    display: flex;
    align-items: center;
}

nav a {
    margin-left: 1.5rem;
    color: var(--text-main);
    font-weight: 500;
    transition: color 0.3s ease;
}

/* Theme Toggle Button */
#theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    margin-left: 1.5rem;
    padding: 0;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

#theme-toggle:hover {
    transform: scale(1.1);
}

/* Hero / About Section */
#about {
    margin-top: 3rem;
    margin-bottom: 2rem;
}

.hero-layout {
    display: flex;
    align-items: center;
    gap: 2.5rem;
}

.headshot-image {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent);
    flex-shrink: 0;
    transition: border-color 0.3s ease;
}

.profile-photo {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent);
    flex-shrink: 0;
    transition: border-color 0.3s ease;
}

.hero-text p:last-child {
    margin-bottom: 0;
}

/* Expandable Sections */
details.case-study {
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1.25rem;
    background-color: var(--card-bg);
    transition: all 0.3s ease;
}

details.case-study[open] {
    box-shadow: 0 6px 16px var(--shadow);
    border-color: var(--accent);
}

/* Smooth Details Reveal Animation */
details.case-study summary ~ * {
    animation: revealContent 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transform-origin: top;
}
blockquote {
    margin: 0;
}

@keyframes revealContent {
    0% { opacity: 0; transform: translateY(-10px) scaleY(0.98); }
    100% { opacity: 1; transform: translateY(0) scaleY(1); }
}

summary {
    font-weight: 600;
    font-size: 1.25rem;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-main);
}

summary::-webkit-details-marker {
    display: none;
}

summary::after {
    content: '+';
    font-size: 1.5rem;
    color: var(--accent);
    font-weight: 400;
    transition: transform 0.3s ease;
}

details[open] summary::after {
    content: '−';
    transform: rotate(180deg);
}

.summary-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.summary-content {
    display: flex;
    flex-direction: column;
}

.project-name {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.logo-image {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    object-fit: contain;
    border: 1px solid var(--border-color);
    background-color: #ffffff;
    flex-shrink: 0;
    padding: 2px;
    transition: border-color 0.3s ease;
}

.case-content {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* TL;DR Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: var(--img-bg);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.metric-item {
    display: flex;
    flex-direction: column;
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.1;
    margin-bottom: 0.25rem;
}

.metric-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Deeper Case Study Formatting */
.case-content h4 {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    color: var(--text-main);
    margin-top: 1.5rem;
}

.case-content h4:first-child {
    margin-top: 0;
}

.case-content ul {
    padding-left: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.case-content li {
    margin-bottom: 0.5rem;
}

/* Sanitized Artifact Code Blocks */
.sanitized-artifact {
    background-color: var(--img-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    margin: 1.5rem 0;
}

.artifact-header {
    background-color: var(--border-color);
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
}

.sanitized-artifact pre {
    margin: 0;
    padding: 1.25rem;
    overflow-x: auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Image Galleries */
.case-study-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.gallery-item {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background-color: var(--img-bg);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--shadow);
}

.gallery-item img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
}

.image-label {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background-color: rgba(23, 23, 23, 0.85);
    color: #ffffff;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Experience Section Single Card */
.experience-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px var(--shadow);
}

.job {
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.job:last-child {
    padding-bottom: 0;
    margin-bottom: 0;
    border-bottom: none;
}

.job-layout {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
}

.job-content {
    flex: 1;
}

.job-content h3 {
    margin: 0 0 0.2rem 0;
    line-height: 1.1;
}

.job-content p.meta {
    margin: 0 0 0.25rem 0;
    font-size: 0.95rem;
    color: var(--text-main);
}

.job-date {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.job-duties {
    margin-top: 0;
    margin-bottom: 0;
    padding-left: 1.2rem;
    color: var(--text-muted);
}

.job-duties li {
    margin-bottom: 0.5rem;
}

.job-duties li:last-child {
    margin-bottom: 0;
}

footer {
    margin-top: 4rem;
    padding: 2rem 0;
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
    text-align: center;
}

/* Utility Classes */
.hidden {
    display: none;
}
.mx-auto {
    margin-left: auto;
    margin-right: auto;
}
.ml-auto {
    margin-left: auto;
}
.mr-auto {
    margin-left: auto;
}
.pb-3 {
    padding-bottom: 1rem;
}
.mb-0 {
    margin-bottom: 0;
}
.mb-3 {
    margin-bottom: 1rem;
}
.mt-0 {
    margin-top: 0;
}
.mt-3 {
    margin-top: 1rem;
}
.text-muted {
    color: var(--text-muted)!important;
}
.text-main {
    color: var(--text-main)!important;
}
.text-accent {
    color: var(--accent)!important;
}
.text-border-color {
    color: var(--border-color);
}

/* Mobile Adjustments */
@media (max-width: 600px) {
    header {
        padding: 1rem 0;
        display: flex;
        flex-direction: column;
    }
    nav a {
        margin-left: 1rem;
        font-size: 0.9rem;
    }
    nav a:first-child {
        margin-left: 0;
    }
    #theme-toggle {
        margin-left: 1rem;
    }
    .hero-layout {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
    }
    .profile-photo {
        width: 120px;
        height: 120px;
    }
    h1 {
        font-size: 2rem;
    }
    .experience-card {
        padding: 1.25rem;
    }
    .metrics-grid {
        grid-template-columns: 1fr;
    }
}