/* Keepsake: a photo album. Hand-written CSS, no framework.
   Colours come from the backdrop chosen on <html data-theme="...">. */

@font-face {
    font-family: 'Caveat';
    src: url('../fonts/caveat.woff2') format('woff2');
    font-weight: 400 700;
    font-display: swap;
}

@font-face {
    font-family: 'DM Serif Display';
    src: url('../fonts/dm-serif-display.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: 'Nunito';
    src: url('../fonts/nunito.woff2') format('woff2');
    font-weight: 200 1000;
    font-display: swap;
}

/* ------------------------------------------------------------------ backdrops */

:root {
    --font-ui: 'Nunito', system-ui, sans-serif;
    --font-title: 'DM Serif Display', Georgia, serif;
    --font-hand: 'Caveat', 'Segoe Print', 'Bradley Hand', cursive;

    --paper: #fbf6ec;
    --paper-edge: #e9dfcb;
    --paper-ink: #2c2420;
    --pen: #23365f;
    --muted: #6c6157;
    --danger: #a3301f;
    --shadow: 0 1px 1px rgb(0 0 0 / .08), 0 6px 14px rgb(0 0 0 / .18), 0 18px 40px rgb(0 0 0 / .14);
    --radius: 10px;

    /* Classic: a walnut desk */
    --bg-1: #3b2619;
    --bg-2: #5a3a24;
    --bg-3: #2a1a10;
    --on-bg: #f6ead6;
    --accent: #b5572a;
    --accent-ink: #fff8ef;
    --cover: #5b2a1c;
    --cover-2: #3d1a10;
    --foil: #e2c178;
    --tape-1: rgb(214 171 92 / .82);
    --tape-2: rgb(152 180 160 / .82);
    --tape-3: rgb(201 129 92 / .78);
}

[data-theme='nature'] {
    --bg-1: #1f3b2b;
    --bg-2: #3d6b47;
    --bg-3: #10241a;
    --on-bg: #eef6e8;
    --accent: #3f7d4f;
    --accent-ink: #f4fbef;
    --cover: #2f5a3f;
    --cover-2: #1c3a27;
    --foil: #e9d18e;
    --tape-1: rgb(167 196 118 / .82);
    --tape-2: rgb(229 196 120 / .82);
    --tape-3: rgb(126 168 140 / .8);
}

[data-theme='ocean'] {
    --bg-1: #0c3b57;
    --bg-2: #13739a;
    --bg-3: #061f30;
    --on-bg: #e8f6fb;
    --accent: #137a9e;
    --accent-ink: #f1fbff;
    --cover: #164e6b;
    --cover-2: #0b3146;
    --foil: #e9e2c6;
    --tape-1: rgb(127 200 214 / .8);
    --tape-2: rgb(240 214 160 / .82);
    --tape-3: rgb(96 160 196 / .78);
}

[data-theme='love'] {
    --bg-1: #4a1020;
    --bg-2: #8e2236;
    --bg-3: #2b0812;
    --on-bg: #fbecea;
    --accent: #a8253c;
    --accent-ink: #fff4f2;
    --cover: #7c1a2e;
    --cover-2: #50101d;
    --foil: #f0cf8d;
    --tape-1: rgb(214 104 104 / .78);
    --tape-2: rgb(232 196 132 / .82);
    --tape-3: rgb(196 140 120 / .8);
}

[data-theme='sunset'] {
    --bg-1: #f2a05b;
    --bg-2: #d9654b;
    --bg-3: #5a2f5f;
    --on-bg: #fff6ea;
    --accent: #c45231;
    --accent-ink: #fff7ee;
    --cover: #9c3f2c;
    --cover-2: #63261a;
    --foil: #f6d58e;
    --tape-1: rgb(242 176 96 / .82);
    --tape-2: rgb(214 120 92 / .78);
    --tape-3: rgb(160 120 170 / .72);
}

[data-theme='cosy'] {
    --bg-1: #151a2c;
    --bg-2: #262a45;
    --bg-3: #0b0e19;
    --on-bg: #f3ecdb;
    --accent: #c98a2e;
    --accent-ink: #1b1306;
    --cover: #2d3557;
    --cover-2: #1a1f36;
    --foil: #f1cf86;
    --tape-1: rgb(232 190 110 / .82);
    --tape-2: rgb(150 160 210 / .78);
    --tape-3: rgb(214 140 100 / .76);
}

/* ------------------------------------------------------------------ base */

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

html {
    scroll-padding-top: 5rem;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--font-ui);
    font-size: 1.0625rem;
    line-height: 1.55;
    color: var(--on-bg);
    background: var(--bg-3);
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: inherit;
}

h1, h2, h3 {
    font-family: var(--font-title);
    font-weight: 400;
    line-height: 1.1;
    margin: 0 0 .4em;
}

h1 {
    font-size: clamp(2.3rem, 5vw, 3.6rem);
}

code {
    font-size: .9em;
    background: rgb(0 0 0 / .07);
    padding: .08em .35em;
    border-radius: 4px;
}

.handwritten {
    font-family: var(--font-hand);
    font-weight: 600;
    letter-spacing: .01em;
}

:focus-visible {
    outline: 3px solid #f1c35b;
    outline-offset: 3px;
    border-radius: 4px;
}

.skip {
    position: absolute;
    left: 1rem;
    top: -5rem;
    z-index: 200;
    padding: .5rem .9rem;
    background: var(--paper);
    color: var(--paper-ink);
    border-radius: 6px;
}

.skip:focus {
    top: 1rem;
}

main {
    flex: 1;
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 1.5rem 1rem 4rem;
}

/* ------------------------------------------------------------------ the scene behind everything */

.backdrop {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    background: radial-gradient(120% 90% at 50% 0%, var(--bg-2), var(--bg-1) 55%, var(--bg-3));
    transition: background .6s ease;
}

.backdrop-scene,
.backdrop-scene::before,
.backdrop-scene::after {
    position: absolute;
    inset: 0;
    content: '';
    pointer-events: none;
}

