/* ============================================================
   index.css — Home page (Onni Korhonen)
   Page-specific styles formerly inlined in index.html, plus the
   index-only rules it used to inherit from main.css.
   Load AFTER styles.css and music-player.css so these overrides win.
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
    --nav-text: rgb(224, 224, 224);
    --nav-bg: rgba(8, 8, 8, 0.9);
    --nav-hover-bg: rgba(85, 85, 85, 0.54);
    --dropdown-bg: rgba(10, 10, 10, 0.96);
    --dropdown-border: rgba(255, 255, 255, 0.16);
}

/* ---------- Header ---------- */
.site-header {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0);
    color: rgb(224, 224, 224);
    padding: 0;
    padding-top: 3em;
    padding-bottom: 4em;
    font-family: "Montserrat", sans-serif;
    letter-spacing: 0.30em;
    font-weight: 200;
    text-align: center;
    overflow: hidden; /* keeps video clipped to header */
    scroll-snap-align: none;
    scroll-snap-stop: none;
}
.header-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -1;
    filter: brightness(0.8);
    will-change: transform;
    transform: translateZ(0);
}
.site-header ul {
    margin: 0;
    padding: 0;
}
.site-subheader {
    background-color: rgba(20, 20, 20, 0);
    color: rgb(224, 224, 224);
    padding: 0;
    font-family: "Montserrat", serif;
    letter-spacing: 0.30em;
    font-weight: 200;
    text-align: center;
    display: inline-block;
    margin: 0 auto;
    position: relative;
    top: -5px;
}

/* ---------- Base ---------- */
body {
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    letter-spacing: 0.7px;
    touch-action: pan-y;
    scroll-snap-type: y proximity;
    scroll-behavior: smooth;
    overscroll-behavior-y: contain;
}
body::-webkit-scrollbar {
    width: 0;
    background: transparent;
}

/* ---------- Layout ---------- */
section {
    max-width: 1200px;
    margin: 0 auto;
    box-sizing: border-box;
    scroll-snap-align: start;
    scroll-snap-stop: always;
}
#about-section,
#music-production,
#composition,
#filmmaking {
    border-top: 0px solid rgb(224, 224, 224);
}
#music-production,
#composition,
#filmmaking {
    width: 100%;
    height: auto;
    padding-top: 5em;
}
/* Empty spacer sections used between content blocks */
#splash-screen1,
#splash-screen2,
#splash-screen3 {
    width: 100%;
    height: 720px;
    background-size: cover;
    max-width: none;
    opacity: 60%;
    min-height: 8rem;
    overflow: hidden;
}
.splash-screen {
    color: rgb(224, 224, 224);
    padding: 1em;
}

