/* Basic Setup */
body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    color: #536163;
    background-color: #ffffff;

    /* Layout Logic: Flexible height for mobile */
    min-height: 100vh;
    min-height: 100dvh;
    /* Modern mobile viewport unit */
    display: flex;
    flex-direction: column;

    /* Allow natural scrolling to prevent cut-off */
    overflow-y: auto;

    /* Prevent layout breaking on extremely narrow screens */
    min-width: 320px;
    overflow-x: hidden;
}

/* 
 * NOTE: Loader Styles (#loader-scene, .loading-bar, etc.) 
 * have been moved to index.html (Inline CSS) to prevent FOUC.
 */

/* Scene 2: Content */
#content-scene {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

/* Header Styles */
#header {
    /* Match Main Page Button Height (~4.5rem total) */
    padding: 1.25rem 2rem;
    min-height: 4.5rem;
    width: 100%;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    flex-shrink: 0;
}

.back-link {
    justify-self: start;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #536163;
    font-size: 0.9em;
    font-weight: 500;
    padding: 8px 16px;
    background-color: #E8F5F7;
    border-radius: 20px;
    transition: transform 0.2s ease, background-color 0.2s ease;
    white-space: nowrap;
}

.back-link:hover {
    transform: translateX(-3px);
    background-color: #dbeff2;
}

.page-title {
    justify-self: center;
    margin: 0;
    font-size: 1.5em;
    font-weight: 500;
    white-space: nowrap;
}

/* Embed Container */
#typeform-embed {
    flex: 1;
    width: 100%;
    /* Let the container grow naturally, but ensure min-height */
    min-height: 500px;
    border: none;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* FORCE iframe to fill container */
#typeform-embed iframe {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    /* Using absolute positioning to fill the flex parent */
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    display: block !important;
}

/* Target the wrapper div Typeform might create */
#typeform-embed>div {
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    flex: 1 !important;
}

/* Visibility State */
body.loaded #loader-scene {
    opacity: 0;
    pointer-events: none;
}

body.loaded #content-scene {
    opacity: 1;
    pointer-events: auto;
}

/* Mobile Adjustments */
@media (max-width: 600px) {
    #header {
        padding: 15px;
    }

    .back-link .text {
        display: none;
    }

    .back-link {
        padding: 8px;
        width: 36px;
        height: 36px;
        justify-content: center;
        border-radius: 50%;
    }

    .back-link .icon {
        font-size: 1.2em;
    }

    .page-title {
        font-size: 1.2em;
    }
}