/* Main styles for Malina Malina website */

/* Font Face Declaration */
@font-face {
    font-family: 'Questrial-Regular';
    src: url('../fonts/Questrial/Questrial-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
    /* Ensures text remains visible during font load */
}

/* CSS Custom Properties */
:root {
    --primary-bg: linear-gradient(to bottom, #EC6578, #F23D42);
    --text-primary: #DEC0D2;
    --audio-player-primary: #000;
    --font-main: 'Questrial-Regular', 'Arial', sans-serif;
    --section-height: 110vh;
}

/* Base Reset and Typography */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    color: var(--text-primary);
    line-height: 1.4;
    overflow-x: hidden;
    background: var(--primary-bg);
    background-attachment: fixed;
}

/* Main Title Typography */
.main-title {
    font-family: var(--font-main);
    font-size: clamp(3.3rem, 8.8vw, 6.6rem);
    /* font-weight: bold; */
    color: var(--text-primary);
    line-height: 1.0;
    letter-spacing: -0.02em;
    margin: 0;
    padding: 2rem 0 1rem 2rem;
    text-transform: none;
    word-spacing: 0.1em;
}

/* Font Loading States and Error Handling */
.font-loading .main-title {
    visibility: hidden;
}

.font-loaded .main-title,
.font-failed .main-title {
    visibility: visible;
}

/* Fallback styling when custom font fails to load */
.font-failed .main-title {
    font-family: Arial, sans-serif;
    font-weight: 900;
    /* Compensate for missing custom font weight */
}

/* Main Section Layout */
.main-section {
    height: var(--section-height);
    background: transparent;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: height 0.3s ease;
}

/* Scroll-down hint (section 1 → section 2) */
.scroll-down-arrow {
    position: fixed;
    left: 50%;
    bottom: 2rem;
    z-index: 10;
    transform: translateX(-50%) translateY(0.5rem);
    border: none;
    background: none;
    color: #fff;
    cursor: pointer;
    padding: 0.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.scroll-down-arrow.is-visible {
    opacity: 0.8;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.scroll-down-arrow-icon {
    display: block;
    width: 3.5rem;
    height: 3.5rem;
}

.scroll-down-arrow:hover,
.scroll-down-arrow:focus-visible {
    outline: none;
    opacity: 0.65;
}

/* Section 1: content area with title at bottom */
#section-1 {
    display: flex;
    flex-direction: column;
    background-color: #DEC0D2;
}

#section-1 .title-area {
    width: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    flex: 0 0 auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    position: relative;
    z-index: 2;
    overflow: hidden;
}

#section-1 .main-title {
    width: max-content;
    display: inline-block;
    white-space: nowrap;
    text-align: left;
    padding: 0 1.5rem;
    margin: 0;
    line-height: 1;
    will-change: transform;
    transform: translateX(-90%) translateY(0.2em);
}

#section-1 .content-container {
    width: 100%;
    flex: 1;
    position: relative;
    display: block;
    min-height: 0;
}

/* Other sections maintain original layout */
#section-3 .content-container {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: 40% 60%;
    grid-template-rows: 1fr;
    gap: 0;
    transition: grid-template-columns 0.3s ease, grid-template-rows 0.3s ease;
}

.left-content {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 0;
    height: 100%;
    overflow: hidden;
}

#section-1 .section-1-audio {
    position: absolute;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 3;
    width: min(520px, 58vw);
    min-width: 300px;
    height: auto;
    justify-content: flex-end;
    align-items: stretch;
    overflow: visible;
    pointer-events: none;
}

#section-1 .section-1-audio .audio-player-area,
#section-1 .section-1-audio .audio-player {
    pointer-events: auto;
    width: 100%;
}

#section-1 .section-1-audio .audio-player {
    max-width: 100%;
}

#section-1 .section-1-audio .audio-player-area {
    flex: 0 0 auto;
    align-items: stretch;
    justify-content: flex-end;
    padding: 0;
    margin-top: 0;
}

#section-1 .section-1-audio .track-item {
    width: 100%;
}

#section-1 .section-1-audio .progress-container {
    flex: 0 0 auto;
    width: 15%;
    max-width: 15%;
    min-width: 1.5rem;
}

#section-1 .right-content {
    position: static;
    width: 100%;
    height: 100%;
    overflow: visible;
}

#section-1 .visual-composition {
    position: static;
    overflow: visible;
}

#section-1 .composition-video-wrap {
    width: 60%;
    max-width: 60%;
    min-width: 800px;
}

.audio-player-area {
    flex: 1;
    display: flex;
    align-items: flex-start;
    padding: 1rem 2rem;
    min-height: 0;
}

.right-content {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    height: 100%;
    overflow: hidden;
}

/* Responsive Design Breakpoints */

