/* global, fonts are loaded in index.html */
:root {
    --bg: #222831;
    --text: darkgray;
    --accent: #ffd369;
    --hover: #ade6e1;
    --light: #eeeeee;
    --mono: 'Roboto Mono', monospace;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg);
    color: var(--text);
}

body.locked {
    overflow: hidden;
}

a {
    color: var(--light);
    text-decoration: none;
}

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

/* header */
.head {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 clamp(1rem, 5vw, 4rem);
}

.back {
    display: inline-block;
    padding: 0.8rem 0; /* keeps the tap target at least 44px high */
    font-family: var(--mono);
    font-size: 0.9rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    transition: color 0.3s;
}

.back:hover {
    color: var(--hover);
}

.back .icon {
    margin: 0 0.4rem;
}

.icon {
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* top bar */
.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem clamp(1rem, 5vw, 4rem);
    background: rgba(34, 40, 49, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-height: 44px;
}

.brand img {
    display: block;
    width: 36px;
    height: 36px;
    transition: transform 0.3s ease;
}

.brand:hover img {
    transform: scale(1.1);
}

.name {
    font-family: var(--mono);
    font-size: 0.9rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--light);
}

h1 {
    color: var(--accent);
    font-size: clamp(2.5rem, 7vw, 5.5rem);
    font-weight: 700;
    line-height: 0.9;
    letter-spacing: -0.04em;
    margin: 2.5rem 0 0;
}

/* contact sheet: a 12 column broken grid, the layout repeats every 7 frames */
.sheet {
    max-width: 1100px;
    margin: 0 auto;
    padding: 5rem clamp(1rem, 5vw, 4rem) 6rem;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    column-gap: clamp(1rem, 3vw, 3rem);
    row-gap: clamp(3rem, 8vw, 7rem);
    align-items: start;
}

.frame:nth-child(7n+1) { grid-column: 1 / span 6; }
.frame:nth-child(7n+2) { grid-column: 9 / span 4; margin-top: 30%; }
.frame:nth-child(7n+3) { grid-column: 3 / span 4; }
.frame:nth-child(7n+4) { grid-column: 8 / span 5; margin-top: -15%; }
.frame:nth-child(7n+5) { grid-column: 4 / span 6; }
.frame:nth-child(7n+6) { grid-column: 1 / span 4; margin-top: 10%; }
.frame:nth-child(7n+7) { grid-column: 6 / span 6; margin-top: 35%; }

/* frames */
.frame {
    margin: 0;
    opacity: 0;
    transform: translateY(2rem);
    transition: opacity 0.9s ease, transform 0.9s ease;
}

.frame.seen {
    opacity: 1;
    transform: none;
}

