:root {
  --ink: #16191f; --ink-2: #4b5260; --ink-3: #8a91a0; --line: #e3e5ea; --soft: #f5f6f8;
  --brand: #000; --brand-red: #e00000; --ok: #1b7f4b; --warn: #b26a00; --bad: #b42318;
  --accent: #1f3a4d; --backdrop: #f6f2ea;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.55 var(--sans); color: var(--ink); background: #fff; }
a { color: inherit; }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
p { margin: 0 0 .8em; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--ink-3); }
.opt { color: var(--ink-3); font-weight: 400; }
.narrow { max-width: 560px; margin: 0 auto; padding: 48px 16px; }
.center-block { text-align: center; }

/* ---------- buttons and fields ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px;
  border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: 600 14px var(--sans);
  text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #c7cbd3; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.12); }
.btn.dark { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.big { padding: 14px 22px; font-size: 16px; width: 100%; }
.btn.ok { border-color: var(--ok); color: var(--ok); }
.field { margin: 0 0 14px; }
.field label, .label { display: block; font-weight: 600; font-size: 14px; margin: 0 0 5px; }
input[type=text], input[type=email], input:not([type]), input[type=date], input[type=time], input[type=number],
select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #cfd3da; border-radius: 8px; font: 15px var(--sans);
  background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
textarea { resize: vertical; }
.err { color: var(--bad); font-size: 14px; margin: 4px 0 0; }
.hint { color: var(--ink-3); font-size: 13px; margin: 4px 0 0; }

/* ---------- guest page ---------- */
body.guest { background: var(--backdrop); }
.invite { max-width: 760px; margin: 0 auto; padding: 28px 16px 40px; }
.card-art { margin: 0 0 26px; }
.card-art img { width: 100%; border-radius: 10px; box-shadow: 0 18px 50px rgba(0,0,0,.18), 0 2px 6px rgba(0,0,0,.08); }
.facts { text-align: center; padding: 6px 8px 18px; }
.facts .hello { font: italic 19px var(--serif); color: var(--accent); margin: 0 0 4px; }
.facts h1 { font: 600 34px/1.15 var(--serif); color: var(--accent); margin: 0 0 12px; }
.facts .when { font-size: 18px; font-weight: 600; margin: 0 0 10px; }
.facts .where { color: var(--ink-2); }
.facts .where a { color: var(--ink-2); text-decoration-color: rgba(0,0,0,.25); }
.facts .hosts { font: italic 16px var(--serif); color: var(--ink-2); }
.facts .details { text-align: left; max-width: 560px; margin: 16px auto 0; color: var(--ink-2); }
.rsvp { background: #fff; border-radius: 14px; padding: 24px 22px; box-shadow: 0 6px 24px rgba(0,0,0,.07); }
.rsvp-head { font: 600 24px var(--serif); color: var(--accent); text-align: center; margin: 0 0 4px; }
.rsvp .by { text-align: center; color: var(--ink-2); font-size: 14px; }
.rsvp .current { background: var(--soft); border-radius: 8px; padding: 10px 12px; font-size: 15px; }
.rsvp .closed { text-align: center; font-weight: 600; }
.saved { text-align: center; padding: 6px 0 18px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.saved h2 { font: 600 28px var(--serif); color: var(--accent); margin: 0 0 4px; }
.choices { border: 0; padding: 0; margin: 14px 0 10px; display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 10px; }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.choice span { display: block; text-align: center; padding: 14px 8px; border: 2px solid #d5d8de; border-radius: 10px;
  font-weight: 700; font-size: 17px; color: var(--ink-2); transition: all .12s; }
.choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.choice.yes input:checked + span { border-color: var(--ok); background: #e9f6ef; color: var(--ok); }
.choice.maybe input:checked + span { border-color: var(--warn); background: #fdf3e2; color: var(--warn); }
.choice.no input:checked + span { border-color: #8a91a0; background: var(--soft); color: var(--ink); }
.rsvp-form .btn.big { margin-top: 6px; }
.calendar { margin-top: 18px; text-align: center; font-size: 14px; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; }
.calendar a { color: var(--accent); font-weight: 600; }
.extras { margin-top: 28px; display: grid; gap: 18px; }
.extras img { width: 100%; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.12); }
.coming { margin-top: 28px; background: #fff; border-radius: 14px; padding: 20px 22px; }
.coming h2 { font: 600 20px var(--serif); color: var(--accent); }
.coming ul { columns: 2; margin: 0; padding-left: 18px; }
.foot { text-align: center; color: var(--ink-3); font-size: 12px; margin-top: 30px; }
#celebrate { position: fixed; inset: 0; pointer-events: none; z-index: 50; display: none; }
#celebrate.on { display: block; }
@media (max-width: 560px) {
  .facts h1 { font-size: 28px; }
  .rsvp { padding: 20px 16px; }
  .coming ul { columns: 1; }
}

/* ---------- host side ---------- */
body.hostside { background: var(--soft); --accent: #000; }
.topbar { background: #000; color: #fff; }
.topbar .in { max-width: 1120px; margin: 0 auto; padding: 0 16px; height: 56px; display: flex; align-items: center; gap: 18px; }
.topbar .logo { font-weight: 800; letter-spacing: .2px; text-decoration: none; font-size: 17px; }
.topbar .logo b { color: var(--brand-red); }
.topbar .sp { flex: 1; }
.topbar a, .topbar button { color: #d9dbe0; font-size: 14px; text-decoration: none; background: none; border: 0; cursor: pointer; font-family: inherit; }
.topbar a:hover, .topbar button:hover { color: #fff; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 22px 16px 60px; }
.crumbs { font-size: 13px; color: var(--ink-3); margin-bottom: 6px; }
.crumbs a { color: var(--ink-2); }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 14px; }
.head h1 { font-size: 26px; margin: 0; }
.head .sub { color: var(--ink-2); font-size: 14px; margin: 2px 0 0; }
.head .sp { flex: 1; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 0 0 20px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--brand-red); }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-bottom: 18px; }
.panel h2 { font-size: 17px; }
.panel h3 { font-size: 15px; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; background: #e9f6ef; color: #134e32; font-size: 14px; }
.flash.error { background: #fdecea; color: #7a1a12; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; text-decoration: none; display: block; }
.tile .n { font-size: 30px; font-weight: 800; line-height: 1.1; }
.tile .l { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.tile .s { font-size: 12px; color: var(--ink-3); }
.tile.yes .n { color: var(--ok); } .tile.maybe .n { color: var(--warn); } .tile.no .n { color: var(--ink-2); }
.tile.on { outline: 2px solid var(--ink); }
.bar { height: 10px; border-radius: 6px; background: var(--line); overflow: hidden; display: flex; margin: 4px 0 18px; }
.bar i { display: block; height: 100%; }
.bar .y { background: var(--ok); } .bar .m { background: #e8a33a; } .bar .n { background: #9aa0ad; }
.grid2 { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--ink-3); padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.list td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr.row { cursor: pointer; }
table.list tr.row:hover td { background: #fafbfc; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; }
.pill.yes { background: #e9f6ef; color: var(--ok); } .pill.maybe { background: #fdf3e2; color: var(--warn); }
.pill.no { background: var(--soft); color: var(--ink-2); } .pill.none { background: #fff; color: var(--ink-3); border: 1px solid var(--line); }
.pill.off { background: #fff4e5; color: #8a4b00; }
.editor td { background: #fafbfc; }
.editor .fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 14px; }
.editor .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.table-scroll { overflow-x: auto; }
.designs { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.design { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.design .art { background: var(--soft); display: flex; align-items: center; justify-content: center; padding: 12px; min-height: 180px; }
.design .art img { max-height: 260px; width: auto; box-shadow: 0 4px 14px rgba(0,0,0,.12); }
.design .meta { padding: 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.design .tag { font-size: 12px; font-weight: 700; color: var(--brand-red); text-transform: uppercase; letter-spacing: .4px; }
.design form.inline { display: inline; }
.drop { border: 2px dashed #c7cbd3; border-radius: 12px; padding: 22px; text-align: center; background: #fff; }
.drop input[type=file] { margin: 10px auto; display: block; }
.linkbox { display: flex; gap: 8px; }
.linkbox input { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.checks label { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; margin: 0 0 8px; font-size: 15px; }
.checks input { margin-top: 4px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .cols { grid-template-columns: 1fr; } .head h1 { font-size: 22px; } }
.activity { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.activity li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.activity .when { color: var(--ink-3); display: block; font-size: 12px; }
.evcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.evcard { background: #fff; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; overflow: hidden; display: block; }
.evcard .body { padding: 14px 16px; }
.evcard h3 { margin: 0 0 4px; }
.evcard .cover { aspect-ratio: 7 / 4; background: var(--soft) center / cover no-repeat; }
.notice { background: #fff8e6; border: 1px solid #f3d38b; border-radius: 10px; padding: 14px 16px; font-size: 14px; }
.notice.good { background: #e9f6ef; border-color: #b6e0c8; }
.diet { font-size: 14px; }

/* ---------- RSVP form, per person ---------- */
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 480px) { .cols2 { grid-template-columns: 1fr; } }
.person { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
.person h3 { font: 600 16px var(--serif); color: var(--accent); margin: 0 0 8px; }
.guests-q { border: 0; padding: 0; }
.guests-q legend { padding: 0; }
label.inline { display: inline-flex; align-items: center; gap: 6px; margin: 4px 18px 4px 0; font-weight: 500; font-size: 15px; }
.updates { background: #fff; border-radius: 14px; padding: 18px 22px; margin-bottom: 18px; border-left: 4px solid var(--accent); }
.updates h2 { font: 600 18px var(--serif); color: var(--accent); margin: 0 0 6px; }
.update { padding: 8px 0; border-top: 1px solid var(--line); }
.update:first-of-type { border-top: 0; }
.update p { margin: 2px 0 0; }
.update.host form { display: inline; }
.small { font-size: 12px; }

/* ---------- effects ---------- */
#ambient { position: fixed; inset: 0; pointer-events: none; z-index: 40; }
.envelope { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  background: var(--backdrop); cursor: pointer; perspective: 1200px; transition: opacity .6s ease .2s; }
.envelope .env-back, .envelope .env-front, .envelope .env-flap, .envelope .env-card { position: absolute; width: min(78vw, 460px); left: 50%; top: 50%; }
.envelope .env-back { height: min(52vw, 300px); transform: translate(-50%, -50%); background: var(--env); border-radius: 6px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.envelope .env-card { transform: translate(-50%, -47%); padding: 0 9%; transition: transform 1s cubic-bezier(.2,.8,.2,1) .55s; z-index: 1; }
.envelope .env-card img { width: 100%; border-radius: 4px; box-shadow: 0 6px 16px rgba(0,0,0,.25); }
.envelope .env-front { height: min(52vw, 300px); transform: translate(-50%, -50%); z-index: 2; pointer-events: none;
  background: linear-gradient(to top right, transparent 49.5%, color-mix(in srgb, var(--env) 82%, #000) 50%) left / 50% 100% no-repeat,
              linear-gradient(to top left, transparent 49.5%, color-mix(in srgb, var(--env) 82%, #000) 50%) right / 50% 100% no-repeat,
              linear-gradient(to top, color-mix(in srgb, var(--env) 90%, #000) 0, color-mix(in srgb, var(--env) 90%, #000) 55%, transparent 55%); border-radius: 6px; }
.envelope .env-flap { height: calc(min(52vw, 300px) * .58); transform: translate(-50%, calc(min(52vw, 300px) * -.5)); transform-origin: top; z-index: 3;
  background: color-mix(in srgb, var(--env) 75%, #000); clip-path: polygon(0 0, 100% 0, 50% 100%); transition: transform .6s ease; }
.envelope .env-hint { position: absolute; bottom: 12%; width: 100%; text-align: center; font: italic 17px var(--serif); color: var(--accent); }
.envelope.open .env-flap { transform: translate(-50%, calc(min(52vw, 300px) * -.5)) rotateX(180deg); z-index: 0; }
.envelope.open .env-card { transform: translate(-50%, -105%); z-index: 4; }
.envelope.open .env-hint { opacity: 0; }
.envelope.gone { opacity: 0; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .envelope { display: none; } }
