/* ==========================================================================
   Natal Solidário — stylesheet
   Dark evergreen night, berry red and gold, cream text. Typography follows the
   campaign flyer: brush script titles, handwritten notes, rounded sans body.
   ========================================================================== */

:root {
    color-scheme: dark;

    --bg: #0c1d15;
    --bg-deep: #08150f;
    --surface: #132a1e;
    --surface-2: #1a3627;
    --surface-3: #21412f;
    --border: #254532;
    --border-strong: #34604a;
    --text: #f4ecdd;
    --muted: #b6ad99;

    --pine: #2f8a5c;
    --pine-bright: #5fcf92;
    --pine-dark: #1f5a3d;
    --pine-soft: rgba(47, 138, 92, 0.18);
    --berry: #d23a2f;
    --berry-dark: #b02e25;
    --berry-bright: #ff7466;
    --berry-soft: rgba(210, 58, 47, 0.16);
    --gold: #e2b456;
    --gold-bright: #f3cd7a;
    --gold-soft: rgba(226, 180, 86, 0.14);
    --cream: #f6efe2;

    --ok-bg: rgba(47, 138, 92, 0.2);
    --ok-text: #9be3bb;
    --error-bg: rgba(210, 58, 47, 0.2);
    --error-text: #ffaaa1;

    --available: #6fd39c;
    --pending: #f0c063;
    --approved: #8ab8ff;
    --selected: rgba(226, 180, 86, 0.07);

    --radius: 12px;
    --radius-lg: 20px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 28px 70px rgba(0, 0, 0, 0.55);

    --font-brush: "Caveat Brush", "Segoe Script", cursive;
    --font-hand: "Caveat", "Segoe Print", cursive;
    --font-body: "Nunito Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(900px 600px at 100% 0%, rgba(210, 58, 47, 0.07), transparent 60%),
        radial-gradient(800px 600px at 0% 100%, rgba(226, 180, 86, 0.05), transparent 60%),
        var(--bg);
    background-attachment: fixed;
    color: var(--text);
    font: 16px/1.55 var(--font-body);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 800; }
h1 { font-family: var(--font-brush); font-weight: 400; font-size: clamp(2.4rem, 4vw, 3.1rem); line-height: 1; color: var(--cream); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }

a { color: var(--gold-bright); }
.muted { color: var(--muted); }
code { font-family: ui-monospace, Consolas, monospace; font-size: 0.88em; }
strong { color: var(--cream); }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
::selection { background: rgba(226, 180, 86, 0.35); }

.visually-hidden {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* Handwritten notes, as on the flyer */
.note { font-family: var(--font-hand); font-weight: 700; color: var(--gold-bright); font-size: 1.5rem; line-height: 1.1; margin: 0; }

/* ------------------------------------------------------------------ Top bar */
.topbar {
    position: sticky; top: 0; z-index: 20;
    background: rgba(8, 21, 15, 0.82);
    backdrop-filter: saturate(1.3) blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.topbar-inner {
    max-width: 1200px; margin: 0 auto; padding: 0 16px; height: 66px;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--cream); white-space: nowrap; }
.brand-mark {
    width: 42px; height: 42px; flex: none; border-radius: 12px;
    box-shadow: 0 0 0 1px rgba(226, 180, 86, 0.35), 0 6px 16px rgba(0, 0, 0, 0.45);
    transition: transform 0.4s var(--ease-spring);
}
.brand:hover .brand-mark { transform: rotate(-12deg) scale(1.06); }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-title { font-family: var(--font-brush); font-size: 1.55rem; }
.brand-title em { font-style: normal; color: var(--berry-bright); }
.brand small { font-weight: 700; font-size: 0.7rem; color: var(--muted); letter-spacing: 0.03em; margin-top: 3px; }

.topbar nav { display: flex; align-items: center; gap: 4px; }
.topbar nav a {
    color: var(--muted); text-decoration: none; padding: 7px 14px; border-radius: 999px;
    font-weight: 700; font-size: 0.93rem; transition: background 0.2s, color 0.2s;
}
.topbar nav a:hover { color: var(--cream); background: rgba(255, 255, 255, 0.06); }
.topbar nav a.active { color: var(--gold-bright); background: var(--gold-soft); }
.nav-sep { width: 1px; height: 20px; background: var(--border-strong); margin: 0 6px; }
.nav-team { font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-right: 2px; }

/* ------------------------------------------------------------------ Layout */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 32px 16px 64px; flex: 1; }
.container > section, [data-live] > section { margin-top: 32px; }
.page-head { margin-bottom: 22px; }
.page-head p { margin: 6px 0 0; }
.page-head.with-actions { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.page-head.with-actions > div:first-child { flex: 1 1 420px; }
.eyebrow {
    display: inline-flex; align-items: center; gap: 6px; margin: 0 0 6px;
    font-size: 0.74rem; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold);
}
.section-title { font-size: 1.6rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.02em; color: var(--cream); }
.section-title.red { color: var(--berry-bright); }

