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

/* === COLORS === */
:root {
    --bg: #FFFFFF;
    --bg2: #F8F8F8;
    --text: #2C2C2C;
    --text2: #6B7280;
    --accent: #8B7116;
    --accent2: #B85555;
    --border: #E5E7EB;
    --green: #4E9A06;
}

[data-theme="dark"] {
    --bg: #1A1A14;
    --bg2: #252520;
    --text: #E0DBD0;
    --text2: #A8A090;
    --accent: #C9A835;
    --accent2: #CC6666;
    --border: #3A3A30;
}

/* === BASE === */
body {
    font-family: monospace;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

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

/* Skip link for keyboard users */
.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--accent);
    color: #FFFFFF;
    padding: 0.5rem 1rem;
    z-index: 200;
    font-size: 0.9em;
}

.skip-link:focus { top: 0; }

/* Focus outlines for keyboard navigation */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

h2 {
    font-size: 2em;
    border-bottom: 2px solid var(--accent);
    padding-bottom: 0.25rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

h3 { font-size: 1.25em; margin-bottom: 0.75rem; }

/* === HERO SECTION === */
.hero-section {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
}

.hero-bg {
    width: 100%;
    height: auto;
    display: block;
    transform-origin: top center;
    position: absolute;
    top: 0;
    left: 0;
}

.hero {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: auto;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 1rem;
}

/* JS sets .hero height to match the image */

.hero-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.hero-label {
    color: #FFFFFF;
    font-size: clamp(0.6em, 2.5vw, 0.85em);
    letter-spacing: 0.1em;
    font-weight: bold;
}

.hero-name {
    color: #FFFFFF;
    font-size: clamp(1.2em, 5vw, 2em);
    font-weight: bold;
    letter-spacing: 0.1em;
    border: none;
    padding: 0;
    margin: 0.25rem 0;
}

.hero .subtitle {
    color: var(--green);
    font-size: clamp(0.8em, 2.5vw, 1.1em);
    min-height: 1.5em;
    margin-top: 0.5rem;
    background: #000;
    padding: 0.4rem 0.75rem;
    border-radius: 3px;
    text-align: left;
    width: 32ch;
    max-width: 90vw;
    display: inline-block;
}

/* === NAV SHARED === */
.nav-transparent,
.nav-standard {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    position: relative;
}

.nav-transparent h1,
.nav-standard h1 {
    display: flex;
    align-items: center;
    margin: 0;
    font-size: 1.1em;
}

.nav-transparent h1 a,
.nav-standard h1 a {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.nav-logo {
    height: 48px;
    width: 48px;
    object-fit: contain;
    border-radius: 4px;
    margin-right: 0.5rem;
}

#menu-toggle {
    display: block;
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
}

#nav-links {
    display: none;
    flex-direction: column;
    list-style: none;
    gap: 0.25rem;
}

#nav-links.open { display: flex; }

.nav-right { display: flex; align-items: center; gap: 0.75rem; }

/* Nav transparent (home) */
.nav-transparent {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 50;
    background: transparent;
}

.nav-transparent h1 a,
.nav-transparent a { color: #FFFFFF; font-size: 1.2em; font-weight: bold; }
.nav-transparent h1 a:hover,
.nav-transparent a:hover { color: var(--accent); }
.nav-transparent #menu-toggle { color: #FFFFFF; }

/* Nav standard (other pages) */
.nav-standard {
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
}

.nav-standard h1 a,
.nav-standard a { color: var(--text); font-size: 1.2em; font-weight: bold; }
.nav-standard h1 a:hover,
.nav-standard a:hover { color: var(--accent); }
.nav-standard #menu-toggle { color: var(--text); }

/* === CONTENT WRAPPER === */
.content-wrapper {
    position: relative;
    z-index: 1;
}

.content-section { background: var(--bg); }

.section-gap { height: 40vh; background: transparent; }

.section-inner { padding: 1.5rem 1rem; }

main { padding: 4rem 1rem; }

/* === INTRO === */
.intro { margin: 0 auto 2rem; max-width: 700px; }

.intro p {
    font-size: 0.95em;
    text-align: justify;
    text-indent: 2em;
    line-height: 1.8;
    color: var(--text2);
    margin-bottom: 0.75rem;
}

/* === FEATURED PROJECTS === */
.projects {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.project { flex: 1; }

.project iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg2);
}

