/* ==========================================================================
   JOUR.DAY LANDING PAGE DESIGN SYSTEM (STRICT NO-PX POLICY)
   ========================================================================== */

/* Font Definitions */
@font-face {
    font-family: 'PicNic';
    src: url('assets/fonts/PicNic.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'BDOGrotesk';
    src: url('assets/fonts/BDOGrotesk-VF.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

/* Register custom animatable variables for gradient stops */
@property --stop-base {
    syntax: '<percentage>';
    inherits: true;
    initial-value: 80%;
}

@property --stop-base-soft {
    syntax: '<percentage>';
    inherits: true;
    initial-value: 90%;
}

/* Custom Properties (Variables) */
:root {
    /* Brand Colors */
    --color-green-flash: #9FFFC4;
    --color-nutrition: #FFFF00;
    --color-activity: #CCEBFF;
    --color-sleep: #070B34;
    --color-base: #FFFFFF;
    --color-base-soft: #F7F1EA;
    --color-base-dark: #5C5B4B;

    /* Theme-specific custom variables */
    --font-family-display: 'PicNic', system-ui, sans-serif;
    --font-family-body: 'BDOGrotesk', system-ui, sans-serif;

    /* Transitions */
    --transition-speed-smooth: 0.8s;

    /* Gradient stop color variables */
    --stop-base: 80%;
    --stop-base-soft: 90%;
}

/* Base resets & structural styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden; /* Prevent page scrolling entirely */
}

body {
    background-color: var(--color-base);
    font-family: var(--font-family-body);
    font-size: 0.75rem; /* Standard text size */
    color: var(--color-base-dark);
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Contain all elements */
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
}

/* Ambient rising background glow */
body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(circle at 50% 200%, var(--color-nutrition) 45%, var(--color-base) var(--stop-base), var(--color-base-soft) var(--stop-base-soft));
    z-index: -1;
    pointer-events: none;
    transform-origin: bottom center;
    opacity: 1; /* Default state once animation ends/class is removed */
}

body.play-intro::before {
    opacity: 0;
    animation: expandBg 2.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Header styling */
#site-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: flex-start; /* Align contents to top */
    padding: 1rem; /* Uniform vertical and horizontal padding */
    gap: 2rem; /* Column gap space between header elements */
    z-index: 10;
    opacity: 1; /* Default state */
    transform: translateY(0); /* Default state */
}

body.play-intro #site-header {
    opacity: 0;
    transform: translateY(-0.5rem);
    animation: fadeInHeader 1.2s cubic-bezier(0.16, 1, 0.3, 1) 2.2s forwards;
}

.header-text {
    font-size: 0.75rem; /* Matches footer */
    font-weight: 350; /* Light styling, no bold */
    letter-spacing: -0.01em;
    color: var(--color-base-dark);
    opacity: 0.7;
    text-transform: lowercase;
}

#brand-title {
    text-align: left;
    max-width: 50%;
}

/* Vision paragraph area inside header */
#vision-section {
    width: 20rem; /* Fixed width */
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
}

#vision-card {
    background: none;
    border: none;
    padding: 0;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-radius: 0;
    width: 100%;
}

#vision-paragraph {
    font-family: var(--font-family-body);
    font-size: inherit; /* Inherits body size */
    font-weight: 350;
    line-height: 1.6;
    letter-spacing: -0.005em;
    color: var(--color-base-dark);
    text-align: left; /* Left-aligned text */
}

#vision-paragraph .highlight {
    font-weight: 600;
    color: var(--color-sleep);
}

/* Main Content styling */
#main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1rem 5vw;
    z-index: 5;
}

/* Animated Words & Logo Hero Area */
#hero-words-section {
    height: 50vh; /* Taller hero section to accommodate larger logo */
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

#animation-viewport {
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: visible;
    height: 100%;
    width: 100%;
    position: relative;
}

/* Hero Logo (inline SVG styled dynamically) */
#brand-logo {
    width: 80vw; /* Responsive large width */
    height: auto;
    max-width: 90%; /* Max container constraint */
    color: var(--color-green-flash);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-speed-smooth) ease, visibility var(--transition-speed-smooth) ease;
    position: absolute;
    display: block;
}

