/* ==========================================================================
   AUTO VIBES — Master Stylesheet (Side Spotify Song Preview Widget)
   Single-page 100vh Canvas Experience
   ========================================================================== */

/* 1. COLOR PALETTE & DESIGN TOKENS */
:root {
    --bg-yellow: #FFD95A;
    --sun-cream: #FFEAA5;
    --text-dark: #101820;
    --auto-green: #159B5A;
    --auto-yellow: #FFC928;
    --pink-btn: #F45182;
    --white: #FFFFFF;
    --black-outline: #111111;
    --cyan-dot: #159B5A;
    --blue-vibe: #3B82F6;
    --orange-vibe: #FF9F29;

    /* Typography */
    --font-heading: 'Baloo 2', cursive, sans-serif;
    --font-body: 'Fredoka', cursive, sans-serif;
}

/* 2. STRICT 100VH PAGE CANVAS */
html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: var(--bg-yellow);
    font-family: var(--font-body);
    color: var(--text-dark);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    user-select: none;
    touch-action: manipulation;
}

.page {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-sizing: border-box;
    overflow: hidden;
    background-color: var(--bg-yellow);
}

/* Background City Skyline Layer (using assets/city.png) */
.skyline-bg {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 38vh;
    pointer-events: none;
    z-index: 1;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    overflow: hidden;
}

.skyline-img {
    width: 100%;
    max-width: 1400px;
    height: 100%;
    object-fit: contain;
    object-position: bottom center;
    opacity: 0.65;
}

/* FLOATING SIDE SPOTIFY SONG PREVIEW WIDGET */
.side-spotify-widget {
    position: fixed;
    right: 20px;
    top: 20px;
    z-index: 200;
    width: 340px;
    max-width: calc(100vw - 32px);
    background-color: var(--white);
    border: 3.5px solid var(--black-outline);
    border-radius: 18px;
    box-shadow: 0 6px 0px var(--black-outline);
    padding: 10px;
    box-sizing: border-box;
    transition: transform 0.3s ease, opacity 0.3s ease;
    animation: sideWidgetFloat 4s ease-in-out infinite alternate;
}

.side-spotify-widget.active-playing {
    border-color: var(--black-outline);
    box-shadow: 0 0 24px rgba(21, 155, 90, 0.75), 0 8px 0px var(--black-outline);
    animation: sideWidgetPulse 1.5s infinite alternate;
}

.widget-header.playing {
    background-color: var(--auto-green);
    color: var(--white);
}