.project h3 { margin-top: 0.5rem; font-size: 1.1em; }
.project p { color: var(--text2); font-size: 0.85em; }

/* === BUTTONS === */
.cta, .download-btn, .submit-btn {
    display: inline-block;
    background: var(--accent);
    color: #FFFFFF;
    padding: 0.6rem 1.5rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 1em;
    border: none;
    cursor: pointer;
}

.cta { margin-top: 1rem; }
.download-btn { padding: 0.5rem 1.2rem; font-size: 0.9em; margin-top: 0.5rem; }

.cta:hover, .download-btn:hover, .submit-btn:hover {
    background: var(--accent2);
    color: #FFFFFF;
}

/* === TAGS === */
.tags, .timeline-skills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.4rem;
}

.tag {
    background: var(--accent);
    color: #FFFFFF;
    font-size: 0.75em;
    padding: 0.15em 0.5em;
    border-radius: 3px;
    text-decoration: none;
    display: inline-block;
}

a.tag:hover { background: var(--accent2); color: #FFFFFF; }

/* === FILTER BUTTONS === */
.filter-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.filter-btn, .filter-select {
    background: none;
    border: 1px solid var(--border);
    color: var(--text);
    font-family: monospace;
    font-size: 1em;
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-radius: 3px;
    text-align: left;
}

.filter-select { background: var(--bg); }
.filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.filter-btn.active { background: var(--accent); border-color: var(--accent); color: #FFFFFF; }

/* === PROJECT GRID === */
.project-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.project-card {
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1rem;
    background: var(--bg2);
}

.project-card iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
}

.project-img {
    width: 100%;
    border-radius: 4px;
    border: 1px solid var(--border);
    display: block;
}

.project-card h3 { margin-top: 0.5rem; font-size: 1.1em; }
.project-card p { color: var(--text2); font-size: 0.85em; margin: 0.3rem 0; }

.repo-card {
    display: block;
    border: 1px solid var(--border);
    border-radius: 4px;
    margin-top: 0.5rem;
    overflow: hidden;
}

.repo-card:hover { border-color: var(--accent); }

.repo-og { width: 100%; display: block; }

/* === TIMELINE === */
.timeline {
    position: relative;
    max-width: 900px;
    margin: 0 auto 2rem;
    padding: 1rem 0;
}

.timeline-line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--accent);
    transform: translateX(-50%);
}

.timeline-entry {
    position: relative;
    display: flex;
    align-items: flex-start;
    margin-bottom: 5rem;
    gap: 3rem;
}

.timeline-dot {
    position: absolute;
    left: 50%;
    top: 0.5rem;
    width: 14px;
    height: 14px;
    background: var(--accent);
    border: 3px solid var(--bg);
    border-radius: 50%;
    transform: translateX(-50%);
    z-index: 2;
}

.timeline-content, .timeline-img { width: 42%; }

.timeline-entry.right .timeline-content { order: 1; text-align: right; }
.timeline-entry.right .timeline-img { order: 2; margin-left: auto; }
.timeline-entry.right .timeline-skills { justify-content: flex-end; }
.timeline-entry.left .timeline-img { order: 1; text-align: right; }
.timeline-entry.left .timeline-content { order: 2; margin-left: auto; }

