/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #3c2f2f;
    --surface: #4b3832;
    --surface-hover: #242424;
    --border: #2a2a2a;
    --text: #fff4e6;
    --text-muted: #888;
    --accent: #87b442;
    --accent-dim: #87b442;
    --radius: 10px;
    --lightDivision: #453A38;
    --navbar-height: 50px;
}

html {
    scroll-behavior: smooth;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    /* scroll-padding-top: var(--navbar-height); */
    scroll-snap-align: start;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
        Ubuntu, Cantarell, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

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

h2 {
    font-size: 1.6rem;
    margin-bottom: 1rem;
}
h3 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

#loader {
    width: 100vw;
    min-height: 100vh;
    text-align: center;
    margin-top: 50vh;
    font-size: 30px;
}

/* ===== Navbar ===== */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.0rem 2rem;
    background: var(--lightDivision);
    border-bottom: 1px solid var(--border);
    /* backdrop-filter: blur(12px); */
    /* margin-bottom: 50px; */
    filter: opacity(0%);
    transition: all 0.5s ease;
}

.nav-brand {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
}
.nav-brand a {
    scale: 1 !important;
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    transition: all 0.2s ease;
}
.nav-brand a:hover {
    text-decoration: none;
    color: var(--text);
}

.nav-tabs {
    display: flex;
    gap: 0.25rem;
}

.tab-btn {
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: 0.5rem 1.2rem;
    font-size: 0.95rem;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
}
.tab-btn:hover {
    background: var(--surface-hover);
    color: var(--text);
}
.tab-btn.active {
    background: var(--accent-dim);
    color: #fff;
}

#intro {
    /* scroll-snap-align: end; */
    margin: 0 auto;
    max-width: 960px;
    min-height: calc(100vh - var(--navbar-height));
}

/* ===== Tab Content ===== */
.tab-content {
    display: none;
    padding: 0 1.5rem;
    animation: fadeIn 0.3s ease;
}
.tab-content.active {
    display: block;
}
.tab-button {
    padding: 0%;
    /* color: red; */
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes leftFadeIn {
    from { opacity: 0; transform: translateX(8px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes zoomIn {
    from { width: 100vw }
    to   { width: 110vw }
}

/* ===== Intro / Hero ===== */

.contents {
    height: 100vh;
    /* justify-content: flex-start; */
    margin: 0 auto;
    margin: 10px clamp(1rem, 7vw, 100px) 10px clamp(1rem, 7vw, 100px);
    overflow: hidden;
    /* background-color: var(--lightDivision); */
}
.contents h1 {
    font-size: clamp(4rem, 6vw, 8rem);
}

#about {
    /* overflow: hidden; */
    width: max-content;
    height: 100vh;
}

.intro-hero {
    /* scroll-snap-align: center; */
    display: flex;
    align-items: center;
    gap: 6rem;
    margin-bottom: 3rem; 
    justify-content: center;
}

.hero-text {
    flex: 1;
}

.hero-text h1 {
    font-size: 10rem;
    margin-bottom: 0.4rem;
    text-align: justify;
    text-indent: 0px;
    line-height: 12rem;
    display: grid;
    overflow-wrap: break-word;
}

.accent {
    color: var(--accent);
}
.tagline {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.hero-photo {
    /* background-color: var(--surface-hover); */
    border-radius: 20px;
    flex-shrink: 0;
    text-wrap: inherit;
    max-width: 420px;
    width: 420px;
    padding: 15px;
    overflow: hidden;
    /* outline: 20px solid var(--surface-hover); */
    margin: auto;
    animation: leftFadeIn 0.3s ease-in !important;
    opacity: 0%;
    visibility: hidden;
    transition: opacity 1.5s ease;
}
.photo-placeholder {
    width: 350px;
    height: 450px;
    margin: auto;
    border-radius: 25px;
    background: var(--surface);
    display: grid;
    background-repeat: no-repeat;
    place-items: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    background-size: cover;
    background-position: -30px;
    filter: grayscale(90%);
    transition: all 0.5s ease;
}
.photo-placeholder:hover {
    scale: 1.04 !important;
    filter: grayscale(20%);
}

.hero-photo-info {
    margin: 20px;
    font-size: clamp(0.9rem, 1.3vw, 1.3rem);
    background-color: #85756788;
    border-radius: 10px;
    padding: 10px;
    overflow-wrap: break-word;
    min-width: 0;
}

/* ===== Header ===== */
.owfa-header{
    display: flex;
    max-height: 20rem;
    justify-content: center;
}
#header-image {
    display: flex;
    object-fit: cover;
    width: 110vw;
    /* width: 100px; */
    animation: zoomIn 0.8s ease;
}

/* ===== Sections ===== */

/* Each part of the scrollable tab will be a division */
.division {
    height: 100vh;
    background-color: var(--lightDivision);
    scroll-snap-align: start;
}

.hero {
    display: flex;
    gap: clamp(1rem, 4vw, 6rem);
    padding: clamp(1rem, 2.5vw, 3rem);
    height: 100%;
}

.bio {
    text-align: left;
    display: flex;
    align-items: flex-start;
    /* max-width: 80%; */
    font-size: clamp(1rem, 1.6vw, 2rem);
    color: var(--text);
    grid-row: 1/2;
    width: 60%;
    overflow: hidden;
}

.hero-section-photo {
    overflow: hidden;
    position: relative;
    width: 40%;
    height: 100%;
    background-color: var(--lightDivision);
}
#section-photo {
    width: 100%;
    height: 130%;
    object-fit: cover;
    object-position: center;
    position: absolute;
    top: -15%;
    left: 0;
}
/* Hero-photo section — reusable division layout with a contained image */
.hero-photo-section {
    overflow: hidden;
}
.hero-photo-section .contents {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 20px); /* subtract top+bottom margins */
    
    animation: fadeIn 0.3s ease-in; 
}
.hero-photo-section .hero {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.hero-photo-section .hero-section-photo {
    min-height: 0;
}
.hero-photo-section .hero-section-photo img {
    /* inherits centered absolute positioning from #section-photo */
}

.hero-section-code {
    width: 100%;
    margin: 0px 30px 0px 0px;
    overflow: hidden;
}
#source-code {
    width: calc(100% + 17px);
}

/* ===== Contact ===== */
.contact-hero {
    scroll-snap-align: start;
    margin: 0px 100px 0px 100px;
}

.contact-section {
    margin-bottom: 3rem;
}
.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}
.contact-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.2rem;
}
.contact-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}

