/* Admin pages and the plain pages (sign-in, errors). */
:root {
    color-scheme: light dark;
    --bg: #f5f4f1; --surface: #ffffff; --text: #1f2328; --muted: #646a73; --line: #e1e0dc;
    --primary: #7a2e3a; --primary-text: #ffffff; --danger: #b42318;
    --yes: #2f8a4e; --maybe: #c58a10; --no: #8c8f94; --pending: #b8bcc2;
    --radius: 10px;
}
@media (prefers-color-scheme: dark) {
    :root { --bg: #16171a; --surface: #202227; --text: #e8e6e3; --muted: #9ca1a8; --line: #33363c; --primary: #d0707f; --primary-text: #16171a; --danger: #f97066; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--primary); }
h1 { font-size: 1.6rem; margin: 0 0 1rem; line-height: 1.25; }
h2 { font-size: 1.15rem; margin: 0 0 .8rem; }
h3 { font-size: 1rem; margin: 1.2rem 0 .5rem; }
code, .code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
pre.code { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .8rem 1rem; overflow-x: auto; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.error-text { color: var(--danger); }

/* Plain pages */
.plain-main { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.plain-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 2rem; width: min(100%, 26rem); }
.plain-card .brand { color: var(--primary); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: .8rem; margin: 0 0 .5rem; }

/* Chrome */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: .75rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar .brand { font-weight: 700; text-decoration: none; color: var(--text); }
.topbar nav { display: flex; gap: 1.1rem; align-items: center; }
.topbar nav a { text-decoration: none; color: var(--muted); }
.topbar nav a:hover { color: var(--text); }
.topbar form { margin: 0; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); cursor: pointer; }
.admin-main { max-width: 72rem; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.admin-footer { text-align: center; color: var(--muted); font-size: .8rem; padding-bottom: 2rem; }
.crumbs { margin: 0 0 .5rem; color: var(--muted); font-size: .9rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { margin-bottom: .25rem; }
.page-head p { margin: 0; }
.head-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Buttons and notices */
.btn { display: inline-flex; align-items: center; gap: .4rem; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
    padding: .5rem .9rem; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.btn.small { padding: .25rem .6rem; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.copied { border-color: var(--yes); color: var(--yes); }
.notice { padding: .7rem 1rem; border-radius: 8px; margin: 0 0 1rem; background: color-mix(in srgb, var(--yes) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--yes) 35%, var(--line)); }
.notice.error { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.pill { display: inline-block; font-size: .75rem; font-weight: 700; padding: .1rem .55rem; border-radius: 999px; vertical-align: middle; background: var(--line); color: var(--text); white-space: nowrap; }
.status-open { background: color-mix(in srgb, var(--yes) 20%, var(--surface)); }
.status-closed { background: color-mix(in srgb, var(--danger) 16%, var(--surface)); }
.reply-yes { background: color-mix(in srgb, var(--yes) 22%, var(--surface)); }
.reply-maybe { background: color-mix(in srgb, var(--maybe) 25%, var(--surface)); }
.reply-no { background: color-mix(in srgb, var(--no) 25%, var(--surface)); }

/* Panels and forms */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.25rem; }
.panel.danger { border-color: color-mix(in srgb, var(--danger) 30%, var(--line)); }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
details.panel summary { cursor: pointer; list-style: revert; }
details.panel summary h2 { display: inline; }
.form label, .stack label { display: grid; gap: .3rem; margin-bottom: .9rem; font-weight: 600; }
.form label.inline, label.inline { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; font-weight: 500; }
.hint { font-weight: 400; color: var(--muted); font-size: .85rem; }
input:not([type=checkbox]):not([type=radio]):not([type=color]), select, textarea {
    font: inherit; font-weight: 400; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .5rem .65rem; width: 100%; min-width: 0;
}
label.inline input:not([type=checkbox]) { width: auto; }
input[type=number] { max-width: 7rem; }
input[type=color] { width: 100%; height: 2.4rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); padding: 2px; }
textarea { resize: vertical; }
textarea.code { font-size: .85rem; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 0 1rem; }
.align-end { align-self: center; justify-self: start; }
.checks { display: grid; gap: .2rem; margin-bottom: .9rem; }
.checks label { display: flex; align-items: center; gap: .5rem; font-weight: 500; margin: 0; }
.colors { display: grid; grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr)); gap: .75rem; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.actions.sticky { position: sticky; bottom: 0; background: var(--bg); padding: .75rem 0; border-top: 1px solid var(--line); }
.inline-form, .inline-forms { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin: 0 0 .75rem; }
.inline-forms form { margin: 0; }
.form.narrow { max-width: 24rem; }
.stack { display: grid; gap: .5rem; }

/* Events list */
.empty { text-align: center; padding: 3rem 1rem; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.event-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: 1rem; }
.event-card { display: block; text-decoration: none; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
.event-card:hover { border-color: var(--primary); }
.event-card h2 { margin: .5rem 0 .2rem; }
.event-card p { margin: 0; }
.mini-stats { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin-top: .75rem !important; font-size: .9rem; color: var(--muted); }
.mini-stats strong { color: var(--text); }

/* Event dashboard */
.status-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem 1rem; margin-bottom: 1.25rem; }
.status-bar span { margin-right: auto; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: .75rem; margin-bottom: .75rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; display: grid; }
.stat .num { font-size: 1.8rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .label { color: var(--muted); font-size: .85rem; }
.stat.yes { border-top: 3px solid var(--yes); }
.stat.maybe { border-top: 3px solid var(--maybe); }
.stat.no { border-top: 3px solid var(--no); }
.progress { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--pending); gap: 2px; }
.progress span { display: block; height: 100%; }
.bar-yes { background: var(--yes); } .bar-maybe { background: var(--maybe); } .bar-no { background: var(--no); }
.filters { display: flex; gap: .3rem .9rem; flex-wrap: wrap; font-size: .9rem; }
.filters a { color: var(--muted); text-decoration: none; }
.filters a.active { color: var(--text); font-weight: 700; text-decoration: underline; }
.table-wrap { overflow-x: auto; margin: 0 -1.25rem; padding: 0 1.25rem; }
table.guests { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.guests th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: .5rem; border-bottom: 1px solid var(--line); }
table.guests td { padding: .65rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.guests td.details { max-width: 22rem; }
table.guests .message { font-style: italic; }
table.guests .link-cell { white-space: nowrap; }
table.guests .link-cell .btn { margin: 0 0 .3rem; }
.add-guests { margin-top: 1.25rem; display: grid; gap: .5rem; justify-items: start; }
.add-guests label { display: grid; gap: .4rem; width: 100%; font-weight: 400; }
.activity { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
.link-row { display: flex; gap: .5rem; margin-bottom: .5rem; }
.link-row input { flex: 1; }

/* Design editor */
.design-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.preview-pane { position: sticky; top: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.preview-head { padding: .5rem .9rem; font-size: .85rem; color: var(--muted); border-bottom: 1px solid var(--line); }
.preview-pane iframe { display: block; width: 100%; height: calc(100vh - 6rem); border: 0; background: #fff; }
.hero-thumb { display: block; max-height: 10rem; border-radius: 8px; margin-bottom: .6rem; }
@media (max-width: 960px) {
    .design-layout { grid-template-columns: 1fr; }
    .preview-pane { position: static; }
    .preview-pane iframe { height: 75vh; }
}
@media (max-width: 600px) {
    .admin-main { padding: 1rem .75rem 2rem; }
    .link-row { flex-wrap: wrap; }
}
/* Progress bar widths (no inline styles: the CSP blocks them). */
.w0 { width: 0%; } .w1 { width: 1%; } .w2 { width: 2%; } .w3 { width: 3%; } .w4 { width: 4%; } .w5 { width: 5%; } .w6 { width: 6%; } .w7 { width: 7%; } .w8 { width: 8%; } .w9 { width: 9%; } .w10 { width: 10%; } .w11 { width: 11%; } .w12 { width: 12%; } .w13 { width: 13%; } .w14 { width: 14%; } .w15 { width: 15%; } .w16 { width: 16%; } .w17 { width: 17%; } .w18 { width: 18%; } .w19 { width: 19%; } .w20 { width: 20%; } .w21 { width: 21%; } .w22 { width: 22%; } .w23 { width: 23%; } .w24 { width: 24%; } .w25 { width: 25%; } .w26 { width: 26%; } .w27 { width: 27%; } .w28 { width: 28%; } .w29 { width: 29%; } .w30 { width: 30%; } .w31 { width: 31%; } .w32 { width: 32%; } .w33 { width: 33%; } .w34 { width: 34%; } .w35 { width: 35%; } .w36 { width: 36%; } .w37 { width: 37%; } .w38 { width: 38%; } .w39 { width: 39%; } .w40 { width: 40%; } .w41 { width: 41%; } .w42 { width: 42%; } .w43 { width: 43%; } .w44 { width: 44%; } .w45 { width: 45%; } .w46 { width: 46%; } .w47 { width: 47%; } .w48 { width: 48%; } .w49 { width: 49%; } .w50 { width: 50%; } .w51 { width: 51%; } .w52 { width: 52%; } .w53 { width: 53%; } .w54 { width: 54%; } .w55 { width: 55%; } .w56 { width: 56%; } .w57 { width: 57%; } .w58 { width: 58%; } .w59 { width: 59%; } .w60 { width: 60%; } .w61 { width: 61%; } .w62 { width: 62%; } .w63 { width: 63%; } .w64 { width: 64%; } .w65 { width: 65%; } .w66 { width: 66%; } .w67 { width: 67%; } .w68 { width: 68%; } .w69 { width: 69%; } .w70 { width: 70%; } .w71 { width: 71%; } .w72 { width: 72%; } .w73 { width: 73%; } .w74 { width: 74%; } .w75 { width: 75%; } .w76 { width: 76%; } .w77 { width: 77%; } .w78 { width: 78%; } .w79 { width: 79%; } .w80 { width: 80%; } .w81 { width: 81%; } .w82 { width: 82%; } .w83 { width: 83%; } .w84 { width: 84%; } .w85 { width: 85%; } .w86 { width: 86%; } .w87 { width: 87%; } .w88 { width: 88%; } .w89 { width: 89%; } .w90 { width: 90%; } .w91 { width: 91%; } .w92 { width: 92%; } .w93 { width: 93%; } .w94 { width: 94%; } .w95 { width: 95%; } .w96 { width: 96%; } .w97 { width: 97%; } .w98 { width: 98%; } .w99 { width: 99%; } .w100 { width: 100%; }
.offscreen { position: fixed; left: -9999px; top: 0; }

/* Home page: the family crest on a frosted, slightly transparent card over the seascape. */
body.home {
    background: #2a2b2e url("/assets/img/home-bg.jpg") center / cover no-repeat fixed;
    color: #f4f2ee;
}
/* Dimming overlay over the photo, so the lighter frosted card stands out from it. */
body.home .plain-main {
    background: linear-gradient(rgb(0 0 0 / .42), rgb(0 0 0 / .62));
}
.home-card {
    width: min(100%, 30rem);
    padding: 2.25rem 2rem 2rem;
    text-align: center;
    color: #f4f2ee;
    background: linear-gradient(rgb(255 255 255 / .08), rgb(255 255 255 / .08)), rgb(22 23 26 / .45);
    border: 1px solid rgb(255 255 255 / .3);
    border-radius: 18px;
    box-shadow: 0 20px 60px rgb(0 0 0 / .45);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}
.home-card .crest { display: block; width: 150px; height: auto; margin: 0 auto 1rem; opacity: .92; filter: drop-shadow(0 4px 14px rgb(0 0 0 / .45)); }
.home-card .brand { color: rgb(255 255 255 / .75); font-weight: 600; letter-spacing: .18em; text-transform: uppercase; font-size: .75rem; margin: 0 0 .35rem; }
.home-card h1 { font-family: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif; font-size: clamp(1.8rem, 6vw, 2.4rem); font-weight: 600; margin: 0 0 1rem; }
.home-card p:last-child { margin: 0; color: rgb(255 255 255 / .85); line-height: 1.6; }
/* iOS ignores fixed backgrounds on scrolling pages; let it scroll there instead. */
@supports (-webkit-touch-callout: none) { body.home { background-attachment: scroll; } }

/* Sign-in form on the frosted home card. */
.home-form { text-align: left; margin-top: .5rem; }
.home-form label { color: rgb(255 255 255 / .85); font-weight: 600; }
.home-card input:not([type=checkbox]):not([type=radio]) {
    background: rgb(255 255 255 / .1); border-color: rgb(255 255 255 / .3); color: #fff; padding: .65rem .8rem;
}
.home-card input:focus { outline: 2px solid rgb(255 255 255 / .7); outline-offset: 1px; }
.home-card .btn.primary { justify-content: center; padding: .7rem 1rem; background: #f4f2ee; border-color: #f4f2ee; color: #1f2023; }
.home-card .btn.primary:hover { background: #fff; }
.home-card .notice.error { text-align: left; background: rgb(180 35 24 / .35); border-color: rgb(255 140 130 / .5); color: #fff; }
.home-card .notice code { color: #fff; }