.timeline-date {
    display: inline-block;
    color: var(--accent);
    font-size: 0.85em;
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.timeline-content h3 { font-size: 1.15em; margin-bottom: 0.4rem; }
.timeline-content p { color: var(--text2); font-size: 0.85em; line-height: 1.6; margin-bottom: 0.5rem; }

.timeline-img img {
    width: 100%;
    max-height: 300px;
    border-radius: 4px;
    border: 1px solid var(--border);
    display: block;
    object-fit: cover;
}

/* === CAROUSEL === */
.carousel {
    position: relative;
    width: 100%;
    height: 280px;
    perspective: 600px;
}

.carousel-img {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border);
    transition: transform 0.5s, opacity 0.5s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.carousel-img.pos-0 { z-index: 3; transform: translateY(0) scale(1); opacity: 1; }
.carousel-img.pos-1 { z-index: 2; transform: translateY(12px) scale(0.95); opacity: 0.7; }
.carousel-img.pos-2 { z-index: 1; transform: translateY(24px) scale(0.9); opacity: 0.4; }
.carousel-img.pos-hidden { z-index: 0; transform: translateY(36px) scale(0.85); opacity: 0; }

.carousel-img.shuffle-out {
    z-index: 4;
    transform: translateX(110%) rotate(5deg) scale(0.9);
    opacity: 0;
    transition: transform 0.5s, opacity 0.4s;
}

/* Carousel exploded view */
.carousel.exploded {
    height: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
    perspective: none;
}

.carousel.exploded .carousel-img {
    position: relative;
    transform: none;
    opacity: 1;
    height: auto;
    max-height: none;
    aspect-ratio: 4 / 3;
    transition: transform 0.3s, opacity 0.3s;
    cursor: pointer;
    z-index: 1;
}

.carousel.exploded .carousel-img:hover {
    transform: scale(1.03);
    z-index: 5;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.carousel.exploded .carousel-img:last-child:nth-child(odd) {
    grid-column: 1 / -1;
}

/* Mobile */
@media (max-width: 767px) {
    .nav-logo { height: 32px; width: 32px; }
    .nav-transparent h1, .nav-standard h1 { font-size: 0.85em; }
    .nav-transparent a, .nav-standard a { font-size: 1em; }

    #nav-links {
        position: fixed;
        top: 2.5rem;
        left: 0;
        right: 0;
        padding: 0.4rem 1rem;
        gap: 0.15rem;
        z-index: 9999;
        background: rgba(0, 0, 0, 0.95);
        font-size: 0.85em;
        text-align: center;
        align-items: center;
    }

    #nav-links a { color: #FFFFFF; }
    #nav-links a:hover { color: var(--accent); }

    #menu-toggle { z-index: 10000; }

    .hero { padding-top: 5rem; }
    .hero-name { font-size: clamp(0.9em, 4vw, 1.4em) !important; letter-spacing: 0.05em; }
    .hero-label { font-size: clamp(0.5em, 2vw, 0.7em) !important; }
    .hero .subtitle { font-size: clamp(0.6em, 2vw, 0.85em) !important; width: 24ch; }

    .tag { padding: 0.3em 0.6em; font-size: 0.8em; min-height: 44px; display: inline-flex; align-items: center; }
    .filter-btn { min-height: 44px; }
    .cta, .download-btn, .submit-btn { min-height: 44px; }

    /* Timeline mobile */
    .timeline-line { left: 1rem; }
    .timeline-dot { left: 1rem; }

    .timeline-entry {
        flex-direction: column;
        padding-left: 2.5rem;
        gap: 0.75rem;
    }

    .timeline-content, .timeline-img { width: 100%; margin-left: 0; }

    .timeline-entry.right .timeline-content,
    .timeline-entry.left .timeline-content { order: 1; text-align: left; }

    .timeline-entry.right .timeline-img,
    .timeline-entry.left .timeline-img { order: 2; text-align: left; }

    .timeline-entry.right .timeline-skills { justify-content: flex-start; }
}

/* === RESUME === */
.resume-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    text-align: center;
}

.resume-header .headshot {
    width: 140px;
    height: 140px;
    object-fit: cover;
    border: 2px solid var(--border);
}

.resume-header .location { color: var(--text2); font-size: 0.95em; }
.resume-section { margin-bottom: 2rem; }
.resume-section h2 { font-size: 1.3em; }
.resume-section h3 { font-size: 1.05em; margin-bottom: 0.25rem; }
.resume-section .meta { color: var(--text2); font-size: 0.85em; margin-bottom: 0.5rem; }
.resume-section ul { list-style: disc; margin-left: 1.5rem; margin-bottom: 1rem; }
.resume-section li { margin-bottom: 0.3rem; font-size: 0.9em; }