/* Desktop Layout (> 1024px) */
@media (min-width: 1025px) {
    #section-1 .main-title {
        font-size: clamp(3.025rem, 10.45vw, 11rem);
        padding: 0 2rem;
        font-weight: 100;
        color: #fff;
    }

    #section-1 .section-1-audio {
        bottom: 2rem;
        right: 0rem;
    }
}

/* Tablet Layout (768px - 1024px) - Adjusted proportions */
@media (min-width: 768px) and (max-width: 1024px) {
    #section-1 .main-title {
        font-size: clamp(2.42rem, 10.45vw, 6.05rem);
        padding: 0 1.5rem;
        line-height: 1;
    }

    #section-1 .section-1-audio {
        bottom: 1.5rem;
        right: 1.5rem;
        width: min(480px, 62vw);
        min-width: 280px;
    }
}

/* Mobile Layout (< 768px) - Vertical stacking */
@media (max-width: 767px) {
    #section-1 .content-container {
        min-height: calc(var(--section-height) - 80px);
    }

    #section-1 {
        height: auto;
        min-height: var(--section-height);
        padding: 1rem 0 0;
    }

    #section-1 .right-content {
        height: 60vh;
        min-height: 400px;
    }

    #section-1 .composition-video-wrap {
        width: 80%;
        max-width: 80%;
        min-width: 0;
    }

    #section-1 .main-title {
        font-size: clamp(2.09rem, 12.65vw, 4.29rem);
        padding: 0 1rem;
    }

    #section-1 .section-1-audio {
        bottom: 1rem;
        right: 1rem;
        width: min(100%, calc(100% - 2rem));
        min-width: 0;
    }

    #section-1 .section-1-audio .track-list {
        width: 100%;
        margin: 0;
    }

    #section-1 .section-1-audio .progress-container {
        min-width: 1rem;
    }
}

/* Small Mobile Layout (< 480px) - Further optimizations */
@media (max-width: 479px) {
    #section-1 {
        padding: 0.5rem 0 0;
    }

    #section-1 .section-1-audio {
        right: 0.5rem;
        bottom: 0.75rem;
    }

    #section-1 .section-1-audio .progress-container {
        max-width: none;
    }

    #section-1 .main-title {
        font-size: clamp(1.815rem, 13.75vw, 3.63rem);
        padding: 0 0.5rem;
        line-height: 1;
    }

    #section-1 .right-content {
        height: 50vh;
        min-height: 300px;
    }
}

/* 
Prevent layout shifts and ensure smooth responsive transitions */
.left-content,
.right-content {
    transition: all 0.3s ease;
}

/* Ensure proper aspect ratio maintenance across breakpoints */
@media (orientation: landscape) and (max-width: 767px) {
    #section-1 {
        min-height: 100vh;
    }

    #section-1 .right-content {
        height: 70vh;
        min-height: 350px;
    }
}

@media (orientation: portrait) and (max-width: 767px) {
    #section-1 .right-content {
        height: 50vh;
        min-height: 300px;
        width: 100%;
    }

}

/* High DPI display optimizations */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
    .main-title {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Loading overlay styles */
#loading-overlay {
    font-family: var(--font-main);
}

#loading-progress {
    border-radius: 2px;
}

#loading-progress-fill {
    border-radius: 2px;
}

/* Accessibility improvements for reduced motion */
@media (prefers-reduced-motion: reduce) {

    .content-container,
    .main-section,
    .left-content,
    .right-content {
        transition: none;
    }

    #section-1 .title-area {
        justify-content: center;
    }

    #section-1 .main-title {
        transform: none;
        will-change: auto;
    }

    /* Disable loading animations for users who prefer reduced motion */
    #loading-progress-fill {
        transition: none;
    }

    .track-item.loading .play-icon {
        animation: none;
    }
}

/* Section 2 Styles */
#section-2 {
    background-color: black;
    height: auto;
    min-height: var(--section-height);
    overflow: visible;
}

#section-2 .content-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5.5rem;
    padding: 7.5rem 3rem 5.5rem 3rem;
    height: auto;
}

.text-content {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
    width: 100%;
    max-width: 62rem;
    color: #1e1e1e
}

.text-content.animate-in {
    opacity: 1;
    transform: translateX(0);
}

.description-text {
    font-family: var(--font-main);
    font-size: clamp(2.0rem, 2.5vw, 1.5rem);
    line-height: 1.1;
    color: var(--text-primary);
    margin: 0;
    text-align: left;
}

#section-2 .image-container:not(.slideshow) {
    width: 100%;
    max-width: 42rem;
    display: flex;
    justify-content: center;
    transform: translateX(-20%);
}

.section-image {
    max-width: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
}

/* Section 2 Responsive Design */
@media (max-width: 767px) {
    #section-2 .content-container {
        gap: 3rem;
        padding: 4.5rem 1rem 4rem;
    }

    .description-text {
        font-size: clamp(1.2rem, 3vw, 1.1rem);
    }
}

@media (max-width: 479px) {
    #section-2 .content-container {
        gap: 2.5rem;
        padding: 3.5rem 0.5rem 3rem;
    }
}

