@import url('/fonts/bricolage.css');

:root {
    --grid: 1.5rem;
    --column-width: 36rem;
    --grey: #999;
}

/* Use rch if supported */
@supports(width: 55rch) {
    :root {
        --column-width: 55rch;
    }
}

/*******************************************************************************
 * Josh's Custom CSS Reset
 * https://www.joshwcomeau.com/css/custom-css-reset/
 ******************************************************************************/
*, *::before, *::after {
    box-sizing: border-box;
}
* {
    margin: 0;
}
html, body {
    height: 100%;
}
body {
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
}
input, button, textarea, select {
    font: inherit;
}
p, h1, h2, h3, h4, h5, h6 {
    overflow-wrap: break-word;
}


/*******************************************************************************
 * Layout
 ******************************************************************************/
[hidden] {
    display: none !important;
}

html, body {
    font-size: 2vh;
    font-family: "Bricolage Grotesque", system-ui, sans-serif;
    line-height: var(--grid);
    scroll-behavior: smooth;
}

body {
    display: flex;
    flex-flow: column nowrap;
}

h1, h2, h3, h4, h5, h6 {
    font-family: "Bricolage Grotesque Condensed", system-ui, sans-serif;
}

p, h1, h2, h3, h4, h5, h6 {
    margin-bottom: var(--grid);
}

h1 {
    font-size: 6em;
    line-height: calc(3 * var(--grid));
}

h2 {
    font-size: 2em;
}

small {
    font-size: .75em;
}

a,
a:visited {
    color: black;
    text-decoration: underline;
    text-decoration-thickness: .1em;
}

a:hover,
a:focus {
    background: black;
    color: white;
    margin: 0 -.2em;
    outline: none;
    padding: 0 .2em;
    text-decoration: none;
}

figure img {
    box-shadow: .2rem .2rem 0px black,
                .5rem .5rem 0px white;
}

/* Make sure font-size is always at least 18px.
 * (2vh == 18px at height == 900px)
 */
@media (max-height: 900px) {
    html, body {
        font-size: 18px;
    }
}


/*******************************************************************************
 * Dialog
 ******************************************************************************/
dialog {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    padding-top: 0;
    padding-right: 0;
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: 0;
    background: black;
    border-radius: 0;
    border: none;
}

dialog[open] {
    display: flex;
    align-items: center;
    justify-content: center;
}

dialog figure {
    height: calc(100% - 5rem);
    width: calc(100% - 5rem);
    display: flex;
    align-items: center;
    justify-content: center;
}

dialog figure img {
    max-height: 100%;
    max-width: 100%;
    margin: auto;
}

dialog button {
    position: absolute;
    top: 0;
    right: 0;
    height: 2rem;
    width: 2rem;
    margin: 0;
    padding: 0;
    background: none;
    border: none;
    font-size: 2rem;
    line-height: 2rem;
    color: white;
    text-align: center;
    cursor: pointer;
    overflow: hidden;
}

dialog button:focus {
    outline: none;
}

dialog .image-title {
    position: absolute;
    bottom: env(safe-area-inset-bottom);
    margin: 0;
    padding: .5rem 1rem;
    font-size: .75em;
    line-height: 1.5em;
    color: white;
    text-align: center;
}

@media (pointer: coarse) {
    dialog button {
        height: 2.5rem;
        width: 2.5rem;
        font-size: 2.5rem;
        line-height: 2.5rem;
    }
}


/*******************************************************************************
 * Navigation
 ******************************************************************************/
nav {
    order: 9999; /* ensure it's at the bottom */
    width: 100%;
    padding-bottom: env(safe-area-inset-bottom);
    display: flex;
    justify-content: center;
    gap: 1em;
    background: black;
    color: white;
    z-index: 10;
}

nav button,
nav div {
    border: none;
    height: 2em;
    text-align: center;
}

nav button {
    width: 2em;
    margin: 0;
    padding: 0;
    background: none;
    color: inherit;
    cursor: pointer;
}

nav div {
    min-width: 7em;
    line-height: 2em;
    font-variant-numeric: tabular-nums;
}

