/*
 * The running advent calendar around the site (Redmine #44658): the band and the corner reminder of the home page,
 * the badge and the card of its articles. Loaded after festive.css, which brings the green background with snow, the
 * ribbon, the headings and the button; the blog list only shows the badge, which does not need it. The menu pill is in
 * site-chrome.css.
 */

/* Band. The fixed "We bake with CakePHP" flag hangs over the right 80px of the window: on phones the tree sits
   on that side, from 560px the band keeps it free while its content reaches that far. */
.cdc-advent-band__inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 20px;
    align-items: end;
    padding-top: 24px;
    padding-bottom: 24px;
}

.cdc-advent-band__body {
    grid-row: 1;
    grid-column: 1;
}

.cdc-advent-band .cdc-advent-deco {
    grid-row: 1;
    grid-column: 2;
}

.cdc-advent-band__open {
    grid-column: 1 / -1;
}

.cdc-advent-band__title {
    padding: 0;
    font-size: clamp(22px, 3vw, 34px);
    line-height: 1.1;
}

.cdc-advent-band .cdc-advent__eyebrow {
    margin-bottom: 8px;
    font-size: 13px;
    line-height: 1.5;
}

.cdc-advent-band .cdc-advent__lead {
    margin-top: 10px;
    font-size: 16px;
    line-height: 1.5;
}

@media (min-width: 560px) {
    .cdc-advent-band__inner {
        grid-template-columns: auto minmax(0, 1fr);
        gap: 16px 32px;
        align-items: center;
        padding-top: 32px;
        padding-bottom: 32px;
    }

    .cdc-advent-band .cdc-advent-deco {
        grid-row: 1 / span 2;
        grid-column: 1;
    }

    .cdc-advent-band__body {
        grid-column: 2;
        align-self: end;
    }

    .cdc-advent-band__open {
        grid-column: 2;
        align-self: start;
        justify-self: start;
    }
}

@media (min-width: 560px) and (max-width: 1439px) {
    .cdc-advent-band__inner {
        padding-right: 100px;
    }
}

@media (min-width: 992px) {
    .cdc-advent-band__inner {
        grid-template-columns: auto minmax(0, 1fr) auto;
        column-gap: 40px;
    }

    .cdc-advent-band .cdc-advent-deco,
    .cdc-advent-band__body,
    .cdc-advent-band__open {
        grid-row: 1;
        align-self: center;
    }

    .cdc-advent-band__open {
        grid-column: 3;
    }
}

/* Below 992px the hero is hidden and the band is the first thing on the page: start under the fixed menu, which is
   taller where its items do not fit on one line (up to 363px, and from 889 to 935px) */
@media (max-width: 991px) {
    .cdc-advent-band {
        margin-top: 68px;
    }
}

@media (max-width: 363px) {
    .cdc-advent-band {
        margin-top: 112px;
    }
}

@media (min-width: 768px) and (max-width: 888px) {
    .cdc-advent-band {
        margin-top: 97px;
    }
}

@media (min-width: 889px) and (max-width: 935px) {
    .cdc-advent-band {
        margin-top: 145px;
    }
}

@media (min-width: 936px) and (max-width: 991px) {
    .cdc-advent-band {
        margin-top: 75px;
    }
}

/* Decorative tree, the same in the band and in the card */
.cdc-advent-deco {
    --orn: 11px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: center;
}

@media (min-width: 560px) {
    .cdc-advent-deco {
        --orn: 20px;
        gap: 7px;
    }
}

.cdc-advent-deco__star {
    width: 0;
    height: 0;
    border-right: calc(var(--orn) * .4) solid transparent;
    border-bottom: calc(var(--orn) * .65) solid var(--adv-gold);
    border-left: calc(var(--orn) * .4) solid transparent;
    filter: drop-shadow(0 0 6px rgba(240, 194, 94, .7));
}

.cdc-advent-deco__row {
    display: flex;
    gap: calc(var(--orn) * .28);
}

.cdc-advent-deco__ornament {
    position: relative;
    width: var(--orn);
    height: var(--orn);
    border-radius: 50%;
    background: var(--adv-cream);
    box-shadow: inset calc(var(--orn) * -.08) calc(var(--orn) * -.11) 0 rgba(0, 0, 0, .12);
}

.cdc-advent-deco__ornament::before {
    content: "";
    position: absolute;
    top: -2px;
    left: 35%;
    width: 30%;
    height: 3px;
    border-radius: 1px;
    background: var(--adv-hook);
}

.cdc-advent-deco__ornament.is-lit {
    background: var(--adv-red);
}

.cdc-advent-deco__ornament.is-gold {
    background: var(--adv-gold);
}

