:root {
    --paper: #fdfcf6;
    --paper-edge: #ece7d4;
    --desk: #c9bfa7;
    --ink: #1c2a4a;
    --muted: #8a8474;
    --accent: #44546f;
    --rule: #cdd9e8;
    --margin-line: #d28c8c;
    --line-height: 2.1rem;
    --baseline-offset: -0.4rem;
    --hand: "Kalam", "Segoe Print", "Bradley Hand", cursive;
    --display: "Kalam", "Segoe Print", "Bradley Hand", cursive;
}

* {
    box-sizing: border-box;
}

html {
    font-size: 19px;
}

body {
    margin: 0;
    min-height: 100vh;
    user-select: none;
    -webkit-user-select: none;
    background: var(--desk);
    background-image:
        radial-gradient(ellipse at 20% 0%, rgba(255, 248, 220, 0.22), transparent 55%),
        radial-gradient(ellipse at 85% 110%, rgba(0, 0, 0, 0.18), transparent 55%),
        radial-gradient(circle at 50% 50%, transparent 60%, rgba(0, 0, 0, 0.10) 100%),
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.10 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
    background-size: auto, auto, auto, 220px 220px;
    color: var(--ink);
    font-family: var(--hand);
    font-weight: 400;
    line-height: var(--line-height);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    padding: 3rem 1.25rem 4rem;
}

.page {
    position: relative;
    max-width: 40rem;
    margin: 0 auto;
}

.pile-paper {
    position: absolute;
    top: 0;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    background: #fdfcf7;
    border-radius: 2px;
    overflow: hidden;
    width: 100%;
    height: 100%;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.4) inset,
        0 1px 2px rgba(0, 0, 0, 0.08),
        0 10px 22px -10px rgba(0, 0, 0, 0.28),
        0 24px 48px -22px rgba(0, 0, 0, 0.32);
}

.pile-paper svg {
    width: 100%;
    height: 100%;
    display: block;
}

.pile-anmeldung {
    z-index: 1;
    height: calc(100% + 2.4rem);
    transform: translate(-3.2rem, -0.6rem) rotate(-3.2deg);
    transform-origin: center center;
}

.pile-steuer {
    z-index: 2;
    height: calc(100% + 1.6rem);
    transform: translate(-2rem, -0.2rem) rotate(2deg);
    transform-origin: center center;
}

.pile-notebook {
    z-index: 3;
    background: #fafaf3;
    height: calc(100% + 0.8rem);
    transform: translate(-0.9rem, 0.2rem) rotate(-1.2deg);
    transform-origin: center center;
}

main {
    position: relative;
    z-index: 4;
    transform: rotate(-0.4deg);
    transform-origin: center top;
    max-width: 40rem;
    margin: 0 auto;
    background: var(--paper);
    background-image:
        repeating-linear-gradient(
            to bottom,
            transparent 0,
            transparent calc(var(--line-height) - 1px),
            var(--rule) calc(var(--line-height) - 1px),
            var(--rule) var(--line-height)
        );
    background-position: 0 var(--baseline-offset);
    background-size: 100% var(--line-height);
    padding: calc(var(--line-height) * 2) 2.5rem var(--line-height) 4.5rem;
    border-radius: 2px;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.4) inset,
        0 1px 2px rgba(0, 0, 0, 0.08),
        0 12px 28px -8px rgba(0, 0, 0, 0.28),
        0 32px 60px -20px rgba(0, 0, 0, 0.32);
}

html,
body,
main,
main * {
    cursor: none;
}

#cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    transition: opacity 120ms ease;
    color: var(--ink);
}

#cursor.visible {
    opacity: 1;
}

#cursor .ico {
    position: absolute;
    width: 22px;
    height: 22px;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 130ms ease, transform 200ms cubic-bezier(0.2, 0.8, 0.2, 1.4);
    will-change: opacity, transform;
}

#cursor .ico.active {
    opacity: 1;
    transform: scale(1);
}

#cursor .ico.pencil.active {
    transform: scale(var(--pen-scale, 1));
}

#cursor .ico.pencil  { left: -3px; top: -19px; }
#cursor .ico.pointer { left: -11px; top: -11px; }

@media (hover: none) {
    html, body, main, main * { cursor: auto; }
    #cursor { display: none; }
}

body.doodling,
body.doodling main,
body.doodling main * {
    user-select: none;
    -webkit-user-select: none;
}

#doodles {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 1;
}

#doodles path {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.85;
}

main::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 3rem;
    width: 1px;
    background: var(--margin-line);
    opacity: 0.55;
}

main::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.04) 0%,
        transparent 18%,
        transparent 82%,
        rgba(0, 0, 0, 0.05) 100%
    );
    mix-blend-mode: multiply;
}

h1 {
    font-family: var(--display);
    font-size: 2rem;
    font-weight: 700;
    line-height: calc(var(--line-height) * 2);
    height: calc(var(--line-height) * 2);
    margin: 0 0 var(--line-height);
    letter-spacing: 0;
    display: block;
    width: fit-content;
    overflow: visible;
}

.intro {
    margin: 0 0 var(--line-height);
    max-width: 32rem;
    font-size: 1.1rem;
    line-height: var(--line-height);
}

.block p,
.work li,
.reading li {
    font-size: 1.1rem;
    line-height: var(--line-height);
}

.block {
    margin-top: var(--line-height);
}

h2 {
    font-family: var(--display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ink);
    line-height: var(--line-height);
    height: var(--line-height);
    margin: 0;
    display: block;
    width: fit-content;
    overflow: visible;
    position: relative;
}

