:root {
  --bg: #0a0a0b;
  --bg-2: #121214;
  --card: rgba(22, 21, 19, 0.92);
  --line: rgba(212, 175, 55, 0.35);
  --line-soft: rgba(212, 175, 55, 0.16);
  --gold: #d4af37;
  --gold-light: #f1d98a;
  --gold-dark: #9c7a1c;
  --text: #f5f1e6;
  --muted: #b9b2a0;
  --danger: #ff8a7a;
  --ok: #9fdc9a;
  --radius: 14px;
  --display: 'Cinzel', 'Times New Roman', serif;
  --script: 'Great Vibes', 'Brush Script MT', cursive;
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(212, 175, 55, 0.18), transparent 60%),
    radial-gradient(600px 400px at 100% 100%, rgba(212, 175, 55, 0.08), transparent 70%),
    var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--body);
}

a { color: var(--gold-light); }
a:hover { color: #fff3c8; }
[hidden] { display: none !important; }

.wrap { max-width: 560px; margin: 0 auto; padding: 16px 16px 48px; }
.wrap.wide { max-width: 1200px; }

/* ---- Top bar & language toggle ---------------------------------------- */
.topbar { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }
.lang { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.lang button {
  background: transparent; color: var(--muted); border: 0; font: 600 13px/1 var(--body);
  letter-spacing: .08em; padding: 0 14px; min-height: 36px; cursor: pointer;
}
.lang button[aria-pressed="true"] { background: var(--gold); color: #1a1405; }

/* ---- Hero -------------------------------------------------------------- */
.hero { text-align: center; padding: 20px 4px 8px; }
.kicker { font: 400 34px/1 var(--script); color: var(--gold-light); margin: 0 0 6px; }
.title {
  font: 700 clamp(28px, 8vw, 44px)/1.08 var(--display);
  letter-spacing: .06em; text-transform: uppercase; margin: 0;
  background: linear-gradient(180deg, #fff1bf 0%, var(--gold) 55%, var(--gold-dark) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.year {
  display: block; font: 700 clamp(56px, 20vw, 96px)/1 var(--display); letter-spacing: .04em;
  background: linear-gradient(180deg, #fff6d5 0%, var(--gold) 50%, var(--gold-dark) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 18px rgba(212, 175, 55, 0.25));
}
.divider { display: flex; align-items: center; gap: 12px; color: var(--gold); margin: 18px auto; max-width: 280px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }

.details { list-style: none; padding: 0; margin: 0 auto; display: grid; gap: 10px; text-align: center; }
.details li { font-size: 17px; }
.details .when { font: 600 18px/1.4 var(--display); letter-spacing: .05em; color: var(--gold-light); }
.details .muted { color: var(--muted); font-size: 15px; }
.details a { text-decoration: none; border-bottom: 1px dashed var(--line); }

/* ---- Counter ----------------------------------------------------------- */
.counter {
  margin: 22px 0 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius);
  background: rgba(212, 175, 55, 0.06); text-align: center;
}
.counter strong { font: 700 20px/1.3 var(--display); letter-spacing: .03em; color: var(--gold-light); }
.bar { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); margin-top: 10px; overflow: hidden; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-dark), var(--gold-light)); transition: width .6s ease; }
.counter.full strong { color: var(--danger); }

/* ---- Cards & form ------------------------------------------------------ */
.card {
  background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 20px 16px; margin: 16px 0; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.card h2 {
  font: 700 22px/1.2 var(--display); letter-spacing: .08em; text-transform: uppercase;
  color: var(--gold); margin: 0 0 14px; text-align: center;
}
.field { margin-bottom: 18px; }
label, .label { display: block; font-weight: 600; margin-bottom: 6px; }
.opt { font-weight: 400; color: var(--muted); font-size: 14px; }
.hint { color: var(--muted); font-size: 14px; margin: 6px 0 0; }

input[type="text"], input[type="tel"], input[type="password"], input[type="number"], input[type="search"], textarea, select {
  width: 100%; min-height: 52px; padding: 12px 14px; font: 16px/1.4 var(--body); color: var(--text);
  background: var(--bg-2); border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.25); }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); }

.phone { display: flex; }
.phone .prefix {
  display: flex; align-items: center; padding: 0 14px; border: 1px solid rgba(255, 255, 255, 0.16);
  border-right: 0; border-radius: 10px 0 0 10px; background: rgba(212, 175, 55, 0.1); color: var(--gold-light); font-weight: 600;
}
.phone input { border-radius: 0 10px 10px 0; }

