/*
 * Students' Stories (/successstories/, archive-storypost.php) restyled after the new home page (MILESTONES #20).
 * The intro band, the counter, the college logos carousel, the registration and the headquarters are shared blocks
 * (site-components.css); here the list of stories ([shortcode_show_successstories_posts], the storypost posts in
 * template-parts/success_story_tpl.php) as cards. The home Results slides link to the stories by their id
 * (story-{ID}, Amerlink_Genesis_Home_Results::story_anchors()). The .students-stories-* rules of style-divi-child.css
 * are shared with the stories block of the old Divi home template and stay; the ones written for this archive only
 * (.post-type-archive-storypost, .success-stories-image-container, #success-stories) were removed.
 */

/* ---------- Intro band: the photo of this template has its own container (not #collage-sports-image). */

body.amg-skin #page-container #collage-sports .success-stories-image-container {
    position: relative;
    width: 100%;
    max-width: 50%;
    height: 100%;
    max-height: 500px;
    clip-path: polygon(185px 0%, 100% 0%, 100% 100%, 0% 100%);
}

body.amg-skin #page-container #collage-sports .success-stories-image-container .success-stories-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
}

/* Below 500px the other bands hide their photo (style_tymek.css, #collage-sports-image); this one squeezed the
   description into a narrow column next to a sliver of the photo. */
@media (max-width: 500px) {
    body.amg-skin #page-container #collage-sports .success-stories-image-container {
        display: none;
    }
}

/* ---------- Stories: one card each, the photo on alternate sides. */

body.amg-skin #page-container #success-stories {
    display: block;
    margin: 0;
    padding: clamp(40px, 4.6vw, 72px) 0 clamp(48px, 5vw, 80px);
    background: linear-gradient(180deg, var(--amg-soft-blue) 0%, var(--amg-soft) 50%, #fff 100%);
}

body.amg-skin #page-container #success-stories-inner {
    display: flex;
    flex-flow: column;
    gap: clamp(20px, 2.2vw, 32px);
    width: min(100% - 32px, 1100px);
    margin: 0 auto;
}

body.amg-skin #page-container #success-stories .students-stories-container {
    flex-flow: row nowrap;
    align-items: center;
    gap: clamp(24px, 3.4vw, 52px);
    max-width: none;
    height: auto;
    margin: 0;
    padding: clamp(24px, 3vw, 44px);
    border: 1px solid var(--amg-line);
    border-radius: var(--amg-radius-lg);
    background: #fff;
    box-shadow: var(--amg-shadow);
}

body.amg-skin #page-container #success-stories .students-stories-container:nth-child(2n) {
    flex-direction: row-reverse;
}

/* The header of the restyled pages is in the page flow, not fixed (Results added 120px for the fixed Divi header). */
body.amg-skin #page-container #success-stories .students-stories-container[id^='story-'] {
    scroll-margin-top: 24px;
}

body.amg-skin #page-container #success-stories .students-stories-image {
    position: static;
    flex: 0 0 auto;
    width: clamp(150px, 16vw, 210px);
    max-width: none;
    height: auto;
    max-height: none;
}

body.amg-skin #page-container #success-stories .students-stories-photo-box {
    position: static;
    width: 100%;
    max-width: none;
    height: auto;
    max-height: none;
    aspect-ratio: 1;
}

body.amg-skin #page-container #success-stories .students-stories-photo-box .photo-box-image {
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 50%;
    box-shadow: 0 0 0 6px var(--amg-soft-blue);
}

body.amg-skin #page-container #success-stories .students-stories-info {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    height: auto;
    margin: 0;
}

body.amg-skin #page-container #success-stories .students-stories-info .title {
    margin: 0 0 14px;
    color: var(--amg-navy);
    font-family: var(--amg-font);
    font-size: clamp(20px, 1.8vw, 26px);
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.25;
}

/* style-divi-child.css cuts these paragraphs to 147px (the old home carousel); the archive shows the whole story. */
body.amg-skin #page-container #success-stories .students-stories-info .description {
    height: auto;
    max-height: none;
    margin: 0 0 18px;
    overflow: visible;
    color: var(--amg-text);
    font-family: var(--amg-font);
    font-size: 16px;
    letter-spacing: 0;
    line-height: 1.75;
}

/* "Name, sport, university": the commas are text nodes of the template (also left behind when a field is empty),
   hidden with font-size 0; the parts become a name and two tags. */
body.amg-skin #page-container #success-stories .students-stories-info .student-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    height: auto;
    max-height: none;
    margin: 0;
    overflow: visible;
    font-size: 0;
    line-height: 1;
}

body.amg-skin #page-container #success-stories .student-info span {
    margin: 0;
    font-family: var(--amg-font);
    font-size: 14px;
    letter-spacing: 0;
    line-height: 1.3;
}

body.amg-skin #page-container #success-stories .student-info .name {
    margin-right: 4px;
    color: var(--amg-navy);
    font-size: 16px;
    font-weight: 700;
}

body.amg-skin #page-container #success-stories .student-info .sports-discipline,
body.amg-skin #page-container #success-stories .student-info .university {
    padding: 6px 12px;
    border-radius: 999px;
    font-weight: 600;
}

body.amg-skin #page-container #success-stories .student-info .sports-discipline {
    background: var(--amg-soft-blue);
    color: var(--amg-blue-strong);
}

body.amg-skin #page-container #success-stories .student-info .university {
    border: 1px solid var(--amg-line);
    color: var(--amg-muted);
}

/* Narrow screens: the photo above the text (style_tymek.css stacks the container below 500px with !important). */
@media (max-width: 700px) {
    body.amg-skin #page-container #success-stories .students-stories-container,
    body.amg-skin #page-container #success-stories .students-stories-container:nth-child(2n) {
        flex-direction: column !important;
        align-items: stretch;
    }

    body.amg-skin #page-container #success-stories .students-stories-image {
        width: 140px;
        margin: 0 auto;
    }
}