/* ---------- Navigation ---------- */
nav a {
    color: white;
}
.site-nav {
    font-family: "Montserrat", sans-serif;
    max-width: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem 1rem;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 40;
    width: 100%;
    background: var(--nav-bg);
    backdrop-filter: blur(4px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
    box-sizing: border-box;
}
.site-nav .nav-item {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin: 0;
}
.site-nav a,
.site-nav .nav-item > a {
    padding: 1em;
    border-radius: 2px;
    display: inline-block;
}
.site-nav a:hover,
.site-nav a:focus-visible,
.site-nav .nav-item:hover > a,
.site-nav .nav-item:focus-within > a,
.site-nav .nav-item.menu-open > a {
    color: #fff;
    background-color: var(--nav-hover-bg);
}
.contact-dropdown {
    position: absolute;
    top: calc(100% + 0.15rem);
    left: 50%;
    transform: translate(-50%, 0.4rem);
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 11rem;
    padding: 0.45rem;
    background: var(--dropdown-bg);
    border: 1px solid var(--dropdown-border);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}
.contact-dropdown a {
    padding: 0.55rem 0.7rem;
    font-size: 0.92rem;
    background: transparent;
    white-space: nowrap;
}
.contact-dropdown a:hover,
.contact-dropdown a:focus-visible {
    background: rgba(63, 62, 62, 0.08);
    color: #fff;
}
.nav-item.menu-open .contact-dropdown,
.nav-item:hover .contact-dropdown,
.nav-item:focus-within .contact-dropdown {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate(-50%, 0);
}
@media (hover: none), (pointer: coarse) {
    .nav-item:hover .contact-dropdown,
    .nav-item:focus-within .contact-dropdown {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translate(-50%, 0.4rem);
    }
}
.nav-toggle {
    display: none;
    position: fixed;
    top: 3rem;
    right: 1.05rem;
    width: 42px;
    height: 42px;
    border: none;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border-radius: 0.2rem;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 999;
}
.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
    display: block;
    width: 20px;
    height: 2px;
    background: #fff;
    border-radius: 1px;
    position: relative;
}
.nav-toggle span::before,
.nav-toggle span::after {
    content: "";
    position: absolute;
    left: 0;
}
.nav-toggle span::before {
    top: -6px;
}
.nav-toggle span::after {
    top: 6px;
}
.nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.901);
    z-index: 19;
    overflow-y: auto;
    padding: 2rem 1.25rem;
}
.nav-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
}
body.nav-open .site-nav {
    display: none !important;
}
.nav-overlay .overlay-nav {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    max-width: 420px;
    text-align: center;
    padding: 1rem 0;
}
.nav-overlay .overlay-nav .nav-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}
.nav-overlay .overlay-nav .nav-item > a {
    display: flex;
    align-items: center;
    justify-content: center;
}
.nav-overlay .overlay-nav a {
    color: #fff;
    text-decoration: none;
    font-size: 1.15rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    padding: 0.85rem 0.75rem;
    border-radius: 0.15rem;
    background: transparent;
    transition: 0.15s ease, transform 0.15s ease;
}
.overlay-nav a:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}
.nav-overlay .overlay-nav a:focus {
    transform: translateY(-1px);
}
@media (max-width: 820px) {
    nav {
        background-color: transparent;
    }
    .site-nav .site-title {
        margin-right: 0;
        padding-left: 0;
        text-align: center;
        width: 100%;
        justify-content: center;
    }
    .nav-overlay .site-title,
    .overlay-nav .site-title {
        margin-right: 0;
        padding-left: 0;
        text-align: center;
        width: auto;
        justify-content: center;
    }
    .nav-toggle {
        display: flex;
    }
    .site-nav {
        display: none;
    }
}

/* ---------- About ---------- */
#about-section {
    position: relative;
    width: 100%;
    background-color: rgba(24, 24, 24, 1);
    color: rgb(224, 224, 224);
    padding: 2em 1.5rem 5rem;
    box-sizing: border-box;
    scroll-snap-align: none;
}
.about-inner {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
}
.about-copy {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}
.about-text {
    width: 100%;
}
.about-image-wrapper {
    width: 50%;
}
/* Raise the About portrait to match the music player's offset look */
#about-section .section-image {
    margin-top: -1.90rem;
}
.recmix-player-wrapper {
    width: 100%;
}

