/* One stylesheet for both faces of the site.
 *
 * No web fonts and no CDN: a guest opening the page should not have their
 * address handed to Google or Cloudflare on the way, and in a year's time a
 * font host going away should not change what the invitation looks like.
 * System serif for the guest pages, system sans for the planning hub.
 *
 * Light and dark both honoured -- half the RSVPs will arrive from a phone in
 * bed with the lights off. */

:root {
  --ink: #241f1c;
  --ink-soft: #5d534c;
  --ink-faint: #8a7f77;
  --paper: #fcfaf7;
  --card: #ffffff;
  --line: #e6ddd4;
  --accent: #7a5c3e;        /* warm brown; reads as ink, not as a brand */
  --accent-soft: #f2e9df;
  --good: #2f6b4f;
  --good-soft: #e5f1ea;
  --bad: #9b3030;
  --bad-soft: #f8e8e8;
  --warn: #8a6410;
  --warn-soft: #fbf0d8;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(36, 31, 28, .06), 0 8px 24px rgba(36, 31, 28, .05);
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: ui-serif, Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #ece6e0;
    --ink-soft: #b5aaa1;
    --ink-faint: #8b8077;
    --paper: #17150f;
    --card: #211e18;
    --line: #35302a;
    --accent: #d2ab7e;
    --accent-soft: #2e271f;
    --good: #7fc29b;
    --good-soft: #1d2a22;
    --bad: #e08b8b;
    --bad-soft: #2d1e1e;
    --warn: #d9b366;
    --warn-soft: #2a2317;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
}

a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 680px; }

/* --- the guest-facing pages ---------------------------------------------- */

.guest { font-family: var(--serif); }
.guest h1, .guest h2, .guest h3 { font-family: var(--serif); font-weight: 500; }

.hero {
  text-align: center;
  padding: 64px 16px 48px;
  border-bottom: 1px solid var(--line);
}
.hero .names {
  font-family: var(--serif);
  font-size: clamp(2.4rem, 9vw, 4.2rem);
  line-height: 1.05;
  margin: 0 0 12px;
  letter-spacing: -.01em;
}
.hero .line { color: var(--ink-soft); font-size: 1.1rem; margin: 0 0 20px; letter-spacing: .04em; text-transform: uppercase; font-size: .85rem; }
.hero .when { font-family: var(--serif); font-size: clamp(1.1rem, 4vw, 1.5rem); margin: 0; }
.hero .where { color: var(--ink-soft); margin: 6px 0 0; }
.countdown { margin-top: 24px; color: var(--accent); font-size: .9rem; letter-spacing: .08em; text-transform: uppercase; }

.section { padding: 40px 0; border-bottom: 1px solid var(--line); }
.section:last-child { border-bottom: 0; }
.section h2 {
  font-size: 1.05rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-faint); font-family: var(--sans); font-weight: 600; margin: 0 0 16px;
}
.section .body { font-family: var(--serif); font-size: 1.08rem; }
.section .body p { margin: 0 0 1em; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 18px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline .t { min-width: 74px; color: var(--accent); font-variant-numeric: tabular-nums; }
.timeline .what strong { font-weight: 600; }
.timeline .what div { color: var(--ink-soft); font-size: .95rem; }

.cta { text-align: center; padding: 48px 16px; }

footer.guest-foot { text-align: center; padding: 32px 16px 56px; color: var(--ink-faint); font-size: .9rem; }

.preview-note {
  background: var(--warn-soft); color: var(--warn); text-align: center;
  padding: 8px 16px; font-size: .9rem; font-family: var(--sans);
}

/* --- forms and buttons --------------------------------------------------- */

label { display: block; font-size: .85rem; color: var(--ink-soft); margin-bottom: 4px; font-family: var(--sans); }

/* Written as an exclusion rather than a list of types, because an <input>
 * with no type attribute at all is still a text box -- and `input[type=text]`
 * does not match one. Half the forms here omit it, and they rendered at the
 * browser's default width while their neighbours filled the column. */
input:not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=button]):not([type=file]),
select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-family: var(--sans);
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent);
}