/* Accessibility for reduced motion */
@media (prefers-reduced-motion: reduce) {
    .text-content {
        transition: none;
        opacity: 1;
        transform: translateX(0);
    }
}

/* Section 3 Styles */
#section-3 {
    background-color: black;
    height: auto;
}

#section-3 .content-container {
    display: grid;
    grid-template-columns: 40% 60%;
    height: 44vh;
    align-items: center;
    padding-top: 2rem;
}

#section-3 .section-3-video {
    display: flex;
    /* align-items: center; */
    justify-content: center;
    height: 100%;
    padding-top: 1.8rem;
    padding-right: 1rem;
}

#section-3 .video-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

#section-3 .section-3-video-element {
    width: 100%;
    height: 100%;
    object-fit: cover;
    mask: url('../assets/section 3 Mask White.png');
    -webkit-mask: url('../assets/section 3 Mask White.png');
    mask-size: cover;
    -webkit-mask-size: cover;
    mask-position: center;
    -webkit-mask-position: center;
    mask-repeat: no-repeat;
    -webkit-mask-repeat: no-repeat;
}

#section-3 .section-3-contact {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    height: 100%;
    padding-top: 1rem;
}

#section-3 .contact-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    align-items: flex-start;
}

#section-3 .contact-button {
    display: block;
    font-family: var(--font-main);
    font-size: 2rem;
    font-weight: bold;
    line-height: 1.15;
    color: var(--text-primary);
    text-decoration: none;
    text-align: left;
    margin: 0;
    padding: 0;
    border: none;
    border-bottom: 2px solid transparent;
    background: none;
    appearance: none;
    -webkit-appearance: none;
    transition: border-bottom-color 0.3s ease;
    cursor: pointer;
    box-sizing: border-box;
}

#section-3 .contact-button:hover {
    border-bottom-color: var(--text-primary);
}

/* Contact modal */
.contact-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.contact-modal[hidden] {
    display: none;
}

.contact-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    cursor: pointer;
}

.contact-modal-dialog {
    position: relative;
    z-index: 1;
    max-width: min(420px, 92vw);
    padding: 2.5rem 2rem 2rem;
    background: #fff;
    color: var(--text-primary);
    text-align: center;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.contact-modal-close {
    position: absolute;
    top: 0.35rem;
    right: 0.5rem;
    z-index: 2;
    width: 2.25rem;
    height: 2.25rem;
    border: none;
    border-radius: 50%;
    background: none;
    color: var(--text-primary);
    font-size: 2.5rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.contact-modal-close:hover {
    opacity: 0.75;
}

.contact-modal-label {
    margin: 0 0 0.75rem;
    font-family: var(--font-main);
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.65;
}

.contact-modal-email {
    font-family: var(--font-main);
    font-size: 1.15rem;
    color: var(--text-primary);
    text-decoration: underline;
    word-break: break-all;
}

.contact-modal-email:hover {
    opacity: 0.75;
}

/* Rider modal */
.rider-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.rider-modal[hidden] {
    display: none;
}

.rider-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    cursor: pointer;
}

.rider-modal-dialog {
    position: relative;
    z-index: 1;
    max-width: min(920px, 92vw);
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rider-modal-image {
    display: block;
    max-width: 100%;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.rider-modal-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 2;
    width: 2.25rem;
    height: 2.25rem;
    border: none;
    border-radius: 50%;
    background: none;
    color: #000;
    font-size: 2.5rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rider-modal-close:hover {
    background: none;
    opacity: 0.75;
}

.rider-modal-download {
    position: absolute;
    right: 0.75rem;
    bottom: 0.75rem;
    z-index: 2;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.rider-modal-download:hover {
    background: #fff;
    transform: translateY(-1px);
}

.rider-download-icon {
    width: 1.25rem;
    height: 1.25rem;
}

/* Section 3 Responsive Design */
@media (max-width: 767px) {
    #section-3 .content-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        gap: 1rem;
        height: auto;
    }

    #section-3 .section-3-video {
        order: 1;
        height: 50vh;
        min-height: 300px;
        padding-top: 1rem;
    }

    #section-3 .video-container {
        height: 100%;
    }

    #section-3 .section-3-contact {
        order: 2;
        padding: 2rem 1rem;
        order: 0;
    }

    #section-3 {
        height: auto;
    }

    #section-3 .contact-buttons {
        align-items: center;
        gap: 0.4rem;
        flex-direction: row;

    }

    #section-3 .contact-button {
        font-size: 1.5rem;
    }
}

@media (max-width: 479px) {
    #section-3 .section-3-video {
        height: 40vh;
        min-height: 250px;
        padding: 0.5rem;
    }

    #section-3 .section-3-contact {
        padding: 1.5rem 0.5rem;
    }

    #section-3 .contact-button {
        font-size: 1.3rem;
    }
}