/* ---------- Section titles / text / images ---------- */
.section-title {
    font-family: "Montserrat", sans-serif;
    font-size: clamp(1.5em, 4vw, 2em);
    line-height: 1.6;
    margin: 0 0 1em 0;
    max-width: 800px;
    box-sizing: border-box;
    opacity: 0;
    transform: translateY(1rem);
    animation: fadeIn 0.8s ease forwards;
}
.section-text {
    font-family: "Montserrat", sans-serif;
    font-weight: 200;
    line-height: 1.6;
    margin: 0 0 1em 0;
    max-width: 800px;
    box-sizing: border-box;
    opacity: 0;
    transform: translateY(1rem);
    animation: fadeIn 0.8s ease forwards;
    animation-delay: 0.1s;
}
.section-image {
    max-width: 100%;
    max-height: 700px;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* ---------- Image grid hover ---------- */
.image-grid img:hover,
.image-grid img:focus-visible {
    transform: scale(1.02);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
    outline: none;
}

/* ---------- Lightbox ---------- */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.92);
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    box-sizing: border-box;
}
.lightbox.active {
    display: flex;
}
.lightbox-content {
    position: relative;
    width: min(100%, 1000px);
    max-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 40px;
    box-sizing: border-box;
}
.lightbox-img {
    max-width: calc(100vw - 120px);
    max-height: calc(80vh - 40px);
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    border-radius: 0.2rem;
}
.lightbox-caption {
    margin-top: 0.95rem;
    color: #eee;
    text-align: center;
    font-size: 0.95rem;
    line-height: 1.5;
    max-width: min(100%, 760px);
    word-break: break-word;
}
.lightbox-close {
    position: fixed;
    top: 20px;
    right: 40px;
    z-index: 2500;
    font-size: 40px;
    color: white;
    background: transparent;
    border: none;
    outline: none;
    cursor: pointer;
    font-weight: bold;
    transition: color 0.3s;
    line-height: 1;
    padding: 0.25rem 0.5rem;
}
.lightbox-close:hover {
    color: #ccc;
}
.lightbox-close:focus {
    outline: none;
}
.lightbox-controls {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2500;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 1rem;
    box-sizing: border-box;
    pointer-events: none;
}
.lightbox-nav {
    pointer-events: auto;
    background: transparent;
    border: none;
    color: white;
    font-size: 40px;
    cursor: pointer;
    padding: 1.25em;
    transition: color 0.3s;
    line-height: 1;
}
.lightbox-nav:hover {
    color: #ccc;
}
.lightbox-nav:disabled {
    opacity: 0;
    cursor: default;
    pointer-events: none;
}
@media (max-width: 2150px) {
    .lightbox {
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        padding-top: 20px;
    }
    .lightbox-content {
        padding: 20px 20px 10px;
        width: 100%;
        box-sizing: border-box;
    }
    .lightbox-img {
        max-width: calc(80vw - 40px);
        max-height: calc(60vh - 40px);
    }
    .lightbox-nav {
        font-size: 32px;
        padding: 1em;
    }
    .lightbox-close {
        top: 10px;
        right: 10px;
        font-size: 32px;
    }
}
@media (max-height: 520px) and (orientation: landscape) {
    .lightbox {
        padding: 0;
        justify-content: center;
    }
    .lightbox-content {
        width: 80vw;
        height: 80vh;
        max-height: 80vh;
        padding: 0;
    }
    .lightbox-img {
        max-width: 90vw;
        max-height: 90vh;
        width: auto;
        height: auto;
    }
    .lightbox-caption {
        margin-top: 0.4rem;
        font-size: 0.85rem;
    }
}
body.lightbox-open {
    overflow: hidden;
}

/* ---------- Poster grid ---------- */
.poster-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem 8.5rem;
    justify-content: center;
    align-items: flex-start;
    margin: 0 auto;
    padding: 0;
}
.poster-grid img {
    width: 100%;
    max-width: 450px; /* cap poster width */
    height: auto; /* maintain aspect ratio */
    object-fit: contain;
    flex: 1 0 330px;
    border-radius: 0.2rem;
    display: block;
    cursor: pointer;
    transition: transform 0.2s;
}
.poster-grid img:hover {
    transform: scale(1.02);
}

/* ---------- Social links ---------- */
.social-links {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    gap: 12px;
    align-items: center;
}

/* ---------- Buttons / links ---------- */
.back-to-top {
    display: inline-block;
    align-self: flex-start;
    width: auto;
    max-width: none;
    text-decoration: none;
    color: inherit;
    font-family: "Montserrat", sans-serif;
    font-weight: 200;
    margin-top: 0;
    padding: 0.6rem 1rem;
    background-color: rgb(40, 40, 40);
    color: rgb(224, 224, 224);
    border-radius: 1px;
    border: 1px solid rgb(150, 150, 150);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transition: transform 0.12s ease, background-color 0.12s ease, box-shadow 0.12s ease;
    font-weight: 500;
    letter-spacing: 0.2px;
    margin-top: 0.5rem;
    cursor: pointer;
}
.section-link {
    display: inline-block;
    align-self: flex-start;
    width: auto;
    max-width: none;
    text-decoration: none;
    color: inherit;
    font-family: "Montserrat", sans-serif;
    font-weight: 200;
    margin-top: 0;
    padding: 0.6rem 1rem;
    background-color: rgb(40, 40, 40);
    color: rgb(224, 224, 224);
    border-radius: 1px;
    border: 1px solid rgb(150, 150, 150);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transition: transform 0.12s ease, background-color 0.12s ease, box-shadow 0.12s ease;
    font-weight: 500;
    letter-spacing: 1px;
    margin-top: 0.5rem;
    cursor: pointer;
}
.section-link:hover,
.back-to-top:hover,
.section-link:focus,
.back-to-top:focus {
    background-color: #000;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
    color: #fff;
    text-decoration: none;
}