/* ===== Skills ===== */
.skills-section {
    margin-bottom: 2rem;
    scroll-snap-align: start;
    overflow: hidden;
}
.skills-section p {font-size: 1.4vw;}
.skills-section h2 {font-size: 8rem;}
.skills-list {
    display: flex;
    flex-wrap: nowrap;
    gap: 2.0rem;
    width: max-content;
    animation: infiniteSlide 20s linear infinite;
}

@keyframes infiniteSlide {
    from { transform: translateX(-100%); }
    to   { transform: translateX(100vw); }
}

.skill-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* background: var(--surface); */
    border: 1px solid var(--border);
    padding: 0.35rem 0.9rem;
    border-radius: 20px;
    font-size: 1.85rem;
    width: fit-content;
    height: fit-content;
    color: var(--text);
}
.skill-tag img {
    display: block;
    height: clamp(7rem, 10vw, 10rem);
    width: auto;
}

/* ===== Tech Projects ===== */
.section-subtitle {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.projects-grid {
    display: grid;
    margin: 0 auto;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
}

.project-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: border-color 0.2s, transform 0.2s;
}
.project-card a {
    text-decoration: none;
    color: var(--text);
}
.project-card:hover {
    border-color: var(--accent-dim);
    transform: translateY(-2px);
}
.project-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}
.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}
.project-links {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
}

/* ===== Miscellaneous — category cards ===== */
.misc-cards {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.misc-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 5.8rem 2rem;
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.2s, transform 0.2s;
}
.misc-card:hover {
    border-color: var(--accent);
    transform: translateX(6px);
    text-decoration: none;
}
.misc-card-label {
    font-size: 2.25rem;
    font-weight: 600;
    flex: 1;
}
.misc-card-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    flex: 2;
}
.misc-card-arrow {
    font-size: 1.4rem;
    color: var(--accent);
    transition: transform 0.2s;
}
.misc-card:hover .misc-card-arrow {
    transform: translateX(4px);
}

/* ===== Sub-page (music / renders / photography) ===== */
.subpage-header {
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 1.2rem;
    margin-bottom: 0.5rem;
}
.back-link {
    font-size: 0.9rem;
    color: var(--accent);
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.3rem 0.8rem;
    transition: background 0.2s;
    white-space: nowrap;
}
.back-link:hover {
    background: var(--surface);
    text-decoration: none;
}

.normal-video-container {
    display: flex;
    overflow: hidden;
    width: 100%;
    padding: 20px;
}
.normal-video-container #owfaVideo {
    width: 100%;
    padding: 0px 0px 50px 0px;
    aspect-ratio: 16/9;
    height: fit-content;
}


.video-container{
    position: relative;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}