/* Animated word display styling */
#animated-word {
    font-family: var(--font-family-display);
    font-size: 15vw; /* Refined display typography */
    line-height: 0.9; /* Tight line height for large letters */
    max-width: 90vw; /* Ensures text wraps rather than extending past screen */
    padding-bottom: 15%; /* Shifts animated word up to center it better */
    color: var(--color-base-soft);
    text-align: center;
    user-select: none;
    letter-spacing: -0.01em;
    display: inline-block;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-speed-smooth) ease, visibility var(--transition-speed-smooth) ease;
    position: absolute;
}

/* Intro-specific animations */
body.play-intro #hero-words-section.state-logo #brand-logo {
    opacity: 0;
    visibility: visible;
    animation: fadeInLogo 1.5s cubic-bezier(0.16, 1, 0.3, 1) 0.8s forwards;
}

body.play-intro #hero-words-section.state-logo #animated-word {
    opacity: 0;
    visibility: hidden;
}

/* Standard state representation after intro finishes */
body:not(.play-intro) #hero-words-section.state-logo #brand-logo {
    opacity: 1;
    visibility: visible;
}

body:not(.play-intro) #hero-words-section.state-logo #animated-word {
    opacity: 0;
    visibility: hidden;
}

body:not(.play-intro) #hero-words-section.state-words #brand-logo {
    opacity: 0;
    visibility: hidden;
}

body:not(.play-intro) #hero-words-section.state-words #animated-word {
    opacity: 1;
    visibility: visible;
}

/* Animation classes triggered during word change transitions */
#animated-word.word-exit {
    animation: slideOutUp var(--transition-speed-smooth) cubic-bezier(0.77, 0, 0.175, 1) forwards;
}

#animated-word.word-enter {
    animation: slideInUp var(--transition-speed-smooth) cubic-bezier(0.77, 0, 0.175, 1) forwards;
}

/* Keyframe Animations */
@keyframes slideInUp {
    0% {
        opacity: 0;
        transform: translateY(2rem) scale(0.95);
        filter: blur(0.5rem);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

@keyframes slideOutUp {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-2rem) scale(1.05);
        filter: blur(0.5rem);
    }
}

/* Footer Section styling */
#site-footer {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem; /* Uniform vertical and horizontal padding */
    margin-top: auto;
    z-index: 10;
    opacity: 1; /* Default state */
    transform: translateY(0); /* Default state */
}

body.play-intro #site-footer {
    opacity: 0;
    transform: translateY(0.5rem);
    animation: fadeInFooter 1.2s cubic-bezier(0.16, 1, 0.3, 1) 2.2s forwards;
}

.footer-text {
    font-size: 0.75rem; /* Matches header */
    font-weight: 350;
    letter-spacing: -0.01em;
    color: var(--color-base-dark);
    opacity: 0.7;
}

#footer-launch {
    text-align: left;
    text-transform: lowercase;
}

#footer-copyright {
    text-align: right;
}

/* Intro Animations Keyframes */
@keyframes expandBg {
    0% {
        opacity: 0;
        --stop-base: 0%;
        --stop-base-soft: 0%;
    }
    100% {
        opacity: 1;
        --stop-base: 80%;
        --stop-base-soft: 90%;
    }
}

@keyframes fadeInLogo {
    0% {
        opacity: 0;
        transform: scale(0.95);
        filter: blur(0.5rem);
    }
    100% {
        opacity: 1;
        transform: scale(1);
        filter: blur(0);
    }
}

@keyframes fadeInHeader {
    0% {
        opacity: 0;
        transform: translateY(-0.5rem);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInFooter {
    0% {
        opacity: 0;
        transform: translateY(0.5rem);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive adjustments */
@media (max-width: 48rem) {
    #site-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    #brand-title {
        max-width: 100%;
    }
    
    #vision-section {
        width: 100%;
        max-width: 100%;
    }
    
    #hero-words-section {
        height: 40vh;
    }
    
    #site-footer {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }
    
    #footer-launch, #footer-copyright {
        text-align: center;
    }
}
