/* Oncebook – shared page
   Watercolour on warm paper, fine ink type. Big type, big targets. */

/* Self-hosted fonts (SIL Open Font License). Never load them from Google: that would send visitors' IP addresses to a third party. */

@font-face {
    font-family: 'Instrument Serif';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/instrument-serif-regular-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Instrument Serif';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/instrument-serif-regular-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Instrument Serif';
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/instrument-serif-italic-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Instrument Serif';
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/instrument-serif-italic-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Nunito Sans';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('../fonts/nunito-sans-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Nunito Sans';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('../fonts/nunito-sans-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    --paper: #fbf7f1;
    --paper-deep: #f2ebe0;
    --card: #fffdf9;
    --ink: #3b3431;
    --ink-soft: #7a6e66;
    --ink-faint: #b0a59c;
    --accent: #b4614a;
    --danger: #a9473a;
    --line: rgba(59, 52, 49, 0.10);
    --line-strong: rgba(59, 52, 49, 0.22);
    --shadow: 0 1px 2px rgba(90, 70, 54, 0.05), 0 14px 30px -18px rgba(90, 70, 54, 0.38);
    --shadow-print: 0 1px 2px rgba(90, 70, 54, 0.08), 0 10px 20px -10px rgba(90, 70, 54, 0.45);
    --radius: 22px;
    --gutter: 20px;
    --measure: 640px;
    --display: 'Instrument Serif', Georgia, serif;
    --body: 'Nunito Sans', -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; overflow-x: clip; }

