/* William & Rosie photo wall: colours, type and spacing from the William & Rosie design system */
:root {
  --navy: #142447;
  --line: #1F3566;
  --gold: #B8913E;
  --gold-soft: #E6D6A8;
  --gold-deep: #9A7A2E;
  --cream: #F1E3B5;
  --paper: #F4F3EC;
  --card: #FBFAF5;
  --field: #FDFCF8;
  --muted: #5A6785;
  --lede: #4A577A;
  --rule: #DDE1EA;
  --hairline: #ECEAE0;
  --warn: #7A2E2E;

  --font-script: "Pinyon Script", cursive;
  --font-serif: "EB Garamond", Garamond, serif;
  --font-caps: "Cinzel", serif;
  --font-ui: "Jost", system-ui, sans-serif;

  --space-2xs: 6px; --space-xs: 9px; --space-sm: 12px; --space-md: 16px;
  --space-lg: 18px; --space-xl: 26px; --space-2xl: 32px;
  --radius-card: 4px; --radius-field: 6px; --radius-panel: 8px; --radius-pill: 999px;

  --shadow-card: 0 10px 40px rgba(20, 36, 71, 0.14), inset 0 0 0 1px rgba(184, 145, 62, 0.45), inset 0 0 0 6px rgba(251, 250, 245, 0.92), inset 0 0 0 7px rgba(230, 214, 168, 0.7);
  --shadow-panel: 0 4px 18px rgba(20, 36, 71, 0.07), inset 0 0 0 1px rgba(184, 145, 62, 0.35);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--navy);
  font: 400 18px/1.5 var(--font-serif);
  padding-bottom: env(safe-area-inset-bottom);
  overflow-x: hidden;
}

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

/* ---------- Corner artwork (fixed, behind content, never over the middle) ---------- */
.deco { position: fixed; z-index: 0; pointer-events: none; user-select: none; }
.deco-frond { top: 0; width: min(40vw, 300px); opacity: 0.42; }
.deco-frond.left { left: 0; transform: translate(-34%, -30%); }
.deco-frond.right { right: 0; transform: translate(34%, -30%) scaleX(-1); }
@media (min-width: 700px) { .deco-frond.left { transform: translate(-12%, -14%); } .deco-frond.right { transform: translate(12%, -14%) scaleX(-1); } }
.deco-flower { bottom: 0; width: min(34vw, 230px); opacity: 0.78; }
.deco-flower.left { left: 0; transform: translate(-22%, 18%); }
.deco-flower.right { right: 0; transform: translate(22%, 18%) scaleX(-1); }
@media (min-width: 900px) { .deco-frond { opacity: 0.5; } }
.page { position: relative; z-index: 1; }

/* ---------- Type pieces ---------- */
.label { font: 500 14px/1.3 var(--font-caps); letter-spacing: 0.22em; color: var(--gold); margin: 0 0 var(--space-sm); text-transform: uppercase; }
.names { font: 400 56px/1.02 var(--font-script); color: var(--gold); margin: 2px 0 6px; }
.lede { font: italic 400 18px/1.5 var(--font-serif); color: var(--lede); margin: 0; text-wrap: balance; }
.fine { font: 400 13px/1.4 var(--font-ui); color: var(--muted); margin: 0; }
.divider { width: 56px; height: 1px; margin: 20px auto 18px; background: var(--gold); position: relative; border: 0; }
.divider::after { content: ""; position: absolute; left: 50%; top: 50%; width: 7px; height: 7px; background: var(--paper); border: 1px solid var(--gold); transform: translate(-50%, -50%) rotate(45deg); }
.card .divider::after { background: var(--card); }

/* ---------- Header ---------- */
.hero { text-align: center; padding: 56px var(--space-lg) var(--space-lg); }
.hero .names { font-size: clamp(48px, 14vw, 72px); }

main { max-width: 1100px; margin: 0 auto; padding: 0 var(--space-lg) 120px; }

/* ---------- Card (stationery with the double gold frame) ---------- */
.card {
  width: 100%; max-width: 400px; margin: 0 auto;
  text-align: center;
  padding: var(--space-2xl) var(--space-xl) 30px;
  background: rgba(251, 250, 245, 0.92);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}
.upload-card { display: grid; gap: var(--space-md); margin-bottom: 48px; }
.upload-card .label { margin-bottom: 0; }

.field { display: grid; gap: var(--space-2xs); text-align: left; font: 400 14px/1.5 var(--font-ui); color: var(--navy); }
.field .hint { color: var(--muted); }
.field input {
  font: 400 16px/1.4 var(--font-ui); padding: 12px 14px; border-radius: var(--radius-field);
  border: 1px solid var(--rule); background: var(--field); color: var(--navy);
}
.field input:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 15px 22px; border: 0; border-radius: var(--radius-pill);
  background: var(--navy); color: var(--cream);
  font: 500 16px/1 var(--font-ui); text-decoration: none; cursor: pointer; user-select: none;
}
.btn svg { stroke: var(--gold-soft); fill: none; stroke-width: 1.6; stroke-linecap: round; }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.btn[aria-disabled="true"] { opacity: 0.6; pointer-events: none; }
.btn-block { width: 100%; }
.btn-quiet { background: none; color: var(--navy); box-shadow: inset 0 0 0 1px var(--rule); }

