/* Layout: full-screen slideshow, four small text anchors at the corners, one centred stage. */
:root {
    --bg: #ffffff;
    --fg: #666666;
    --fg-strong: #000000;
    --line: #ececec;
    --ph: #f3f3f3;
    --cursor-close: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M5 5L19 19M19 5L5 19' stroke='%23111' stroke-width='1.5' fill='none'/%3E%3C/svg%3E") 12 12, pointer;
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
    --gutter: 20px;
    --size: 13px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
}

body {
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font);
    font-size: var(--size);
    line-height: 1.35;
    -webkit-font-smoothing: antialiased;
}

.loader {
    position: fixed;
    inset: 0;
    z-index: 10;
    background: var(--bg);
    display: grid;
    place-items: center;
    transition: opacity .4s ease, visibility 0s linear .4s;
}

.loader.done {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader img {
    width: 100px;
    height: auto;
}


.site {
    height: 100%;
    display: grid;
    grid-template-rows: auto 1fr auto;
    padding-inline: var(--gutter);
    padding-block: 20px;
    position: relative;
}

button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    text-align: inherit;
}

a {
    color: inherit;
}

button:focus-visible,
a:focus-visible {
    outline: 1px solid var(--fg-strong);
    outline-offset: 3px;
}

/* Header */
/* Header and footer sit on top of the full-screen image; only their buttons catch clicks. */
.top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    position: relative;
    z-index: 3;
    pointer-events: none;
}

.top button,
.bottom a {
    pointer-events: auto;
}

.name[aria-expanded="true"],
.filter[aria-pressed="true"] {
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    color: var(--fg-strong);
}

.name:hover,
.filter:hover {
    color: var(--fg-strong);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

#aboutBtn {
    cursor: help;
}

.menu {
    text-align: right;
}

/* Stage */
.stage {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.hit {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 50%;
    z-index: 1;
}

.hit.prev {
    left: 0;
    cursor: w-resize;
}

.hit.next {
    right: 0;
    cursor: e-resize;
}

.slide {
    position: relative;
    z-index: 2;
    display: grid;
    pointer-events: none;
}

/* Size is set by fit() in the script: the largest size that fits the stage, keeping the ratio. */
.ph-image {
    display: block;
    width: 100%;
    height: auto;
    opacity: 0;
    transition: opacity .3s ease;
}

.ph-image.loaded {
    opacity: 1;
}

/* Footer */
/* Pinned to the screen: 40px from the bottom, 20px from the left and right, always above the image. */
.bottom {
    position: fixed;
    left: 20px;
    right: 20px;
    bottom: calc(30px + env(safe-area-inset-bottom, 0px));
    z-index: 5;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    pointer-events: none;
    font-variant-numeric: tabular-nums;
}

.bottom #caption {
    text-align: left;
    max-width: 85%;
}

.bottom #caption a {
    pointer-events: auto;
    text-decoration: none;
}

.bottom #caption a:hover {
    color: var(--fg-strong);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

/* About page */
.about {
    position: absolute;
    inset: 0;
    background: color-mix(in srgb, var(--bg) 30%, transparent);
    -webkit-backdrop-filter: blur(30px);
    backdrop-filter: blur(30px);
    z-index: 2;
    padding-inline: var(--gutter);
    padding-top: 52px;
    padding-bottom: 56px;
    overflow-y: hidden;
    cursor: var(--cursor-close);
}

.about[hidden] {
    display: none !important;
}

.about .block {
    display: grid;
    gap: 0;
    margin-bottom: 14px;
}

.about p {
    margin: 0;
    max-width: 50ch;
}

.about .lead {
    margin-bottom: 14px;
}

.about .label {
    color: var(--fg);
}

.about a {
    text-decoration: none;
    cursor: pointer;
}

.about a:hover {
    color: var(--fg-strong);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

.about-note {
    position: fixed;
    left: 20px;
    bottom: calc(30px + env(safe-area-inset-bottom, 0px));
}

.about-date {
    position: fixed;
    right: 20px;
    bottom: calc(30px + env(safe-area-inset-bottom, 0px));
    margin: 0;
    font-variant-numeric: tabular-nums;
}

.slide .img-link {
    display: block;
    pointer-events: auto;
    cursor: pointer;
}

@media (prefers-reduced-motion: no-preference) {
    .slide {
        animation: in .25s ease both;
    }

    @keyframes in {
        from {
            opacity: 0;
        }

        to {
            opacity: 1;
        }
    }
}

@media (max-width: 520px) {
    .top {
        flex-wrap: wrap;
    }
}