/* Mobile first: everything is a single column sized for a phone;
   wider screens only get a centered column and a few two-up grids. */
:root {
  --bg: #3e0f0f;
  --card: #4a1616;
  --line: #6b2c2c;
  --text: #f8e6df;
  --muted: #d9b8b0;
  --accent: #e3a3a8;
  --accent-ink: #3e0f0f;
  --sage: #a9b594;
  --field: #2f0b0b;
  --ok: #a9b594;
  --err: #f0a08a;
  /* button states: outline buttons turn sage, the rose primary turns gold */
  --hover: #a9b594; --press: #8a9976; --hover-ink: #2c0909;
  --pri-hover: #e8c98a; --pri-press: #c9a24d; --pri-ink: #3e0f0f;
  --choice-hover: #4a1a1a;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}
body.admin {
  --bg: #f7f1ee;
  --card: #ffffff;
  --line: #e2d5d0;
  --text: #2b1414;
  --muted: #6d5552;
  --accent: #6e1f24;
  --accent-ink: #ffffff;
  --sage: #55683f;
  --field: #ffffff;
  --ok: #55683f;
  --err: #a8321c;
  /* button states: outline buttons tint rose, the burgundy primary turns sage green */
  --hover: #f1dcd9; --press: #e3bdb8; --hover-ink: #2b1414;
  --pri-hover: #55683f; --pri-press: #3f4f2d; --pri-ink: #ffffff;
  --choice-hover: #f7f1ee;
  --serif: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.5;
}
[hidden] { display: none !important; }
a { color: var(--accent); }

.page { max-width: 560px; margin: 0 auto; padding: 0 16px 48px; }
.page.wide { max-width: 760px; padding-top: 16px; }
.page.narrow { max-width: 420px; padding-top: 48px; }

/* ---- Guest page: ivory backdrop so the burgundy invitation stands out ---- */
body.guest { background: #f1e8dc; --card: #3e0f0f; --field: #2c0909; }
.guest footer { color: #5c3a36; }
.guest footer a { color: #6e1f24; }

/* Without JS / with reduced motion: the invitation simply sits at the top. */
.hero { display: block; width: 100%; max-width: 560px; height: auto; margin: 0 auto; box-shadow: 0 10px 30px rgba(62, 15, 15, .28); }
.env, .scroll-hint { display: none; }

/* With the envelope: a tall section whose sticky stage is driven by scroll position (see invite.html). */
.js-env .scene { height: 280vh; height: 280svh; }
.js-env .stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }
.fx { display: none; }
.js-env .props { position: absolute; inset: 0; }
.js-env .props.pop { animation: pop .28s ease-out both; }
@keyframes pop { to { opacity: 0; transform: scale(1.12); } }
.js-env .props.reappear { animation: reappear .9s ease both; }
@keyframes reappear { from { opacity: 0; } to { opacity: 1; } }
.js-env .fx { display: block; position: absolute; inset: 0; width: 100%; height: 100%; z-index: 6; pointer-events: none; }
.js-env .props > .env, .js-env .hero { position: absolute; left: 50%; top: 50%; display: block; will-change: transform; }
.js-env .hero { z-index: 2; max-width: none; margin: 0; }
.env-back { z-index: 1; background: #6f7d5e; border-radius: 6px; }
.env-front { z-index: 3; filter: drop-shadow(0 12px 18px rgba(40, 30, 20, .3)); }
.front-shape { position: absolute; inset: 0; border-radius: 0 0 6px 6px; background: #9aa886; clip-path: polygon(0 0, 50% 40%, 100% 0, 100% 100%, 0 100%); }
.front-shape::after { content: ""; position: absolute; inset: 0; background: #a6b393; clip-path: polygon(0 100%, 50% 44%, 100% 100%); }
.addressee { position: absolute; left: 0; right: 0; bottom: 13%; margin: 0; padding: 0 12px; text-align: center; color: #2f3a24; font-style: italic; font-size: 1.35rem; line-height: 1.2; overflow-wrap: anywhere; }
.addressee small { display: block; font-style: normal; font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; margin-bottom: 4px; }
.env-flap { z-index: 4; transform-origin: 50% 0; filter: drop-shadow(0 3px 5px rgba(40, 30, 20, .3)); }
.env-flap.open { z-index: 1; filter: none; }
.flap-shape { position: absolute; inset: 0; background: #8a9976; clip-path: polygon(0 0, 100% 0, 50% 100%); }
.env-flap.open .flap-shape { background: #7b8a69; }
.seal { position: absolute; left: 50%; top: 100%; width: 58px; height: 58px; margin: -40px 0 0 -29px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #8a2a30, #5a1519 70%); color: #f1d9d2; font-size: .85rem; font-style: italic; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 5px rgba(0, 0, 0, .35), inset 0 0 0 3px rgba(255, 255, 255, .08); }
.env-flap.open .seal { visibility: hidden; }

.js-env .scroll-hint { display: flex; flex-direction: column; align-items: center; gap: 4px; position: absolute; z-index: 5; left: 0; right: 0; bottom: 18px; margin: 0; color: #5c3a36; font-size: 1rem; }
.hint-text { text-transform: uppercase; letter-spacing: .16em; font-size: .85rem; }
.chev { width: 14px; height: 14px; border-right: 2px solid #6e1f24; border-bottom: 2px solid #6e1f24; transform: rotate(45deg); animation: nudge 1.6s ease-in-out infinite; }
.scroll-hint a { color: #6e1f24; font-size: .9rem; padding: 10px 12px; }
@keyframes nudge { 0%, 100% { translate: 0 0; } 50% { translate: 0 7px; } }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 18px;
  margin-top: 16px;
  scroll-margin-top: 60px;
}
.guest .card { text-align: center; }
.guest .card form { text-align: left; }

h1, h2, h3 { margin: 0 0 10px; font-weight: 500; line-height: 1.25; text-wrap: balance; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; margin-top: 22px; }
p { margin: 0 0 12px; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .78rem; color: var(--sage); margin-bottom: 6px; }
.big { font-size: 1.2rem; }
.label { color: var(--muted); font-size: .95rem; margin: 16px 0 8px; }
.fine { color: var(--muted); font-size: .9rem; }
.opt { color: var(--muted); font-size: .85em; font-weight: 400; }
.address { color: var(--text); text-decoration-color: var(--accent); text-underline-offset: 4px; }
.closed { font-size: 1.1rem; }

/* Forms: 16px+ text so iOS doesn't zoom, 48px+ tap targets */
label { display: block; margin: 16px 0 6px; font-size: 1rem; }
input, select, textarea {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  min-height: 48px;
}
label > input, label > select { margin-top: 6px; }
textarea { resize: vertical; }
input[type=file] { padding: 10px; margin-bottom: 10px; }
::placeholder { color: var(--muted); opacity: .7; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

fieldset { border: 0; padding: 0; margin: 0; }
legend { padding: 0; margin-bottom: 10px; font-size: 1.1rem; }
.choice { position: relative; margin: 0 0 10px; }
.choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.choice span {
  display: flex; align-items: center; justify-content: center;
  min-height: 56px; padding: 10px 14px;
  border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--field); font-size: 1.1rem; text-align: center;
}
.choice input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.choice input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.check { display: flex; gap: 10px; align-items: center; margin-top: 10px; font-size: .95rem; }
.check input { width: 24px; height: 24px; min-height: 0; flex: none; accent-color: var(--accent); }

.who { margin-top: 16px; }
.who .check { min-height: 44px; margin: 0; font-size: 1.05rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 50px; padding: 10px 16px;
  font: inherit; font-size: 1rem; text-align: center; text-decoration: none;
  color: var(--text); background: transparent;
  border: 1.5px solid var(--accent); border-radius: 12px;
  cursor: pointer;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); font-weight: 600; }

/* Button feedback. Hover only where a real pointer exists, so it never sticks after a tap on phones;
   the pressed colour applies everywhere. */
.btn, .choice span { transition: background-color .15s, border-color .15s, color .15s, transform .08s; }
@media (hover: hover) {
  .btn:hover { background: var(--hover); border-color: var(--hover); color: var(--hover-ink); }
  .btn.primary:hover { background: var(--pri-hover); border-color: var(--pri-hover); color: var(--pri-ink); }
  .btn.danger:hover { background: var(--err); border-color: var(--err); color: var(--card); }
  .choice:hover input:not(:checked) + span { border-color: var(--hover); background: var(--choice-hover); }
}
.btn:active { background: var(--press); border-color: var(--press); color: var(--hover-ink); transform: scale(.98); }
.btn.primary:active { background: var(--pri-press); border-color: var(--pri-press); color: var(--pri-ink); }
.btn.danger:active { background: var(--err); border-color: var(--err); color: var(--card); }
.choice input:active + span { background: var(--press); border-color: var(--press); color: var(--hover-ink); }
.btn.small { min-height: 44px; padding: 6px 12px; font-size: .92rem; }
.btn.danger { border-color: var(--err); color: var(--err); margin-top: 12px; }
form > .btn.primary { width: 100%; margin-top: 20px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.row.three { grid-template-columns: repeat(3, 1fr); }
.row.stack { grid-template-columns: 1fr; }

.banner { border-radius: 10px; padding: 12px 14px; border: 1px solid; text-align: left; font-size: 1rem; }
.banner.ok { border-color: var(--ok); color: var(--ok); }
.banner.error { border-color: var(--err); color: var(--err); }
.guest .banner.ok { color: var(--text); }

.wall blockquote { margin: 16px 0 0; padding: 14px 0 0; border-top: 1px solid var(--line); }
.wall blockquote p { font-style: italic; margin-bottom: 6px; overflow-wrap: anywhere; }
.wall cite { color: var(--sage); font-style: normal; font-size: .95rem; }
.wall cite::before { content: "— "; }

.notes-sec + .notes-sec { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.notes-sec p:last-child { margin-bottom: 0; }
.sched { list-style: none; padding: 0; margin: 4px auto 12px; display: inline-grid; grid-template-columns: auto 1fr; gap: 8px 14px; text-align: left; }
.sched li { display: contents; }
.sched .when { color: var(--sage); white-space: nowrap; font-variant-numeric: tabular-nums; }
.sched:last-child { margin-bottom: 0; }

footer { text-align: center; color: var(--muted); font-size: .9rem; margin-top: 28px; }

/* ---- Host dashboard ---- */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; background: var(--accent); color: #fff; }
.topbar a { color: #fff; font-size: .95rem; }
.tabs { position: sticky; top: 0; z-index: 5; display: flex; gap: 4px; overflow-x: auto; padding: 8px 12px; background: var(--card); border-bottom: 1px solid var(--line); }
.tabs a { flex: none; padding: 10px 12px; border-radius: 8px; text-decoration: none; color: var(--text); font-size: .95rem; }
.tabs a:active { background: var(--bg); }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.stat { border: 1px solid var(--line); border-left: 5px solid var(--muted); border-radius: 10px; padding: 12px; display: flex; gap: 10px; align-items: center; }
.stat b { font-size: 2rem; line-height: 1; font-variant-numeric: tabular-nums; }
.stat span { font-size: .9rem; line-height: 1.25; }
.stat small { color: var(--muted); }
.stat.yes { border-left-color: #55683f; }
.stat.maybe { border-left-color: #b98a1d; }
.stat.no { border-left-color: #a8321c; }

.plain { padding-left: 20px; margin: 0 0 16px; }
.chip { flex: none; font-size: .8rem; padding: 4px 10px; border-radius: 99px; background: #eee5e1; color: #4a3835; white-space: nowrap; }
.chip.yes { background: #e2ead6; color: #36461f; }
.chip.maybe { background: #f6e8c4; color: #6a4d05; }
.chip.no { background: #f6dcd5; color: #7d2412; }

details.guest { border-top: 1px solid var(--line); padding: 4px 0; scroll-margin-top: 60px; }
details.guest summary { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 52px; cursor: pointer; list-style: none; }
details.guest summary::-webkit-details-marker { display: none; }
details.guest[open] { padding-bottom: 18px; }
.gname { font-weight: 600; overflow-wrap: anywhere; }
#g-filter { margin-bottom: 8px; }
.linkrow { display: flex; gap: 8px; }
.linkrow input { min-width: 0; font-size: .85rem; }
.linkrow .btn { flex: none; }
.grid { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
.grid label { margin-top: 12px; }

.msg-edit { margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; }
.msg-edit summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--accent); }
.msg-edit[open] { padding-bottom: 12px; }
.btn:disabled { opacity: .45; cursor: default; }
.sendlist { list-style: none; padding: 0; margin: 0; }
.sendlist li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.sendlist .btns { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; flex: 0 1 auto; }
.sendlist li.done .gname { color: var(--muted); font-weight: 400; }
.sendlist li.done .gname::after { content: " ✓"; color: var(--ok); }

.note { border-top: 1px solid var(--line); padding: 12px 0; }
.note p { margin-bottom: 6px; overflow-wrap: anywhere; }
.note form { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
code { font-size: .85em; background: var(--bg); padding: 2px 6px; border-radius: 6px; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #2b1414; color: #fff; padding: 10px 18px; border-radius: 99px; font-size: .95rem; opacity: 0; pointer-events: none; transition: opacity .2s; }
#toast.show { opacity: 1; }

@media (min-width: 600px) {
  .page { padding-top: 24px; }
  .card { padding: 28px; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .grid { grid-template-columns: 1fr 1fr; }
  .grid .full { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } #toast { transition: none; } }
