/* Wishbox styles. Mobile first, built from the approved mockups.
   Guest pages override --accent, --hero, --tint, --banner and --hero-muted from the list's theme
   (set as inline custom properties on <body>); everything else is shared. */

@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('/fonts/bricolage-grotesque-latin-wght-normal.woff2') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'DM Sans';
  src: url('/fonts/dm-sans-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 1000;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #1c2541;
  --muted: #5b6478;
  --line: #8a93a8;
  --soft: #dde2ec;
  --white: #fff;
  --green: #1f6b4f;
  --green-text: #14573d;
  --green-tint: #e3f2ea;
  --gold: #f3b73f;
  --gold-text: #7a5200;
  --gold-tint: #fff3d6;
  --danger: #b3261e;
  /* themeable */
  --accent: #c8421f;
  --tint: #f2f4f8;
  --banner: #e4e8fb;
  --hero: #1b2f5c;
  --hero-muted: #c9d5f2;
  --display: 'Bricolage Grotesque', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--tint);
  color: var(--ink);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.4;
}
h1, h2, p { margin: 0; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.icon { flex: none; }

.page {
  max-width: 520px; min-height: 100vh; margin: 0 auto; padding: 16px 20px 32px;
  display: flex; flex-direction: column; gap: 16px;
}
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.push-down { margin-top: auto; }
.muted { color: var(--muted); }
.small { font-size: 13px; line-height: 1.4; }
.center { text-align: center; }

/* Type */
.display { font-family: var(--display); font-weight: 700; font-size: 36px; line-height: 1.05; letter-spacing: -0.02em; }
.title { font-family: var(--display); font-weight: 700; font-size: 32px; line-height: 1.05; letter-spacing: -0.02em; }
.lead { font-size: 16px; line-height: 1.5; color: var(--muted); }

/* Brand + top bar */
.brand { display: flex; align-items: center; gap: 10px; }
.brand__mark {
  width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.brand__name { font-family: var(--display); font-weight: 700; font-size: 22px; }
.topbar { display: flex; align-items: center; gap: 4px; min-height: 48px; }
.topbar__back, .topbar__action {
  width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
}
.topbar__back { margin-left: -10px; }
.topbar__action:last-child { margin-right: -10px; }
.topbar__title { flex: 1; min-width: 0; font-family: var(--display); font-weight: 700; font-size: 24px; letter-spacing: -0.01em; }

/* Cards */
.card {
  background: var(--white); border-radius: 20px; padding: 16px;
  box-shadow: 0 1px 2px rgba(28, 37, 65, 0.08);
}
.card--flush { padding: 12px; }

/* Buttons */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; width: 100%; padding: 0 16px; border: 0; border-radius: 14px;
  font: 600 16px/1 'DM Sans', system-ui, sans-serif; cursor: pointer; text-align: center;
}
.btn--sm { min-height: 44px; border-radius: 12px; font-size: 15px; }
.btn--auto { width: auto; }
.btn--accent { background: var(--accent); color: #fff; }
.btn--ink { background: var(--ink); color: #fff; }
.btn--outline { background: var(--white); color: var(--ink); border: 1px solid var(--line); }
.btn--success { background: var(--white); color: var(--green-text); border: 2px solid var(--green); }
.link-btn {
  min-height: 44px; padding: 0 4px; border: 0; background: none; cursor: pointer;
  font: 600 15px/1 'DM Sans', system-ui, sans-serif; color: var(--accent); text-decoration: underline;
}
.link-btn--ink { color: var(--ink); text-decoration: none; }
.link-btn--muted { color: var(--muted); text-decoration: none; }
.link-btn--danger { color: var(--danger); text-decoration: none; }
.inline-form { display: contents; }

/* Chips + progress */
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 600; background: var(--tint); color: var(--muted); white-space: nowrap;
}
.chip--green { background: var(--green-tint); color: var(--green-text); }
.chip--white { background: var(--white); }
.chip--small { font-size: 12px; }
.progress { height: 8px; border-radius: 4px; background: #e4e8fb; }
.progress > span { display: block; height: 8px; border-radius: 4px; background: var(--green); }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; border: 0; margin: 0; padding: 0; min-width: 0; }
.field > label, .field > legend, .label { font-size: 14px; font-weight: 600; padding: 0; }
.field > legend { margin-bottom: 6px; }
.input {
  width: 100%; height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--white); color: var(--ink); font: 400 16px 'DM Sans', system-ui, sans-serif;
}
textarea.input { height: 84px; padding: 12px 14px; resize: vertical; }
select.input { padding: 0 10px; }
.input--readonly { height: 44px; background: var(--tint); font-size: 15px; padding: 0 12px; }
.input-row { display: flex; gap: 8px; }
.input-row .input { flex: 1; min-width: 0; }
.input-row .btn { flex: none; white-space: nowrap; }
.btn[hidden] { display: none; }
.btn:disabled { opacity: 0.6; cursor: default; }
.hint { font-size: 13px; line-height: 1.4; color: var(--muted); }

.segmented { display: flex; gap: 8px; }
.segmented label { flex: 1; }
.segmented span {
  display: flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--white); font-size: 15px; font-weight: 500; text-align: center; padding: 0 4px;
}
.segmented input:checked + span { border: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 12%, white); font-weight: 600; }
.segmented input:focus-visible + span { outline: 3px solid var(--ink); outline-offset: 2px; }