.stepper { display: grid; grid-template-columns: 64px 1fr 64px; align-items: center; gap: 10px; max-width: 320px; }
.stepper button {
  height: 64px; border-radius: 50%; border: 1px solid var(--gold); background: rgba(212, 175, 55, 0.08);
  color: var(--gold-light); font: 400 32px/1 var(--body); cursor: pointer; transition: background .15s, transform .1s;
  touch-action: manipulation;
}
.stepper button:hover:not(:disabled) { background: rgba(212, 175, 55, 0.2); }
.stepper button:active:not(:disabled) { transform: scale(.94); }
.stepper button:disabled { opacity: .3; cursor: not-allowed; border-color: rgba(255, 255, 255, 0.2); color: var(--muted); }
.stepper button:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.4); }
.stepper output { text-align: center; font: 700 44px/1 var(--display); color: var(--gold-light); }

.check { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 10px; border: 1px solid transparent; cursor: pointer; font-weight: 500; margin: 0; }
.check:hover { background: rgba(255, 255, 255, 0.03); }
.check input { appearance: none; -webkit-appearance: none; flex: 0 0 26px; width: 26px; height: 26px; margin: 0; border: 2px solid var(--gold); border-radius: 6px; background: transparent; display: grid; place-content: center; cursor: pointer; }
.check input::after { content: ''; width: 12px; height: 7px; border: 3px solid #1a1405; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); opacity: 0; }
.check input:checked { background: var(--gold); }
.check input:checked::after { opacity: 1; }
.check input:focus-visible { box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.35); }
.check.invalid { border-color: var(--danger); }