.widget-header {
    background-color: var(--auto-yellow);
    color: var(--text-dark);
    border: 2px solid var(--black-outline);
    border-radius: 10px;
    padding: 4px 10px;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 13px;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.widget-icon {
    font-size: 15px;
}

.spotify-iframe {
    width: 100%;
    height: 152px;
    border-radius: 12px;
    border: none;
    display: block;
}

/* 3. CENTERED CONTENT CONTAINER (94vh, min 90vw / max 660px) */
.content {
    width: min(90vw, 660px);
    height: 94vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 10;
    box-sizing: border-box;
    padding: 4px 0;
}


/* SECTION 1: TOP AUTO (Height ~24%) */
.top-auto-section {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 24%;
}

/* Warm Soft Circular Sun Aura & Outer Pulsing Ring */
.sun-aura {
    position: absolute;
    width: 225px;
    height: 225px;
    background-color: var(--sun-cream);
    border-radius: 50%;
    z-index: 1;
    opacity: 0.85;
}

.sun-ring {
    position: absolute;
    width: 250px;
    height: 250px;
    border: 2.5px dashed rgba(255, 201, 40, 0.45);
    border-radius: 50%;
    z-index: 1;
    animation: sunRingSpin 20s linear infinite;
}

.top-auto-box {
    position: relative;
    z-index: 2;
    animation: topAutoBounce 2.5s ease-in-out infinite alternate;
}

/* ENLARGED TOP AUTO */
.top-auto-img {
    width: 215px;
    max-width: 52vw;
    height: auto;
    display: block;
    object-fit: contain;
    filter: drop-shadow(0 9px 3px rgba(16, 24, 32, 0.1));
}

/* Headlight Glow Effects */
.headlight-glow {
    position: absolute;
    width: 26px;
    height: 26px;
    background: radial-gradient(circle, rgba(255,245,160,0.85) 0%, rgba(255,245,160,0) 70%);
    border-radius: 50%;
    top: 54%;
    pointer-events: none;
    z-index: 3;
    animation: glowPulse 2s infinite alternate;
}

.left-glow { left: 15%; }
.right-glow { right: 15%; }

/* 8 LARGE SCATTERED MUSIC & SPARKLE DOODLES */
.doodle-notes {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 4;
}

.note {
    position: absolute;
    font-weight: 900;
    user-select: none;
    filter: drop-shadow(0 4px 0px rgba(16, 24, 32, 0.12));
}

.note.n1 { left: 10%; top: 6%; font-size: 38px; color: var(--text-dark); animation: noteFloat 2.8s ease-in-out infinite alternate; }
.note.n2 { left: 2%; top: 38%; font-size: 44px; color: var(--pink-btn); animation: noteFloat 2.4s ease-in-out infinite alternate 0.3s; }
.note.n3 { left: 14%; top: 72%; font-size: 36px; color: var(--blue-vibe); animation: noteFloat 3.1s ease-in-out infinite alternate 0.6s; }
.note.n4 { right: 10%; top: 4%; font-size: 36px; color: var(--text-dark); animation: noteFloat 2.6s ease-in-out infinite alternate 0.2s; }
.note.n5 { right: 2%; top: 35%; font-size: 46px; color: var(--pink-btn); animation: noteFloat 3.3s ease-in-out infinite alternate 0.5s; }
.note.n6 { right: 12%; top: 68%; font-size: 38px; color: var(--auto-green); animation: noteFloat 2.7s ease-in-out infinite alternate 0.4s; }
.note.n7 { right: 24%; top: 12%; font-size: 28px; color: var(--auto-yellow); animation: sparkleSpin 3s ease-in-out infinite alternate; }
.note.n8 { left: 24%; top: 16%; font-size: 26px; color: var(--pink-btn); animation: heartPulse 2s infinite ease-in-out; }


/* SECTION 2: MAIN LOGO STICKER (Height ~25%) */
.logo-section {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 25%;
}

.logo-doodles {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.logo-note {
    position: absolute;
    font-size: 36px;
    filter: drop-shadow(0 4px 0px rgba(16, 24, 32, 0.12));
}

.ln-left { left: 6%; top: 25%; animation: noteFloat 2.5s ease-in-out infinite alternate; }
.ln-right { right: 6%; top: 20%; animation: noteFloat 2.9s ease-in-out infinite alternate 0.4s; }

.logo-sparkle {
    position: absolute;
    font-size: 26px;
    color: var(--orange-vibe);
}

.sp-1 { left: 14%; top: 8%; animation: sparkleSpin 2.5s infinite alternate; }
.sp-2 { right: 14%; top: 65%; animation: sparkleSpin 3s infinite alternate 0.5s; }

.logo-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 4;
}

.logo-sticker-img {
    width: 335px;
    max-width: 80vw;
    height: auto;
    display: block;
    object-fit: contain;
    filter: drop-shadow(0 8px 0px rgba(16, 24, 32, 0.08));
    animation: logoWiggle 3.8s ease-in-out infinite alternate;
}


/* SECTION 3: TAGLINE PILL (Height ~7%) */
.tagline-section {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 7%;
}

.tagline-pill {
    background-color: var(--white);
    color: var(--text-dark);
    border: 3.5px solid var(--black-outline);
    border-radius: 30px;
    padding: 8px 24px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.2px;
    box-shadow: 0 4.5px 0px var(--black-outline);
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.pill-dec {
    display: flex;
    align-items: center;
    gap: 3px;
}

.dash-green {
    display: block;
    width: 11px;
    height: 4px;
    background-color: var(--auto-green);
    border-radius: 2px;
}

.dash-yellow {
    display: block;
    width: 11px;
    height: 4px;
    background-color: var(--auto-yellow);
    border-radius: 2px;
}


/* SECTION 4: AUDIO VISUALIZER (Height ~8%) */
.visualizer-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 8%;
    max-width: 460px;
}

.vis-dots {
    color: var(--auto-green);
    font-size: 17px;
    letter-spacing: 2px;
    font-weight: 900;
    opacity: 0.85;
    user-select: none;
}

.waveform {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 36px;
    flex-grow: 1;
}

.waveform span {
    display: block;
    width: 3.5px;
    height: 6px;
    min-height: 4px;
    max-height: 32px;
    border-radius: 6px;
    background-color: var(--auto-green);
    transition: height 0.08s ease-out;
}

/* Idle Bell-Curve Animation Profile prior to audio play */
.waveform.idle span {
    animation: barPulse 1.2s ease-in-out infinite alternate;
}

/* Bell curve height mapping for 30 bars */
.waveform.idle span:nth-child(1), .waveform.idle span:nth-child(30) { height: 5px; }
.waveform.idle span:nth-child(2), .waveform.idle span:nth-child(29) { height: 7px; }
.waveform.idle span:nth-child(3), .waveform.idle span:nth-child(28) { height: 9px; }
.waveform.idle span:nth-child(4), .waveform.idle span:nth-child(27) { height: 13px; }
.waveform.idle span:nth-child(5), .waveform.idle span:nth-child(26) { height: 16px; }
.waveform.idle span:nth-child(6), .waveform.idle span:nth-child(25) { height: 19px; }
.waveform.idle span:nth-child(7), .waveform.idle span:nth-child(24) { height: 22px; }
.waveform.idle span:nth-child(8), .waveform.idle span:nth-child(23) { height: 25px; }
.waveform.idle span:nth-child(9), .waveform.idle span:nth-child(22) { height: 27px; }
.waveform.idle span:nth-child(10), .waveform.idle span:nth-child(21) { height: 29px; }
.waveform.idle span:nth-child(11), .waveform.idle span:nth-child(20) { height: 32px; }
.waveform.idle span:nth-child(12), .waveform.idle span:nth-child(19) { height: 29px; }
.waveform.idle span:nth-child(13), .waveform.idle span:nth-child(18) { height: 26px; }
.waveform.idle span:nth-child(14), .waveform.idle span:nth-child(17) { height: 23px; }
.waveform.idle span:nth-child(15), .waveform.idle span:nth-child(16) { height: 30px; }

.waveform.idle span:nth-child(3n) { animation-duration: 0.9s; animation-delay: 0.1s; }
.waveform.idle span:nth-child(4n) { animation-duration: 1.4s; animation-delay: 0.3s; }
.waveform.idle span:nth-child(5n) { animation-duration: 1.1s; animation-delay: 0.2s; }
.waveform.idle span:nth-child(7n) { animation-duration: 0.8s; animation-delay: 0.4s; }


/* SECTION 5: BOTTOM DRIVING AUTO WITH ASSETS/SMOKE.PNG (Height ~18%) */
.bottom-auto-section {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 18%;
}

.driving-doodles {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.drive-note {
    position: absolute;
    font-size: 32px;
    filter: drop-shadow(0 3px 0px rgba(16, 24, 32, 0.12));
}

.dn1 { left: 16%; top: 5%; color: var(--pink-btn); animation: noteFloat 2.3s ease-in-out infinite alternate; }
.dn2 { right: 16%; top: 10%; color: var(--blue-vibe); animation: noteFloat 2.7s ease-in-out infinite alternate 0.5s; }

.driving-auto-box {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: autoDriveMotion 2.2s ease-in-out infinite alternate;
}

.bottom-auto-img {
    width: 215px;
    max-width: 50vw;
    height: auto;
    display: block;
    object-fit: contain;
    filter: drop-shadow(0 6px 0px rgba(16, 24, 32, 0.08));
    position: relative;
    z-index: 2;
}

/* Speed Lines behind Driving Auto */
.speed-lines {
    position: absolute;
    right: -20px;
    top: 35%;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 3;
}

.speed-lines span {
    display: block;
    width: 20px;
    height: 3.5px;
    background-color: var(--black-outline);
    border-radius: 2px;
}

.speed-lines span:nth-child(2) { width: 28px; }
.speed-lines span:nth-child(3) { width: 16px; }

/* Smoke Trail from assets/smoke.png */
.smoke-trail-box {
    position: absolute;
    bottom: 15px;
    right: -85px;
    pointer-events: none;
    z-index: 1;
}

.smoke-img {
    width: 95px;
    height: auto;
    display: block;
    object-fit: contain;
    transform-origin: left bottom;
    animation: smokePuffPulse 1.8s infinite ease-out;
}


/* SECTION 6: INTERACTION BUTTON (Continuous Music) */
.button-section {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-bottom: 8px;
}

.tap-start-btn {
    background-color: var(--pink-btn);
    color: var(--white);
    border: 3.5px solid var(--black-outline);
    border-radius: 40px;
    padding: 12px 32px;
    font-family: var(--font-heading);
    font-size: 19px;
    font-weight: 800;
    letter-spacing: 0.8px;
    box-shadow: 0 6px 0px var(--black-outline);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transform: scale(1);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.3s ease;
    animation: btnPulse 2s infinite ease-in-out;
}

.tap-start-btn:hover {
    transform: scale(1.04);
    box-shadow: 0 8px 0px var(--black-outline);
}

.tap-start-btn:active {
    transform: scale(0.96);
    box-shadow: 0 2px 0px var(--black-outline);
}



.btn-note {
    font-size: 24px;
}


/* SECTION 7: LOADING INDICATOR (Height ~7%) */
.loading-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    height: 7%;
}

.loading-text {
    font-size: 13px;
    letter-spacing: 3px;
    font-weight: 700;
    color: var(--text-dark);
}

.loading-dots {
    display: inline-flex;
    gap: 6px;
}

.loading-dots .dot {
    color: var(--auto-green);
    font-size: 20px;
    line-height: 1;
    animation: dotFade 1.4s infinite ease-in-out;
}

.loading-dots .dot.d1 { animation-delay: 0s; }
.loading-dots .dot.d2 { animation-delay: 0.3s; }
.loading-dots .dot.d3 { animation-delay: 0.6s; }


/* 4. KEYFRAME ANIMATIONS */

/* Side Widget Float */
@keyframes sideWidgetFloat {
    0% { transform: translateY(0); }
    100% { transform: translateY(-6px); }
}

/* Top Auto tiny bounce (5-8px) */
@keyframes topAutoBounce {
    0% { transform: translateY(-5px); }
    100% { transform: translateY(5px); }
}

/* Sun Ring Spin */
@keyframes sunRingSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Headlight Glow Pulse */
@keyframes glowPulse {
    0% { opacity: 0.4; transform: scale(0.9); }
    100% { opacity: 0.95; transform: scale(1.15); }
}

/* Subtle logo sticker float */
@keyframes logoWiggle {
    0% { transform: rotate(-1deg) scale(1); }
    100% { transform: rotate(1deg) scale(1.02); }
}

/* Scattered music notes float */
@keyframes noteFloat {
    0% { transform: translateY(0) rotate(-10deg); opacity: 0.8; }
    100% { transform: translateY(-12px) rotate(10deg); opacity: 1; }
}

/* Sparkle Spin */
@keyframes sparkleSpin {
    0% { transform: scale(0.8) rotate(0deg); opacity: 0.7; }
    100% { transform: scale(1.2) rotate(45deg); opacity: 1; }
}

/* Heart Pulse */
@keyframes heartPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.25); }
}