/* ---------- Showreel ---------- */
.showreel {
    text-align: center;
    display: flex;
}
.showreel video {
    width: 80%;
    height: auto;
}

/* ---------- Music player tweaks ---------- */
#music-player,
.music-player {
    width: auto;
    max-width: 600px;
    flex: 1 1 100%;
    box-sizing: border-box;
}
.music-player-title {
    text-wrap: wrap;
}
.music-player {
    white-space: nowrap;
    margin: -4rem 0 auto 1.75rem;
}
.track-box {
    display: flex;
    flex: 1;
    min-width: 0;
}
.track-info {
    min-width: 0;
}
.track-info h3,
.track-info p {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.track-list {
    margin-top: 0.5rem;
}
.track-btn {
    margin-left: 0.2rem;
}
/* Ensure progress bar and inner elements can expand
   without being constrained by parent max-widths */
.music-player .track-box,
.music-player .progress-bar {
    max-width: 400px;
    width: 100%;
}

/* ---------- Responsive: tablet / desktop ---------- */
@media (min-width: 900px) {
    .overlay-nav {
        background-color: transparent;
    }
    .about-inner {
        flex-direction: row;
        align-items: flex-start;
    }
    .about-copy {
        width: 55%;
    }
    .about-image-wrapper,
    .recmix-player-wrapper {
        width: 45%;
    }
    .section-image {
        margin: 0;
    }
}
#composition .about-inner {
    flex-direction: column;
    align-items: stretch;
}
#composition .about-inner .about-text,
#composition .about-inner > section {
    width: 100%;
}
#composition .showreel {
    aspect-ratio: 17 / 9;
    width: 100%;
    max-width: 1080px;
    min-width: 320;
    height: auto;
    display: block;
}

/* ---------- Responsive: mobile ---------- */
@media (max-width: 900px) {
    .site-header {
        padding-top: 1.6em;
        padding-bottom: 3em;
        min-height: 5rem;
        background-attachment: scroll;
    }
    .site-header h1 {
        font-size: clamp(1.6rem, 8vw, 2.2rem);
        padding-top: 0.5rem;
        margin-bottom: 0;
        line-height: 1.1;
        max-width: 100%;
        word-break: break-word;
    }
    .site-subheader {
        top: 0;
        left: 0;
        padding-top: 0rem;
        letter-spacing: 0.14em;
        font-size: clamp(0.9rem, 3.5vw, 1rem);
        max-width: 90%;
        margin: 0.5rem auto 0;
        white-space: normal;
    }
    .site-nav {
        display: none;
    }
    #mobile-hidden {
        display: none;
    }
    .nav-toggle {
        display: inline-flex;
        top: 12rem;
    }
    .site-nav a {
        text-align: center;
        padding: 0.55rem 0.55rem;
    }
    .about-inner {
        gap: 1rem;
    }
    #about-section {
        padding-top: 0rem;
        /* scroll snap is disabled on mobile */
        scroll-snap-align: none;
        scroll-snap-stop: normal;
    }
    /* Disable the native scroll-snap behavior on mobile */
    body {
        scroll-snap-type: none;
    }
    section,
    .snap-section,
    #about-section {
        scroll-snap-align: none;
        scroll-snap-stop: normal;
    }
    #music-production,
    #composition,
    #filmmaking {
        padding-top: 1rem;
    }
    #about-section,
    .splash-screen,
    section {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    /* Remove splash-screen spacer sections on mobile */
    #splash-screen1,
    #splash-screen2,
    #splash-screen3 {
        display: none;
    }
    .poster-grid {
        gap: 1rem;
        padding: 0;
    }
    .poster-grid img {
        max-width: 100%;
        flex: 1 1 100%;
    }
    .image-grid {
        display: flex;
        flex-wrap: wrap;
        gap: 0.75rem;
        justify-content: center;
    }
    .image-grid img {
        width: 100%;
        max-width: 100%;
        flex: 1 1 100%;
    }
    .section-title {
        font-size: clamp(1.5rem, 5vw, 1.8rem);
    }
    .section-text {
        font-size: 0.95rem;
    }
    .social-links {
        flex-wrap: wrap;
        justify-content: flex-start;
    }
    .social-icon {
        width: 36px;
        height: auto;
    }
}