.ambient {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

/* Classic: wood grain and the pool of light from a desk lamp */
[data-theme='classic'] .backdrop-scene {
    background:
        radial-gradient(60% 45% at 50% 18%, rgb(255 214 150 / .28), transparent 70%),
        repeating-linear-gradient(92deg, rgb(0 0 0 / .0) 0 7px, rgb(0 0 0 / .07) 8px 9px, rgb(255 255 255 / .03) 10px 18px),
        repeating-linear-gradient(88deg, transparent 0 41px, rgb(0 0 0 / .08) 42px 44px, transparent 45px 97px);
}

[data-theme='classic'] .backdrop-scene::after {
    background: radial-gradient(130% 100% at 50% 40%, transparent 55%, rgb(0 0 0 / .45));
}

/* Nature: sunlight through leaves */
[data-theme='nature'] .backdrop-scene {
    background:
        radial-gradient(35% 30% at 20% 12%, rgb(255 244 190 / .35), transparent 70%),
        radial-gradient(25% 22% at 78% 22%, rgb(255 244 190 / .22), transparent 70%),
        radial-gradient(18% 16% at 55% 8%, rgb(255 244 190 / .18), transparent 70%);
}

[data-theme='nature'] .backdrop-scene::before {
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 400'%3E%3Cg fill='%23163322' opacity='.55'%3E%3Cpath d='M0 0c60 10 120 40 150 100-50 10-110-10-150-50z'/%3E%3Cpath d='M0 60c40 0 90 30 110 80-40 10-80-10-110-40z'/%3E%3Cpath d='M60 0c30 30 60 80 50 140-30-20-50-70-50-140z'/%3E%3C/g%3E%3C/svg%3E") top left / 420px no-repeat,
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 400'%3E%3Cg fill='%23163322' opacity='.5'%3E%3Cpath d='M400 0c-60 10-120 40-150 100 50 10 110-10 150-50z'/%3E%3Cpath d='M400 70c-40 0-90 30-110 80 40 10 80-10 110-40z'/%3E%3Cpath d='M330 0c-30 30-60 80-50 140 30-20 50-70 50-140z'/%3E%3C/g%3E%3C/svg%3E") top right / 380px no-repeat;
}

[data-theme='nature'] .backdrop-scene::after {
    background: radial-gradient(130% 100% at 50% 30%, transparent 50%, rgb(5 20 10 / .5));
}

/* Ocean: light from the surface, waves along the bottom */
[data-theme='ocean'] .backdrop {
    background: linear-gradient(180deg, #2aa7c9 0%, var(--bg-2) 22%, var(--bg-1) 60%, var(--bg-3));
}

[data-theme='ocean'] .backdrop-scene {
    background:
        linear-gradient(100deg, transparent 20%, rgb(255 255 255 / .07) 24%, transparent 30%, transparent 45%, rgb(255 255 255 / .06) 50%, transparent 56%, transparent 68%, rgb(255 255 255 / .05) 72%, transparent 78%);
    animation: rays 14s ease-in-out infinite alternate;
}

[data-theme='ocean'] .backdrop-scene::after {
    top: auto;
    height: 160px;
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 160' preserveAspectRatio='none'%3E%3Cpath d='M0 70 Q100 40 200 70 T400 70 T600 70 T800 70 V160 H0Z' fill='%23083047' opacity='.7'/%3E%3Cpath d='M0 100 Q100 75 200 100 T400 100 T600 100 T800 100 V160 H0Z' fill='%23051f30' opacity='.8'/%3E%3C/svg%3E") 0 100% / 800px 160px repeat-x;
    animation: swell 18s linear infinite;
}

@keyframes rays {
    to { transform: translateX(6%) skewX(-4deg); }
}

@keyframes swell {
    to { background-position: -800px 100%; }
}

/* Love: warm glow and soft lights */
[data-theme='love'] .backdrop-scene {
    background:
        radial-gradient(40% 35% at 50% 20%, rgb(255 190 150 / .28), transparent 70%),
        radial-gradient(6px 6px at 12% 30%, rgb(255 210 170 / .5), transparent),
        radial-gradient(8px 8px at 85% 18%, rgb(255 210 170 / .45), transparent),
        radial-gradient(5px 5px at 70% 60%, rgb(255 210 170 / .4), transparent),
        radial-gradient(7px 7px at 25% 75%, rgb(255 210 170 / .35), transparent);
}

[data-theme='love'] .backdrop-scene::after {
    background: radial-gradient(130% 100% at 50% 30%, transparent 50%, rgb(30 0 8 / .5));
}

/* Sunset: a big low sun */
[data-theme='sunset'] .backdrop {
    background: linear-gradient(180deg, #f7c46c 0%, var(--bg-1) 25%, var(--bg-2) 55%, #8a3f62 80%, var(--bg-3));
}

[data-theme='sunset'] .backdrop-scene {
    background:
        radial-gradient(circle at 50% 78%, rgb(255 236 170 / .95) 0 9vmin, rgb(255 210 130 / .5) 9.5vmin, transparent 30vmin);
}

[data-theme='sunset'] .backdrop-scene::after {
    top: auto;
    height: 22vh;
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 120' preserveAspectRatio='none'%3E%3Cpath d='M0 60 C120 20 220 70 330 40 S560 10 650 45 S760 30 800 40 V120 H0Z' fill='%234a2347' opacity='.75'/%3E%3Cpath d='M0 90 C150 60 260 95 400 75 S640 60 800 80 V120 H0Z' fill='%23301634'/%3E%3C/svg%3E") bottom / 100% 100% no-repeat;
}

/* Cosy night: a string of fairy lights */
[data-theme='cosy'] .backdrop-scene {
    background:
        radial-gradient(50% 40% at 50% 100%, rgb(255 190 110 / .12), transparent 70%),
        radial-gradient(30px 30px at 15% 55%, rgb(255 200 120 / .07), transparent),
        radial-gradient(50px 50px at 80% 70%, rgb(255 200 120 / .06), transparent);
}

[data-theme='cosy'] .backdrop-scene::before {
    height: 110px;
    bottom: auto;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 110'%3E%3Cpath d='M-10 20 Q75 80 150 30 T300 30 T450 30 T610 25' fill='none' stroke='%23050710' stroke-width='2'/%3E%3Cg fill='%23ffd27a'%3E%3Ccircle cx='40' cy='45' r='5'/%3E%3Ccircle cx='95' cy='55' r='5'/%3E%3Ccircle cx='190' cy='44' r='5'/%3E%3Ccircle cx='250' cy='26' r='5'/%3E%3Ccircle cx='345' cy='45' r='5'/%3E%3Ccircle cx='400' cy='27' r='5'/%3E%3Ccircle cx='495' cy='44' r='5'/%3E%3Ccircle cx='560' cy='28' r='5'/%3E%3C/g%3E%3C/svg%3E") top / 600px 110px repeat-x;
    filter: drop-shadow(0 0 6px rgb(255 205 120 / .9)) drop-shadow(0 0 16px rgb(255 190 100 / .5));
    animation: twinkle 3.2s ease-in-out infinite alternate;
}

@keyframes twinkle {
    from { opacity: .75; }
    to { opacity: 1; }
}

/* ------------------------------------------------------------------ demo strip, top bar, footer */

.demo-strip {
    margin: 0;
    padding: .4rem 1rem;
    text-align: center;
    font-size: .85rem;
    background: rgb(0 0 0 / .45);
    color: #f8efe1;
    backdrop-filter: blur(4px);
}

.demo-strip b {
    margin-right: .4rem;
    padding: .05rem .45rem;
    border-radius: 99px;
    background: #f1c35b;
    color: #2a1d08;
    font-size: .75rem;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.demo-strip--owner b {
    background: #8fd3a2;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .55rem clamp(.8rem, 3vw, 2rem);
    background: rgb(251 246 236 / .93);
    color: var(--paper-ink);
    border-bottom: 1px solid rgb(0 0 0 / .08);
    box-shadow: 0 2px 16px rgb(0 0 0 / .18);
    backdrop-filter: blur(6px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    text-decoration: none;
    font-family: var(--font-hand);
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.brand-icon {
    width: 1.6rem;
    height: 1.6rem;
    color: var(--accent);
    transform: rotate(-8deg);
}

.topnav {
    display: flex;
    gap: .25rem;
}

.topnav a {
    padding: .35rem .7rem;
    border-radius: 99px;
    text-decoration: none;
    font-weight: 700;
    font-size: .95rem;
}

.topnav a:hover {
    background: rgb(0 0 0 / .06);
}

.topnav a[aria-current='page'] {
    background: var(--accent);
    color: var(--accent-ink);
}

.topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.footer {
    padding: 2rem 1rem 2.5rem;
    text-align: center;
    font-size: .92rem;
    color: var(--on-bg);
    text-shadow: 0 1px 2px rgb(0 0 0 / .4);
}

.footer p {
    margin: .25rem 0;
    opacity: .9;
}

.footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: .4rem 1.2rem;
}

.footer a {
    font-weight: 700;
}

/* ------------------------------------------------------------------ buttons and forms */

.icon {
    width: 1.15em;
    height: 1.15em;
    flex: none;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .55rem 1rem;
    border: 0;
    border-radius: 99px;
    font: inherit;
    font-weight: 800;
    font-size: .95rem;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease, background .2s;
    white-space: nowrap;
}

.button:hover {
    transform: translateY(-1px);
}

.button:active {
    transform: translateY(1px);
}

.button--primary {
    background: var(--accent);
    color: var(--accent-ink);
    box-shadow: 0 2px 0 rgb(0 0 0 / .25), 0 6px 14px rgb(0 0 0 / .18);
}

.button--paper {
    background: var(--paper);
    color: var(--paper-ink);
    box-shadow: 0 2px 0 rgb(0 0 0 / .15), 0 6px 14px rgb(0 0 0 / .18);
}

.button--ghost {
    background: rgb(0 0 0 / .05);
    color: inherit;
    box-shadow: inset 0 0 0 1.5px rgb(0 0 0 / .14);
}

.button--danger {
    color: var(--danger);
}

.button--big {
    padding: .8rem 1.4rem;
    font-size: 1.05rem;
}

.button[disabled] {
    opacity: .55;
    pointer-events: none;
}

.icon-button {
    display: inline-grid;
    place-items: center;
    width: 2.4rem;
    height: 2.4rem;
    border: 0;
    border-radius: 50%;
    background: rgb(0 0 0 / .06);
    color: inherit;
    cursor: pointer;
}

.icon-button:hover {
    background: rgb(0 0 0 / .12);
}

.link-button {
    border: 0;
    padding: 0;
    background: none;
    color: inherit;
    font: inherit;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
}

.inline-form {
    display: inline;
    margin: 0;
}

.field {
    display: block;
    margin: 0 0 1rem;
    border: 0;
    padding: 0;
}

.field-label {
    display: block;
    margin-bottom: .3rem;
    font-weight: 800;
    font-size: .92rem;
}

.optional {
    font-weight: 400;
    color: var(--muted);
}

.field input[type='text'],
.field input[type='password'],
.field textarea,
.field select {
    width: 100%;
    padding: .6rem .75rem;
    border: 1.5px solid #d6cab4;
    border-radius: 8px;
    background: #fffdf8;
    color: var(--paper-ink);
    font: inherit;
}

.field textarea {
    resize: vertical;
    min-height: 5rem;
    background-image: repeating-linear-gradient(transparent 0 1.55em, rgb(35 54 95 / .09) 1.55em calc(1.55em + 1px));
    background-attachment: local;
    line-height: 1.55em;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgb(0 0 0 / .08);
}

.field-error,
.notice--error {
    color: var(--danger);
    font-weight: 700;
}

.notice {
    margin: 0 0 1rem;
    padding: .7rem .9rem;
    border-radius: 8px;
    background: rgb(0 0 0 / .05);
}

.notice--error {
    background: rgb(163 48 31 / .08);
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 1.4rem;
    z-index: 120;
    display: flex;
    align-items: center;
    gap: .6rem;
    max-width: min(92vw, 34rem);
    margin: 0;
    padding: .75rem 1.1rem;
    border-radius: 12px;
    background: var(--paper);
    color: var(--paper-ink);
    font-weight: 700;
    box-shadow: var(--shadow);
    transform: translateX(-50%) rotate(-1deg);
    animation: toast-in .4s cubic-bezier(.2, 1.4, .4, 1);
}

.toast .icon {
    color: #3f7d4f;
}

.toast.is-leaving {
    opacity: 0;
    transform: translateX(-50%) translateY(1rem);
    transition: .4s;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(1.5rem) rotate(-4deg); }
}

/* ------------------------------------------------------------------ paper sheets */

.sheet {
    position: relative;
    padding: clamp(1.4rem, 4vw, 2.8rem);
    background:
        radial-gradient(120% 80% at 0 0, rgb(255 255 255 / .6), transparent 60%),
        var(--paper);
    color: var(--paper-ink);
    border-radius: 4px;
    box-shadow: var(--shadow);
}

.sheet--narrow {
    max-width: 38rem;
    margin: 2rem auto;
}

.stack-form {
    margin: 0;
}

/* ------------------------------------------------------------------ home: the hero note and the shelf */

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
    gap: 2rem;
    align-items: center;
    margin: 1rem 0 3.5rem;
}

.hero-text {
    position: relative;
    padding: clamp(1.4rem, 4vw, 2.6rem);
    background: var(--paper);
    color: var(--paper-ink);
    border-radius: 3px;
    box-shadow: var(--shadow);
    transform: rotate(-.6deg);
}

.hero-text::before {
    content: '';
    position: absolute;
    top: -14px;
    left: 50%;
    width: 120px;
    height: 30px;
    background: var(--tape-1);
    transform: translateX(-50%) rotate(-3deg);
    box-shadow: 0 1px 2px rgb(0 0 0 / .15);
}

.hero-kicker {
    margin: 0 0 .2rem;
    font-size: 1.6rem;
    color: var(--pen);
}

.hero-lead {
    font-size: 1.12rem;
    max-width: 36rem;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .7rem;
    margin: 1.4rem 0 0;
}

.hero-stack {
    position: relative;
    min-height: 330px;
}

.hero-print {
    position: absolute;
    width: 62%;
    padding: 10px 10px 42px;
    background: #fff;
    box-shadow: var(--shadow);
    transition: transform .3s ease;
}

.hero-print img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.hero-print span {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 6px;
    text-align: center;
    font-size: 1.5rem;
    color: var(--pen);
}

.hero-print--0 { left: 4%; top: 10%; transform: rotate(-7deg); z-index: 1; }
.hero-print--1 { right: 2%; top: 0; transform: rotate(5deg); z-index: 2; }
.hero-print--2 { left: 20%; top: 32%; transform: rotate(-1deg); z-index: 3; }

.hero-stack:hover .hero-print--0 { transform: rotate(-10deg) translate(-6%, -2%); }
.hero-stack:hover .hero-print--1 { transform: rotate(8deg) translate(6%, -4%); }

.shelf-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.shelf-head h2 {
    margin: 0;
    padding: .1rem .9rem .2rem;
    background: var(--paper);
    color: var(--paper-ink);
    font-size: 2.1rem;
    box-shadow: var(--shadow);
    transform: rotate(-1.5deg);
}

.shelf-count {
    margin: 0;
    font-weight: 700;
    text-shadow: 0 1px 3px rgb(0 0 0 / .5);
}

.shelf-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 2.2rem 1.8rem;
    align-items: end;
    padding: 0 .6rem;
    perspective: 1200px;
}

.shelf-plank {
    height: 22px;
    margin: -6px -1rem 0;
    border-radius: 4px;
    background: linear-gradient(#8a5a36, #6a4126 60%, #4b2c18);
    box-shadow: 0 14px 24px rgb(0 0 0 / .4), inset 0 2px 0 rgb(255 255 255 / .18);
}

/* One album on the shelf: a cloth-bound book with a window for a photo */
.shelf-book {
    --cover: #5b2a1c;
    --cover-2: #3d1a10;
    --foil: #e2c178;
    position: relative;
    display: block;
    text-decoration: none;
    transform-style: preserve-3d;
    transition: transform .35s cubic-bezier(.2, .9, .3, 1.2);
}

.shelf-book:hover,
.shelf-book:focus-visible {
    transform: rotateY(-14deg) translateY(-8px);
}

.shelf-cover {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    aspect-ratio: 4 / 5;
    padding: 12% 10% 10%;
    border-radius: 3px 8px 8px 3px;
    background:
        linear-gradient(90deg, rgb(0 0 0 / .35) 0, rgb(255 255 255 / .12) 5%, transparent 9%),
        repeating-linear-gradient(45deg, rgb(255 255 255 / .03) 0 2px, transparent 2px 4px),
        repeating-linear-gradient(-45deg, rgb(0 0 0 / .05) 0 2px, transparent 2px 4px),
        linear-gradient(160deg, var(--cover), var(--cover-2));
    color: var(--foil);
    box-shadow: inset 0 0 0 1px rgb(255 255 255 / .06), 0 2px 2px rgb(0 0 0 / .3), 8px 14px 24px rgb(0 0 0 / .35);
}

.shelf-window {
    width: 82%;
    aspect-ratio: 4 / 3;
    padding: 5px;
    background: var(--foil);
    box-shadow: inset 0 1px 2px rgb(0 0 0 / .5), 0 1px 0 rgb(255 255 255 / .2);
}

.shelf-window img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.shelf-window-empty {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    background: rgb(0 0 0 / .25);
    color: rgb(255 255 255 / .6);
}

.shelf-window-empty .icon {
    width: 2.2rem;
    height: 2.2rem;
}

.shelf-title {
    margin-top: auto;
    font-family: var(--font-title);
    font-size: 1.35rem;
    line-height: 1.1;
    text-align: center;
    text-shadow: 0 -1px 0 rgb(0 0 0 / .5), 0 1px 0 rgb(255 255 255 / .2);
}

.shelf-meta {
    margin-top: .35rem;
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    opacity: .85;
}

.shelf-pages {
    position: absolute;
    z-index: 1;
    top: 3%;
    bottom: 3%;
    right: -7px;
    width: 12px;
    border-radius: 0 3px 3px 0;
    background: repeating-linear-gradient(180deg, #f3ead8 0 2px, #d8ccb4 2px 3px);
    box-shadow: 2px 2px 6px rgb(0 0 0 / .3);
}

.shelf-book--new .shelf-cover {
    background: rgb(255 255 255 / .08);
    color: var(--on-bg);
    border: 2px dashed rgb(255 255 255 / .5);
    box-shadow: none;
    justify-content: center;
    gap: .3rem;
}

.shelf-book--new .shelf-title {
    margin-top: .4rem;
}

.shelf-new-icon {
    display: grid;
    place-items: center;
    width: 3.4rem;
    height: 3.4rem;
    border-radius: 50%;
    background: rgb(255 255 255 / .15);
}

.shelf-new-icon .icon {
    width: 1.8rem;
    height: 1.8rem;
}

/* The colours of each backdrop, for an album's cover and the swatches */
.theme-chip--classic, .swatch--classic { --cover: #5b2a1c; --cover-2: #3d1a10; --foil: #e2c178; --chip: linear-gradient(135deg, #6b4228, #3b2619); }
.theme-chip--nature, .swatch--nature { --cover: #2f5a3f; --cover-2: #1c3a27; --foil: #e9d18e; --chip: linear-gradient(135deg, #5f9a63, #1f3b2b); }
.theme-chip--ocean, .swatch--ocean { --cover: #164e6b; --cover-2: #0b3146; --foil: #e9e2c6; --chip: linear-gradient(180deg, #2aa7c9, #0c3b57); }
.theme-chip--love, .swatch--love { --cover: #7c1a2e; --cover-2: #50101d; --foil: #f0cf8d; --chip: linear-gradient(135deg, #b8324a, #4a1020); }
.theme-chip--sunset, .swatch--sunset { --cover: #9c3f2c; --cover-2: #63261a; --foil: #f6d58e; --chip: linear-gradient(180deg, #f7c46c, #d9654b 60%, #5a2f5f); }
.theme-chip--cosy, .swatch--cosy { --cover: #2d3557; --cover-2: #1a1f36; --foil: #f1cf86; --chip: radial-gradient(circle at 30% 30%, #ffd27a 0 3px, transparent 4px), radial-gradient(circle at 70% 45%, #ffd27a 0 3px, transparent 4px), linear-gradient(135deg, #262a45, #151a2c); }

.only-you {
    display: inline-block;
    padding: .02rem .45rem;
    border-radius: 99px;
    background: #f1c35b;
    color: #2a1d08;
    font-family: var(--font-ui);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .04em;
    vertical-align: middle;
}

.only-you--cover {
    position: absolute;
    top: 8px;
    right: 10px;
}

/* ------------------------------------------------------------------ the backdrop picker */

.picker {
    position: relative;
}

.picker-menu {
    position: absolute;
    right: 0;
    top: calc(100% + .6rem);
    width: min(92vw, 21rem);
    padding: 1rem;
    border-radius: 12px;
    background: var(--paper);
    color: var(--paper-ink);
    box-shadow: var(--shadow);
}

.picker-title {
    margin: 0 0 .6rem;
    font-weight: 800;
}

.picker-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .5rem;
}

.swatch {
    display: grid;
    gap: .3rem;
    justify-items: center;
    padding: .4rem;
    border: 2px solid transparent;
    border-radius: 10px;
    background: none;
    color: inherit;
    font: inherit;
    font-size: .82rem;
    font-weight: 700;
    cursor: pointer;
}

.swatch:hover {
    background: rgb(0 0 0 / .05);
}

.swatch[aria-checked='true'] {
    border-color: var(--accent);
}

.swatch-chip {
    display: block;
    width: 100%;
    aspect-ratio: 3 / 2;
    border-radius: 6px;
    background: var(--chip);
    box-shadow: inset 0 0 0 1px rgb(0 0 0 / .1);
}

.picker-reset {
    margin-top: .7rem;
    border: 0;
    background: none;
    padding: 0;
    color: var(--muted);
    font: inherit;
    font-size: .85rem;
    text-decoration: underline;
    cursor: pointer;
}

.picker-motion {
    display: flex;
    align-items: center;
    gap: .4rem;
    margin-top: .5rem;
    font-size: .88rem;
}

/* ------------------------------------------------------------------ photos in their frames */

.snap {
    --tilt: 0deg;
    position: relative;
    margin: 0;
    transform: rotate(var(--tilt));
    transition: transform .25s ease;
}

.snap-link {
    position: relative;
    display: block;
    text-decoration: none;
    color: inherit;
}

.snap-picture {
    position: relative;
    display: block;
    overflow: hidden;
    background: #ccc;
}

.snap-picture img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.snap:hover {
    transform: rotate(0deg) scale(1.02);
    z-index: 3;
}

.snap figcaption {
    margin-top: .45rem;
    text-align: center;
    font-family: var(--font-hand);
    color: var(--pen);
    line-height: 1.15;
}

.snap-title {
    display: block;
    font-size: 1.45rem;
    font-weight: 700;
}

.snap-caption {
    display: block;
    font-size: 1.15rem;
    opacity: .9;
}

.snap .only-you {
    margin-top: .25rem;
}

/* Polaroid: a white print with room for a title at the bottom */
.snap--polaroid .snap-link {
    padding: 4.5% 4.5% 0;
    background: #fffefb;
    box-shadow: 0 1px 2px rgb(0 0 0 / .18), 0 8px 18px rgb(0 0 0 / .18);
}

.snap-polaroid-title {
    display: block;
    padding: .35rem .3rem .55rem;
    text-align: center;
    font-family: var(--font-hand);
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--pen);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Photo corners: four little black paper pockets */
.snap--corners .snap-picture {
    box-shadow: 0 2px 6px rgb(0 0 0 / .25);
}

.snap--corners .snap-link::before,
.snap--corners .snap-link::after,
.snap--corners .snap-picture::before,
.snap--corners .snap-picture::after {
    content: '';
    position: absolute;
    z-index: 2;
    width: 26px;
    height: 26px;
    background: linear-gradient(135deg, #1d1a18 50%, transparent 50%);
    filter: drop-shadow(1px 1px 1px rgb(0 0 0 / .35));
}

.snap--corners .snap-link::before { top: -5px; left: -5px; }
.snap--corners .snap-link::after { top: -5px; right: -5px; transform: rotate(90deg); }
.snap--corners .snap-picture { overflow: visible; }
.snap--corners .snap-picture img { position: relative; z-index: 1; }
.snap--corners .snap-picture::before { bottom: -5px; right: -5px; transform: rotate(180deg); }
.snap--corners .snap-picture::after { bottom: -5px; left: -5px; transform: rotate(270deg); }

/* Washi tape across the top corners */
.snap--tape .snap-picture {
    overflow: visible;
    box-shadow: 0 2px 8px rgb(0 0 0 / .22);
}

.snap--tape .snap-link::before,
.snap--tape .snap-link::after {
    content: '';
    position: absolute;
    z-index: 2;
    top: -10px;
    width: 34%;
    max-width: 110px;
    height: 24px;
    background:
        repeating-linear-gradient(45deg, rgb(255 255 255 / .25) 0 4px, transparent 4px 9px),
        var(--tape-1);
    box-shadow: 0 1px 2px rgb(0 0 0 / .12);
    clip-path: polygon(2% 0, 98% 4%, 100% 50%, 97% 100%, 3% 96%, 0 50%);
}

.snap--tape .snap-link::before { left: -6%; transform: rotate(-24deg); }
.snap--tape .snap-link::after { right: -6%; transform: rotate(22deg); background-color: var(--tape-2); }
.snap--tape[style*='--tape: 1'] .snap-link::before { background-color: var(--tape-3); }
.snap--tape[style*='--tape: 2'] .snap-link::after { background-color: var(--tape-3); }
.snap--tape .snap-picture img { position: relative; z-index: 1; }

/* Deckle: an old-fashioned print with a narrow white border */
.snap--deckle .snap-link {
    padding: 3.5%;
    background: #fbf7ee;
    box-shadow: inset 0 0 0 1px rgb(0 0 0 / .06), 0 1px 2px rgb(0 0 0 / .2), 0 8px 16px rgb(0 0 0 / .16);
}

.snap--deckle .snap-picture img {
    filter: sepia(.16) contrast(1.04) saturate(.94);
}

/* ------------------------------------------------------------------ album page */

.album-head {
    position: relative;
    max-width: 52rem;
    margin: .5rem auto 2rem;
    padding: 1.4rem 1.6rem;
    background: var(--paper);
    color: var(--paper-ink);
    border-radius: 3px;
    box-shadow: var(--shadow);
    text-align: center;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    font-weight: 700;
    font-size: .92rem;
    text-decoration: none;
    opacity: .8;
}

.back-link:hover {
    opacity: 1;
    text-decoration: underline;
}

.album-head h1 {
    margin: .3rem 0 .1rem;
}

.album-blurb {
    margin: 0;
    font-size: 1.6rem;
    color: var(--pen);
}

.album-meta {
    margin: .4rem 0 1rem;
    color: var(--muted);
    font-size: .92rem;
}

.album-tools {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: .5rem;
}

.segmented {
    display: inline-flex;
    padding: 3px;
    border-radius: 99px;
    background: rgb(0 0 0 / .07);
}

.segmented a {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .4rem .9rem;
    border-radius: 99px;
    text-decoration: none;
    font-weight: 800;
    font-size: .92rem;
}

.segmented a[aria-current='page'] {
    background: var(--paper);
    box-shadow: 0 1px 3px rgb(0 0 0 / .2);
}

/* The book. Without scripts every page is shown, one under another. */
.book {
    position: relative;
    margin: 0 auto;
    max-width: 1180px;
}

.book-pages {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.page {
    position: relative;
    aspect-ratio: 5 / 6.4;
    padding: 7% 8%;
    background:
        radial-gradient(140% 100% at 100% 0, rgb(255 255 255 / .5), transparent 55%),
        radial-gradient(1px 1px at 20% 30%, rgb(0 0 0 / .05), transparent),
        var(--paper);
    color: var(--paper-ink);
    border-radius: 3px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.page-inner {
    position: relative;
    height: 100%;
    display: grid;
    gap: 5%;
    padding-bottom: 7%;   /* room for the page number */
}

.page-number {
    position: absolute;
    bottom: 3.5%;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-hand);
    font-size: 1.15rem;
    color: var(--muted);
}

.layout--solo {
    place-items: center;
}

.layout--solo .snap {
    width: 100%;
}

.layout--solo .snap--square {
    width: 86%;
}

.layout--solo .snap--portrait {
    width: 74%;
}

.layout--stack {
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    justify-items: center;
}

.layout--stack .snap {
    width: 66%;
}

.layout--stack .snap--square {
    width: 48%;
}

.layout--stack .snap:nth-child(2) {
    justify-self: end;
}

.layout--stack .snap:first-child {
    justify-self: start;
}

.layout--stack .snap--portrait {
    width: 38%;
}

.layout--side {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
}

.layout--side .snap:first-child {
    margin-bottom: 22%;
}

.layout--side .snap:nth-child(2) {
    margin-top: 22%;
}

.layout--side .snap--square {
    width: 100%;
}

/* Photos on book pages are fitted to the page height */
.page .snap-picture {
    max-height: 100%;
}

.layout--stack .snap figcaption .snap-caption,
.layout--side .snap figcaption .snap-caption {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.page--title .page-inner,
.page--end .page-inner {
    align-content: center;
    justify-items: center;
    text-align: center;
    gap: .6rem;
}

.title-page-kicker {
    margin: 0;
    font-size: 1.7rem;
    color: var(--muted);
}

.title-page-name {
    margin: 0;
    font-size: clamp(2.2rem, 4.2vw, 3.4rem);
}

.title-page-blurb {
    margin: 0;
    font-size: 1.7rem;
    color: var(--pen);
}

.title-page-meta {
    margin: 0;
    color: var(--muted);
    font-size: .92rem;
}

.title-page-sticker {
    width: 38%;
    aspect-ratio: 1;
    margin: .6rem 0;
    background: center / contain no-repeat;
    filter: drop-shadow(0 3px 4px rgb(0 0 0 / .2));
    transform: rotate(-6deg);
}

.sticker--classic { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='46' fill='%23fff' /%3E%3Cpath d='M22 38h14l6-9h16l6 9h14v36H22z' fill='%23b5572a'/%3E%3Ccircle cx='50' cy='55' r='12' fill='%23fff'/%3E%3Ccircle cx='50' cy='55' r='7' fill='%233b2619'/%3E%3C/svg%3E"); }
.sticker--nature { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='46' fill='%23fff'/%3E%3Cpath d='M50 18c22 12 30 34 18 54-6 10-30 10-36 0-12-20-4-42 18-54z' fill='%233f7d4f'/%3E%3Cpath d='M50 26v58' stroke='%23fff' stroke-width='3'/%3E%3Cpath d='M50 46l12-8M50 58l-12-8M50 70l12-8' stroke='%23fff' stroke-width='2.5'/%3E%3C/svg%3E"); }
.sticker--ocean { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='46' fill='%23fff'/%3E%3Cpath d='M14 58q9-8 18 0t18 0 18 0 18 0v18q-9 8-18 0t-18 0-18 0-18 0z' fill='%23137a9e'/%3E%3Cpath d='M30 50l20-30 4 30z' fill='%23e3b25b'/%3E%3Cpath d='M56 50V18l16 32z' fill='%23f6efe0' stroke='%23137a9e' stroke-width='2'/%3E%3C/svg%3E"); }
.sticker--love { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='46' fill='%23fff'/%3E%3Cpath d='M50 78S22 60 22 40a14 14 0 0 1 28-6 14 14 0 0 1 28 6c0 20-28 38-28 38z' fill='%23a8253c'/%3E%3C/svg%3E"); }
.sticker--sunset { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='46' fill='%23fff'/%3E%3Ccircle cx='50' cy='60' r='20' fill='%23f2a05b'/%3E%3Cpath d='M16 62h68v20H16z' fill='%23fff'/%3E%3Cpath d='M22 66h56M30 72h40' stroke='%23d9654b' stroke-width='4' stroke-linecap='round'/%3E%3C/svg%3E"); }
.sticker--cosy { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='46' fill='%23fff'/%3E%3Crect x='38' y='40' width='24' height='36' rx='3' fill='%23efe3c8' stroke='%232d3557' stroke-width='3'/%3E%3Cpath d='M50 22c7 8 6 14 0 18-6-4-7-10 0-18z' fill='%23f1a83a'/%3E%3Cpath d='M50 30c3 3 3 6 0 8-3-2-3-5 0-8z' fill='%23ffe08a'/%3E%3C/svg%3E"); }

.end-page-text {
    margin: 0 0 .5rem;
    font-size: 2rem;
    color: var(--pen);
}

/* With scripts: an open book showing two pages (one on small screens) */
.js .book.is-ready .book-pages {
    display: none;
}

.book-spread {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    max-width: 1120px;
    margin: 0 auto;
    perspective: 2400px;
    filter: drop-shadow(0 22px 30px rgb(0 0 0 / .35));
}

.book-spread::before {
    /* the album's cover, peeking out behind the pages */
    content: '';
    position: absolute;
    inset: -14px -16px;
    border-radius: 8px;
    background:
        repeating-linear-gradient(45deg, rgb(255 255 255 / .03) 0 2px, transparent 2px 4px),
        linear-gradient(160deg, var(--cover), var(--cover-2));
    box-shadow: inset 0 0 0 2px rgb(255 255 255 / .06);
}

.book-spread .page {
    border-radius: 0;
    box-shadow: none;
}

.book-spread .slot-left .page {
    border-radius: 4px 0 0 4px;
    background:
        linear-gradient(90deg, transparent 80%, rgb(0 0 0 / .1) 96%, rgb(0 0 0 / .2)),
        var(--paper);
}

.book-spread .slot-right .page {
    border-radius: 0 4px 4px 0;
    background:
        linear-gradient(270deg, transparent 80%, rgb(0 0 0 / .08) 96%, rgb(0 0 0 / .18)),
        var(--paper);
}

.slot {
    position: relative;
    min-width: 0;
}

.slot .page {
    height: 100%;
}

.book-spread.is-single {
    grid-template-columns: 1fr;
    max-width: 560px;
}

.book-spread.is-single .slot-right {
    display: none;
}

.book-spread.is-single .slot-left .page {
    border-radius: 4px;
    background: var(--paper);
}

/* The leaf that turns */
.leaf {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 50%;
    transform-style: preserve-3d;
    transition: transform .75s cubic-bezier(.45, .05, .25, 1);
    z-index: 5;
}

.leaf--forward {
    left: 50%;
    transform-origin: left center;
}

.leaf--back {
    left: 0;
    transform-origin: right center;
}

.leaf-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
}

.leaf-face .page {
    height: 100%;
}

.leaf-face--back {
    transform: rotateY(180deg);
}

.leaf::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(90deg, rgb(0 0 0 / .0), rgb(0 0 0 / .18));
    opacity: 0;
    transition: opacity .75s;
}

.leaf.is-turning::after {
    opacity: 1;
}

.leaf--forward.is-turning {
    transform: rotateY(-180deg);
}

.leaf--back.is-turning {
    transform: rotateY(180deg);
}

.book-spread.is-single .leaf {
    width: 100%;
    left: 0;
    transform-origin: left center;
}

.book-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin: 1.6rem 0 0;
}

.book-turn {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    border: 0;
    border-radius: 50%;
    background: var(--paper);
    color: var(--paper-ink);
    box-shadow: var(--shadow);
    cursor: pointer;
}

.book-turn .icon {
    width: 1.5rem;
    height: 1.5rem;
}

.book-turn[disabled] {
    opacity: .4;
    cursor: default;
}

.book-where {
    min-width: 9rem;
    margin: 0;
    text-align: center;
    font-family: var(--font-hand);
    font-size: 1.5rem;
    font-weight: 700;
    text-shadow: 0 1px 3px rgb(0 0 0 / .5);
}

/* The wall: every photo, pinned up */
.wall {
    columns: 4 230px;
    column-gap: 2rem;
    padding: 1rem .5rem;
}

.wall .snap {
    break-inside: avoid;
    margin: 0 0 2.2rem;
    display: inline-block;
    width: 100%;
}

.wall .snap figcaption {
    padding: .4rem .6rem .5rem;
    background: rgb(251 246 236 / .92);
    border-radius: 4px;
    box-shadow: 0 2px 6px rgb(0 0 0 / .2);
}

.wall .snap--polaroid figcaption {
    margin-top: 0;
    background: #fffefb;
    border-radius: 0;
    box-shadow: 0 8px 18px rgb(0 0 0 / .18);
    padding-top: 0;
}

.wall .snap--polaroid figcaption:empty {
    display: none;
}

.empty {
    padding: 2rem;
    font-size: 1.8rem;
    text-align: center;
    background: var(--paper);
    color: var(--paper-ink);
    box-shadow: var(--shadow);
}

/* ------------------------------------------------------------------ lightbox */

.lightbox {
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: #f6efe3;
}

.lightbox::backdrop {
    background: rgb(12 10 9 / .92);
    backdrop-filter: blur(4px);
}

.lightbox-stage {
    position: relative;
    display: grid;
    grid-template-columns: 4rem 1fr 4rem;
    align-items: center;
    height: 100%;
    padding: 1rem;
}

.lightbox-figure {
    display: grid;
    justify-items: center;
    gap: 1rem;
    margin: 0;
    max-height: 100%;
}

.lightbox-figure img {
    max-height: 72vh;
    max-width: 100%;
    width: auto;
    height: auto;
    padding: 10px;
    background: #fffefb;
    box-shadow: 0 20px 50px rgb(0 0 0 / .5);
    animation: lift .35s ease;
}

@keyframes lift {
    from { opacity: 0; transform: scale(.96) rotate(-1deg); }
}

.lightbox-text {
    max-width: 42rem;
    text-align: center;
}

.lightbox-text h2 {
    margin: 0;
    font-size: 2.3rem;
}

.lightbox-text p {
    margin: .2rem 0;
}

.lightbox-meta {
    font-size: .88rem;
    opacity: .75;
}

.lightbox-links {
    display: flex;
    justify-content: center;
    gap: 1.2rem;
    margin-top: .6rem !important;
}

.lightbox-links a {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-weight: 700;
    font-size: .92rem;
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 2;
    background: rgb(255 255 255 / .12);
    color: inherit;
}

.lightbox-step {
    width: 3.2rem;
    height: 3.2rem;
    border: 0;
    border-radius: 50%;
    background: rgb(255 255 255 / .12);
    color: inherit;
    cursor: pointer;
    display: grid;
    place-items: center;
}

.lightbox-step:hover,
.lightbox-close:hover {
    background: rgb(255 255 255 / .22);
}

.lightbox-step .icon {
    width: 1.6rem;
    height: 1.6rem;
}

/* ------------------------------------------------------------------ dialogs */

.dialog {
    width: min(94vw, 46rem);
    max-height: 92vh;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: var(--paper);
    color: var(--paper-ink);
    box-shadow: 0 30px 80px rgb(0 0 0 / .5);
}

.dialog::backdrop {
    background: rgb(10 8 6 / .6);
    backdrop-filter: blur(3px);
}

.dialog[open] {
    animation: dialog-in .3s cubic-bezier(.2, 1.2, .4, 1);
}

@keyframes dialog-in {
    from { opacity: 0; transform: translateY(14px) rotate(-1deg); }
}

.dialog--page {
    display: block;
    margin: 1.5rem auto;
    max-height: none;
}

.dialog form {
    margin: 0;
}

.dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.4rem .2rem;
}

.dialog-head h2 {
    margin: 0;
    font-size: 2.3rem;
}

.dialog-body {
    padding: .6rem 1.4rem;
}

.dialog-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: .6rem;
    padding: 1rem 1.4rem 1.3rem;
    border-top: 1px solid var(--paper-edge);
}

.dialog-foot .field-error {
    flex: 1 1 100%;
    margin: 0;
}

.dialog .notice {
    margin: .4rem 1.4rem 0;
}

.upload-body {
    display: grid;
    grid-template-columns: 15rem 1fr;
    gap: 1.6rem;
    padding: .8rem 1.4rem;
}

.upload-preview {
    padding-top: .4rem;
}

.upload-snap {
    transform: rotate(-3deg);
}

.upload-picture {
    display: grid;
    place-items: center;
    aspect-ratio: 4 / 3;
    background: #e9e1d2;
}

.upload-picture img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upload-placeholder .icon {
    width: 2.6rem;
    height: 2.6rem;
    color: #b3a58e;
}

.upload-preview-caption {
    margin: .8rem .2rem 0;
    font-size: 1.25rem;
    color: var(--pen);
    text-align: center;
    word-break: break-word;
}

.drop {
    position: relative;
    display: grid;
    justify-items: center;
    gap: .2rem;
    margin-bottom: 1rem;
    padding: 1.2rem 1rem;
    border: 2px dashed #c9bba2;
    border-radius: 10px;
    background: rgb(0 0 0 / .025);
    text-align: center;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}

.drop:hover,
.drop.is-over {
    border-color: var(--accent);
    background: rgb(0 0 0 / .05);
}

.drop input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.drop:has(input:focus-visible) {
    outline: 3px solid #f1c35b;
    outline-offset: 2px;
}

.drop-icon {
    width: 2rem;
    height: 2rem;
    color: var(--accent);
}

.drop-hint {
    font-size: .82rem;
    color: var(--muted);
}

.progress {
    flex: 1 1 100%;
    height: 8px;
    border-radius: 99px;
    background: rgb(0 0 0 / .08);
    overflow: hidden;
}

.progress span {
    display: block;
    width: 0;
    height: 100%;
    background: var(--accent);
    transition: width .2s;
}

.theme-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .6rem;
}

.theme-option {
    position: relative;
    display: grid;
    gap: .15rem;
    padding: .5rem;
    border: 2px solid var(--paper-edge);
    border-radius: 10px;
    cursor: pointer;
}

.theme-option input {
    position: absolute;
    opacity: 0;
}

.theme-option:has(input:checked) {
    border-color: var(--accent);
    background: rgb(0 0 0 / .03);
}

.theme-option:has(input:focus-visible) {
    outline: 3px solid #f1c35b;
}

.theme-option-name {
    font-weight: 800;
    font-size: .92rem;
}

.theme-option-blurb {
    font-size: .78rem;
    color: var(--muted);
    line-height: 1.3;
}

/* ------------------------------------------------------------------ photo page */

.photo-page {
    max-width: 62rem;
    margin: 0 auto;
}

.photo-page > .back-link {
    color: var(--on-bg);
    text-shadow: 0 1px 3px rgb(0 0 0 / .5);
}

.photo-print {
    margin: 1rem auto 1.5rem;
    padding: 14px 14px 1.2rem;
    background: #fffefb;
    color: var(--paper-ink);
    box-shadow: var(--shadow);
    transform: rotate(-.4deg);
}

.photo-print img {
    width: 100%;
    height: auto;
    background: var(--c);
}

.photo-print figcaption {
    padding: .8rem .4rem 0;
    text-align: center;
}

.photo-print h1 {
    margin: 0;
    font-size: clamp(2.2rem, 5vw, 3rem);
    color: var(--pen);
}

.photo-caption {
    max-width: 42rem;
    margin: .3rem auto;
    font-size: 1.1rem;
}

.photo-meta {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: .3rem 1.1rem;
    margin: .6rem 0 0;
    color: var(--muted);
    font-size: .88rem;
}

.photo-meta span {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
}

.photo-steps {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.photo-edit h2 {
    font-size: 2.2rem;
}

.photo-edit-more {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    padding-top: 1rem;
    border-top: 1px solid var(--paper-edge);
}

/* ------------------------------------------------------------------ then and now */

.about {
    max-width: 52rem;
    margin: 1rem auto;
}

.about-kicker {
    margin: 0;
    font-size: 1.7rem;
    color: var(--pen);
}

.about-lead {
    font-size: 1.15rem;
}

.about h2 {
    margin-top: 2.4rem;
    font-size: 2rem;
}

.about h3 {
    font-family: var(--font-ui);
    font-weight: 800;
    font-size: 1.15rem;
}

.then-now {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.6rem;
    margin: 2rem 0;
}

.then-now figure {
    margin: 0;
}

.then-now figcaption {
    font-size: 2rem;
    color: var(--pen);
}

.retro-2018 {
    padding: 8px 10px;
    border: 9px groove #222;
    background: #fff;
    color: #000;
    font: 14px/1.3 'Times New Roman', Times, serif;
    box-shadow: 0 0 0 14px #ff0;
}

.retro-2018 p {
    margin: .45em 0;
}

.retro-title {
    color: #00e;
    text-decoration: underline;
    font-weight: bold;
    font-size: 19px;
}

.retro-row {
    overflow: hidden;
    margin: .4em 0;
}

.retro-thumb {
    float: left;
    width: 60px;
    height: 45px;
    margin: 0 8px 4px 0;
    background: linear-gradient(#a7b6a0, #4d5a40);
}

.retro-thumb--2 {
    background: linear-gradient(#1a2340, #6a5a2a);
}

.retro-input {
    display: inline-block;
    padding: 0 4px;
    border: 1px solid #767676;
    background: #efefef;
    font: 12px Arial, sans-serif;
}

.retro-input--wide {
    width: 120px;
    height: 16px;
    background: #fff;
    vertical-align: middle;
}

.retro-button {
    display: inline-block;
    padding: 1px 6px;
    border: 1px solid #767676;
    background: #efefef;
    font: 12px Arial, sans-serif;
}

.then-note {
    margin-top: 1.6rem;
    color: var(--muted);
    font-size: .92rem;
}

.now-list {
    margin: 0;
    padding: 1rem 1.2rem 1rem 2.2rem;
    background: #fffefb;
    box-shadow: 0 2px 10px rgb(0 0 0 / .12);
    transform: rotate(.6deg);
}

.now-list li {
    margin: .3rem 0;
}

.fix {
    margin: 1.4rem 0;
    padding-left: 1rem;
    border-left: 4px solid var(--accent);
}

.code {
    overflow-x: auto;
    padding: .9rem 1rem;
    border-radius: 8px;
    font-size: .85rem;
    line-height: 1.5;
}

.code code {
    background: none;
    padding: 0;
}

.code--old {
    background: #3a1d1a;
    color: #ffd8cf;
}

.code--new {
    background: #182b20;
    color: #d6f5df;
}

.error-sheet {
    text-align: center;
}

.error-code {
    margin: 0;
    font-size: 4.5rem;
    line-height: 1;
    color: var(--accent);
}

.error-detail {
    text-align: left;
    white-space: pre-wrap;
    font-size: .85rem;
    background: rgb(0 0 0 / .06);
    padding: .8rem;
}

/* ------------------------------------------------------------------ small screens */

@media (max-width: 860px) {
    .hero {
        grid-template-columns: 1fr;
    }

    .hero-stack {
        min-height: 240px;
        max-width: 440px;
        width: 100%;
        margin: 0 auto;
    }

    .upload-body {
        grid-template-columns: 1fr;
    }

    .upload-preview {
        max-width: 13rem;
        margin: 0 auto;
    }

    .then-now {
        grid-template-columns: 1fr;
    }

    .theme-options {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    body {
        font-size: 1rem;
    }

    .topbar {
        gap: .5rem;
    }

    .topnav {
        display: none;
    }

    .hide-small {
        display: none;
    }

    .brand {
        font-size: 1.7rem;
    }

    .shelf-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.6rem 1.2rem;
    }

    .shelf-title {
        font-size: 1.05rem;
    }

    .lightbox-stage {
        grid-template-columns: 1fr;
        padding: 3.5rem .6rem 1rem;
    }

    .lightbox-step {
        position: absolute;
        bottom: 1rem;
    }

    .lightbox-step--back {
        left: 1rem;
    }

    .lightbox-step--next {
        right: 1rem;
    }

    .lightbox-figure img {
        max-height: 60vh;
    }

    .page {
        padding: 8% 7%;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

html.still *, html.still *::before, html.still *::after {
    animation-play-state: paused !important;
}

/* A photo that has just been added glows for a moment */
.snap.is-new .snap-link,
.snap.is-new .snap-picture {
    animation: glow 2.4s ease 2;
}

@keyframes glow {
    50% { box-shadow: 0 0 0 6px #f1c35b, 0 10px 30px rgb(0 0 0 / .3); }
}

/* Turning a single page on small screens */
.slot.is-flipping .page {
    animation: flip-in .55s cubic-bezier(.3, .7, .3, 1);
    transform-origin: left center;
}

.slot.is-flipping-back .page {
    animation: flip-in-back .55s cubic-bezier(.3, .7, .3, 1);
    transform-origin: right center;
}

@keyframes flip-in {
    from { transform: perspective(1600px) rotateY(70deg); opacity: .3; }
}

@keyframes flip-in-back {
    from { transform: perspective(1600px) rotateY(-70deg); opacity: .3; }
}

.page--blank .page-inner {
    background: none;
}

.about-note {
    margin-top: 2rem;
    padding: .8rem 1rem;
    border-radius: 8px;
    background: rgb(0 0 0 / .05);
    color: var(--muted);
    font-size: .92rem;
}