.video-container video,
.video-container .header-img {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    transform: translate(-50%, -50%);
    object-fit: cover;
    z-index: -1;
}
.video-container video {
    transform: translate(-47%, -49%); /* keeps existing video offset */
    scale: 1.08;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.25rem;
    margin-top: 1.5rem;
}

.gallery-item {
    display: flex;
    flex-direction: column;
}
.gallery-cover {
    width: 100%;
    aspect-ratio: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: grid;
    place-items: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    transition: border-color 0.2s, transform 0.2s;
    background-size: contain;
}
.gallery-item:hover .gallery-cover {
    border-color: var(--accent);
    transform: translateY(-3px);
}
.gallery-item-title {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
}
.gallery-item-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
}

.music-releases {
    padding: 1.5rem;
    scroll-snap-align: start;
}

/* Gallery detail drill-down */
#insight-detail {
    display: none;
}
#coffee-detail {
    display: none;
}
#blossom-detail {
    display: none;
}
#dissonant-detail {
    display: none;
}
#music.showing-detail .music-releases {
    display: none;
}
#music[data-showing="insight-detail"] #insight-detail {
    display: block;
}
#music[data-showing="dissonant-detail"] #dissonant-detail {
    display: block;
}

/* ===== OWFA feature highlights ===== */
.owfa-features-section {
    background-color: var(--bg);
    scroll-snap-align: start;
}
.owfa-features-content {
    padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 7vw, 100px);
}
.owfa-features-content h2 {
    font-size: clamp(2rem, 5vw, 4rem);
    margin-bottom: 1.5rem;
    color: var(--accent);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
}

.feature-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.4rem;
    transition: border-color 0.2s, transform 0.2s;
}
.feature-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}
.feature-icon {
    font-size: 1.4rem;
    color: var(--accent);
    display: block;
    margin-bottom: 0.5rem;
}
.feature-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.4rem;
    color: var(--text);
}
.feature-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
}
.feature-card code {
    font-family: monospace;
    background: var(--bg);
    padding: 0.1em 0.3em;
    border-radius: 3px;
    font-size: 0.85em;
    color: var(--accent);
}

.frame-holder {
    display: flex;
    width: 100%;
    height: 60%;
}
.frame-holder iframe {
    justify-content: center;
    margin: auto 0;
}


/* Detail drill-down — tech */
#owfa-detail {
    display: none;
    animation: fadeIn 0.3s, ease-in;
}
#tech[data-showing] .tech-overview {
    display: none;
}
#tech[data-showing="owfa-detail"] #owfa-detail {
    display: block;
}
#tech[data-showing="coffee-detail"] #coffee-detail {
    display: block;
}
#tech[data-showing="blossom-detail"] #blossom-detail {
    display: block;
}

.project-card--detail {
    cursor: pointer;
}

.gallery-item--detail {
    cursor: pointer;
}
.gallery-item--detail .gallery-item-title {
    color: var(--accent);
}

.detail-back-btn {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.3rem 0.8rem;
    font-size: 0.9rem;
    cursor: pointer;
    margin-bottom: 0.5rem;
    transition: background 0.2s;
}
.detail-back-btn:hover {
    background: var(--surface);
}

.gallery-category-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent);
    margin-top: 2rem;
    margin-bottom: 0.25rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border);
}

/* ===== OWFA Screenshot Carousel ===== */
.owfa-screenshots-section .contents {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 20px);
}
.screenshot-carousel {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-height: 0;
    padding: 1rem 0;
}
.carousel-window {
    flex: 1;
    height: 100%;
    overflow: hidden;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
}
.carousel-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: opacity 0.2s ease;
}
.carousel-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text);
    font-size: 1.4rem;
    width: 3rem;
    height: 3rem;
    flex-shrink: 0;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.carousel-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
}
.carousel-counter {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 0.5rem 0;
}

/* ===== Footer ===== */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
    margin-top: 3rem;
}

