@font-face {
    font-family: 'Varela Round';
    font-style: normal;
    font-weight: 400;
    src: url(VarelaRound-Regular.woff2) format('woff2'),
         url(VarelaRound-Regular.woff) format('woff'),
         url(VarelaRound-Regular.ttf) format('truetype');
    font-display: swap;
}

html {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
}
body {
    /* color: #aba99f; */
    color: #4c4742;
    margin: 0;
    padding: 0;
    background: #fcd9d5;
    font-family: "Varela Round", "sans-serif";
    height: 100%;
    width: 100%;
}

button {
    background: #ee3342;
    color: #ffffff;
    border-radius: 20px;
    border: 0;
    padding: 20px 60px;
    text-decoration: none;
    font-family: "Varela Round", "sans-serif";
    font-weight: bold;
    filter: drop-shadow(0 0 15px #4c4742);
}
button:hover {
    background: #d01524;
}

a {
    color: inherit;
}

details {
    list-style: none;
    border-top: 4px solid #aba99f;
    border-bottom: 4px solid #aba99f;
    position: relative;
    margin-top: 10px;
}

details+details {
    margin-top: -4px;
}

details p {
    padding: 10px;
    margin: 0;
}

summary {
    cursor: pointer;
    padding: 10px;
}

summary + p {
    border-top: 1px solid #aba99f;
}

section {
    max-width: 1060px;
    margin: 0 auto;
    padding: 10px;
    background: #ffffff;
}

section#group-photo {
    color: #ee3342;
    height: 100%;
    width: 100%;
    max-width: 100%;
    background: url("images/group-photo-highish-quality.jpg"),
                url("images/group-photo-low-quality.jpg"),
                #fcd9d5;
    padding: 0;
    /*
     * I wanted to use "fixed, fixed, fixed", but it breaks iOS because it uses the height of the
     * body instead of the height of the image.
     */
    background-attachment: scroll, scroll, scroll;
    background-position-x: center, center, center;
    background-position-y: 30%, 30%, 30%;
    background-size: cover, cover, cover;
    display: flex;
    z-index: 2;
    position: relative;
}
section#group-photo > div {
    align-self: flex-end;
    background: #ffffffcc; /* some opacity to the background */
    padding: 20px 40px;
    border-radius: 20px 20px 0 0;
    margin: 0 auto;
    font-size: 1.5em;
    text-align: center;
}
section#group-photo img {
    max-height: 100px;
    max-width: 100%;
}
section#group-photo h1 {
    font-size: 3em;
    margin: 0;
    padding: 0;
}
section#group-photo button {
    margin: 20px auto;
    font-size: 1em;
    cursor: pointer;
}

/* Hide the subtitle on really small phones. */
@media screen and (max-height : 380px) and (max-width : 634px) {
    section#group-photo span.subtitle {
        display: none;
    }
}

@media screen and (min-width : 737px) {
    section#group-photo button {
        margin: 20px auto;
        font-size: 1.3em;
        cursor: pointer;
    }
}

section.info {
    margin-top: 20px;
    border-radius: 10px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    background: #fff;
    align-items: center;
}
section.info > div.content {
    padding: 10px;
    width: 100%;
    font-size: 1.5em;
    flex: 1;
}
section.info h2 {
    font-size: 1.5em;
    margin-top: 0;
}
section.info > img, section.info > div.fader {
    /* width: 200px; */
    /* height: 200px; */
    width: 50%;
    border-radius: 50%;
    border: 20px solid #ee3342;
}
section.info dl {
    margin-bottom: 0;
}
section.info dl dt {
    margin-top: 5px;
    font-weight: bold;
}
section.info dl dt:after {
    content: ":";
}

section.links {
    display: block;
    text-align: center;
}
section.links p {
    margin-top: 0;
}
section.links div {
    width: auto;
}
section.links img {
    max-height: 100px;
    max-width: 100%;
}

section:last-child {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

div.fader {
    position: relative;
    padding-top: 50%; /* Somehow this makes it 1:1 aspect ratio even though the contents are position absolute. */
    overflow: hidden;
}
div.fader > img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/*
 * n = number of images
 * a = presentation time for one image
 * b = duration for cross fading
 * Total animation duration t = (a+b)*n
 *
 * Percentage for keyframes:
 *   0%              => 100% opacity
 *   a/t*100%        => 100% opacity
 *   1/n*100%        => 0% opacity
 *   100%-(b/t*100%) => 0% opacity
 *   100%            => 100% opacity
 *
 * In our case:
 *   n = 4
 *   a = 6s
 *   b = 1s
 *   t = (6s + 1s) * 3 = 28s
 *
 * Then each animation needs to be staggered by t/n (or a+b) = 7s.
 *
 * The height trick just makes it so that when you click on an image
 * during the animation, it's the one that you're actually looking at
 * rather than the "top" one in the DOM.
 */
@keyframes image-fader {
    0% {
        opacity: 1;
    }
    21% {
        opacity: 1;
    }
    25% {
        opacity: 0;
        height: initial;
    }
    26% {
        height: 0px;
    }
    95% {
        height: 0px;
    }
    96% {
        opacity: 0;
        height: initial
    }
    100% {
        opacity: 1;
    }
}
div.fader > img {
    animation-name: image-fader;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
    animation-duration: 28s;
}
div.fader > img:nth-of-type(1) {
    animation-delay: 0s;
}
div.fader > img:nth-of-type(2) {
    animation-delay: -21s;
}
div.fader > img:nth-of-type(3) {
    animation-delay: -14s;
}
div.fader > img:nth-of-type(4) {
    animation-delay: -7s;
}

@media screen and (min-width : 737px) {
    section.info {
        padding: 30px;
    }
    section.info > img, section.info > div.fader {
        width: 300px;
        height: 300px;
    }

    section.info:nth-child(odd) {
        flex-direction: row-reverse;
    }
    section.info:nth-child(odd) > div.content {
        padding: 0;
        padding-left: 50px;
    }
    section.info:nth-child(even) {
        flex-direction: row;
    }
    section.info:nth-child(even) > div.content {
        padding: 0;
        padding-right: 50px;
    }

    div.fader {
        padding-top: 0; /* on desktop we don't need the weird padding trick, because we use explicit sizes */
    }

    /*
     * These sections have some expandable stuff, which changes the
     * height of the box and moves around the image. To avoid that,
     * just pin the image to the top. It looks good enough. We only do
     * this for desktops, though, because on mobile the images follow
     * the text, so we still want to center them.
     */
    section.info {
        align-items: flex-start;
    }

    section.links {
        padding-top: 5px;
        padding-bottom: 5px;
    }
    section.links p {
        width: 400px;
        margin: 0 auto;
        margin-top: 10px;
    }
    section.links div {
        padding: 10px;
    }
}