.error { color: var(--danger); font-size: 14px; margin: 6px 0 0; }
.alert { border: 1px solid var(--danger); background: rgba(255, 138, 122, 0.08); color: #ffd2cb; border-radius: 10px; padding: 12px 14px; margin: 12px 0; }
.notice { border: 1px solid var(--line); background: rgba(212, 175, 55, 0.08); border-radius: 10px; padding: 12px 14px; margin: 12px 0; }

/* Contribution */
details.contrib { border: 1px solid var(--line-soft); border-radius: var(--radius); background: rgba(212, 175, 55, 0.04); margin: 18px 0; }
details.contrib summary {
  list-style: none; cursor: pointer; padding: 16px; min-height: 56px; display: flex; align-items: center; justify-content: space-between;
  font: 700 17px/1.2 var(--display); letter-spacing: .06em; text-transform: uppercase; color: var(--gold);
}
details.contrib summary::-webkit-details-marker { display: none; }
details.contrib summary::after { content: '+'; font-size: 24px; color: var(--gold-light); transition: transform .2s; }
details.contrib[open] summary::after { transform: rotate(45deg); }
.contrib .inner { padding: 0 16px 16px; }
.contrib .friendly { margin: 0 0 14px; color: var(--muted); }
.copyrow { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 10px; margin-bottom: 10px; }
.copyrow .k { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
.copyrow .v { font: 700 22px/1.2 var(--display); color: var(--gold-light); letter-spacing: .06em; }
.copyrow > div { flex: 1; }
.vipps-btn { margin: 4px 0 16px; text-decoration: none; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 20px;
  border-radius: 999px; border: 1px solid var(--gold); background: transparent; color: var(--gold-light);
  font: 700 15px/1 var(--body); letter-spacing: .06em; text-transform: uppercase; cursor: pointer; text-decoration: none;
  transition: transform .1s, background .15s, box-shadow .15s;
}
.btn:hover { background: rgba(212, 175, 55, 0.1); color: var(--gold-light); }
.btn:active { transform: scale(.98); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.4); }
.btn.primary { width: 100%; min-height: 58px; font-size: 17px; color: #1a1405; border: 0; background: linear-gradient(180deg, #f8e7a8 0%, var(--gold) 55%, #b88f22 100%); box-shadow: 0 8px 24px rgba(212, 175, 55, 0.25); }
.btn.primary:hover { filter: brightness(1.05); color: #1a1405; }
.btn.primary:disabled { opacity: .6; cursor: progress; }
.btn.small { min-height: 44px; padding: 0 16px; font-size: 13px; }
.btn.block { width: 100%; }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: rgba(255, 138, 122, 0.1); }
.btn.ghost { border-color: transparent; color: var(--muted); text-transform: none; letter-spacing: 0; font-weight: 500; text-decoration: underline; }
.stack { display: grid; gap: 10px; margin-top: 14px; }

.privacy { color: var(--muted); font-size: 13px; text-align: center; margin: 16px 4px; }

/* Confirmation */
.cheers { font: 400 clamp(64px, 20vw, 88px)/1 var(--script); color: var(--gold-light); text-align: center; margin: 8px 0 4px; text-shadow: 0 4px 24px rgba(212, 175, 55, 0.35); }
.lead { text-align: center; font-size: 18px; margin: 0 0 16px; }
dl.summary { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0; }
dl.summary dt { color: var(--muted); }
dl.summary dd { margin: 0; font-weight: 600; word-break: break-word; }
.linkbox { font: 14px/1.4 ui-monospace, Menlo, monospace; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; word-break: break-all; color: var(--gold-light); margin: 10px 0; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.badge.confirmed { background: rgba(159, 220, 154, 0.15); color: var(--ok); }
.badge.waitlist { background: rgba(212, 175, 55, 0.18); color: var(--gold-light); }
.badge.cancelled { background: rgba(255, 138, 122, 0.15); color: var(--danger); }

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

/* Dialog */
dialog { background: var(--bg-2); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; width: min(92vw, 440px); }
dialog::backdrop { background: rgba(0, 0, 0, 0.7); }
dialog h3 { font: 700 20px/1.2 var(--display); color: var(--gold); margin: 0 0 10px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--gold); color: #1a1405; padding: 10px 18px; border-radius: 999px; font-weight: 700; z-index: 50; box-shadow: 0 8px 24px rgba(0,0,0,.5); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---- Admin ------------------------------------------------------------- */
.admin-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin: 8px 0 16px; }
.admin-head h1 { font: 700 24px/1.2 var(--display); letter-spacing: .06em; color: var(--gold); margin: 0; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
.tile { border: 1px solid var(--line-soft); background: var(--card); border-radius: var(--radius); padding: 14px; }
.tile .k { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.tile .v { font: 700 26px/1.2 var(--display); color: var(--gold-light); }
.tile .s { color: var(--muted); font-size: 13px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar input[type="search"] { flex: 1 1 200px; min-height: 44px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs button { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-soft); background: transparent; color: var(--muted); cursor: pointer; font-weight: 600; }
.tabs button[aria-pressed="true"] { border-color: var(--gold); color: var(--gold-light); background: rgba(212, 175, 55, 0.1); }

table.rsvps { width: 100%; border-collapse: collapse; font-size: 15px; }
table.rsvps th { text-align: left; color: var(--gold); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.rsvps td { padding: 10px 8px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); vertical-align: top; }
table.rsvps tr.cancelled td { opacity: .55; }
table.rsvps .num { text-align: right; font-variant-numeric: tabular-nums; }
table.rsvps .actions { white-space: nowrap; display: flex; gap: 6px; flex-wrap: wrap; }
.verify { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.verify input { width: 22px; height: 22px; accent-color: var(--gold); }
.small-muted { color: var(--muted); font-size: 13px; }

/* Admin: event page editor */
.view-tabs { margin: 0 0 16px; }
.view-tabs button { min-height: 44px; padding: 0 18px; font-size: 15px; }
.event-form h2 { text-align: left; }
.form-section { font: 700 16px/1.2 var(--display); letter-spacing: .06em; text-transform: uppercase; color: var(--gold-light); margin: 24px 0 12px; border-top: 1px solid var(--line-soft); padding-top: 18px; }
.lang-grid, .text-row { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
.lang-head { display: none; color: var(--gold); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px; }
.text-row > .row-label { font-weight: 600; margin: 4px 0 8px; }
.text-row .field { margin-bottom: 12px; }
.text-row .field label { font-weight: 500; color: var(--muted); font-size: 14px; }
.shared-grid { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
.event-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 8px; }
.event-actions .btn.primary { width: auto; flex: 1 1 220px; }
.event-form input[type="url"], .event-form input[type="datetime-local"] {
  width: 100%; min-height: 52px; padding: 12px 14px; font: 16px/1.4 var(--body); color: var(--text);
  background: var(--bg-2); border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 10px;
}
.event-form .changed { border-color: var(--gold) !important; }
@media (min-width: 760px) {
  .lang-grid { grid-template-columns: 1fr 1fr; }
  .lang-head { display: block; }
  .text-row { grid-template-columns: 1fr 1fr; }
  .text-row > .row-label { grid-column: 1 / -1; }
  .text-row .field label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .shared-grid { grid-template-columns: 1fr 1fr; }
  .shared-grid .wide { grid-column: 1 / -1; }
}

@media (max-width: 860px) {
  table.rsvps thead { display: none; }
  table.rsvps, table.rsvps tbody, table.rsvps tr, table.rsvps td { display: block; width: 100%; }
  table.rsvps tr { border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--card); margin-bottom: 10px; padding: 8px 12px; }
  table.rsvps td { border: 0; padding: 6px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  table.rsvps td::before { content: attr(data-label); color: var(--muted); font-size: 13px; text-align: left; flex: 0 0 auto; }
  table.rsvps td.name-cell { font: 700 18px/1.3 var(--display); color: var(--gold-light); }
  table.rsvps td.name-cell::before { content: none; }
  table.rsvps .num { text-align: right; }
  table.rsvps .actions { justify-content: flex-end; }
}
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(4, 1fr); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
