/**
 * Downloads Layout Styles
 * Headline, intro text, and a grid of file download cards.
 * Card colour follows the page colour family via the body class set by
 * ga26_add_color_body_class().
 */

.ga26-downloads {
    /* Palette per colour family:
       --ga26-downloads-light  LIGHT - file type badge, file size
       --ga26-downloads-dark   DARK  - card, section headline, download link */
    --ga26-downloads-light: #d0d0d0; /* Black/Grey */
    --ga26-downloads-dark: #000000;
    width: 100%;
    padding: 5vw;
}

body.menu-color-blue .ga26-downloads {
    --ga26-downloads-light: #00aeef;
    --ga26-downloads-dark: #0060af;
}

body.menu-color-purple .ga26-downloads {
    --ga26-downloads-light: #c6168d;
    --ga26-downloads-dark: #5c2e91;
}

body.menu-color-red .ga26-downloads {
    --ga26-downloads-light: #f15922;
    --ga26-downloads-dark: #a92b31;
}

body.menu-color-yellow .ga26-downloads {
    --ga26-downloads-light: #fcaf17;
    --ga26-downloads-dark: #dd5828;
}

body.menu-color-green .ga26-downloads {
    --ga26-downloads-light: #20bdbe;
    --ga26-downloads-dark: #006b6b;
}

.ga26-downloads__headline {
    font-family: 'Grack', sans-serif !important;
    margin: 0 auto 40px auto;
    text-align: center;
    font-weight: 500;
    font-size: 36px !important;
    line-height: 1.2em !important;
    text-transform: uppercase;
    max-width: 700px;
    color: var(--ga26-downloads-dark) !important;
}

/* Tighter gap when intro text follows; headline-only keeps the 40px above */
.ga26-downloads__headline--has-intro {
    margin-bottom: 20px;
}

.ga26-downloads__intro {
    max-width: 800px;
    margin: 0 auto 60px auto;
    text-align: center;
}

.ga26-downloads__intro p {
    font-family: 'Noto Serif', serif !important;
    font-style: normal;
    font-weight: 400;
    font-size: 26px;
    letter-spacing: -.15px;
    line-height: 1.4em;
    margin: 0 0 20px 0;
}

.ga26-downloads__intro p:last-child {
    margin-bottom: 0;
}

.ga26-downloads__intro a {
    text-decoration: underline;
}

/* !important on the list resets beats Divi's content ul styles */
.ga26-downloads__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    max-width: 1400px;
    margin: 0 auto !important;
    padding: 0 !important;
    list-style: none !important;
}

.ga26-downloads__item {
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

/* The whole card is the link */
.ga26-downloads__card {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    height: 100%;
    min-height: 220px;
    padding: 30px;
    border-radius: 32px; /* Matches the other card layouts */
    background-color: var(--ga26-downloads-dark);
    color: #fff;
    text-decoration: none;
}

.ga26-downloads__card:focus-visible {
    outline: 3px solid #000;
    outline-offset: 3px;
}

/* File type and size share a row; baseline alignment keeps the size level
   with the badge text rather than the badge box */
.ga26-downloads__details {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 12px;
}

/* File type badge - LIGHT box, white lettering */
.ga26-downloads__type {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 8px;
    background-color: var(--ga26-downloads-light);
    font-family: 'Cachet Pro', sans-serif;
    font-size: 18px;
    line-height: 1;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: #fff;
}

.ga26-downloads__title {
    margin: 0 !important;
    padding: 0 !important;
    font-family: 'Grack', sans-serif !important;
    font-size: 28px !important;
    font-weight: 300 !important;
    line-height: 1.2em !important; /* Spacing matches the Grack 300 nav items */
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #fff !important;
    overflow-wrap: anywhere; /* Long unbroken labels stay inside the card */
}

/* margin-top:auto pins the row to the card's bottom edge, so it lines up
   across a grid row regardless of label length */
.ga26-downloads__meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-sizing: border-box;
    width: 100%;
    margin-top: auto;
    /* White box, as .ga26-connection-cards__video on the Connection page.
       Icon and label take the card colour (DARK) via currentColor. */
    padding: 10px 15px;
    border-radius: 12px;
    background-color: #fff;
    font-family: 'Cachet Pro', sans-serif;
    font-size: 18px;
    line-height: 1;
    letter-spacing: -.5px;
    text-transform: uppercase;
    color: var(--ga26-downloads-dark);
}

.ga26-downloads__card:hover .ga26-downloads__action,
.ga26-downloads__card:focus-visible .ga26-downloads__action {
    text-decoration: underline;
}

/* Same type treatment as the badge text so the two sit on one baseline */
.ga26-downloads__size {
    font-family: 'Cachet Pro', sans-serif;
    font-size: 18px;
    line-height: 1;
    letter-spacing: .5px;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--ga26-downloads-light);
}

.ga26-downloads__icon {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    display: block;
}

/* Read by screen readers, hidden on screen (e.g. "opens in a new tab") */
.ga26-downloads__sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Stroked circle and arrow, both following the text colour */
.ga26-downloads__icon circle,
.ga26-downloads__icon polyline,
.ga26-downloads__icon line {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

/* Tablet: step the intro down before the mobile rules take over at 768px */
@media only screen and (max-width: 980px) {
    .ga26-downloads__intro p {
        font-size: 18px !important;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .ga26-downloads {
        padding: 10%;
    }

    .ga26-downloads__headline {
        margin: 40px auto 20px auto;
    }

    .ga26-downloads__intro {
        margin-bottom: 40px;
    }

    .ga26-downloads__grid {
        grid-template-columns: 1fr;
        gap: 5vw;
    }

    .ga26-downloads__card {
        min-height: 0;
        padding: 25px;
        border-radius: 15px; /* Matches the mobile card radius */
    }

    .ga26-downloads__title {
        font-size: 22px !important;
    }

    .ga26-downloads__type,
    .ga26-downloads__size,
    .ga26-downloads__meta {
        font-size: 16px;
    }

    .ga26-downloads__icon {
        width: 22px;
        height: 22px;
    }
}