/* ------------------------------------------------------------------ Footer: the flyer's red band */
.site-footer {
    background: linear-gradient(180deg, #a2271f 0%, #7d1a14 100%);
    color: rgba(255, 255, 255, 0.88); font-size: 0.9rem;
    box-shadow: inset 0 6px 0 rgba(0, 0, 0, 0.12);
}
.footer-inner {
    max-width: 1200px; margin: 0 auto; padding: 26px 16px;
    display: grid; grid-template-columns: auto 1fr auto; gap: 28px; align-items: center;
}
.footer-logo { display: flex; align-items: center; gap: 12px; color: #fff; font-weight: 800; line-height: 1.15; }
.footer-logo img { border-radius: 16px; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25), 0 6px 16px rgba(0, 0, 0, 0.3); }
.footer-logo span { display: flex; flex-direction: column; font-size: 0.85rem; }
.footer-logo strong { font-size: 1.15rem; color: #fff; }
.site-footer address { font-style: normal; border-left: 1px solid rgba(255, 255, 255, 0.25); padding-left: 24px; line-height: 1.6; }
.site-footer address strong { display: block; color: #fff; }
.site-footer address a { color: #fff; }
.footer-script { font-family: var(--font-hand); font-weight: 700; font-size: 1.7rem; line-height: 1; color: #fff; margin: 0; transform: rotate(-6deg); }

/* ------------------------------------------------------------------ Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font: inherit; font-weight: 800; font-size: 0.95rem; line-height: 1.2;
    padding: 10px 18px; border-radius: var(--radius); cursor: pointer; text-decoration: none;
    border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
    transition: transform 0.15s var(--ease-out), background 0.2s, border-color 0.2s, box-shadow 0.2s, color 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--surface-3); border-color: #44735a; }
.btn:active:not(:disabled) { transform: scale(0.96); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--berry); border-color: var(--berry); color: #fff; box-shadow: 0 6px 18px rgba(210, 58, 47, 0.35); }
.btn-primary:hover:not(:disabled) { background: var(--berry-dark); border-color: var(--berry-dark); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.06); color: var(--cream); border-color: transparent; }
.btn-light { background: rgba(255, 255, 255, 0.06); border-color: rgba(246, 239, 226, 0.35); color: var(--cream); }
.btn-light:hover { background: rgba(255, 255, 255, 0.12); border-color: rgba(246, 239, 226, 0.6); }
.btn-lg { padding: 14px 26px; font-size: 1.05rem; border-radius: 14px; }
.btn-small { padding: 5px 12px; font-size: 0.84rem; border-radius: 9px; }
.btn-approve { color: var(--approved); border-color: currentColor; background: transparent; }
.btn.busy { opacity: 0.6; pointer-events: none; }
.btn .spinner {
    width: 16px; height: 16px; border-radius: 50%;
    border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite;
}

.btn-icon {
    border: none; background: none; color: var(--muted); cursor: pointer;
    font-size: 0.95rem; padding: 4px 8px; border-radius: 8px; transition: background 0.2s, color 0.2s, transform 0.15s;
}
.btn-icon:hover { color: var(--error-text); background: var(--error-bg); }
.btn-icon:active { transform: scale(0.9); }
.btn-icon.write-to:hover { color: var(--pine-bright); background: var(--pine-soft); }

.link { color: var(--gold-bright); font-size: 0.9rem; font-weight: 700; }
kbd {
    font: inherit; font-size: 0.78rem; padding: 0 6px; border: 1px solid var(--border-strong);
    border-bottom-width: 2px; border-radius: 5px; background: var(--surface-2); color: var(--text);
}

/* ------------------------------------------------------------------ Messages */
.flash {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 12px 16px; border-radius: var(--radius); margin-bottom: 18px; font-weight: 700;
    border: 1px solid transparent; animation: slide-down 0.35s var(--ease-out);
}
.flash::before { line-height: 1.5; }
.flash-ok { background: var(--ok-bg); color: var(--ok-text); border-color: rgba(95, 207, 146, 0.25); }
.flash-ok::before { content: "✓"; }
.flash-error { background: var(--error-bg); color: var(--error-text); border-color: rgba(255, 116, 102, 0.25); }
.flash-error::before { content: "!"; font-weight: 900; }
.field-error { color: var(--error-text); font-size: 0.88rem; font-weight: 700; display: block; margin-top: 4px; }
.field-error:empty { display: none; }

.notice {
    padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 0.93rem;
    background: var(--gold-soft); color: #f1d797; border: 1px solid rgba(226, 180, 86, 0.3);
}
.notice strong { color: var(--gold-bright); }
.notice code { background: rgba(0, 0, 0, 0.25); padding: 0 4px; border-radius: 4px; }

.empty {
    padding: 44px 16px; text-align: center; color: var(--muted);
    background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius-lg);
}

.toast {
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
    max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: var(--radius);
    box-shadow: var(--shadow-lg); font-weight: 700; animation: toast-in 0.35s var(--ease-spring);
}
.toast-ok { background: var(--pine); color: #fff; }
.toast-error { background: var(--berry-dark); color: #fff; }

/* ------------------------------------------------------------------ Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.card {
    display: flex; flex-direction: column;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 20px; box-shadow: var(--shadow-sm);
}
section.card { margin-top: 32px; }
.card > h2 { margin-bottom: 2px; color: var(--cream); }
.card p { margin: 4px 0 14px; font-size: 0.92rem; }
.card p.hint, p.hint { margin: 0 0 10px; font-size: 0.82rem; }
.card p.hint.columns { margin-top: auto; padding-top: 8px; }

.upload { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.upload input[type=file] { flex: 1; min-width: 0; font-size: 0.9rem; color: var(--muted); }

details.card summary { cursor: pointer; list-style: none; }
details.card summary h2 { display: inline; }
details.card summary::before { content: "▸ "; color: var(--muted); }
details.card[open] summary::before { content: "▾ "; }
details.card[open] .table-wrap { margin-top: 14px; }

/* ------------------------------------------------------------------ Section header, filters */
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { color: var(--cream); display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.section-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.section-actions form { margin: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filters a {
    color: var(--muted); text-decoration: none; padding: 6px 14px; font-size: 0.9rem; font-weight: 700;
    border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.filters a:hover { border-color: var(--border-strong); color: var(--cream); }
.filters a.active { color: var(--gold-bright); border-color: var(--gold); background: var(--gold-soft); }
.count {
    display: inline-block; min-width: 1.6em; padding: 0 7px; margin-left: 3px; text-align: center;
    border-radius: 999px; background: rgba(255, 255, 255, 0.08); font-size: 0.78rem; color: var(--muted);
}
.toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-bottom: 12px; }
.sync { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; }
.sync .btn { white-space: nowrap; }
.kit-summary {
    font-size: 0.82rem; font-weight: 800; padding: 4px 12px; border-radius: 999px;
    background: var(--ok-bg); color: var(--ok-text);
}

/* ------------------------------------------------------------------ Tables */
.table-wrap {
    overflow-x: auto; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
table.data { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table.data th, table.data td {
    padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data th { background: var(--surface-2); font-weight: 800; color: var(--gold-bright); position: sticky; top: 0; }
table.data th::first-letter { text-transform: uppercase; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background 0.15s; }
table.data tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
td.num { text-align: center; cursor: default; }

table.grid td.cell { cursor: text; outline: none; min-width: 3em; transition: background 0.2s, box-shadow 0.2s; }
table.grid td.cell:hover { background: var(--selected); }
table.grid td.cell:focus { background: var(--bg-deep); box-shadow: inset 0 0 0 2px var(--gold); white-space: pre-wrap; }
table.grid td.cell.saving { background: var(--gold-soft); }
table.grid td.cell.saved { animation: cell-saved 1.4s ease-out; }
table.grid td.cell.error { box-shadow: inset 0 0 0 2px var(--error-text); }
table.grid tr.just-added td { background: var(--gold-soft); }
td.row-actions { width: 1%; padding-left: 4px; padding-right: 10px; }
td.row-actions form { margin: 0; }

.status-cell { display: flex; gap: 6px; align-items: center; }
.status-cell form { margin: 0; }
select.status {
    font: inherit; font-size: 0.85rem; font-weight: 800; padding: 4px 8px;
    border: 1px solid var(--border-strong); border-radius: 8px; background: var(--bg-deep); cursor: pointer;
}
.status-available { color: var(--available); }
.status-pending { color: var(--pending); }
.status-approved { color: var(--approved); }

/* "Kit entregue" switch */
.kit-cell { width: 1%; }
.kit-toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 700; font-size: 0.86rem; color: var(--muted); user-select: none; }
.kit-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.kit-switch {
    position: relative; width: 38px; height: 22px; border-radius: 999px; flex: none;
    background: var(--bg-deep); border: 1px solid var(--border-strong);
    transition: background 0.25s, border-color 0.25s;
}
.kit-switch::after {
    content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
    background: var(--muted); transition: transform 0.3s var(--ease-spring), background 0.25s;
}
.kit-toggle:has(input:checked) .kit-switch { background: var(--pine); border-color: var(--pine); }
.kit-toggle:has(input:checked) .kit-switch::after { transform: translateX(16px); background: #fff; }
.kit-toggle:has(input:checked) .kit-label { color: var(--pine-bright); }
.kit-toggle:has(input:focus-visible) .kit-switch { outline: 3px solid var(--gold); outline-offset: 2px; }
.kit-toggle:has(input:disabled) { opacity: 0.6; cursor: progress; }
.kit-toggle.pop { animation: pop 0.45s var(--ease-spring); }

.pill { display: inline-block; font-size: 0.8rem; font-weight: 800; padding: 3px 11px; border-radius: 999px; white-space: nowrap; }
.pill-none { background: rgba(255, 255, 255, 0.07); color: var(--muted); }
.pill-pending { background: rgba(240, 192, 99, 0.16); color: var(--pending); }
.pill-approved { background: var(--ok-bg); color: var(--ok-text); }

/* ------------------------------------------------------------------ Forms */
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 800; font-size: 0.9rem; margin-bottom: 5px; color: var(--cream); }
.field label small { font-weight: 600; color: var(--muted); }
.field input, .field textarea, .field select {
    width: 100%; font: inherit; padding: 11px 13px; color: var(--text);
    border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--bg-deep);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.field input::placeholder, .field textarea::placeholder, .search input::placeholder { color: #7f7867; }
.field input:focus, .field textarea:focus, .field select:focus, select:focus {
    outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(226, 180, 86, 0.16);
}
.field textarea { resize: vertical; line-height: 1.45; }
.field input.input-validation-error { border-color: var(--error-text); }
select, textarea {
    font: inherit; padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: var(--radius);
    background: var(--bg-deep); color: var(--text);
}
input[type=checkbox], input[type=radio] { width: 17px; height: 17px; cursor: pointer; accent-color: var(--gold); }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.form-footer { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.inline-field { display: flex; align-items: center; gap: 8px; font-size: 0.93rem; font-weight: 700; }

/* ------------------------------------------------------------------ Dialog */
dialog {
    width: min(480px, calc(100vw - 32px)); padding: 24px; color: var(--text);
    border: 1px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
    background: var(--surface);
}
dialog[open] { animation: dialog-in 0.32s var(--ease-spring); }
dialog::backdrop { background: rgba(3, 10, 7, 0.7); backdrop-filter: blur(4px); animation: fade-in 0.25s ease; }
dialog h2 { margin-bottom: 4px; color: var(--cream); }
dialog > p { margin: 0 0 16px; }
#write-dialog { width: min(560px, calc(100vw - 32px)); }

/* ------------------------------------------------------------------ E-mails page */
dl.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin: 6px 0 14px; }
dl.stats dt { font-size: 0.8rem; color: var(--muted); }
dl.stats dd { margin: 0; font-size: 2rem; font-family: var(--font-brush); color: var(--gold-bright); line-height: 1.1; }
dl.stats dd small { font-size: 0.8rem; color: var(--muted); font-family: var(--font-body); }
.progress { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--bg-deep); margin-bottom: 6px; }
.progress .bar-approved { background: var(--pine-bright); transition: width 0.6s var(--ease-out); }
.progress .bar-pending { background: var(--gold); transition: width 0.6s var(--ease-out); }

.template-choice { border: none; padding: 0; margin: 8px 0 14px; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.template-choice legend { padding: 0; margin-bottom: 8px; font-size: 0.9rem; }
.choice {
    display: flex; gap: 10px; align-items: flex-start; padding: 14px; cursor: pointer;
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2);
    transition: border-color 0.2s, background 0.2s, transform 0.15s var(--ease-out);
}
.choice:hover { border-color: var(--border-strong); }
.choice:active { transform: scale(0.98); }
.choice:has(input:checked) { border-color: var(--gold); background: var(--gold-soft); box-shadow: 0 0 0 3px rgba(226, 180, 86, 0.1); }
.choice input { margin-top: 3px; }
.choice small { display: block; margin-top: 2px; }
.preview { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-deep); padding: 14px 16px; }
.preview:not([hidden]) { animation: fade-in 0.25s ease; }
.preview-subject { font-weight: 800; margin-bottom: 8px; }
.preview-body { white-space: pre-wrap; font-size: 0.93rem; }
.send-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 6px; }

.templates { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.template { gap: 4px; }
.template h3 { color: var(--gold-bright); }
.template .field { margin-bottom: 10px; }
.placeholders { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip {
    font: inherit; font-size: 0.78rem; padding: 3px 9px; border-radius: 999px; cursor: pointer;
    border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-family: ui-monospace, Consolas, monospace;
    transition: border-color 0.2s, color 0.2s, transform 0.15s;
}
.chip:hover { border-color: var(--gold); color: var(--gold-bright); }
.chip:active { transform: scale(0.94); }
.link-button { align-self: flex-start; margin-top: auto; }

/* ==========================================================================
   Public page — laid out after the campaign flyer
   ========================================================================== */

/* ----------------------------------------------------------------- Hero */
.hero {
    position: relative; overflow: hidden; isolation: isolate; padding: 56px 0 64px;
    background:
        radial-gradient(700px 420px at 12% 30%, rgba(226, 180, 86, 0.16), transparent 65%),
        radial-gradient(900px 500px at 100% 110%, rgba(210, 58, 47, 0.28), transparent 60%),
        linear-gradient(170deg, #12301f 0%, var(--bg) 60%, var(--bg-deep) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.hero-inner {
    position: relative; max-width: 1200px; margin: 0 auto; padding: 0 16px;
    display: grid; gap: 48px; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); align-items: center;
}

/* Warm out-of-focus lights, like the tree behind the child in the flyer */
.hero-bokeh {
    position: absolute; inset: 0; z-index: -1; pointer-events: none; filter: blur(2px);
    background:
        radial-gradient(circle at 8% 18%, rgba(243, 205, 122, 0.35) 0 10px, transparent 26px),
        radial-gradient(circle at 18% 8%, rgba(243, 205, 122, 0.25) 0 14px, transparent 34px),
        radial-gradient(circle at 30% 26%, rgba(255, 116, 102, 0.25) 0 9px, transparent 24px),
        radial-gradient(circle at 92% 14%, rgba(243, 205, 122, 0.28) 0 12px, transparent 30px),
        radial-gradient(circle at 80% 30%, rgba(243, 205, 122, 0.18) 0 8px, transparent 22px),
        radial-gradient(circle at 70% 88%, rgba(255, 116, 102, 0.2) 0 11px, transparent 28px),
        radial-gradient(circle at 4% 80%, rgba(243, 205, 122, 0.22) 0 10px, transparent 26px);
    animation: twinkle 5s ease-in-out infinite;
}

/* Snow: two layers of dots drifting down at different speeds. */
.hero-snow, .hero-snow::after {
    position: absolute; inset: -100% 0 0; z-index: -1; pointer-events: none;
    background-image:
        radial-gradient(2px 2px at 20px 30px, rgba(255, 255, 255, 0.85), transparent 60%),
        radial-gradient(2px 2px at 140px 80px, rgba(255, 255, 255, 0.7), transparent 60%),
        radial-gradient(3px 3px at 90px 160px, rgba(255, 255, 255, 0.8), transparent 60%),
        radial-gradient(1.5px 1.5px at 200px 210px, rgba(255, 255, 255, 0.65), transparent 60%),
        radial-gradient(2.5px 2.5px at 260px 120px, rgba(255, 255, 255, 0.75), transparent 60%);
    background-size: 300px 260px;
    animation: snow 22s linear infinite;
}
.hero-snow::after { content: ""; inset: 0; background-size: 420px 380px; opacity: 0.55; animation-duration: 34s; }

.hero-photo { position: relative; margin: 0; justify-self: center; width: min(100%, 420px); }
.hero-photo img {
    display: block; width: 100%; height: auto; aspect-ratio: 422 / 612; object-fit: cover;
    border-radius: 32px 32px 32px 120px;
    box-shadow: 0 0 0 6px rgba(226, 180, 86, 0.25), var(--shadow-lg);
    transform: rotate(-2deg);
    animation: rise-in 0.8s var(--ease-out) both;
}
.note-photo {
    position: absolute; left: -54px; top: 34px; font-size: 1.75rem; color: var(--cream);
    transform: rotate(-10deg); text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
    animation: fade-in 1s ease 0.5s both;
}

.hero-text { position: relative; }
.hero-title { font-family: var(--font-brush); font-weight: 400; line-height: 0.88; margin: 0; color: var(--cream); }
.title-line { display: block; font-size: clamp(3.6rem, 8.5vw, 6.6rem); text-shadow: 0 6px 24px rgba(0, 0, 0, 0.35); }
.title-year {
    position: relative; display: inline-block; margin: 6px 0 0 18%;
    font-size: clamp(3rem, 7vw, 5.4rem); color: var(--berry-bright); transform: rotate(-3deg);
}
/* the little gold strokes around the year */
.title-year::before, .title-year::after {
    content: ""; position: absolute; top: 50%; width: 34px; height: 4px; border-radius: 4px; background: var(--gold);
    box-shadow: 0 -16px 0 -0.5px var(--gold), 0 16px 0 -0.5px var(--gold);
}
.title-year::before { right: calc(100% + 14px); transform: rotate(-8deg); }
.title-year::after { left: calc(100% + 14px); transform: rotate(8deg); }
.tagline {
    font-family: var(--font-hand); font-weight: 700; font-size: clamp(1.8rem, 3.4vw, 2.4rem); color: var(--gold-bright);
    margin: 10px 0 0; transform: rotate(-3deg); transform-origin: left;
    display: inline-block; padding-bottom: 6px;
    background: linear-gradient(90deg, var(--gold), transparent) left bottom / 100% 3px no-repeat;
}
.hero .lead { margin: 20px 0 26px; font-size: 1.1rem; max-width: 48ch; color: rgba(246, 239, 226, 0.86); }
.hero .lead strong { color: var(--gold-bright); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* Campaign progress: a string of lights that fills up. */
.hero-card {
    margin-top: 28px; max-width: 520px; padding: 18px 20px;
    background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg); backdrop-filter: blur(6px);
}
.hero-card-row { display: flex; align-items: center; gap: 14px; font-size: 0.95rem; color: rgba(246, 239, 226, 0.85); }
.big-number { font-family: var(--font-brush); font-size: 3.2rem; line-height: 1; color: var(--gold-bright); }
.garland {
    position: relative; height: 16px; margin-top: 12px; border-radius: 999px;
    background: rgba(0, 0, 0, 0.35); overflow: hidden;
}
.garland-fill {
    position: absolute; inset: 0 auto 0 0; width: var(--fill, 0%); border-radius: 999px;
    background: linear-gradient(90deg, var(--berry), var(--gold));
    transition: width 1.2s var(--ease-out);
}
.garland::after {
    content: ""; position: absolute; inset: 0;
    background: radial-gradient(circle at 8px 8px, rgba(255, 255, 255, 0.95) 0 2.5px, transparent 3.5px) 0 0 / 20px 16px repeat-x;
    mix-blend-mode: overlay; animation: twinkle 2.4s ease-in-out infinite;
}

/* ----------------------------------------------------------------- Steps: the flyer's coloured circles */
.steps {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; margin-top: 8px; padding: 12px 0 8px;
    text-align: center; scroll-margin-top: 90px;
}
.step { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.step + .step::before {
    /* the little gold "rays" between circles */
    content: ""; position: absolute; top: 34px; left: -30px; width: 30px; height: 30px;
    background:
        linear-gradient(var(--gold), var(--gold)) 50% 0 / 3px 9px no-repeat,
        linear-gradient(var(--gold), var(--gold)) 50% 100% / 3px 9px no-repeat;
    transform: rotate(-35deg); opacity: 0.8;
}
.step-circle {
    width: 104px; height: 104px; border-radius: 50%; display: grid; place-items: center; color: #fff;
    margin-bottom: 8px; box-shadow: var(--shadow), inset 0 -6px 0 rgba(0, 0, 0, 0.15);
    transition: transform 0.35s var(--ease-spring);
}
.step:hover .step-circle { transform: translateY(-4px) rotate(-6deg); }
.step-red .step-circle { background: var(--berry-dark); }
.step-green .step-circle { background: var(--pine-dark); border: 2px solid var(--pine); }
.step-gold .step-circle { background: #b88a2f; }
.step h3 { font-size: 1.15rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.02em; }
.step-red h3 { color: var(--berry-bright); }
.step-green h3 { color: var(--pine-bright); }
.step-gold h3 { color: var(--gold-bright); }
.step p { margin: 0; max-width: 22ch; color: var(--muted); font-size: 0.98rem; }

/* ----------------------------------------------------------------- Kit, calendar, closing */
.info-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; margin-top: 44px; align-items: stretch; }
.kit, .calendar, .more, .quote { border-radius: var(--radius-lg); padding: 26px; position: relative; }

.kit { background: var(--surface); border: 1px solid var(--border); text-align: center; }
.brush-banner {
    display: inline-block; margin: 0 0 6px; padding: 6px 32px 10px;
    font-family: var(--font-brush); font-weight: 400; font-size: 2.6rem; line-height: 1; color: #fff;
    background: var(--berry-dark); transform: rotate(-2deg);
    /* ragged ends, like a brush stroke */
    clip-path: polygon(3% 8%, 12% 0, 30% 6%, 52% 0, 74% 5%, 96% 0, 100% 30%, 97% 62%, 100% 92%, 82% 100%, 58% 94%, 36% 100%, 14% 94%, 0 100%, 2% 66%, 0 34%);
}
.brush-banner span { color: var(--gold-bright); font-size: 0.8em; }
.kit-intro { margin: 8px 0 14px; color: var(--muted); font-weight: 700; }
.kit-items { list-style: none; margin: 0; padding: 0; display: flex; justify-content: center; gap: clamp(16px, 5vw, 48px); }
.kit-items li { display: flex; flex-direction: column; align-items: center; gap: 6px; font-weight: 800; }
.kit-items svg { width: 76px; height: 76px; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.35)); transition: transform 0.35s var(--ease-spring); }
.kit-items li:hover svg { transform: translateY(-4px) rotate(-6deg) scale(1.06); }

.calendar {
    background: linear-gradient(160deg, var(--pine-dark), #143d29);
    border: 1px solid rgba(95, 207, 146, 0.25); display: flex; flex-direction: column; justify-content: center;
}
.calendar h2 {
    display: flex; align-items: center; gap: 12px; margin-bottom: 14px;
    font-size: 1.5rem; font-weight: 900; text-transform: uppercase; color: #fff;
}
.calendar h2 svg { color: var(--gold-bright); }
.calendar p { margin: 0 0 6px; font-size: 1.05rem; color: rgba(255, 255, 255, 0.9); }
.calendar strong { color: #fff; }
.calendar-note { font-size: 0.92rem !important; color: rgba(255, 255, 255, 0.7) !important; margin-top: 8px !important; }

.closing { margin-top: 56px; align-items: center; }
.more { background: var(--surface); border: 1px solid var(--border); padding-left: 76px; }
.more-star { position: absolute; left: 24px; top: 26px; color: var(--gold); }
.more-star svg { fill: var(--gold); }
.more p { margin: 10px 0 0; font-size: 1.05rem; color: rgba(246, 239, 226, 0.85); }
.more strong { color: var(--gold-bright); }
/* The quote is written in the sky of the Morro Dona Marta drawing. */
.quote { position: relative; color: var(--gold); padding: 0; }
.quote-text {
    position: absolute; z-index: 1; top: 14px; left: 6px;
    font-size: clamp(1.7rem, 3vw, 2.2rem); color: var(--cream); transform: rotate(-3deg); max-width: 15ch;
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.7);
}
.skyline-label {
    position: absolute; right: 10px; bottom: 8px; font-size: 1.25rem; transform: rotate(-6deg);
    color: var(--gold-bright); text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

/* Morro Dona Marta (drawn by SantaMartaIllustration.cs), fading into the page at the edges */
.santa-marta {
    display: block; width: 100%; height: auto;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent), linear-gradient(#000 74%, transparent);
    -webkit-mask-composite: source-in;
    mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent), linear-gradient(#000 74%, transparent);
    mask-composite: intersect;
}

/* ----------------------------------------------------------------- Past Christmases: polaroids on a string of lights */
.memories { margin-top: 64px; text-align: center; scroll-margin-top: 84px; }
.memories-head .note { display: inline-block; transform: rotate(-2deg); margin-bottom: 4px; }
.memories-head p.muted { margin: 8px auto 0; max-width: 58ch; }

.memories-carousel {
    --slide: clamp(220px, 30vw, 350px);
    --spread-ratio: 0.68;  /* read by memories.js to turn a drag into photos moved */
    --spread: calc(var(--slide) * var(--spread-ratio));
    --autoplay: 6s;
    position: relative; margin-top: 8px;
}

/* Photos are laid out by memories.js through --offset (signed distance from the photo on show)
   and --abs (its absolute value), so a drag can move them by fractions. */
.memories-stage {
    --edge-fade: 14%;
    position: relative; isolation: isolate; overflow: hidden;
    height: calc(var(--slide) * 1.16 + 96px);
    touch-action: pan-y; user-select: none; -webkit-user-select: none;
    background: radial-gradient(closest-side, rgba(226, 180, 86, 0.18), rgba(210, 58, 47, 0.07) 55%, transparent);
}
/* The far photos fade into the page at the edges: two narrow gradient strips on top. (A
   mask-image on the stage, or one overlay across all of it, made the slide transition stutter.) */
.memories-stage::before, .memories-stage::after {
    content: ""; position: absolute; z-index: 200; top: 0; bottom: 0; width: var(--edge-fade); pointer-events: none;
}
.memories-stage::before { left: 0; background: linear-gradient(90deg, var(--bg), transparent); }
.memories-stage::after { right: 0; background: linear-gradient(-90deg, var(--bg), transparent); }

.memory {
    --offset: 0; --abs: 0; --tilt: -1.5deg; --tape: rgba(226, 180, 86, 0.66);
    position: absolute; top: 40px; left: 50%; width: var(--slide); margin-left: calc(var(--slide) / -2);
    display: block; padding: 12px 12px 0; border: 0; border-radius: 6px; cursor: pointer;
    font: inherit; color: inherit; text-align: center; -webkit-tap-highlight-color: transparent;
    background: linear-gradient(180deg, #fffaf0, #f2e7d2);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 26px 50px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.35);
    transform:
        translateX(calc(var(--offset) * var(--spread)))
        translateY(calc(var(--abs) * 16px))
        rotate(calc(var(--offset) * 4deg + var(--tilt)))
        scale(calc(1 - min(var(--abs), 3) * 0.15));
    opacity: clamp(0, calc(1.35 - var(--abs) * 0.45), 1);
    transition: transform 0.9s var(--ease-out), opacity 0.9s var(--ease-out);
    will-change: transform;
}
.memory:nth-of-type(even) { --tilt: 1.4deg; --tape: rgba(255, 116, 102, 0.55); }
.memory:nth-of-type(3n) { --tilt: -0.6deg; --tape: rgba(95, 207, 146, 0.5); }
.memory.is-far { pointer-events: none; }
.memory:focus-visible { outline-offset: 6px; }

/* a strip of washi tape holding the photo */
.memory::before {
    content: ""; position: absolute; z-index: 2; top: -13px; left: 50%; width: 96px; height: 26px;
    transform: translateX(-50%) rotate(-4deg);
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.22), transparent 45%), var(--tape);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    clip-path: polygon(2% 0, 98% 6%, 100% 30%, 97% 52%, 100% 76%, 97% 100%, 3% 94%, 0 70%, 3% 48%, 0 24%);
}
/* photos away from the centre sink into the night */
.memory::after {
    content: ""; position: absolute; inset: 0; z-index: 3; border-radius: inherit; pointer-events: none;
    background: var(--bg-deep); opacity: calc(min(var(--abs), 2) * 0.3);
    transition: opacity 0.9s var(--ease-out);
}
.memory-photo {
    position: relative; display: block; aspect-ratio: 1; overflow: hidden; border-radius: 2px; background: #d8cdb8;
}
.memory-photo::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.22); }
.memory-photo img {
    display: block; width: 100%; height: 100%; object-fit: cover; transform: scale(1.01);
    transition: transform 1.2s var(--ease-out);
}
/* slow "Ken Burns" drift on the photo on show */
.memory.is-active .memory-photo img { transform: scale(1.08); transition: transform calc(var(--autoplay) + 1s) linear; }
.memory-caption {
    display: block; padding: 9px 0 13px; line-height: 1;
    font-family: var(--font-hand); font-weight: 700; font-size: calc(var(--slide) * 0.105); color: #3b2a1c;
}
.memory-caption b { color: var(--berry-dark); }
.memory-zoom {
    position: absolute; z-index: 4; top: 22px; right: 22px; display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 11px; border-radius: 999px; font-size: 0.78rem; font-weight: 800; color: #fff;
    background: rgba(8, 21, 15, 0.6); backdrop-filter: blur(6px);
    opacity: 0; transform: translateY(-4px); transition: opacity 0.25s, transform 0.3s var(--ease-out);
}
.memory.is-active:hover .memory-zoom, .memory.is-active:focus-visible .memory-zoom { opacity: 1; transform: none; }
@media (hover: none) { .memory.is-active .memory-zoom { opacity: 1; transform: none; } }

.memories-carousel.is-dragging .memory,
.memories-carousel.is-dragging .memory::after { transition: none; }
.memories-carousel.is-dragging .memory { cursor: grabbing; }
/* first appearance: the photos fan out from a stack */
.memories-carousel.is-stacked .memory { transform: translateY(60px) scale(0.8) rotate(var(--tilt)); opacity: 0; }
.memories-carousel.is-entering .memory { transition-delay: calc(min(var(--abs), 3) * 120ms); }

/* Controls */
.memories-controls { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: -18px; position: relative; z-index: 1; }
.memories-arrow, .memories-play {
    position: relative; width: 46px; height: 46px; padding: 0; border-radius: 50%; display: grid; place-items: center;
    border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--cream); cursor: pointer;
    transition: transform 0.2s var(--ease-out), background 0.2s, border-color 0.2s, color 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.memories-arrow:hover, .memories-play:hover { background: var(--surface-3); border-color: var(--gold); color: var(--gold-bright); }
.memories-arrow:active, .memories-play:active { transform: scale(0.9); }
.memories-arrow svg { transition: transform 0.25s var(--ease-out); }
.memories-arrow[data-prev]:hover svg { transform: translateX(-2px); }
.memories-arrow[data-next]:hover svg { transform: translateX(2px); }
.memories-play { width: 54px; height: 54px; border-color: transparent; background: var(--surface); }
.memories-play[hidden] { display: none; }
.memories-play svg:not(.ring) { fill: currentColor; stroke: none; }
.memories-play .ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 2.5; }
.ring-track { stroke: var(--border-strong); }
.ring-progress { stroke: var(--gold); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; }
.memories-carousel.is-playing .ring-progress { animation: ring-fill var(--autoplay) linear forwards; }
.memories-carousel.is-held .ring-progress { animation-play-state: paused; }
.memories-play .icon-play, .memories-carousel:not(.is-playing) .memories-play .icon-pause { display: none; }
.memories-carousel:not(.is-playing) .memories-play .icon-play { display: block; margin-left: 2px; }
.memories-play > span { display: grid; place-items: center; }

/* Timeline: the wire runs from the first bulb to the last and lights up to the year on show. */
.memories-timeline {
    --p: 0; position: relative; list-style: none; margin: 18px auto 0; padding: 0; max-width: 780px;
    display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr));
}
.memories-timeline::before, .memories-timeline::after {
    content: ""; position: absolute; top: 12px; left: calc(50% / var(--n)); height: 2px; border-radius: 2px;
}
.memories-timeline::before { right: calc(50% / var(--n)); background: var(--border-strong); }
.memories-timeline::after {
    width: calc((100% - 100% / var(--n)) * var(--p));
    background: linear-gradient(90deg, var(--berry), var(--gold));
    box-shadow: 0 0 10px rgba(243, 205, 122, 0.5);
    transition: width 0.9s var(--ease-out);
}
.bulb {
    position: relative; z-index: 1; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 0 0 4px; border: 0; background: none; font: inherit; color: var(--muted); cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.bulb-light {
    --c: var(--berry-bright);
    position: relative; width: 14px; height: 18px; margin-top: 17px; transform-origin: 50% -5px;
    border-radius: 50% 50% 50% 50% / 58% 58% 42% 42%;
    background: #33473b; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25);
    transition: background 0.45s, transform 0.45s var(--ease-spring);
}
li:nth-child(3n+2) .bulb-light { --c: var(--gold-bright); }
li:nth-child(3n) .bulb-light { --c: var(--pine-bright); }
.bulb-light::before {
    content: ""; position: absolute; top: -5px; left: 50%; width: 8px; height: 6px; margin-left: -4px;
    border-radius: 2px 2px 1px 1px; background: #6f6b5b;
}
.bulb-light::after {
    content: ""; position: absolute; inset: -10px; border-radius: 50%; opacity: 0;
    background: radial-gradient(closest-side, color-mix(in srgb, var(--c) 70%, transparent), transparent);
    transition: opacity 0.45s;
}
.bulb.is-lit .bulb-light { background: var(--c); }
.bulb.is-lit .bulb-light::after { opacity: 0.55; }
.bulb[aria-current="true"] .bulb-light { transform: scale(1.4); }
.bulb[aria-current="true"] .bulb-light::after { opacity: 1; animation: bulb-glow 1.8s ease-in-out infinite; }
.bulb:hover .bulb-light { animation: swing 0.7s ease-in-out; }
.bulb-year { font-size: clamp(0.7rem, 2.4vw, 0.85rem); font-weight: 800; transition: color 0.3s; }
.bulb.is-lit .bulb-year { color: rgba(246, 239, 226, 0.75); }
.bulb[aria-current="true"] .bulb-year { color: var(--gold-bright); }
.bulb:hover .bulb-year { color: var(--cream); }

/* Full-size photo */
dialog.viewer {
    width: min(92vw, 78vh, 860px); padding: 0; overflow: visible;
    background: transparent; border: 0; box-shadow: none;
}
dialog.viewer::backdrop { background: rgba(3, 10, 7, 0.9); }
.viewer figure { margin: 0; }
.viewer img {
    display: block; width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 14px;
    background: #050c08; box-shadow: var(--shadow-lg);
}
.viewer figcaption { margin-top: 12px; font-family: var(--font-hand); font-weight: 700; font-size: 2rem; line-height: 1.1; text-align: center; color: var(--cream); }
.viewer-close, .viewer-nav {
    position: absolute; display: grid; place-items: center; padding: 0; border-radius: 50%; cursor: pointer;
    transition: transform 0.2s var(--ease-out), background 0.2s;
}
.viewer-close { top: -16px; right: -16px; width: 42px; height: 42px; border: 0; background: var(--berry); color: #fff; box-shadow: var(--shadow); }
.viewer-close:hover { background: var(--berry-dark); }
.viewer-nav {
    top: calc(50% - 50px); width: 52px; height: 52px; color: var(--cream);
    border: 1px solid rgba(246, 239, 226, 0.25); background: rgba(255, 255, 255, 0.08); backdrop-filter: blur(6px);
}
.viewer-nav:hover { background: rgba(255, 255, 255, 0.16); }
.viewer-close:active, .viewer-nav:active { transform: scale(0.9); }
.viewer-prev { left: -76px; }
.viewer-next { right: -76px; }

/* ----------------------------------------------------------------- Thank-you */
.thanks {
    position: relative; overflow: hidden; text-align: center;
    margin: 0 auto 24px; max-width: 720px; padding: 40px 24px 30px;
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg); animation: rise-in 0.6s var(--ease-spring);
}
.thanks::before {
    content: ""; position: absolute; inset: 0 0 auto; height: 6px;
    background: repeating-linear-gradient(90deg, var(--berry) 0 24px, var(--gold) 24px 48px, var(--pine) 48px 72px);
}
.thanks:focus { outline: none; }  /* focused only so screen readers announce it */
.thanks-icon {
    width: 66px; height: 66px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center;
    background: var(--berry-dark); color: #fff; animation: wiggle 1.2s ease-in-out 0.5s 2;
}
.thanks h2 { font-family: var(--font-brush); font-weight: 400; font-size: 2.6rem; margin-bottom: 8px; color: var(--cream); }
.thanks p { margin: 0 auto 8px; max-width: 52ch; color: var(--muted); }
.thanks .btn { margin-top: 10px; }

/* ----------------------------------------------------------------- Children list */
.list-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 56px 0 14px; scroll-margin-top: 84px; }
.list-head .note { transform: rotate(-2deg); display: inline-block; margin-bottom: 2px; }
.list-head p.muted { margin: 4px 0 0; }

.filter-bar {
    position: sticky; top: 66px; z-index: 10;
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
    margin: 0 -16px 16px; padding: 10px 16px;
    background: rgba(12, 29, 21, 0.9); backdrop-filter: blur(10px);
}
.search { position: relative; flex: 1 1 240px; max-width: 340px; display: flex; align-items: center; }
.search svg { position: absolute; left: 14px; color: var(--muted); pointer-events: none; }
.search input {
    width: 100%; font: inherit; padding: 11px 14px 11px 42px; border-radius: 999px; color: var(--text);
    border: 1px solid var(--border-strong); background: var(--surface); transition: border-color 0.2s, box-shadow 0.2s;
}
.search input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(226, 180, 86, 0.16); }
.turma-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.turma-chip {
    font: inherit; font-size: 0.88rem; font-weight: 800; padding: 8px 14px; border-radius: 999px; cursor: pointer;
    border: 1px solid var(--border); background: var(--surface); color: var(--muted);
    transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.15s var(--ease-out);
}
.turma-chip:hover { color: var(--cream); border-color: var(--border-strong); }
.turma-chip:active { transform: scale(0.94); }
.turma-chip[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: #1b1407; }
.turma-chip[aria-pressed="true"] .count { background: rgba(0, 0, 0, 0.15); color: #1b1407; }
.result-count { margin-left: auto; font-size: 0.88rem; color: var(--muted); font-weight: 700; }

.child-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 16px; }
.child-card {
    position: relative; display: flex; flex-direction: column; gap: 12px; cursor: pointer;
    padding: 18px; background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm); user-select: none; -webkit-tap-highlight-color: transparent;
    transition: transform 0.2s var(--ease-out), box-shadow 0.2s, border-color 0.2s, background 0.2s;
    animation: card-in 0.45s var(--ease-out) both;
    animation-delay: calc(var(--i, 0) * 22ms);
}
.child-card[hidden] { display: none; }
.child-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.child-card:active { transform: scale(0.98); }
.child-card:has(input:focus-visible) { outline: 3px solid var(--gold); outline-offset: 3px; }
.child-card:has(input:checked) {
    border-color: var(--berry); background: linear-gradient(180deg, #2a1f1a 0%, #24201a 100%);
    box-shadow: 0 12px 30px rgba(210, 58, 47, 0.25);
}
/* After a live refresh, cards appear in place instead of animating in again. */
.child-grid.settled .child-card:not(.pop) { animation: none; }
.child-card.pop { animation: pop 0.45s var(--ease-spring); }

.child-top { display: flex; align-items: center; gap: 12px; padding-right: 28px; }
.child-top > span:last-child { min-width: 0; }
.avatar {
    flex: none; width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center;
    font-weight: 900; font-size: 1.05rem; color: #fff; background: var(--avatar, var(--pine));
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.2);
}
.child-name, .child-meta { display: block; overflow-wrap: anywhere; }
.child-name { font-weight: 800; font-size: 1.02rem; line-height: 1.25; color: var(--cream); }
.child-meta { font-size: 0.86rem; color: var(--muted); }
.child-number { position: absolute; top: 14px; right: 14px; font-size: 0.72rem; font-weight: 800; color: var(--muted); }
.sizes { display: flex; gap: 8px; flex-wrap: wrap; }
.size {
    display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 10px;
    background: var(--surface-2); font-size: 0.84rem; color: var(--muted);
}
.size b { color: var(--cream); }
.size svg { color: var(--gold); }
.pick {
    margin-top: auto; display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 9px; border-radius: 12px; font-weight: 900; font-size: 0.92rem;
    border: 1.5px dashed var(--border-strong); color: var(--gold-bright);
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.child-card:hover .pick { border-color: var(--gold); background: var(--gold-soft); }
.pick .when-checked { display: none; }
.child-card:has(input:checked) .pick { border-style: solid; border-color: var(--berry); background: var(--berry); color: #fff; }
.child-card:has(input:checked) .pick .when-checked { display: inline-flex; align-items: center; gap: 6px; }
.child-card:has(input:checked) .pick .when-unchecked { display: none; }
.pick .when-unchecked { display: inline-flex; align-items: center; gap: 6px; }

/* Ribbon badge on chosen cards */
.ribbon {
    position: absolute; top: -11px; left: -11px; width: 34px; height: 34px; border-radius: 50%;
    display: grid; place-items: center; background: var(--berry); color: #fff;
    box-shadow: 0 4px 12px rgba(210, 58, 47, 0.5);
    transform: scale(0) rotate(-90deg); transition: transform 0.35s var(--ease-spring);
}
.child-card:has(input:checked) .ribbon { transform: scale(1) rotate(0); }

.no-results { text-align: center; padding: 40px 16px; color: var(--muted); }
.no-results .btn { margin-top: 10px; }

/* ----------------------------------------------------------------- Gift bag (sticky bottom bar) */
.bag {
    position: fixed; left: 50%; bottom: 18px; z-index: 30; width: min(760px, calc(100vw - 24px));
    transform: translate(-50%, 160%); transition: transform 0.45s var(--ease-spring);
}
.bag.open { transform: translate(-50%, 0); }
.bag-inner {
    display: flex; align-items: center; gap: 14px; padding: 12px 12px 12px 14px;
    background: linear-gradient(160deg, #1f4a33, #163826); color: #fff;
    border: 1px solid rgba(226, 180, 86, 0.35); border-radius: 20px; box-shadow: var(--shadow-lg);
}
.bag-icon {
    position: relative; flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
    background: rgba(255, 255, 255, 0.08); color: var(--gold-bright);
}
.bag-icon.bump { animation: bump 0.45s var(--ease-spring); }
.bag-count {
    position: absolute; top: -6px; right: -6px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
    display: grid; place-items: center; background: var(--berry); color: #fff; font-size: 0.78rem; font-weight: 900;
    border: 2px solid #1a3f2b;
}
.bag-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bag-text strong { font-size: 1rem; color: #fff; }
.bag-text span { font-size: 0.85rem; color: rgba(255, 255, 255, 0.72); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bag .btn-ghost { color: rgba(255, 255, 255, 0.75); }
.page-bottom-space { height: 96px; }

/* ----------------------------------------------------------------- Send dialog */
.dialog-head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.dialog-icon { flex: none; width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; background: var(--berry-dark); color: #fff; }
.dialog-head h2 { font-family: var(--font-brush); font-weight: 400; font-size: 2.1rem; line-height: 1; }
.dialog-head p { margin: 2px 0 0; }
.dialog-children {
    list-style: none; margin: 0 0 18px; padding: 6px; max-height: 196px; overflow-y: auto;
    background: var(--bg-deep); border-radius: var(--radius); border: 1px solid var(--border);
}
.dialog-children li { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 9px; animation: fade-in 0.25s ease both; }
.dialog-children li + li { border-top: 1px solid var(--border); }
.dialog-children .avatar { width: 32px; height: 32px; border-radius: 10px; font-size: 0.82rem; }
.dialog-children .info { flex: 1; min-width: 0; font-size: 0.92rem; font-weight: 800; color: var(--cream); }
.dialog-children .info small { display: block; color: var(--muted); font-weight: 600; }
.privacy { font-size: 0.8rem; color: var(--muted); margin: 14px 0 0; text-align: center; }

/* ----------------------------------------------------------------- Confetti */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti i { position: absolute; top: -14px; width: 9px; height: 14px; border-radius: 2px; animation: confetti-fall linear forwards; }

/* ==========================================================================
   Animations
   ========================================================================== */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-down { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; } }
@keyframes card-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(18px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 20px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.045); } 100% { transform: scale(1); } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.18) rotate(-8deg); } 100% { transform: scale(1); } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-10deg); } 75% { transform: rotate(10deg); } }
@keyframes cell-saved { from { background: var(--ok-bg); } to { background: transparent; } }
@keyframes snow { from { transform: translateY(0); } to { transform: translateY(50%); } }
@keyframes twinkle { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }
@keyframes confetti-fall { to { transform: translate3d(var(--drift, 0), 105vh, 0) rotate(var(--spin, 540deg)); } }
@keyframes ring-fill { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes bulb-glow { 0%, 100% { opacity: 0.75; transform: scale(1); } 50% { opacity: 1; transform: scale(1.25); } }
@keyframes swing { 30% { rotate: 14deg; } 60% { rotate: -9deg; } 85% { rotate: 3deg; } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
    html { scroll-behavior: auto; }
    .hero-snow, .hero-snow::after { display: none; }
    .memory.is-active .memory-photo img { transform: scale(1.01); }
}

/* ==========================================================================
   Smaller screens
   ========================================================================== */
@media (max-width: 980px) {
    .hero-inner { grid-template-columns: 1fr; gap: 28px; }
    .hero-photo { width: min(78%, 360px); }
    .note-photo { left: -28px; font-size: 1.4rem; }
    .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 32px; }
    .step + .step::before { display: none; }
    .info-row { grid-template-columns: 1fr; }
    .footer-inner { grid-template-columns: 1fr; gap: 16px; text-align: center; }
    .footer-logo { justify-content: center; }
    .site-footer address { border-left: none; padding-left: 0; }
    .footer-script { transform: rotate(-3deg); }
}
@media (max-width: 640px) {
    .topbar { position: static; }
    .topbar-inner { height: auto; min-height: 60px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
    .topbar nav a { padding: 6px 10px; font-size: 0.88rem; }
    .nav-team, .nav-sep { display: none; }
    .hero { padding-top: 36px; }
    .note-photo { left: -8px; top: 12px; }
    .title-year { margin-left: 12%; }
    .step-circle { width: 84px; height: 84px; }
    .step-circle svg { width: 32px; height: 32px; }
    .filter-bar { top: 0; }
    .result-count { margin-left: 0; width: 100%; }
    .bag-inner { gap: 10px; }
    .bag .btn-ghost, .bag-text span { display: none; }
    .child-grid { grid-template-columns: minmax(0, 1fr); }
    .hero-actions .btn { flex: 1 1 auto; }
    .more { padding-left: 26px; padding-top: 64px; }
    /* too narrow to write over the sky: the quote goes above the drawing */
    .quote-text { position: static; max-width: 18ch; margin-bottom: -4px; }
    .skyline-label { font-size: 1rem; right: 6px; bottom: 4px; }
    .memories-carousel { --spread-ratio: 0.6; }
    .memories-stage { margin: 0 -16px; --edge-fade: 8%; }
    .memories-timeline { margin-inline: -8px; }
    .bulb-light { width: 12px; height: 16px; }
}
@media (max-width: 980px) {
    .viewer-close { top: 10px; right: 10px; }
    .viewer-nav { top: auto; bottom: -6px; width: 46px; height: 46px; }
    .viewer-prev { left: 0; }
    .viewer-next { right: 0; }
}
