/*
 * Homepage "Upcoming medical congresses" carousel: each congress is a delegate badge, the pass every doctor
 * wears at a congress. A navy specialty band with a lanyard slot, the congress name set large, a perforated
 * tear line, then its dates, place and rooms. Each badge hangs from a short yellow lanyard; hovering it tugs it
 * down a few pixels. The whole badge links to the congress page; the band and the place names keep their own
 * links. Tokens follow the site: navy #333d4c, yellow #fddd01, Nunito.
 *
 * Every badge has the same height: the stub is fixed and each text block is clamped, so the perforation and
 * its notches line up across the row without JavaScript.
 */

.TopCongressesSection {
    --badge-navy: #333d4c;
    --badge-yellow: #fddd01;
    --badge-yellow-deep: #f2cc00;
    --badge-ink: #1f2733;
    --badge-muted: #6b7484;
    --badge-perforation: #d5dae2;
    --badge-page: #fff;
    --badge-stub-height: 178px;
    --badge-notch: 9px;
}

/*
 * Section header: a text link to the full conference list sits before the arrows. Phones drop the arrows, since
 * they swipe and get the carousel's dots, which leaves room for the link next to a two-line title.
 */
.TopCongressesSection .cgBadgesAll {
    display: inline-block;
    margin-right: 14px;
    color: var(--badge-navy);
    font-size: 14px;
    font-weight: 700;
    line-height: 36px;
    vertical-align: top;
    white-space: nowrap;
}

.TopCongressesSection .cgBadgesAll:hover {
    text-decoration: underline;
}

@media (max-width: 666px) {
    .TopCongressesSection .carouselControls .controlBtn {
        display: none;
    }

    .TopCongressesSection .cgBadgesAll {
        margin-right: 0;
    }
}

/*
 * Before the carousel starts, lay the badges out the way it will: one row, as many per row as its breakpoints
 * show, each slide carrying the 15px gutter on its right. Without this the eight badges stack into a tall
 * column that collapses when the script runs, shifting everything below. tiny-slider adds .tns-slider once
 * it has started, which ends these rules.
 */
.TopCongressesSection .TopCongresses:not(.tns-slider) {
    display: flex;
    overflow: hidden;
    margin-right: -15px;
}

.TopCongressesSection .TopCongresses:not(.tns-slider) > .item {
    flex: 0 0 100%;
    padding-right: 15px;
}

@media (min-width: 667px) {
    .TopCongressesSection .TopCongresses:not(.tns-slider) > .item {
        flex-basis: 50%;
    }
}

@media (min-width: 900px) {
    .TopCongressesSection .TopCongresses:not(.tns-slider) > .item {
        flex-basis: 33.3333%;
    }
}

@media (min-width: 1023px) {
    .TopCongressesSection .TopCongresses:not(.tns-slider) > .item {
        flex-basis: 25%;
    }
}

/*
 * The carousel frame hides overflow, so nothing here may reach sideways past a slide. Depth comes from a hairline
 * that traces the badge (notches included) and a ground shadow narrower than the badge, under it. All movement
 * is vertical, into the slide's own top and bottom padding.
 */
.TopCongressesSection .item {
    padding-top: 36px;
    padding-bottom: 32px;
}

/*
 * Holds the badge, its lanyard and its ground shadow. The hairline is a filter here, on the parent: the badge's
 * mask cuts the notches and would clip any shadow drawn on the badge itself.
 */
.TopCongressesSection .cgBadgeHang {
    position: relative;
    isolation: isolate;
    width: calc(100% - 2px);
    max-width: 340px;
    margin: 0 auto;
    filter: drop-shadow(0 0 0.6px rgba(31, 39, 51, 0.4));
}