/* Reminder: above the chat button and the reCAPTCHA badge, which take the bottom 125px of that corner */
.cdc-advent-reminder {
    --adv-green: #1d4a3a;
    --adv-red: #d33c43;
    --adv-red-deep: #b5303a;
    --adv-ink: #22323b;
    --adv-muted: #5f6b71;
    display: none;
    position: fixed;
    right: 20px;
    bottom: 140px;
    z-index: 9998;
    width: 260px;
    padding: 16px 18px 8px;
    border: 2px solid var(--adv-red);
    border-radius: 8px;
    background: #fff;
    color: var(--adv-ink);
    box-shadow: 0 16px 36px rgba(20, 45, 60, .2);
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* on phones the band is already at the top of the page, and the card would cover what they are reading */
@media (min-width: 768px) and (min-height: 560px) {
    .cdc-advent-reminder:not([hidden]) {
        display: block;
        animation: cdc-advent-reminder-in .28s cubic-bezier(.16, 1, .3, 1);
    }
}

@keyframes cdc-advent-reminder-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .cdc-advent-reminder:not([hidden]) {
        animation: none;
    }
}

.cdc-advent-reminder__eyebrow {
    margin: 0 32px 4px 0;
    color: var(--adv-red-deep);
    font-family: 'Raleway', sans-serif;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .1em;
    line-height: 1.4;
    text-transform: uppercase;
}

.cdc-advent-reminder__title {
    margin: 0 0 4px;
    color: var(--adv-ink);
    font-family: 'Raleway', sans-serif;
    font-size: 19px;
    font-weight: 800;
    letter-spacing: normal;
    line-height: 1.25;
}

.cdc-advent-reminder__text {
    margin: 0;
    color: var(--adv-muted);
    font-size: 14.5px;
    letter-spacing: normal;
    line-height: 1.5;
}

.cdc-advent-reminder__open {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    min-height: 44px;
    color: var(--adv-green);
    font-size: 14.5px;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.cdc-advent-reminder__open:hover,
.cdc-advent-reminder__open:focus {
    color: var(--adv-red-deep);
}

.cdc-advent-reminder__close {
    display: flex;
    position: absolute;
    top: 0;
    right: 0;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--adv-muted);
    cursor: pointer;
}

.cdc-advent-reminder__close:hover {
    color: var(--adv-red-deep);
}

.cdc-advent-reminder :focus-visible {
    outline: 3px solid var(--adv-green);
    outline-offset: -3px;
    border-radius: 6px;
}

/* Article: badge in the byline and, without a link, in the cards of the blog list */
.cdc-advent-badge {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    min-height: 30px;
    margin-top: 8px;
    padding: 4px 12px;
    border-radius: 999px;
    background: #1d4a3a;
    color: #fff;
    font-family: 'Raleway', sans-serif;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
    text-decoration: none;
    transition: background-color .15s cubic-bezier(.2, .7, .3, 1);
}

a.cdc-advent-badge:hover,
a.cdc-advent-badge:focus {
    background: #153a2d;
    color: #fff;
    text-decoration: none;
}

.cdc-advent-badge:focus-visible {
    outline: 3px solid var(--cdc-blue);
    outline-offset: 3px;
}

.cdc-advent-badge__day {
    color: #f0c25e;
    white-space: nowrap;
}

.cdc-meta + .cdc-advent-badge {
    align-self: flex-start;
    margin: 0 0 12px;
    vertical-align: top;
}

/* Article: card after the text, the band of the home page in the width of the column */
.cdc-advent-card {
    margin-top: 40px;
    border-radius: var(--cdc-radius, 14px);
}

.cdc-advent-card__inner {
    display: grid;
    grid-template-areas:
        "eyebrow tree"
        "text text"
        "open open";
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px 20px;
    align-items: center;
    padding: 20px;
}

.cdc-advent-card .cdc-advent-deco {
    grid-area: tree;
}

.cdc-advent-card .cdc-advent__eyebrow {
    grid-area: eyebrow;
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
}

.cdc-advent-card__text {
    grid-area: text;
    margin: 0;
    color: #fff;
    font-size: 16px;
    line-height: 1.55;
}

.cdc-advent-card__text a {
    color: #fff;
    font-weight: 700;
    text-decoration: underline;
    text-decoration-color: var(--adv-gold);
    text-underline-offset: 3px;
}

.cdc-advent-card__text a:hover,
.cdc-advent-card__text a:focus {
    color: var(--adv-gold);
}

.cdc-advent-card__open {
    grid-area: open;
}

@media (min-width: 560px) {
    .cdc-advent-card__inner {
        grid-template-areas:
            "tree eyebrow"
            "tree text"
            "tree open";
        grid-template-columns: auto minmax(0, 1fr);
        gap: 10px 32px;
        padding: 26px 28px;
    }

    .cdc-advent-card__open {
        justify-self: start;
        margin-top: 6px;
    }
}
