﻿/* ==========================================================================
   PAGE TEMPLATE: Split Story Panel - Right Form
   Load order:  LAST (after webforms.core.css and theme.css)
   Purpose:     Page structure only: containers, the two panels and the
                content in them. The look of the form itself (fields, buttons,
                toggles, section titles) belongs in the theme.
   Layout:      >= 992px:  story panel (left) beside the form panel (right).
                <  992px:  one column, in this order:
                           header image -> logo -> title and header content
                           -> form -> footer content
   Variables (defined inline on :root by CharityEngine):
       --app-theme-background-color         (story panel background)
       --app-theme-font-primary-color       (story panel text and title)
       --app-theme-header-background-color  (header image background)

   CONTENTS
     1. Base
     2. Page & app containers
     3. Two-panel layout
     4. Story panel
     5. Form panel
     6. Responsive
   ========================================================================== */


/* ==========================================================================
   1. BASE
   (The page font is set in the theme.)
   ========================================================================== */

body {
    margin: 0;
}


/* ==========================================================================
   2. PAGE & APP CONTAINERS
   ========================================================================== */

#pageContainer,
#ceApp-container,
#ceApp,
#formContainer {
    width: 100%;
    min-height: 100vh;
}

#ceApp-container {
    max-width: none;
    margin: 0;
    background-repeat: no-repeat;
    background-size: cover;
    background-attachment: fixed;
}

#ceApp {
    max-width: none;
    margin: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
}


/* ==========================================================================
   3. TWO-PANEL LAYOUT
   Two equal columns. Below 992px it becomes one column (see Responsive).
   ========================================================================== */

#layoutContainer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    min-height: 100vh;
}


/* ==========================================================================
   4. STORY PANEL
   Contains, in order: header image, logo, title, header content, footer content.
   ========================================================================== */

#storyPanel {
    background: var(--app-theme-background-color);
    color: var(--app-theme-font-primary-color);
}

/* Header image: 350px tall on wide screens, shrinking with the screen
   (38% of the screen width) down to a 160px minimum */
#headerImage {
    width: 100%;
    min-height: clamp(160px, 38vw, 350px);
    background-color: var(--app-theme-header-background-color);
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
}

#logoContainer {
    display: block;
    padding-top: 3rem;
}

#orgLogo {
    display: block;
    max-width: 250px;
    max-height: 85px;
    margin-inline: auto;
}

#layoutContentBox {
    margin-top: .5em;
}

#title {
    margin: 0 0 1.25rem;
    font-size: 24pt;
    text-align: center;
}

/* Header and footer content (entered in the app builder).
   --content-gutter is the total space on each side (margin + padding, split
   evenly): 96px from about 990px wide, shrinking evenly to 20px at 389px. */
.ce-contentContainer {
    --content-gutter: clamp(1.25rem, calc((100vw - 389px) * .126 + 20px), 6rem);
    margin: .25rem calc(var(--content-gutter) / 2);
    padding: .5rem calc(var(--content-gutter) / 2) 3rem;
    font-size: 1rem;
    line-height: 1.7;
}

#footerContent {
    margin-top: 0;
}

    #footerContent p:last-child {
        margin-bottom: 0;
    }

    /* An empty title or footer takes no space */
    #title:empty,
    #footerContent:empty {
        display: none;
    }


/* ==========================================================================
   5. FORM PANEL
   ========================================================================== */

#formPanel {
    background-color: white;
}

/* Side padding: 12px at 389px and below, growing with the screen to 64px */
#formPanelInner {
    max-width: 760px;
    margin: 0 auto;
    padding: 2.75rem clamp(0.1rem, calc((100vw - 389px) * .0577 + 12px), 4rem) 4rem;
}


/* ==========================================================================
   6. RESPONSIVE
   ========================================================================== */

/* Stacked (below 992px): one column, with the footer content BELOW the form.
   The footer sits inside the story panel, so the panel is dissolved
   (display: contents). That makes the header image, logo, title/header
   content, form panel and footer content direct grid items of
   #layoutContainer, and `order` can place them. The story panel's background
   and text color move to the container so those items keep them; the form
   panel keeps its own white background.
   align-content: start stops the rows stretching when the page is shorter
   than the screen. */
@media (max-width: 991px) {

    #layoutContainer {
        grid-template-columns: 1fr;
        align-content: start;
        background: var(--app-theme-background-color);
    }

    #storyPanel {
        display: contents;
    }

    #headerImage {
        order: 1;
    }

    #logoContainer {
        order: 2;
    }

    #layoutContentBox {
        order: 3;
    }

    #formPanel {
        order: 4;
    }

    #footerContent {
        order: 5;
    }

    #headerContent,
    #formPanelInner {
        padding-top: 2rem;
        padding-bottom: 2.5rem;
    }
}