.field { margin-bottom: 14px; }
.fields { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.hint { font-size: .82rem; color: var(--ink-faint); margin-top: 4px; }

button, .btn {
  display: inline-block;
  padding: 9px 16px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: var(--paper);
  font: inherit;
  font-family: var(--sans);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
button:hover, .btn:hover { filter: brightness(1.08); }
button.ghost, .btn.ghost { background: transparent; color: var(--accent); }
button.quiet, .btn.quiet {
  background: transparent; color: var(--ink-soft); border-color: var(--line);
}
button.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
button.small, .btn.small { padding: 5px 10px; font-size: .85rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* --- the planning hub ---------------------------------------------------- */

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar .wrap { display: flex; align-items: center; gap: 16px; min-height: 56px; flex-wrap: wrap; }
.topbar .brand { font-family: var(--serif); font-size: 1.15rem; text-decoration: none; color: var(--ink); white-space: nowrap; }
.topbar nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
.topbar nav a {
  padding: 6px 10px; border-radius: 7px; text-decoration: none; color: var(--ink-soft);
  font-size: .92rem; white-space: nowrap;
}
.topbar nav a:hover { background: var(--accent-soft); color: var(--ink); }
.topbar nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.topbar .who { color: var(--ink-faint); font-size: .85rem; display: flex; align-items: center; gap: 8px; }

main.hub { padding: 24px 0 72px; }

h1.page { font-size: 1.5rem; margin: 0 0 4px; font-weight: 600; }
p.page-sub { color: var(--ink-soft); margin: 0 0 20px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.card > h2, .card > h3 { margin: 0 0 12px; font-size: 1rem; font-weight: 600; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 { margin: 0; font-size: 1rem; }

.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin-bottom: 16px; }
.tile {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow);
}
.tile .n { font-size: 1.7rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile .k { font-size: .8rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .06em; margin-top: 2px; }
.tile .sub { font-size: .85rem; color: var(--ink-soft); margin-top: 6px; }
.tile.good .n { color: var(--good); }
.tile.bad .n { color: var(--bad); }
.tile.warn .n { color: var(--warn); }

.nudges { list-style: none; margin: 0; padding: 0; }
.nudges li {
  padding: 9px 12px; border-left: 3px solid var(--warn); background: var(--warn-soft);
  color: var(--warn); border-radius: 0 7px 7px 0; margin-bottom: 8px; font-size: .92rem;
}

table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 600; border-top: 2px solid var(--line); }
.scroll-x { overflow-x: auto; }

.pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem;
  background: var(--accent-soft); color: var(--accent); white-space: nowrap; font-weight: 500;
}
.pill.yes { background: var(--good-soft); color: var(--good); }
.pill.no { background: var(--bad-soft); color: var(--bad); }
.pill.pending { background: var(--warn-soft); color: var(--warn); }
.pill.flat { background: transparent; color: var(--ink-faint); border: 1px solid var(--line); }

code.code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  background: var(--accent-soft); color: var(--accent);
  padding: 2px 7px; border-radius: 6px; letter-spacing: .08em; font-size: .9rem;
}

details.row { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; background: var(--card); }
details.row > summary {
  padding: 12px 14px; cursor: pointer; display: flex; gap: 10px; align-items: center;
  flex-wrap: wrap; list-style: none;
}
details.row > summary::-webkit-details-marker { display: none; }
details.row > summary::before { content: "▸"; color: var(--ink-faint); font-size: .8rem; }
details.row[open] > summary::before { content: "▾"; }
details.row > summary:hover { background: var(--accent-soft); border-radius: var(--radius); }
details.row .inner { padding: 4px 14px 16px; border-top: 1px solid var(--line); }
details.row .title { font-weight: 600; }
details.row .meta { color: var(--ink-faint); font-size: .85rem; margin-left: auto; }

.bar { height: 7px; background: var(--line); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.bar > span { display: block; height: 100%; background: var(--accent); }
.bar > span.over { background: var(--bad); }

.flash {
  background: var(--good-soft); color: var(--good); border: 1px solid currentColor;
  border-radius: 8px; padding: 9px 13px; margin-bottom: 16px; font-size: .92rem;
}
.error {
  background: var(--bad-soft); color: var(--bad); border: 1px solid currentColor;
  border-radius: 8px; padding: 9px 13px; margin-bottom: 16px; font-size: .92rem;
}
.empty { color: var(--ink-faint); padding: 18px 0; text-align: center; font-size: .95rem; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.filters .field { margin: 0; }
.filters input, .filters select { min-width: 150px; }

.strike { text-decoration: line-through; color: var(--ink-faint); }

@media print {
  .topbar, .btn-row, button, .filters, .nudges { display: none !important; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border: 1px solid #ccc; }
  details.row { page-break-inside: avoid; }
  details.row .inner { display: block !important; }
}

/* --- live updates --------------------------------------------------------
 *
 * Three small pieces of furniture for two people editing at once: who else is
 * here, a note saying what just changed, and a bar for when the page wants to
 * move but somebody is typing. See app/static/live.js.
 */

.presence {
  display: none;
  font-size: .8rem;
  color: var(--good);
  background: var(--good-soft);
  padding: 2px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.presence.on { display: inline-block; }

.live-toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(14px);
  background: var(--ink);
  color: var(--paper);
  padding: 9px 16px;
  border-radius: 999px;
  font-size: .9rem;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 60;
  max-width: calc(100vw - 32px);
  text-align: center;
}
.live-toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

.live-bar {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  margin: 0 auto;
  max-width: 560px;
  display: none;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--card);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 11px 14px;
  box-shadow: var(--shadow);
  z-index: 60;
  font-size: .92rem;
}
.live-bar.on { display: flex; }
.live-bar-text { flex: 1; min-width: 180px; }

/* Somebody typing should not have the page yanked about, and somebody who
 * asked for less motion should not have it animate either. */
@media (prefers-reduced-motion: reduce) {
  .live-toast { transition: none; }
}

/* --- footers -------------------------------------------------------------- */

.hub-foot {
  margin-top: 40px;
  padding: 18px 0 8px;
  border-top: 1px solid var(--line);
  color: var(--ink-faint);
  font-size: .82rem;
}
.hub-foot .wrap {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.hub-foot strong { color: var(--ink-soft); font-weight: 600; }

.guest-foot p { margin: 0 0 6px; }
.guest-foot .colophon {
  font-family: var(--sans);
  font-size: .78rem;
  color: var(--ink-faint);
  letter-spacing: .03em;
  margin-top: 18px;
}

/* The nav is one item longer now. Let it scroll sideways on a phone rather
 * than wrapping into a second row that pushes the page down. */
@media (max-width: 760px) {
  .topbar nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .topbar nav::-webkit-scrollbar { display: none; }
}

/* --- the gallery ---------------------------------------------------------- */

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 28px;
}
.photo-grid .photo {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--line);
}
.photo-grid .photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .25s ease;
}
.photo-grid .photo:hover img { transform: scale(1.04); }

.photo-grid.admin { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.photo-admin {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
  background: var(--card);
}
.photo-admin img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}
.photo-admin.is-hidden img { opacity: .35; filter: grayscale(1); }
.photo-admin-meta { font-size: .8rem; margin: 6px 0; }

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 6, .94);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 100%;
  max-height: 86vh;
  object-fit: contain;
  border-radius: 6px;
}
.lightbox-caption {
  position: absolute;
  bottom: 14px;
  left: 0;
  right: 0;
  text-align: center;
  color: rgba(255, 255, 255, .85);
  font-size: .9rem;
  font-family: var(--sans);
  margin: 0;
  padding: 0 60px;
}
.lightbox button {
  position: absolute;
  background: rgba(255, 255, 255, .12);
  border: 0;
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.lightbox button:hover { background: rgba(255, 255, 255, .22); }
.lightbox-close { top: 16px; right: 16px; }
.lightbox-step[data-step="-1"] { left: 12px; }
.lightbox-step[data-step="1"] { right: 12px; }

@media (max-width: 560px) {
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
  .lightbox-step { bottom: 50px; top: auto; }
}

/* --- inline forms ---------------------------------------------------------
 *
 * Inputs are width:100% everywhere else, which is right in a column and wrong
 * in a row: inside a flex row each one claims the full width and the controls
 * stack into a tower. These sit on one line and share what is there.
 */

.inline-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.inline-form input { width: auto; flex: 1 1 120px; min-width: 0; }
.inline-form input.narrow { flex: 0 0 64px; }
.inline-form button { flex: 0 0 auto; }

/* Ten items in the nav now. Tighten them rather than letting the bar wrap
 * into two rows on a laptop. */
.topbar nav a { padding: 5px 7px; font-size: .86rem; }
.topbar .brand { font-size: 1.05rem; }
/* The countdown is a nicety; the navigation is not. Give it up first when the
 * window is too narrow for both. */
@media (max-width: 1340px) { .topbar .who .pill { display: none; } }