.progress-bar { height: 4px; border-radius: var(--radius-pill); background: var(--hairline); overflow: hidden; }
.progress-bar span { display: block; height: 100%; width: 100%; transform: scaleX(0); transform-origin: left; background: var(--gold); transition: transform 0.2s; }
.progress p { margin: var(--space-2xs) 0 0; }
.message:empty { display: none; }
.message { margin: 0; font: 400 15px/1.5 var(--font-ui); min-height: 1.5em; }
.message.ok { color: var(--navy); }
.message.err { color: var(--warn); }

/* ---------- Gallery ---------- */
.gallery-head { text-align: center; margin-bottom: var(--space-lg); }
.gallery-head .label { margin-bottom: 4px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--space-2xs); }
@media (min-width: 700px) { .gallery { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: var(--space-sm); } }
.tile {
  position: relative; aspect-ratio: 1; border: 0; padding: 0; cursor: pointer;
  border-radius: var(--radius-card); overflow: hidden; background: var(--hairline);
  box-shadow: 0 4px 14px rgba(20, 36, 71, 0.08);
}
.tile::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(184, 145, 62, 0.45); pointer-events: none; }
.tile img, .tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.tile .badge {
  position: absolute; right: 8px; bottom: 8px; width: 32px; height: 32px; border-radius: 50%;
  background: rgba(20, 36, 71, 0.82); display: grid; place-items: center;
}
.tile .badge svg { fill: var(--gold-soft); }
.tile .del {
  position: absolute; z-index: 1; top: 6px; right: 6px; border-radius: var(--radius-pill); padding: 5px 11px;
  background: var(--card); color: var(--warn); font: 500 13px/1 var(--font-ui); cursor: pointer;
  box-shadow: 0 2px 8px rgba(20, 36, 71, 0.15);
}
.empty { text-align: center; padding: var(--space-2xl) 0; }

/* ---------- Full-screen viewer (night sky) ---------- */
.viewer { border: 0; padding: 0; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100dvh; background: linear-gradient(var(--navy), var(--line)); color: var(--cream); }
.viewer::backdrop { background: rgba(20, 36, 71, 0.92); }
.viewer[open] { display: grid; grid-template-rows: 1fr auto; }
.viewer-body { display: grid; place-items: center; min-height: 0; padding: 60px 8px 0; }
.viewer-body img, .viewer-body video { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-close, .viewer-nav {
  position: absolute; z-index: 2; border: 0; background: rgba(20, 36, 71, 0.6); color: var(--gold-soft);
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(230, 214, 168, 0.5);
}
.viewer-close svg, .viewer-nav svg { stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.viewer-close { top: 10px; right: 10px; }
.viewer-nav { top: 50%; transform: translateY(-50%); }
.viewer-nav.prev { left: 10px; }
.viewer-nav.next { right: 10px; }
.viewer-close:focus-visible, .viewer-nav:focus-visible, .viewer-foot a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.viewer-foot { display: flex; justify-content: space-between; align-items: center; gap: var(--space-md); padding: var(--space-sm) var(--space-md) calc(var(--space-sm) + env(safe-area-inset-bottom)); }
.viewer-foot span { font: italic 400 17px/1.4 var(--font-serif); color: var(--cream); }
.viewer-foot a { font: 500 15px/1 var(--font-ui); color: var(--cream); text-underline-offset: 4px; }

/* ---------- Printable QR card ---------- */
.qr-page { min-height: 100vh; display: grid; place-items: center; padding: var(--space-lg); }
.qr-page .card { padding-bottom: var(--space-2xl); }
.qr-frame { width: 100%; max-width: 280px; margin: var(--space-lg) auto var(--space-md); padding: 14px; background: #fff; border-radius: var(--radius-card); box-shadow: inset 0 0 0 1px var(--gold), inset 0 0 0 5px #fff, inset 0 0 0 6px var(--gold-soft); }
.qr-frame img { width: 100%; display: block; }
.qr-steps { font: 400 21px/1.5 var(--font-serif); margin: 0 0 var(--space-sm); }
.qr-actions { margin-top: var(--space-lg); }
@media print {
  body { background: #fff; }
  .deco { display: none; }
  .no-print { display: none !important; }
  .card { box-shadow: inset 0 0 0 1px var(--gold), inset 0 0 0 6px #fff, inset 0 0 0 7px var(--gold-soft); background: #fff; }
}

/* ---------- Admin ---------- */
.admin-bar { display: flex; flex-wrap: wrap; gap: var(--space-sm); align-items: center; justify-content: center; margin-bottom: 40px; }
.admin-bar .fine { width: 100%; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
.qr-page .names { font-size: clamp(40px, 11vw, 56px); white-space: nowrap; }
