﻿/* ==========================================================================
   PAGE TEMPLATE: Overlay Card with Story - Right Form
   Load order:  LAST (after webforms.core.css and theme.css)
   Purpose:     Page structure only: container widths, logo, the box around
                the form, and the two-column layout. The look of the form
                itself (fonts, fields, buttons, toggles, section titles)
                belongs in the theme.
   Variables (defined inline on :root by CharityEngine):
       --app-theme-font-primary-color   (left column text)
       --app-theme-top-banner-height    (pushes the content column below the banner)

   CONTENTS
     1. Base
     2. Page & app containers
     3. Logo
     4. Two-column layout & title
     5. Responsive
   ========================================================================== */


/* ==========================================================================
   1. BASE
   (The page font is set in the theme.)
   ========================================================================== */

body {
    margin: 0;
}


/* ==========================================================================
   2. PAGE & APP CONTAINERS
   (#pageContainer and #topBanner are laid out as a grid by the inline style
   in page.html, so the banner sits behind #ceApp-container.)
   ========================================================================== */

#ceApp-container {
    /* min-width: 0 lets this grid item shrink to the screen. Without it, the
       grid's 1fr column (set inline in page.html) grows to fit the widest
       unshrinkable content inside the form and the whole page scrolls sideways. */
    min-width: 0;
    width: 100%;
    margin-inline: auto;
    padding-bottom: 50px;
    background-repeat: no-repeat;
    background-size: cover;
    background-attachment: fixed;
}

#ceApp {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}


/* ==========================================================================
   3. LOGO
   ========================================================================== */

#logoContainer {
    max-width: 200px;
    margin-top: 2.5rem;
    margin-inline: auto;
}

#orgLogoContainer {
    display: flex;
    align-items: center;
    height: 100px;
}

    #orgLogoContainer #orgLogo {
        max-width: 100%;
        max-height: 72px;
        height: auto;
    }

/* margin: auto centers the logo inside the flex container above */
#orgLogo {
    margin: auto;
    vertical-align: middle;
}


/* ==========================================================================
   4. TWO-COLUMN LAYOUT & TITLE
   >= 1140px: side by side.
              Left column:  title, header and footer content, pushed down
                            below the banner.
              Right column: the form box (white card), starting 40px from
                            the top.
   <  1140px: one column, in this order (see Responsive):
              title -> header content -> form box -> footer content
   ========================================================================== */

#layoutContainer {
    display: flex;
    flex-wrap: wrap;
    box-sizing: border-box;
    width: 100%;
    margin-inline: auto;
    padding-inline: clamp(0px, calc((100vw - 400px) * .0686), 12px);
}

#leftColumn {
    box-sizing: border-box;
    margin-top: var(--app-theme-top-banner-height);
    padding: 1.5rem 3rem 3rem;
    color: var(--app-theme-font-primary-color);
}

#rightColumn {
    box-sizing: border-box;
    margin-top: 40px;
    margin-inline: auto;
    padding: clamp(.75rem, 4vw, 1.5rem);
    background-color: white;
    box-shadow: 0 0 10px rgba(0, 0, 0, .5);
}

#title {
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 40px;
    font-weight: 600;
}


/* ==========================================================================
   5. RESPONSIVE (mobile first)
   ========================================================================== */

@media (min-width: 576px) {
    #layoutContainer {
        max-width: 540px;
    }
}

@media (min-width: 768px) {
    #layoutContainer {
        max-width: 720px;
    }
}

@media (min-width: 992px) {
    #layoutContainer {
        max-width: 1320px;
    }
}

/* Stacked (below 1140px): title and header content stay ABOVE the form box,
   footer content goes BELOW it.
   The title, header and footer content sit inside the left column, wrapped in
   #layoutContentBox > #leftContent. Dissolving all three (display: contents)
   makes the title, header and footer content direct flex items of
   #layoutContainer, so `order` can place them around the form box (#rightColumn,
   which holds the logo and the form). Because the left column itself no longer
   exists, its top margin (the banner offset) moves to the container's top
   padding, and its side padding moves to the text items.
   !important on the two wrappers: the theme script calls show() on the content
   box, which sets an inline display style. */
@media (max-width: 1139.98px) {

    /* Shorter banner on smaller screens: 350px (the value from page.html) down to
       about 780px wide, then shrinking with the screen to a 150px minimum.
       Setting it here changes the banner and the offset below it together. */
    #pageContainer {
        --app-theme-top-banner-height: clamp(150px, 45vw, 350px);
    }

    #layoutContainer {
        flex-direction: column;
        flex-wrap: nowrap;
        padding-top: var(--app-theme-top-banner-height);
    }

    #leftColumn {
        display: contents;
    }

    #layoutContentBox,
    #leftContent {
        display: contents !important;
    }

    #leftColumn #title {
        order: 1;
    }

    #leftColumn #headerContent {
        order: 2;
    }

    /* The form box: full width of the container */
    #rightColumn {
        order: 3;
        margin-inline: 0;
    }

    /* After the form (the Double the Donation container comes before the
       footer in the markup, so it stays just above it) */
    #leftColumn #dd-container,
    #leftColumn #footerContent {
        order: 4;
    }

    #leftColumn #footerContent {
        margin-top: 1.5rem;
    }

    /* Line the text up with the page gutter */
    #leftColumn #title,
    #leftColumn #headerContent,
    #leftColumn #footerContent {
        padding-inline: clamp(.75rem, 4vw, 3rem);
    }

        /* An empty title takes no space */
        #leftColumn #title:empty {
            display: none;
        }
}

/* Wide screens: content column (58%) beside the form box (42%) */
@media (min-width: 1140px) {
    #leftColumn {
        width: 58.33333333%;
    }

    #rightColumn {
        width: 41.66666667%;
    }
}