/* ---------- Landscape / short-viewport tweaks ---------- */
@media (max-height: 520px) and (orientation: landscape) {
    body {
        letter-spacing: 0.4px;
    }
    .site-header {
        padding-top: 0.9em;
        padding-bottom: 1.4em;
        min-height: 4rem;
    }
    .site-header h1 {
        font-size: 1.7rem;
        padding-top: 0.15rem;
        line-height: 1.1;
    }
    .site-subheader {
        font-size: 0.9rem;
        letter-spacing: 0.08em;
        margin-top: 0.2rem;
    }
    .nav-toggle {
        top: 0.5rem;
        right: 0.75rem;
        width: 36px;
        height: 36px;
    }
    .nav-toggle span,
    .nav-toggle span::before,
    .nav-toggle span::after {
        width: 18px;
    }
    #about-section {
        padding: 0.4rem 1rem 2.5rem;
    }
    #music-production,
    #composition,
    #filmmaking {
        padding-top: 0.4rem;
    }
    section {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    .section-title {
        font-size: 1.5rem;
        margin-bottom: 0.5em;
        line-height: 1.3;
    }
    .section-text {
        font-size: 0.95rem;
        line-height: 1.5;
        margin-bottom: 0.6em;
    }
    #splash-screen1,
    #splash-screen2,
    #splash-screen3 {
        min-height: 3.5rem;
    }
    .about-inner {
        gap: 0.75rem;
    }
    .section-image {
        max-height: 42vh;
    }
    /* Keep the About image beside the text, scaled to fit the short landscape viewport */
    #about-section .about-inner {
        flex-direction: row;
        align-items: flex-start;
    }
    #about-section .about-copy {
        width: 55%;
    }
    #about-section .about-inner br {
        display: none;
    }
    #about-section .section-image {
        max-width: 100%;
        max-height: 60vh;
        width: auto;
        height: auto;
        object-fit: contain;
    }
    #composition .showreel {
        max-height: 80vh;
    }
    /* Apply the About-section treatment (text beside media, 55/45) */
    #composition .about-inner {
        flex-direction: row;
        align-items: flex-start;
    }
    #music-production .about-inner {
        flex-direction: column;
        align-items: flex-start;
    }
    #composition .about-text {
        flex: 0 0 55%;
        width: 55%;
    }
    #music-production .about-text,
    #filmmaking .about-text {
        font-size: 0.95rem;
    }
    #composition .about-inner > section {
        flex: 1 1 45%;
        width: 45%;
        max-width: 45%;
        min-width: 0;
        box-sizing: border-box;
    }
}

/* Keep the About image scaled down when the window is vertically
   too short to fit it, so it never overflows the viewport.
   Squeeze toward the top-right instead of top-left. */
@media (max-height: 1080px) {
    #about-section .section-image {
        max-height: 50vh;
        margin: -1.90rem 0 0 auto;
    }
}

/* ---------- Music player: small screens ---------- */
@media (max-width: 600px) {
    .play-btn {
        align-self: flex-start;
    }
    .track-box {
        flex-direction: column;
        gap: 0.5rem;
    }
    .track-info h3,
    .track-info p {
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
    }
    .progress-group {
        width: 100%;
    }
    .time-display {
        font-size: 0.9rem;
    }
    .track-btn {
        white-space: normal;
        text-align: left;
    }
    .track-item {
        display: flex;
        gap: 0.5rem;
        align-items: center;
    }
    .track-play-btn {
        flex: 0 0 auto;
    }
}
@media (max-width: 900px) {
    .music-player {
        margin: 0.5rem auto 1.75rem;
        padding: 0.75rem 1.25rem 1.25rem 1.25rem;
    }
    #music-production .about-inner {
        justify-content: center;
    }
    #music-player {
        width: 100%;
        max-width: 100%;
    }
}

/* ---------- View transition ---------- */
::view-transition-group(root) {
    animation-duration: 0.35s;
    animation-timing-function: ease;
}

/* Force-disable scroll snapping on any touch/coarse-pointer device */
@media (hover: none), (pointer: coarse) {
    html,
    body {
        scroll-snap-type: none !important;
        -webkit-scroll-snap-type: none !important;
    }
    section,
    .snap-section,
    #about-section {
        scroll-snap-align: none !important;
        scroll-snap-stop: normal !important;
        -webkit-scroll-snap-align: none !important;
        -webkit-scroll-snap-stop: normal !important;
    }
}