nav button:hover:not(:disabled),
nav button:focus:not(:disabled) {
    outline: .1rem solid white;
    outline-offset: -.3rem;
}

nav button:disabled {
    color: var(--grey);
    cursor: not-allowed;
}

nav > a,
nav > a:visited {
    min-width: 1.5em;
    display: inline-block;
    background: black;
    color: white;
    text-align: center;
    text-decoration: none;
}

@media (pointer: coarse) {
    nav {
        font-size: 1.25em;
    }
}


/*******************************************************************************
 * Poster display
 ******************************************************************************/

main {
    flex: 1 1 100vh;
    display: flex;
    flex-flow: column nowrap;
    overflow-x: hidden;
    overflow-y: auto;
    scroll-snap-type: y proximity;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: white black;
}

.poster {
    scroll-snap-align: start;
    min-height: 100%;
    flex: none;
}

.description,
.image,
.title {
    overflow: hidden;
    padding: 2rem 1rem;
    display: flex;
    justify-content: center;
}

.image,
.title {
    background: black;
    color: white;
}

.image:hover,
.image:focus {
    padding: 0;
    margin: 0;
}

.title {
    min-height: 50vh;
}

.title h1 {
    word-spacing: 100vw; /* force every word on it's own line */
    margin-bottom: 0;
    width: var(--column-width);
    max-width: 100%;
}

.description {
    flex-flow: column nowrap;
    align-items: center;
    justify-content: normal;
}

.description > .content {
    max-width: var(--column-width);
    width: 100%;
}

.description p:last-child {
    margin-bottom: 0;
}

.description footer {
    margin-top: 1rem;
    font-size: .75em;
    width: 100%;
    max-width: var(--column-width);
}

.image {
    height: 50vh;
    align-items: center;
}

.image figure {
    box-shadow: .2rem .2rem 0px black,
                .5rem .5rem 0px white;
    transform: scale(.87) rotate(-2deg) translate(-.25rem, -.25rem);
}

.image figure.has-outline {
    outline: .1rem solid white;
    outline-offset: -.1rem;
}

.image figure img {
    max-height: 50vh;
}

.image figure.is-landscape {
    transform: scale(.85) rotate(-2deg) translate(-.25rem, -.25rem);
}

/* Custom layout for wide devices taller than 700px and wide-ish devices taller
 * than 900px
 */
@media
    ((min-height: 700px) and (min-aspect-ratio: 3/2)),
    ((min-height: 900px) and (min-aspect-ratio: 10/11))
{
    main {
        scroll-snap-type: y mandatory;
    }

    .poster {
        display: flex;
        flex-flow: row nowrap;
    }

    .poster:nth-child(even) {
        flex-direction: row-reverse;
    }

    .description,
    .image,
    .title {
        display: flex;
        align-items: center;
        flex: 0 0 50%;
    }

    .image,
    .title {
        height: auto;
    }

    .title {
        text-align: right;
        justify-content: flex-end;
    }

    .title h1 {
        font-size: 8em;
        line-height: calc(4 * var(--grid));
    }

    .description {
        flex-flow: row nowrap;
        justify-content: flex-start;
        position: relative;
    }

    .description footer {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 0.5rem 1rem;
        width: 100%;
        max-width: none;
    }

    .poster:nth-child(even) .title {
        justify-content: flex-start;
    }

    .poster:nth-child(even) .description {
        justify-content: flex-end;
    }

    .poster:nth-child(odd) .description footer {
        text-align: right;
    }

    .poster figure {
        transform: scale(0.85) rotate(-2deg) translate(-.25rem);
    }

    .poster figure.is-landscape {
        transform: scale(0.87) rotate(-2deg) translate(-.25rem);
    }

    .poster:nth-child(even) figure {
        transform: scale(0.85) rotate(2deg) translate(-.25rem);
    }

    .poster:nth-child(even) figure.is-landscape {
        transform: scale(0.87) rotate(2deg) translate(-.25rem);
    }

    .image figure img {
        max-height: 80vh;
        max-width: 50vw;
    }
}