.radio-card {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--white); cursor: pointer;
}
.radio-card:has(input:checked) { border: 2px solid var(--accent); padding: 11px 13px; }
.radio-card input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.radio-card strong { display: block; font-size: 15px; }
.radio-card span span { display: block; font-size: 13px; line-height: 1.4; color: var(--muted); }

.errors {
  padding: 12px 14px; border-radius: 14px; background: #fdecea; color: #7f1d1d; font-size: 14px;
}
.errors ul { margin: 0; padding-left: 18px; }
.flash {
  padding: 12px 14px; border-radius: 14px; background: var(--green-tint); color: var(--green-text);
  font-size: 14px; font-weight: 600;
}
.note {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 14px;
  background: var(--banner); font-size: 14px; line-height: 1.45;
}
.note .icon { margin-top: 1px; }
.note--warn { background: var(--gold-tint); color: #5c3d00; font-size: 13px; }

/* Admin */
.admin-link { display: inline-flex; align-items: center; }
.admin-nav { display: flex; gap: 8px; }
.admin-nav a {
  flex: 1; display: flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--white); font-size: 15px; font-weight: 500;
}
.admin-nav a.is-current { border: 2px solid var(--accent); font-weight: 600; }
.admin-heading { font-size: 16px; font-weight: 700; }
.admin-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.admin-row__title { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.admin-row__sub { overflow-wrap: anywhere; }
.admin-link-url { display: block; color: var(--muted); text-decoration: underline; }
.chip--danger { background: #fdecea; color: #7f1d1d; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); gap: 8px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: 16px; background: var(--white); }
.stat__value { font-family: var(--display); font-weight: 700; font-size: 24px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat__label { font-size: 13px; color: var(--muted); }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { padding: 8px 6px; border-bottom: 1px solid var(--soft); text-align: right; font-variant-numeric: tabular-nums; }
.data-table th:first-child { text-align: left; font-weight: 500; }
.data-table thead th { font-weight: 600; color: var(--muted); font-size: 13px; }
.data-table tbody tr:last-child th, .data-table tbody tr:last-child td { border-bottom: 0; }

/* Landing preview */
.mini-row { display: flex; align-items: center; gap: 12px; padding: 4px; }
.thumb {
  width: 44px; height: 44px; border-radius: 12px; background: var(--gold-tint); color: var(--gold-text);
  display: flex; align-items: center; justify-content: center; flex: none; overflow: hidden;
}
.thumb--lg { width: 52px; height: 52px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.t1 { background: var(--gold-tint); color: var(--gold-text); }
.t2 { background: #e4e8fb; color: var(--ink); }
.t3 { background: #fde8e1; color: #c8421f; }
.t4 { background: var(--green-tint); color: var(--green-text); }

/* My lists */
.avatar {
  width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-family: var(--display); font-weight: 700; font-size: 20px; flex: none;
}
.list-card { display: flex; flex-direction: column; gap: 14px; }
.list-card__name { font-size: 18px; font-weight: 600; }

/* Parent list rows */
.item-row {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px 8px 8px; min-height: 68px;
  background: var(--white); border-radius: 16px;
}
.item-row__title { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-row__sub { font-size: 13px; color: var(--muted); }
.top-wish { font-weight: 600; color: var(--gold-text); }

/* Photo picker */
.photo-row { display: flex; align-items: center; gap: 14px; }
.photo-tile {
  position: relative; width: 96px; height: 96px; flex: none; border-radius: 16px; border: 2px dashed var(--line);
  background: var(--white); color: var(--muted); display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 6px; font-size: 13px; font-weight: 500; text-align: center; cursor: pointer; overflow: hidden;
}
.photo-tile:focus-within { outline: 3px solid var(--ink); outline-offset: 2px; }
.photo-tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: var(--white); }
.photo-tile--ready { border: 2px solid var(--green); }
.photo-tile--ready::after {
  content: '✓'; position: absolute; right: 4px; bottom: 4px; width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; background: var(--green); color: #fff; font-size: 13px; font-weight: 700;
}
.photo-status { display: block; }
.photo-status:empty { display: none; }
.photo-status--ready { color: var(--green-text); font-weight: 600; }
.photo-status--error { color: var(--danger); font-weight: 600; }

/* Theme picker */
.swatches { display: flex; justify-content: space-between; padding: 6px 6px 8px; }
.swatch { position: relative; display: block; width: 44px; height: 44px; cursor: pointer; }
.swatch__dot {
  display: block; width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, var(--s1) 50%, var(--s2) 50%);
}
.swatch input:checked + .swatch__dot { box-shadow: 0 0 0 3px var(--tint), 0 0 0 5px var(--ink); }
.swatch input:focus-visible + .swatch__dot { outline: 3px solid var(--ink); outline-offset: 6px; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 8px; padding: 4px 4px 0; }
.tile { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 500; text-align: center; cursor: pointer; }
.tile__art { display: block; height: 52px; border-radius: 12px; background: var(--hero); overflow: hidden; }
.tile__art svg { display: block; width: 100%; height: 52px; }
.tile input:checked ~ .tile__art { box-shadow: 0 0 0 3px var(--tint), 0 0 0 5px var(--ink); }
.tile input:checked ~ .tile__name { font-weight: 600; }
.tile input:focus-visible ~ .tile__art { outline: 3px solid var(--ink); outline-offset: 6px; }
.preview { border-radius: 20px; overflow: hidden; background: var(--tint); box-shadow: 0 1px 2px rgba(28, 37, 65, 0.08); }
.preview .hero { border-radius: 0; min-height: 104px; justify-content: flex-end; }
.preview__row { display: flex; align-items: center; gap: 12px; padding: 12px; }
.fake-btn { font-size: 14px; font-weight: 600; color: #fff; background: var(--accent); border-radius: 10px; padding: 9px 12px; }

/* Guest pages */
.hero {
  position: relative; overflow: hidden; border-radius: 20px; background: var(--hero); color: #fff;
  padding: 16px 20px 18px; display: flex; flex-direction: column; gap: 6px;
}
.hero__art { position: absolute; left: 0; top: 0; width: 100%; height: 100%; opacity: 0.6; }
.hero > :not(.hero__art) { position: relative; }
.hero__brand { display: flex; align-items: center; gap: 8px; min-height: 24px; font-family: var(--display); font-weight: 700; font-size: 15px; color: var(--hero-muted); }
.hero__brand span.mark { width: 24px; height: 24px; border-radius: 7px; background: rgba(255, 255, 255, 0.18); color: #fff; display: flex; align-items: center; justify-content: center; }
.hero h1 { font-family: var(--display); font-weight: 700; font-size: 30px; line-height: 1.05; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.hero__date { font-size: 14px; color: var(--hero-muted); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.gift { display: flex; flex-direction: column; background: var(--white); border-radius: 16px; overflow: hidden; box-shadow: 0 1px 2px rgba(28, 37, 65, 0.08); }
.gift__img { position: relative; height: 96px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.gift__img img { width: 100%; height: 100%; object-fit: cover; }
.gift__badge {
  position: absolute; top: 8px; left: 8px; padding: 3px 8px; border-radius: 999px; background: var(--gold);
  color: #5c3d00; font-size: 12px; font-weight: 600;
}
.gift__body { padding: 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.gift__title { font-size: 15px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.gift__notes { font-size: 13px; line-height: 1.35; color: var(--muted); overflow-wrap: anywhere; }
.gift__meta { display: flex; align-items: center; justify-content: space-between; min-height: 36px; margin-top: auto; }
.gift__price { font-size: 14px; font-weight: 600; }
.gift__link { display: flex; align-items: center; gap: 4px; min-height: 36px; font-size: 13px; font-weight: 600; color: var(--accent); text-decoration: underline; }
.gift__taken {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; border-radius: 12px;
  background: var(--green-tint); color: var(--green-text); font-size: 14px; font-weight: 600;
}
.guest .gift__img.t0 { background: #e9ecf3; color: var(--muted); }
.success-mark {
  width: 72px; height: 72px; border-radius: 50%; background: var(--green); color: #fff;
  display: flex; align-items: center; justify-content: center; margin: 24px auto 0;
}
.mini-card { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 14px; background: var(--white); }

@media (min-width: 700px) {
  .page { padding-top: 32px; }
  .display { font-size: 44px; }
}