h2::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 1px;
    height: 6px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 6' preserveAspectRatio='none'><path d='M1 3 Q 6 1, 11 3 T 21 3 T 31 3 T 41 3 T 51 3 T 61 3 T 71 3 T 81 3 T 91 3 T 101 3 T 111 3 T 121 3 T 131 3 T 141 3 T 151 3 T 161 3 T 171 3 T 181 3 T 191 3 T 199 3' stroke='%23c97373' stroke-width='1.3' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    background-repeat: repeat-x;
    background-position: left center;
    background-size: 200px 6px;
    pointer-events: none;
}

.block:nth-of-type(2n) h2::after {
    background-position: -73px center;
}

.block p {
    margin: 0;
}

a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: none;
    transition: color 120ms ease;
}

a:hover,
a:focus-visible {
    color: #2a3954;
    outline: none;
}

.work-link {
    color: inherit;
    text-decoration: none;
    transition: color 120ms ease;
}

.work-link:hover,
.work-link:focus-visible {
    color: var(--accent);
}

.work,
.reading {
    list-style: none;
    padding: 0;
    margin: 0;
}

.work li {
    padding: 0;
    border-radius: 2px;
    outline: none;
    transition: background-color 120ms ease;
    line-height: var(--line-height);
}

.work .blurb,
.reading .blurb {
    color: var(--muted);
    font-size: 1.1rem;
    margin-left: 0.4em;
}

.reading li {
    line-height: var(--line-height);
}

.reading a {
    color: var(--ink);
}

.reading a:hover,
.reading a:focus-visible {
    color: var(--accent);
}

/* Inline brand / place pills */
.badge {
    position: relative;
    display: inline;
    font-weight: 400;
    color: var(--ink);
    white-space: nowrap;
}

.badge > img,
.badge > .berlin-icon {
    display: inline-block;
    width: 1.05em;
    height: 1.05em;
    vertical-align: -0.18em;
    margin-right: 0.18em;
    object-fit: contain;
}

/* logos look like little stickers glued onto the page */
.badge > img {
    padding: 0.08em;
    background: #fff;
    border-radius: 2px;
    transform: rotate(-3deg);
    filter:
        drop-shadow(0 1px 0 rgba(0, 0, 0, 0.12))
        drop-shadow(0 2px 2.5px rgba(0, 0, 0, 0.22));
}

/* alternate tilt so it feels hand-placed */
.intro .badge:nth-of-type(2n) > img,
.work li:nth-of-type(2n) .badge > img {
    transform: rotate(2.5deg);
}
.block > p .badge > img {
    transform: rotate(-2deg);
}

.berlin-badge .berlin-icon {
    color: var(--accent);
    line-height: 0;
}

.berlin-badge .berlin-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

footer {
    margin-top: calc(var(--line-height) * 2);
    font-family: var(--hand);
    font-size: 1rem;
    color: var(--muted);
    line-height: var(--line-height);
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
}

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

footer a:hover,
footer a:focus-visible {
    color: var(--ink);
    text-decoration: none;
}

.polaroid {
    position: absolute;
    top: calc(var(--line-height) * 0.5);
    right: -2.5rem;
    width: 11rem;
    margin: 0;
    padding: 0.6rem 0.6rem 0.4rem;
    background: #fdfcf7;
    transform: rotate(4.5deg);
    z-index: 5;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.12),
        0 8px 18px -8px rgba(0, 0, 0, 0.32),
        0 18px 32px -16px rgba(0, 0, 0, 0.28);
}

.polaroid img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    object-position: center 45%;
    filter: saturate(0.9) contrast(0.95);
}

.polaroid figure,
.polaroid {
    /* grain layered over the photo */
}

.polaroid::after {
    content: "";
    position: absolute;
    top: 0.6rem;
    left: 0.6rem;
    right: 0.6rem;
    aspect-ratio: 1 / 1;
    pointer-events: none;
    opacity: 0.35;
    mix-blend-mode: multiply;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.55 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
    background-size: 160px 160px;
}

.polaroid figcaption {
    font-family: var(--hand);
    font-size: 0.95rem;
    color: var(--muted);
    text-align: center;
    line-height: 1.6rem;
    padding-top: 0.2rem;
}

@media (max-width: 32rem) {
    :root {
        --line-height: 1.9rem;
    }
    body {
        padding: 1rem 0.5rem 2rem;
    }
    main {
        padding: calc(var(--line-height) * 1.5) 1.1rem calc(var(--line-height) * 2) 2.2rem;
        transform: none;
    }
    main::before {
        left: 1.3rem;
    }
    html {
        font-size: 15px;
    }
    .pile-paper {
        display: none;
    }
    h1 {
        font-size: 1.7rem;
        line-height: var(--line-height);
        height: auto;
        margin: 0 0 calc(var(--line-height) * 0.5);
        white-space: normal;
        word-break: break-word;
    }
    h2 {
        font-size: 1.3rem;
    }
    .intro,
    .block p,
    .work li,
    .reading li,
    .work .blurb,
    .reading .blurb {
        font-size: 1rem;
    }
    .work li,
    .reading li {
        margin-bottom: calc(var(--line-height) * 0.25);
    }
    .work .blurb,
    .reading .blurb {
        display: block;
        margin-left: 0;
        line-height: var(--line-height);
    }
    footer {
        font-size: 0.95rem;
        gap: 0.4rem;
    }
    .polaroid {
        position: relative;
        right: auto;
        top: auto;
        width: 6.5rem;
        float: right;
        margin: 0 0 0.5rem 0.8rem;
        padding: 0.4rem 0.4rem 0.3rem;
        transform: rotate(3deg);
        touch-action: auto;
        pointer-events: none;
    }
    .polaroid figcaption {
        font-size: 0.8rem;
        line-height: 1.2rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition: none !important;
        animation: none !important;
    }
}