/* The lanyard: a yellow strap with stitched edges that fades upwards, ending in the badge's slot. */
.TopCongressesSection .cgBadgeHang::before {
    content: "";
    position: absolute;
    top: -36px;
    left: 50%;
    z-index: 2;
    width: 16px;
    height: 48px;
    margin-left: -8px;
    border-radius: 1px;
    background: linear-gradient(90deg, var(--badge-yellow-deep) 10%, var(--badge-yellow) 10% 90%, var(--badge-yellow-deep) 90%);
    -webkit-mask: linear-gradient(to bottom, transparent, #000 22px);
    mask: linear-gradient(to bottom, transparent, #000 22px);
}

.TopCongressesSection .cgBadgeHang::after {
    content: "";
    position: absolute;
    left: 30px;
    right: 30px;
    bottom: -6px;
    z-index: -1;
    height: 26px;
    border-radius: 50%;
    background: rgba(31, 39, 51, 0.28);
    opacity: 0.75;
    filter: blur(9px);
}

.TopCongressesSection .cgBadge {
    position: relative;
    overflow: hidden;
    border-radius: 14px;
    background: var(--badge-page);
    -webkit-mask:
        radial-gradient(circle var(--badge-notch) at 0 var(--badge-stub-height), transparent 97%, #000) left / 51% 100% no-repeat,
        radial-gradient(circle var(--badge-notch) at 100% var(--badge-stub-height), transparent 97%, #000) right / 51% 100% no-repeat;
    mask:
        radial-gradient(circle var(--badge-notch) at 0 var(--badge-stub-height), transparent 97%, #000) left / 51% 100% no-repeat,
        radial-gradient(circle var(--badge-notch) at 100% var(--badge-stub-height), transparent 97%, #000) right / 51% 100% no-repeat;
}

/* Stub: specialty band, then the congress name, set large the way a badge sets its wearer's name. */

.TopCongressesSection .cgBadgeStub {
    display: flex;
    flex-direction: column;
    height: var(--badge-stub-height);
}

/* The band is tall enough to hold the lanyard slot above the specialty name, so a long name never runs under it. */
.TopCongressesSection .cgBadgeBand {
    position: relative;
    z-index: 1;
    display: block;
    height: 46px;
    padding: 23px 18px 0;
    overflow: hidden;
    background: var(--badge-navy);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 16px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.TopCongressesSection .cgBadgeBand:hover {
    color: var(--badge-yellow);
}

.TopCongressesSection .cgBadgeBand::before {
    content: "";
    position: absolute;
    top: 9px;
    left: 50%;
    width: 38px;
    height: 7px;
    margin-left: -19px;
    border-radius: 4px;
    background: var(--badge-page);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.45);
}

/* The name block starts at the same height on every badge, so names line up across the row. */
.TopCongressesSection .cgBadgeWho {
    padding: 18px 18px 0;
}

.TopCongressesSection .cgBadgeTitle {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    font-size: 24px;
    font-weight: 800;
    line-height: 28px;
    letter-spacing: -0.01em;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.TopCongressesSection .cgBadgeTitle a {
    color: var(--badge-ink);
    outline: none;
}

/* The title link covers the whole badge, so a click anywhere opens the congress. */
.TopCongressesSection .cgBadgeTitle a::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: 14px;
}

/* An inset ring, because the badge's mask would clip an outline. */
.TopCongressesSection .cgBadgeTitle a:focus-visible::after {
    box-shadow: inset 0 0 0 3px var(--badge-navy);
}

.TopCongressesSection .cgBadgeName {
    display: -webkit-box;
    margin: 6px 0 0;
    overflow: hidden;
    color: var(--badge-muted);
    font-size: 13px;
    line-height: 20px;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Body: the tear line, then when and where. */

/* The body stays unpositioned so the title's stretched link measures against the whole badge. */
.TopCongressesSection .cgBadgeBody {
    padding: 18px;
}

.TopCongressesSection .cgBadge::after {
    content: "";
    position: absolute;
    top: calc(var(--badge-stub-height) - 1px);
    left: calc(var(--badge-notch) + 6px);
    right: calc(var(--badge-notch) + 6px);
    border-top: 2px dashed var(--badge-perforation);
}

.TopCongressesSection .cgBadgeDates {
    margin: 0;
    color: var(--badge-ink);
    font-size: 15px;
    font-weight: 700;
    line-height: 22px;
}

.TopCongressesSection .cgBadgeWhen {
    margin: 2px 0 0;
    color: var(--badge-muted);
    font-size: 13px;
    line-height: 20px;
}

.TopCongressesSection .cgBadgePlace {
    margin: 10px 0 0;
    overflow: hidden;
    color: var(--badge-ink);
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.TopCongressesSection .cgBadgePlace a {
    position: relative;
    z-index: 1;
    color: inherit;
}

.TopCongressesSection .cgBadgePlace a:hover {
    text-decoration: underline;
}

.TopCongressesSection .cgBadgeFoot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
}

.TopCongressesSection .cgBadgeCounts {
    color: var(--badge-muted);
    font-size: 13px;
    line-height: 20px;
}

.TopCongressesSection .cgBadgeCounts strong {
    color: var(--badge-ink);
    font-weight: 700;
}

.TopCongressesSection .cgBadgeArrow {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--badge-yellow);
    color: var(--badge-ink);
    font-size: 13px;
}

.TopCongressesSection .cgBadgeHang:hover .cgBadgeArrow,
.TopCongressesSection .cgBadgeHang:focus-within .cgBadgeArrow {
    background: var(--badge-yellow-deep);
}

/* Hover tugs the badge down on its lanyard: it springs a little past its rest point and the ground shadow tightens. */
@media (prefers-reduced-motion: no-preference) {
    .TopCongressesSection .cgBadgeHang {
        transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    .TopCongressesSection .cgBadgeHang::after {
        transition: transform 0.45s ease, opacity 0.45s ease;
    }

    .TopCongressesSection .cgBadgeArrow i {
        transition: transform 0.2s ease;
    }

    .TopCongressesSection .cgBadgeHang:hover,
    .TopCongressesSection .cgBadgeHang:focus-within {
        transform: translateY(5px);
    }

    .TopCongressesSection .cgBadgeHang:hover::after,
    .TopCongressesSection .cgBadgeHang:focus-within::after {
        transform: translateY(-5px) scaleX(0.9);
        opacity: 1;
    }

    .TopCongressesSection .cgBadgeHang:hover .cgBadgeArrow i,
    .TopCongressesSection .cgBadgeHang:focus-within .cgBadgeArrow i {
        transform: translateX(3px);
    }
}