.pdf-embed {
    display: block;
    width: 100%;
    height: 600px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg2);
}

/* === CONTACT === */
.contact-layout { display: block; }
.contact-intro { margin-bottom: 1.5rem; font-size: 0.95em; }

.contact-sidebar {
    background: var(--bg2);
    padding: 1rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.contact-sidebar h3 { font-size: 1em; margin-bottom: 0.75rem; color: var(--accent); }
.contact-sidebar p { font-size: 0.85em; margin-bottom: 0.5rem; color: var(--text2); }

.contact-form label { display: block; font-size: 0.9em; margin-bottom: 0.25rem; }

.contact-form input,
.contact-form select,
.contact-form textarea {
    width: 100%;
    padding: 0.5rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
    background: var(--bg);
    color: var(--text);
}

.contact-form textarea { min-height: 120px; resize: vertical; }

.contact-form input:focus,
.contact-form select:focus,
.contact-form textarea:focus { outline: none; border-color: var(--accent); }

.contact-form input:invalid:not(:placeholder-shown),
.contact-form textarea:invalid:not(:placeholder-shown) { border-color: var(--accent2); }

.error-msg {
    color: var(--accent2);
    font-size: 0.8em;
    margin-top: -0.75rem;
    margin-bottom: 0.75rem;
    display: none;
}

.error-msg.visible { display: block; }

/* === LIGHTBOX === */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.9);
    align-items: center;
    justify-content: center;
}

.lightbox.open {
    display: flex;
}

.lightbox img {
    width: 90vw;
    height: 90vh;
    object-fit: contain;
    border-radius: 4px;
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    background: none;
    border: none;
    color: #FFFFFF;
    font-size: 2.5em;
    cursor: pointer;
}

.lightbox-close:hover { color: var(--accent); }

/* === FOOTER === */
footer {
    background: var(--bg2);
    text-align: center;
    padding: 1.5rem 1rem;
    color: var(--text2);
    font-size: 0.85em;
    border-top: 1px solid var(--border);
}

footer a { color: var(--accent); }
footer a:hover { color: var(--accent2); }

#theme-toggle {
    background: none;
    border: 1px solid var(--text2);
    color: var(--text2);
    font-family: monospace;
    font-size: 0.85em;
    padding: 0.5em 0.8em;
    min-height: 44px;
    min-width: 44px;
    cursor: pointer;
    border-radius: 3px;
}

#theme-toggle:hover { color: var(--accent); border-color: var(--accent); }

/* === TABLET+ === */
@media (min-width: 768px) {
    #menu-toggle { display: none; }

    #nav-links {
        display: flex;
        flex-direction: row;
        position: static;
        padding: 0;
        gap: 2rem;
        border-bottom: none;
        background: none !important;
    }

    .nav-transparent { padding: 1rem 2rem; }
    .nav-standard { padding: 0.75rem 2rem; }
    .hero { padding: 4rem 2rem; }
    .hero-name { font-size: 3em; }
    .hero-label { font-size: 1em; }
    main, .section-inner { padding: 2rem; }
    .projects { flex-direction: row; }
    .filter-buttons { flex-direction: row; }
    .filter-btn { text-align: center; }
    .project-grid { grid-template-columns: 1fr 1fr; }
    .resume-header { flex-direction: row; text-align: left; }
    .pdf-embed { height: 800px; }

    .contact-layout {
        display: grid;
        grid-template-columns: 1fr 280px;
        gap: 2rem;
    }

    .contact-sidebar { margin-bottom: 0; order: 2; }
    .contact-form { order: 1; }
}

/* === DESKTOP === */
@media (min-width: 1024px) {
    main, .section-inner { max-width: 1300px; margin: 0 auto; padding: 2rem 4rem; }
    .timeline { max-width: 1100px; }
    .intro { max-width: 1100px; }
    body { font-size: 1.15em; }
    .hero-name { font-size: 3.5em; }
    .hero-label { font-size: 1.1em; }
}