/* Waveform bar idle pulse */
@keyframes barPulse {
    0% { transform: scaleY(0.7); }
    100% { transform: scaleY(1.25); }
}

/* Driving auto horizontal motion */
@keyframes autoDriveMotion {
    0% { transform: translateX(-10px); }
    100% { transform: translateX(10px); }
}

/* Smoke trail pulse animation */
@keyframes smokePuffPulse {
    0% { transform: scale(0.88) translate(0, 0); opacity: 0.75; }
    50% { transform: scale(1.1) translate(5px, -3px); opacity: 1; }
    100% { transform: scale(0.88) translate(0, 0); opacity: 0.75; }
}

/* Button pulse */
@keyframes btnPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

/* Sequential loading dots fade */
@keyframes dotFade {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.3); }
}


/* 5. RESPONSIVE DESIGN (< 960px Viewports) */
@media (max-width: 960px) {
    .side-spotify-widget {
        position: fixed;
        right: 12px;
        top: 12px;
        width: 250px;
        transform: scale(0.85);
        transform-origin: top right;
    }
}

@media (max-width: 600px) {
    .page {
        overflow: hidden;
        position: relative;
    }

    .content {
        width: 94vw;
        height: 98vh;
        padding: 2px 0;
    }

    .top-auto-section {
        height: 22%;
    }

    .top-auto-img {
        width: 132px;
    }

    .sun-aura {
        width: 140px;
        height: 140px;
    }

    .sun-ring {
        width: 155px;
        height: 155px;
    }

    .logo-section {
        height: 24%;
    }

    .logo-sticker-img {
        width: 250px;
    }

    .note {
        font-size: 24px !important;
    }

    .tagline-section {
        height: 6%;
    }

    .tagline-pill {
        font-size: 13px;
        padding: 5px 14px;
    }

    .visualizer-section {
        height: 7%;
    }

    .vis-dots {
        display: none;
    }

    .bottom-auto-section {
        height: 18%;
    }

    .bottom-auto-img {
        width: 150px;
    }

    .smoke-img {
        width: 60px;
    }

    .smoke-trail-box {
        right: -50px;
        bottom: 10px;
    }

    .button-section {
        height: 12%;
    }

    .tap-start-btn {
        padding: 9.5px 22px;
        font-size: 16px;
    }

    .left-btn-accent, .right-btn-accent {
        display: none;
    }

    .loading-section {
        height: 5%;
    }

    .loading-text {
        font-size: 10px;
        letter-spacing: 2px;
    }

    /* Spotify Song Widget Positioned Directly ABOVE the Waveform Visualizer on Mobile */
    .side-spotify-widget {
        display: block;
        position: relative;
        right: auto;
        top: auto;
        left: auto;
        z-index: 100;
        width: 100%;
        max-width: 300px;
        margin: 2px auto 4px auto;
        background-color: var(--white);
        border: 3px solid var(--black-outline);
        border-radius: 14px;
        box-shadow: 0 4px 0px var(--black-outline);
        padding: 5px;
        box-sizing: border-box;
        transform: none;
        animation: none;
    }

    .widget-header {
        padding: 3px 8px;
        font-size: 11px;
        letter-spacing: 0.5px;
        margin-bottom: 4px;
        border-radius: 8px;
        border-width: 1.5px;
    }

    .widget-icon {
        font-size: 13px;
    }

    .spotify-iframe {
        height: 80px;
        border-radius: 8px;
    }
}

/* 6. ACCESSIBILITY: PREFERS REDUCED MOTION */
@media (prefers-reduced-motion: reduce) {
    *,
    ::before,
    ::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