/* ===== Tablet (769px – 1024px) ===== */
@media (min-width: 769px) and (max-width: 1024px) {
    /* Navbar */
    .navbar {
        padding: 0 1.2rem;
    }

    /* Headings */
    h3 {
        font-size: 2rem;
    }

    /* Intro hero — shrink photo & gaps so text has room */
    .intro-hero {
        gap: 2.5rem;
    }
    .hero-text h1 {
        line-height: 1.2 !important;
    }
    .hero-text h1 span {
        font-size: clamp(3rem, 5vw, 5rem) !important;
    }
    .hero-text h2 span {
        font-size: clamp(2rem, 3.5vw, 3.5rem) !important;
    }
    .hero-photo {
        max-width: 280px;
        width: 280px;
        padding: 10px;
    }
    .photo-placeholder {
        width: 240px;
        height: 310px;
    }

    /* #about uses width: max-content on desktop — fix overflow on tablet */
    #about {
        width: 100%;
    }

    /* Contents — tighten horizontal margins */
    .contents {
        margin: 10px clamp(1rem, 3vw, 40px);
    }

    /* About / bio hero row */
    .hero {
        gap: 2rem;
        padding: 1.5rem;
    }
    .bio {
        font-size: clamp(0.95rem, 1.4vw, 1.5rem);
    }

    /* Skills heading is 8rem on desktop — scale it down */
    .skills-section h2 {
        font-size: 5rem;
    }
    .skills-section p {
        font-size: 1rem;
    }

    /* Contact — reduce side margins */
    .contact-hero {
        margin: 0 3rem;
    }

    /* Misc cards — reduce oversized vertical padding */
    .misc-card {
        padding: 3rem 2rem;
    }
    .misc-card-label {
        font-size: 1.75rem;
    }

    /* Video container overlay text */
    .video-container .hero-text h1 span {
        font-size: clamp(3rem, 6vw, 6rem) !important;
    }
}

/* ===== Mobile (≤ 768px) ===== */
@media (max-width: 768px) {
    /* Prevent horizontal scroll from 100vw children inside padded containers */
    body {
        overflow-x: hidden;
    }

    /* Snap snapping on mobile — divisions are auto-height so snap points are unreliable */
    html {
        scroll-snap-type: none;
    }

    /* Navbar */
    .navbar {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.6rem 1rem;
    }
    .nav-brand span {
        font-size: 1.8rem !important;
    }

    /* Base heading sizes */
    h3 {
        font-size: 1.4rem;
    }

    /* Tab content — slightly tighter padding */
    .tab-content {
        padding: 0 0.75rem;
    }

    /* Intro hero — stack vertically and scale down */
    .intro-hero {
        flex-direction: column;
        align-items: center;
        gap: 2rem;
        text-align: center;
        padding: 0 1rem;
    }
    .hero-text {
        text-align: center;
        width: 100%;
    }
    .hero-text h1 {
        display: flex;
        flex-direction: column;
        align-items: center;
        line-height: 1.2 !important;
        text-align: center !important;
        width: 100%;
        max-width: 100%;
    }
    .hero-text h1 span {
        font-size: 2.2rem !important;
        width: auto !important;
        max-width: 100%;
        white-space: normal;
        text-align: center;
    }
    .hero-text h2 span {
        font-size: 1.4rem !important;
        width: auto !important;
        max-width: 100%;
    }
    .hero-photo {
        max-width: 90vw;
    }
    .photo-placeholder {
        width: 220px;
        height: 280px;
    }
    .hero-photo-info {
        font-size: 1rem;
    }

    .video-container .hero-text h1 {
        justify-content: center;
    }
    .video-container .hero-text h1 span {
        font-size: clamp(1.8rem, 10vw, 3rem) !important;
        width: auto !important;
        text-align: center;
    }

    /* Division — size to content on mobile */
    .division {
        height: auto;
        padding-bottom: 2rem;
    }

    /* Intro — don't force full viewport height on mobile */
    #intro {
        min-height: unset;
    }

    /* Contents */
    .contents {
        margin: 10px 1rem;
        height: auto;
    }

    /* hero-photo-section: undo the desktop flex-column height constraint */
    .hero-photo-section .contents {
        height: auto;
        display: block;
    }
    .hero-photo-section .hero {
        overflow: visible;
        min-height: unset;
    }

    /* About / bio hero row — stack vertically */
    .hero {
        flex-direction: column-reverse;
        gap: 2rem;
        height: auto;
        padding: 1.5rem 1rem;
        text-align: left;
    }
    .hero-section-photo {
        width: 100%;
        height: 280px;
    }
    #section-photo {
        scale: 1;
    }
    .bio {
        width: 100%;
        font-size: 1rem;
    }

    /* Skills */
    .skills-section h2 {
        font-size: 3rem;
    }
    .skills-section p {
        font-size: 0.9rem;
    }
    .skill-tag img {
        height: clamp(4rem, 12vw, 6rem);
    }

    /* Tech projects */
    .projects-grid {
        grid-template-columns: 1fr;
    }

    /* Misc cards — reduce extreme padding */
    .misc-card {
        padding: 2rem 1rem;
        gap: 1rem;
    }
    .misc-card-label {
        font-size: 1.4rem;
    }
    .misc-card-desc {
        font-size: 0.85rem;
    }

    /* Contact */
    .contact-hero {
        margin: 0 1rem;
    }

    /* Music releases gallery */
    .music-releases {
        padding: 1rem 0.75rem;
    }
}
