/* bfiesta NFC Contact Cards
   All colors live here. Swap --accent for your exact burgundy HEX when ready. */
:root {
  --bg: #FAF7F2;          /* warm ivory */
  --surface: #FFFFFF;
  --text: #2A2826;        /* charcoal */
  --muted: #736D66;
  --line: #E9E3DA;
  --line-strong: #D9D1C5;
  --accent: #7A2E3E;      /* PLACEHOLDER burgundy - replace with your exact brand HEX */
  --accent-ink: #FFFFFF;
  --accent-soft: color-mix(in srgb, var(--accent) 8%, var(--surface));
  --danger: #9B2C2C;
  --ok-bg: #EEF3EC;
  --ok-ink: #2F5130;
  --err-bg: #F8ECEA;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --radius: 14px;
  --radius-sm: 10px;
  --tap: 48px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1, h2 { font-family: var(--serif); font-weight: 500; letter-spacing: -0.01em; margin: 0 0 .35em; }
h1 { font-size: 1.6rem; line-height: 1.2; }
h2 { font-size: 1.2rem; }
.muted { color: var(--muted); margin: 0 0 1.25rem; }
.fine { color: var(--muted); font-size: .85rem; margin: 1rem 0 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------------------------------------------------------------- public card */
.card-wrap {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center;
  padding: max(40px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}
.card {
  width: 100%; max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 36px 20px 20px;
  text-align: center;
}
.card-empty { padding-bottom: 28px; }
.avatar {
  width: 84px; height: 84px; margin: 0 auto 18px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 1.9rem; letter-spacing: .04em;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}
.avatar-sm { width: 56px; height: 56px; font-size: 1.25rem; margin: 0 0 14px; }
.avatar-xs { width: 40px; height: 40px; font-size: .95rem; margin: 0; }
.name { font-size: 1.85rem; margin-bottom: 24px; overflow-wrap: anywhere; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 18px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font: 500 1rem/1 var(--sans); text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .15s, border-color .15s;
}
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(.92); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn-small { min-height: 36px; padding: 0 12px; font-size: .875rem; }
.btn-small.is-copied { border-color: var(--ok-ink); color: var(--ok-ink); }
.btn-save { width: 100%; min-height: 54px; font-size: 1.05rem; }
.btn-text { background: none; border: 0; padding: 8px 0; font: inherit; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

.link-list { list-style: none; margin: 16px 0 0; padding: 0; text-align: left; border-top: 1px solid var(--line); }
.link-list li + li { border-top: 1px solid var(--line); }
.link-row {
  display: flex; align-items: center; gap: 14px;
  min-height: 64px; padding: 10px 4px;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.link-row:active { background: var(--bg); }
.link-row > .ico:last-child { color: var(--line-strong); width: 18px; height: 18px; }
.link-ico {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; flex: none;
  background: var(--bg); color: var(--text);
}
.link-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.link-label { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.link-value { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.card-foot { margin-top: auto; padding-top: 28px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.edit-link { font-size: .85rem; color: var(--muted); text-underline-offset: 3px; padding: 8px; }
.brand { font-family: var(--serif); font-size: .95rem; letter-spacing: .12em; color: var(--accent); text-decoration: none; opacity: .85; }

/* ---------------------------------------------------------------- forms (guest + admin) */
.narrow { max-width: 480px; margin: 0 auto; padding: 24px 16px 32px; min-height: 100dvh; display: flex; flex-direction: column; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 20px; }
.panel + .panel { margin-top: 16px; }
.panel-quiet { background: transparent; }
.back { display: inline-block; font-size: .875rem; color: var(--muted); text-decoration: none; margin: 0 0 14px; padding: 6px 0; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: .875rem; font-weight: 500; }
.field em { font-style: normal; font-weight: 400; color: var(--muted); }
.field input {
  width: 100%; min-height: var(--tap); padding: 10px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font: 16px/1.3 var(--sans); /* 16px stops iOS zoom on focus */
}
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }
.field input[aria-invalid="true"] { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: .825rem; font-weight: 400; margin: 0; }
.pin-input { font-size: 1.4rem !important; letter-spacing: .4em; text-align: center; }

.toggle-group { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.switch { display: flex; align-items: center; gap: 10px; font-size: .95rem; cursor: pointer; min-height: 32px; }
.switch input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }

.pin-change { border-top: 1px solid var(--line); padding-top: 12px; }
.pin-change summary { cursor: pointer; color: var(--muted); font-size: .9rem; padding: 4px 0; }
.pin-change[open] summary { margin-bottom: 12px; }
.signout { margin-top: 12px; text-align: center; }

.notice { border-radius: var(--radius-sm); padding: 10px 12px; font-size: .9rem; margin: 0 0 16px; }
.notice-ok { background: var(--ok-bg); color: var(--ok-ink); }
.notice-error { background: var(--err-bg); color: var(--danger); }

/* ---------------------------------------------------------------- admin */
.admin-bar { display: flex; align-items: center; justify-content: space-between; max-width: 720px; margin: 0 auto; padding: 14px 16px; }
.admin-home { font-family: var(--serif); font-size: 1.1rem; text-decoration: none; }
.admin-main { max-width: 720px; margin: 0 auto; padding: 0 16px 40px; }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.title-row h1 { margin: 0; }
.count { font-family: var(--sans); font-size: .9rem; color: var(--muted); font-weight: 400; }
.pill { font-size: .75rem; padding: 4px 10px; border-radius: 999px; }
.pill-on { background: var(--ok-bg); color: var(--ok-ink); }
.pill-off { background: var(--err-bg); color: var(--danger); }
.eyebrow { font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }

.card-list { list-style: none; margin: 8px 0 0; padding: 0; }
.card-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.card-item.is-off { opacity: .55; }
.ci-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ci-name { font-weight: 500; text-decoration: none; }
.ci-name:hover { text-decoration: underline; }
.ci-meta { font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.copy-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 10px 12px; margin: 12px 0 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); }
.copy-label { font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.copy-value { font: .9rem/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
.copy-pin .copy-value { font-size: 1.35rem; letter-spacing: .25em; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.inline-form { display: inline-block; margin: 8px 8px 0 0; }

.slug-input { display: flex; align-items: stretch; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.slug-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }
.slug-input input { border: 0 !important; box-shadow: none !important; min-width: 0; flex: 1; padding-left: 2px; padding-right: 2px; }
.slug-pre, .slug-post { display: flex; align-items: center; padding: 0 2px 0 12px; color: var(--muted); font-weight: 400; white-space: nowrap; background: var(--bg); }
.slug-post { padding: 0 12px 0 2px; }

@media (max-width: 420px) {
  .grid-2 { grid-template-columns: 1fr; }
  .copy-row { grid-template-columns: 1fr auto; }
  .copy-label { grid-column: 1 / -1; }
  .slug-pre { display: none; }
  .slug-input input { padding-left: 12px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------------------------------------------------------------- guest sharing + private card */
.name-sm { font-size: 1.35rem; margin-bottom: 8px; }
.card-empty .muted { margin: 0; }
.share-group { background: var(--bg); }
.share-group .switch { align-items: flex-start; }
.share-group .switch input { margin-top: 2px; }
.muted-inline { color: var(--muted); font-size: .825rem; line-height: 1.4; }
.status-note { font-size: .85rem; color: var(--muted); margin: 10px 0 0; }
.pill-wait { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.pill-private { background: #F3EFE7; color: #6B5B3E; }
.check-list { list-style: none; padding: 0; margin: 0 0 16px; font-size: .875rem; }
.check-list li { display: flex; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.check-list li:first-child { border-top: 0; }
.check-ok { color: var(--ok-ink); font-weight: 600; }
.check-bad { color: var(--danger); font-weight: 600; }
.check-warn { color: #7A5A12; font-weight: 600; }
.ci-pills { margin-top: 4px; display: flex; gap: 6px; flex-wrap: wrap; }
.ci-pills .pill, .title-row .pill { font-size: .7rem; padding: 3px 8px; }
code { overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- profession / title (under the name) */
/* Only present when a title exists, so cards without one keep the original spacing exactly. */
.name.has-title { margin-bottom: 6px; }
.card-title {
  margin: 0 0 24px;
  font-family: var(--sans);
  font-size: .95rem;
  line-height: 1.4;
  letter-spacing: .02em;
  color: var(--muted);
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------- card picture (photo / logo) */
.avatar.has-photo { overflow: hidden; padding: 0; background: var(--surface); }
.avatar.has-photo img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }
.picture-group { gap: 14px; }
.picture-legend { padding: 0 6px; font-size: .875rem; font-weight: 500; }
.picture-row { display: flex; align-items: center; gap: 14px; }
.picture-row .avatar { margin: 0; flex: none; }
.picture-initials { flex: 1; }
.picture-initials input { text-transform: uppercase; letter-spacing: .08em; max-width: 140px; }
.field input[type="file"] { min-height: 0; padding: 10px; font-size: .9rem; background: var(--bg); }
.picture-hint { margin: 0; }
.field input[type="file"]::file-selector-button {
  margin-right: 10px; padding: 7px 14px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--surface); color: var(--text); font: 500 .875rem/1.2 var(--sans); cursor: pointer;
}
.field input[type="file"]::file-selector-button:hover { border-color: var(--muted); }