.shot {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: var(--ratio);
    cursor: zoom-in;
    transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.shot picture {
    display: block;
    height: 100%;
    transition: box-shadow 0.5s ease;
}

.shot img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* the photos themselves can't be clicked, selected or dragged (no "save image") */
.shot img,
.lb-frame img {
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
}

.shot:focus-visible {
    outline: none;
}

/* grease pencil marks, each photo has its own (see gallery.js) */
.mark {
    position: absolute;
    inset: -6%;
    width: 112%;
    height: 112%;
    pointer-events: none;
    overflow: visible;
}

.mark path {
    fill: none;
    stroke: var(--accent);
    stroke-width: var(--stroke, 3);
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
    stroke-dasharray: var(--len, 6000);
    stroke-dashoffset: var(--len, 6000);
    opacity: 0;
    transition: stroke-dashoffset var(--draw, 0.7s) ease var(--delay, 0s), opacity 0.15s var(--delay, 0s);
}

.shot:focus-visible .mark path {
    stroke-dashoffset: 0;
    opacity: 1;
}

/* only on devices that really hover, on touch screens the mark would stay after a tap */
@media (hover: hover) {
    .shot:hover .mark path {
        stroke-dashoffset: 0;
        opacity: 1;
    }

    /* lifted like a print picked up from the table, each one tilted its own way */
    .shot:hover {
        transform: rotate(var(--tilt, 0deg)) scale(1.02);
    }

    .shot:hover picture {
        box-shadow: 0 1.2rem 2.5rem rgba(0, 0, 0, 0.35);
    }
}

/* placeholder until the photo file exists */
.frame.missing .shot {
    border: 1px dashed #4a5260;
    background: repeating-linear-gradient(-45deg, transparent 0 12px, rgba(255, 255, 255, 0.025) 12px 24px);
}

.frame.missing .shot img {
    display: none;
}

.frame.missing .shot::after {
    content: "add photo";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-family: var(--mono);
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #5c6574;
}

.noscript {
    text-align: center;
    font-family: var(--mono);
}

/* footer */
.foot {
    text-align: center;
    padding: 0 1rem 4rem;
}

.legal-links {
    margin: 1.5rem 0 0;
    font-family: var(--mono);
    font-size: 0.8rem;
}

.legal-links a {
    display: inline-block;
    padding: 0.8rem 0.4rem; /* 44px tap target */
    color: var(--text);
    transition: color 0.3s;
}

.legal-links a:hover {
    color: var(--hover);
}

/* about / legal page */
.legal {
    max-width: 1100px;
    margin: 0 auto;
    padding: 3rem clamp(1rem, 5vw, 4rem) 5rem;
    line-height: 1.65;
}

.legal > * {
    max-width: 680px;
}

.legal .lead {
    font-size: 1.25rem;
    color: var(--light);
}

.legal a {
    color: var(--light);
    border-bottom: 1px solid var(--accent);
    transition: color 0.3s;
}

.legal a:hover {
    color: var(--hover);
}

.legal section {
    margin-top: 3.5rem;
    scroll-margin-top: 5rem; /* below the sticky top bar when jumping to #impressum */
}

.legal h2 {
    color: var(--accent);
    font-size: 1.5rem;
    margin: 0 0 1rem;
}

.legal h2 span {
    color: var(--text);
    font-weight: 400;
}

.legal h3 {
    color: var(--light);
    font-family: var(--mono);
    font-size: 0.9rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 2rem 0 0.5rem;
}

.legal .contact {
    white-space: pre-line;
    color: var(--light);
}

.legal .updated {
    margin-top: 2.5rem;
    font-family: var(--mono);
    font-size: 0.8rem;
}

/* lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: 4rem 1fr 4rem;
    align-items: center;
    background: rgba(34, 40, 49, 0.97);
}

.lightbox[hidden] {
    display: none;
}

.lb-frame {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
}

.lb-frame picture {
    display: contents;
}

.lb-frame img {
    max-width: 100%;
    max-height: 88vh;
    max-height: 88dvh; /* ignores the mobile address bar */
    object-fit: contain;
}

.lb-nav,
.lb-close {
    display: grid;
    place-items: center;
    color: var(--light);
    font-size: 1.5rem;
    height: 4rem;
    transition: color 0.3s, transform 0.3s;
}

.lb-nav:hover,
.lb-close:hover {
    color: var(--hover);
    transform: scale(1.3);
}

.lb-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 1;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: rgba(34, 40, 49, 0.7); /* stays visible on bright photos */
}

/* media */
@media (max-width: 785px) {
    .sheet {
        display: flex;
        flex-direction: column;
        padding-top: 3rem;
    }

    .frame:nth-child(n) {
        margin-top: 0;
        width: 82%;
    }

    .frame:nth-child(3n+2) {
        align-self: flex-end;
        width: 68%;
    }

    .frame:nth-child(3n) {
        margin-left: 8%;
        width: 92%;
    }

    /* the arrows are hidden on phones (swipe instead), so the photo is the only column */
    .lightbox {
        grid-template-columns: 1fr;
        padding: 0 0.5rem;
    }

    /* leave room above and below the photo for the close button */
    .lb-frame img {
        max-height: calc(100vh - 10rem);
        max-height: calc(100dvh - 10rem);
    }

    .lb-nav {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .frame,
    .shot,
    .shot picture,
    .mark path {
        transition: none;
    }

    .shot:hover {
        transform: none;
    }

    .frame {
        opacity: 1;
        transform: none;
    }
}
