/* Function-first styling. The look is matched to the invitations later. */

:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --text: #2b2723;
  --muted: #7a7168;
  --line: #e4ddd3;
  --accent: #6b5a45;
  --accent-text: #ffffff;
  --error: #a33a2a;
  --ok: #3d7a4a;
  --serif: Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.55 var(--sans);
}

h1, h2, h3, .couple { font-family: var(--serif); font-weight: normal; }
h1 { font-size: 2rem; margin: 0 0 0.5rem; }
h2 { font-size: 1.5rem; margin: 0 0 0.75rem; }
h3 { font-size: 1.15rem; margin: 0 0 0.25rem; }
a { color: var(--accent); }

/* main grows, so the footer sits at the bottom even on a short page. */
main { flex: 1 0 auto; width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }

/* ---------- header and tabs ---------- */

.site-header {
  text-align: center;
  padding: 1.25rem 16px 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.couple { font-size: 1.6rem; margin: 0 0 0.75rem; }
.tabs { display: flex; justify-content: center; gap: 0.25rem; }
@media (max-width: 480px) { .tabs { flex-wrap: wrap; } .tabs a { padding: 0.5rem 0.7rem; } }
.tabs a {
  padding: 0.6rem 1.1rem;
  text-decoration: none;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- front page ---------- */

.showcase { margin: 1.5rem -16px 0; }
.slides {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 0 16px;
  scrollbar-width: none;
}
.slides::-webkit-scrollbar { display: none; }
.slides img {
  flex: 0 0 82%;
  max-width: 420px;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 6px;
  scroll-snap-align: center;
}

.block { padding: 2rem 0; border-bottom: 1px solid var(--line); }
.block:last-child { border-bottom: 0; }
.date { color: var(--muted); margin-top: 0; }
.places { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.place p { margin: 0.25rem 0; }
.time { color: var(--muted); }

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

.button {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
.button:disabled { opacity: 0.6; cursor: default; }
.button.secondary { background: transparent; color: var(--text); border: 1px solid var(--line); }

.field { display: block; margin-bottom: 1rem; }
.field > span:first-child { display: block; margin-bottom: 0.3rem; }
.optional { color: var(--muted); font-size: 0.9em; }
input:not([type="radio"]), select, textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.count select { width: auto; min-width: 5rem; }
.name-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.diet label { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; }
.diet input { width: 1.1rem; height: 1.1rem; }
.choice { display: flex; gap: 1.5rem; }
.choice label { display: flex; align-items: center; gap: 0.4rem; }

.guest {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 1rem 1rem 0.25rem;
  margin: 0 0 1.25rem;
}
.guest legend { font-family: var(--serif); font-size: 1.2rem; padding: 0 0.4rem; }

#turnstile { margin-bottom: 1rem; }
.error { color: var(--error); }
.notice { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 1rem; }

dialog {
  max-width: 420px;
  border: 0;
  border-radius: 10px;
  padding: 1.5rem;
  background: var(--surface);
  color: var(--text);
}
dialog::backdrop { background: rgb(0 0 0 / 0.4); }
.dialog-buttons { display: flex; gap: 0.75rem; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- footer ---------- */

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  max-width: 1100px;
  margin: 2rem auto 0;
  padding: 2rem 16px 2.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
}
.site-footer p { margin: 0.15rem 0; }
.contacts { display: flex; flex-direction: column; gap: 1.25rem; min-width: 0; overflow-wrap: anywhere; }
.contact-name { font-family: var(--serif); font-size: 1.1rem; }
.wishlist { text-align: center; }
.wishlist { flex: 0 0 auto; }
.wishlist img { display: block; margin: 0.4rem auto; width: 120px; height: 120px; }
@media (min-width: 600px) { .wishlist img { width: 140px; height: 140px; } }
.wishlist-title { font-family: var(--serif); font-size: 1.1rem; }

/* ---------- admin ---------- */

body.admin main { max-width: none; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; background: var(--surface); }
th, td { text-align: left; padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tr.group-start td { border-top: 2px solid var(--muted); }

/* ---------- wide screens ---------- */

@media (min-width: 900px) {
  .slides img { flex-basis: calc((100% - 24px) / 3); min-width: 0; max-width: none; }
  .showcase .slides { padding: 0 16px; }
  #rsvp #guests { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.25rem; align-items: start; }
  .block > p, .block > h1 + p { max-width: 70ch; }
}

/* ---------- small helpers ---------- */

.link-button { background: none; border: 0; padding: 0.25rem 0; color: var(--accent); font: inherit; font-size: 0.9rem; text-decoration: underline; cursor: pointer; }
.link-button.danger { color: var(--error); }
.notice.small { padding: 0.5rem 0.75rem; }

/* ---------- bordplan ---------- */

.plan-toolbar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.plan-layout { display: grid; gap: 1.25rem; }
@media (min-width: 1000px) {
  .plan-layout { grid-template-columns: 1fr 320px; align-items: start; }
  /* The plan is tall; the side panel stays in view while scrolling it. */
  .plan-side { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow-y: auto; }
}

#plan { display: block; width: 100%; height: auto; aspect-ratio: 1000 / 1600; border: 1px solid var(--line); border-radius: 8px; touch-action: none; user-select: none; -webkit-user-select: none; }
.plan-floor { fill: var(--surface); }
.fixtures rect, .fixtures circle { fill: #efe9e0; stroke: #c9bfb1; stroke-width: 2; }
.fixture-label { font: 16px var(--sans); fill: var(--muted); }
.table { cursor: grab; }
.table-top { fill: #fff; stroke: var(--accent); stroke-width: 2; }
.table.selected .table-top { fill: #f4eee6; stroke-width: 4; }
.table.over .table-top { stroke: var(--error); stroke-width: 4; }
#plan.picking .table-top { stroke-dasharray: 6 4; }
.table-name { font: 15px var(--serif); fill: var(--text); }
.table-count { font: 12px var(--sans); fill: var(--muted); }
.chair { fill: #fff; stroke: #b8ad9f; stroke-width: 1.5; }
.chair.taken { fill: #8c7b66; stroke: #6b5a45; }
.chair.vegan { fill: #2f7d45; stroke: #1f5a30; }
.chair.vegetarian { fill: #9cc68a; stroke: #5f9a4e; }
.allergy-dot { fill: #c0392b; stroke: #fff; stroke-width: 1.5; pointer-events: none; }
.preview-ghost { opacity: 0.8; stroke: #fff; stroke-width: 2; pointer-events: none; }
.preview-ghost.main { opacity: 0.95; stroke: var(--text); stroke-width: 2.5; }
.chair.preview-shift { stroke: var(--muted); stroke-width: 2.5; stroke-dasharray: 4 3; }
.table.nofit .table-top { stroke: var(--error); stroke-width: 5; }
.table.fits .table-top { fill: #fbf3e2; stroke: #d4a63c; stroke-width: 3; }
.chair.taken.placeholder { fill: #fff; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 3 2; }
.chair.taken.placeholder.vegan, .chair.taken.placeholder.vegetarian { fill: #fff; }
.group-card.placeholder { border-style: dashed; background: var(--surface); }
.badge.placeholder { background: transparent; border: 1px dashed var(--accent); color: var(--accent); }
.swatch.placeholder { background: #fff; border: 1.5px dashed var(--accent); }
.link-select { display: block; width: 100%; margin: 0.2rem 0 0.35rem; padding: 0.25rem 0.4rem; font-size: 0.85rem; }
.group-string { fill: none; stroke-width: 28; stroke-linecap: butt; opacity: 0.5; }

.legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem; font-size: 0.85rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 2px; border: 1px solid rgb(0 0 0 / 0.2); }
.swatch.taken { background: #8c7b66; }
.swatch.vegan { background: #2f7d45; }
.swatch.vegetarian { background: #9cc68a; }
.swatch.allergy { background: #c0392b; border-radius: 50%; }
.swatch.string { background: #d4a63c; opacity: 0.6; width: 22px; border-radius: 6px; }

.side-box { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 0.9rem 1rem; margin-bottom: 1rem; }
.side-box h3 { margin: 0 0 0.4rem; }
.side-head { display: flex; justify-content: space-between; align-items: baseline; }
.table-fields { display: grid; grid-template-columns: 2fr 1fr; gap: 0.6rem; }
.group-card { border: 1px solid var(--line); border-radius: 6px; padding: 0.45rem 0.6rem; margin: 0.4rem 0; background: var(--bg); cursor: grab; user-select: none; -webkit-user-select: none; touch-action: pan-y; font-size: 0.92rem; }
.group-card.picked { outline: 3px solid #d4a63c; }
.member { padding: 0.1rem 0; }
.code { font: 0.8rem ui-monospace, monospace; color: var(--muted); }
.badge { display: inline-block; font-size: 0.75rem; padding: 0 0.4rem; border-radius: 999px; background: #eee; }
.badge.vegan { background: #2f7d45; color: #fff; }
.badge.vegetarian { background: #9cc68a; color: #1f3a17; }
.badge.allergy { background: #f6d5d0; color: #7a1f14; }
.drag-ghost { position: fixed; z-index: 10; pointer-events: none; background: var(--accent); color: #fff; padding: 0.3rem 0.7rem; border-radius: 6px; font-size: 0.9rem; box-shadow: 0 4px 12px rgb(0 0 0 / 0.2); }

/* ---------- køkkenliste ---------- */

body.kitchen main { max-width: 900px; padding-top: 1.5rem; }
.kitchen-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.kitchen-summary { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1rem 0; }
.kitchen-summary div { border: 1px solid var(--line); border-radius: 8px; padding: 0.5rem 1rem; background: var(--surface); }
.kitchen-summary strong { display: block; font-size: 1.5rem; }
.kitchen-summary span { color: var(--muted); font-size: 0.85rem; }
.kitchen-plan { display: block; width: 100%; height: auto; border: 1px solid var(--line); margin: 1rem 0 0.5rem; }
.kitchen-table { margin: 1.5rem 0; break-inside: avoid; }
.kitchen-table h2 { font-size: 1.25rem; margin-bottom: 0.4rem; }
.kitchen-table tr.needs td { background: #fbf3e2; font-weight: 600; }

@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; font-size: 11pt; }
  .no-print { display: none !important; }
  body.kitchen .legend { break-after: page; }
  body.kitchen #plan { width: auto; height: 195mm; margin: 0.5rem auto; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