body {
    margin: 0;
    position: relative;
    overflow-x: clip;
    background: var(--paper) url('../img/watercolor/paper-grain.png') repeat;
    background-size: 256px;
    color: var(--ink);
    font-family: var(--body);
    font-size: 18px;
    line-height: 1.5;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

body.centered .page { justify-content: center; }

img, video { display: block; max-width: 100%; height: auto; }

a { color: inherit; text-decoration: none; }

/* A painted wash bleeding off the top right of the page */
.page-wash {
    position: absolute;
    top: -70px;
    right: -140px;
    width: 440px;
    max-width: none;
    opacity: 0.5;
    pointer-events: none;
    z-index: 0;
}

/* Header */

.top {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px var(--gutter);
    max-width: calc(var(--measure) + 2 * var(--gutter));
    width: 100%;
    margin: 0 auto;
}

.wordmark {
    font-family: var(--display);
    font-style: italic;
    font-size: 21px;
    color: var(--ink);
}

.lock-link {
    appearance: none;
    background: rgba(255, 253, 249, 0.7);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 16px;
    font: inherit;
    font-size: 15px;
    color: var(--ink-soft);
    cursor: pointer;
}

/* Page */

.page {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: calc(var(--measure) + 2 * var(--gutter));
    margin: 0 auto;
    padding: 8px var(--gutter) 64px;
}

.display {
    font-family: var(--display);
    font-weight: 400;
    font-size: clamp(42px, 10vw, 58px);
    line-height: 1.02;
    letter-spacing: -0.01em;
    margin: 0;
    text-wrap: balance;
}

h1:not(.display) {
    font-family: var(--display);
    font-weight: 400;
    font-size: 36px;
    line-height: 1.1;
    margin: 0 0 8px;
}

.lede {
    color: var(--ink-soft);
    font-size: 19px;
    margin: 12px 0 0;
    text-wrap: pretty;
}

.aside {
    font-family: var(--display);
    font-style: italic;
    font-size: 22px;
    color: var(--ink-soft);
    margin: 0;
}

.hero { padding: 24px 0 30px; text-align: center; }

.hero-child { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.hero-child .display { margin-top: 12px; }

.brush {
    width: 130px;
    height: auto;
    margin: 12px auto 0;
}
.hero-child .brush { width: 96px; margin-top: 6px; }

.back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    align-self: flex-start;
    padding: 8px 16px;
    margin-left: -4px;
    border-radius: 999px;
    background: rgba(255, 253, 249, 0.7);
    border: 1px solid var(--line);
    color: var(--ink);
    font-weight: 600;
    font-size: 16px;
}

/* Child marks: an initial painted over its watercolour, or a photo with the colour peeking out */

.child-mark {
    position: relative;
    width: var(--size);
    height: var(--size);
    flex: 0 0 var(--size);
    display: inline-grid;
    place-items: center;
}

.child-mark .wash {
    position: absolute;
    inset: calc(var(--size) * -0.22);
    width: calc(var(--size) * 1.44);
    max-width: none;
    height: auto;
}
.child-mark.has-photo .wash { inset: auto; left: 0; top: calc(var(--size) * 0.06); width: calc(var(--size) * 1.2); }
.child-mark .photo {
    position: relative;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid var(--card);
}
.child-mark .initial {
    position: relative;
    font-family: var(--display);
    font-style: italic;
    font-size: calc(var(--size) * 0.62);
    line-height: 1;
    color: var(--ink);
    margin-top: 2px;
}

/* Family page */

.child-list { display: flex; flex-direction: column; gap: 16px; }

.child-card {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 22px;
    padding: 26px 22px 26px 28px;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-height: 112px;
    transition: transform .15s ease;
}
.child-card:active { transform: scale(0.985); }

.card-wash {
    position: absolute;
    right: -96px;
    top: 8px;
    height: calc(100% - 16px);
    width: 210px;
    max-width: none;
    opacity: 0.32;
    transform: rotate(-4deg);
    pointer-events: none;
}

.child-text { position: relative; display: flex; flex-direction: column; flex: 1; min-width: 0; }
.child-name { font-family: var(--display); font-size: 34px; line-height: 1.05; }
.child-meta { color: var(--ink-soft); font-size: 16px; margin-top: 4px; }
.child-meta.muted { color: var(--ink-faint); margin-top: 0; }
.chevron { position: relative; width: 10px; height: 18px; fill: none; stroke: var(--ink-faint); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* Timeline */

.timeline {
    list-style: none;
    margin: 0;
    padding: 0 0 0 32px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 34px;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 14px;
    bottom: 0;
    width: 1px;
    background: var(--line-strong);
}

.memory { position: relative; }
.memory::before {
    content: '';
    position: absolute;
    left: -32px;
    top: 4px;
    width: 18px;
    height: 18px;
    background: var(--dot) center / contain no-repeat;
}

.memory-link { display: block; padding: 0 0 6px; }

.stamp {
    display: inline-block;
    font-family: var(--display);
    font-style: italic;
    font-size: 21px;
    line-height: 1.1;
    color: var(--accent);
}

.cover {
    position: relative;
    display: block;
    margin: 14px 0 16px;
    padding: 10px 10px 32px;
    background: var(--card);
    border-radius: 3px;
    box-shadow: var(--shadow-print);
    transform: rotate(var(--tilt, -1deg));
    max-width: 460px;
}
.cover img:first-child { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--paper-deep); }
.cover .tape {
    position: absolute;
    top: -14px;
    left: 50%;
    width: 100px;
    margin-left: -50px;
    opacity: 0.9;
    transform: rotate(var(--tape-tilt, -4deg));
}

.memory-title {
    display: block;
    font-family: var(--display);
    font-size: 30px;
    line-height: 1.08;
}
.memory-meta { display: block; color: var(--ink-soft); font-size: 16px; margin-top: 4px; }

.empty { text-align: center; color: var(--ink-soft); padding: 40px 0; }

.pager { display: flex; gap: 12px; justify-content: space-between; margin-top: 40px; }

/* Event page */

.event-head { padding: 18px 0 24px; }
.event-head .display { margin-top: 6px; }
.who { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 14px 0 0; }
.who-child { display: inline-flex; align-items: center; gap: 10px; color: var(--ink-soft); font-weight: 600; font-size: 16px; }
.story { font-size: 19px; line-height: 1.65; margin: 18px 0 0; text-wrap: pretty; }

.album { display: flex; flex-direction: column; gap: 26px; }

.frame {
    margin: 0;
    padding: 10px 10px 14px;
    background: var(--card);
    border-radius: 4px;
    box-shadow: var(--shadow-print);
}
.frame:nth-child(odd) { transform: rotate(-0.6deg); }
.frame:nth-child(even) { transform: rotate(0.5deg); }
.frame img, .frame video { width: 100%; height: auto; background: var(--paper-deep); }
.frame.video { padding: 0; background: #1a1613; overflow: hidden; border-radius: 10px; transform: none; }
.frame.video video { width: 100%; }

/* Gate (password) */

.gate {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    text-align: center;
    padding: 8px 0 24px;
}
.gate-art { width: 100%; max-width: 360px; height: auto; margin: 0 auto 8px; }
.gate-form { margin-top: 30px; text-align: left; display: flex; flex-direction: column; gap: 10px; }

.label {
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.input {
    width: 100%;
    font: inherit;
    font-size: 22px;
    letter-spacing: 0.08em;
    padding: 16px 18px;
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    background: var(--card);
    color: var(--ink);
    outline: none;
    min-height: 60px;
}
.input:focus { border-color: var(--ink); box-shadow: 0 0 0 4px rgba(59, 52, 49, 0.08); }
.input.is-invalid { border-color: var(--danger); }

.error { color: var(--danger); font-weight: 600; margin: 0; }

.button {
    appearance: none;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 60px;
    padding: 14px 22px;
    margin-top: 10px;
    border: 0;
    border-radius: 999px;
    background: var(--ink);
    color: var(--paper);
    font: inherit;
    font-size: 19px;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: transform .12s ease, opacity .12s ease;
}
.button:active { transform: scale(0.99); opacity: 0.88; }
.button.secondary {
    width: auto;
    flex: 1;
    background: rgba(255, 253, 249, 0.7);
    color: var(--ink);
    border: 1px solid var(--line-strong);
    font-size: 17px;
    min-height: 54px;
}

@media (min-width: 560px) {
    body { font-size: 19px; }
    .page { padding-bottom: 96px; }
    .album { gap: 32px; }
    .page-wash { right: -60px; width: 560px; }
}

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

/* Footer */

.site-foot {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: calc(var(--measure) + 2 * var(--gutter));
    margin: 0 auto;
    padding: 0 var(--gutter) 28px;
    font-size: 14px;
    color: var(--ink-soft);
}
.site-foot nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 20px; }
.site-foot a { text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; padding: 6px 0; }

/* Long-form text (privacy policy, terms, help) */

.prose { max-width: 68ch; padding: 12px 0 8px; font-size: 17px; line-height: 1.65; overflow-wrap: break-word; }
.prose h1 { font-family: var(--display); font-weight: 400; font-size: clamp(36px, 8vw, 46px); line-height: 1.08; margin: 0 0 6px; }
.prose h2 { font-family: var(--display); font-weight: 400; font-size: 28px; line-height: 1.15; margin: 40px 0 10px; }
.prose h3 { font-size: 17px; font-weight: 700; margin: 24px 0 6px; }
.prose p, .prose ul, .prose ol, .prose dl, .prose table { margin: 0 0 14px; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin: 0 0 6px; }
.prose li::marker { color: var(--ink-faint); }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.prose strong { font-weight: 700; }
.prose .updated { color: var(--ink-soft); font-size: 15px; margin-bottom: 26px; }
.prose .note { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 16px 18px; }
.prose dl { display: grid; grid-template-columns: minmax(0, max-content) minmax(0, 1fr); gap: 4px 16px; }
.prose dt { color: var(--ink-soft); }
.prose dd { margin: 0; }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; }
.prose th, .prose td { text-align: left; vertical-align: top; padding: 10px 8px 10px 0; border-bottom: 1px solid var(--line); }
.prose th { font-weight: 700; color: var(--ink-soft); }
.table-scroll { overflow-x: auto; margin: 0 0 14px; }
.table-scroll table { min-width: 520px; margin: 0; }
.lang-switch { display: flex; gap: 8px; margin: 0 0 18px; font-size: 15px; }
.prose .lang-switch a { color: var(--ink); text-decoration: none; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 253, 249, 0.7); }
.prose .lang-switch a[aria-current="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

@media (max-width: 480px) {
    .prose dl { grid-template-columns: 1fr; gap: 0; }
    .prose dd { margin-bottom: 8px; }
}

/* Invite page */

.invite-steps { text-align: left; margin: 26px auto 22px; padding-left: 1.4em; max-width: 360px; font-size: 17px; }
.invite-steps li { margin: 0 0 8px; }
.invite-code {
    font-family: var(--body);
    font-weight: 700;
    font-size: clamp(34px, 11vw, 46px);
    letter-spacing: 0.12em;
    margin: 6px 0 4px;
    padding: 14px 10px;
    background: var(--card);
    border-radius: 18px;
    box-shadow: var(--shadow);
    user-select: all;
    font-variant-numeric: tabular-nums;
}
.invite-expires { color: var(--ink-soft); font-size: 15px; margin: 8px 0 14px; }
.invite-store { width: 100%; margin-top: 10px; }

/* Laptops and up: grandparents often browse on a big screen, so memories sit two by two. */
@media (min-width: 1024px) {
    .page:has(.timeline), .page:has(.album) { max-width: 1080px; }
    .timeline { display: grid; grid-template-columns: 1fr 1fr; gap: 56px 64px; padding-left: 0; align-items: start; }
    .timeline::before, .memory::before { display: none; }
    .cover { max-width: none; }
    .event-head { max-width: 720px; }
    .album { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: start; }
    .album .frame.video { grid-column: 1 / -1; }
}
