/* Digital business card page. Builds on the site tokens in /styles.css
   (ink, paper, signal, Space Mono + Manrope). The card face itself carries
   its own colors, set per theme from card.js. */

.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.card-intro { padding-top: 48px; padding-bottom: 28px; }
.card-intro .lede { margin-bottom: 0; }

.card-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 480px);
  gap: 32px;
  align-items: start;
  padding-bottom: 20px;
}

/* ---------- form ---------- */
#form { display: grid; gap: 20px; }
.panel {
  border: 1px solid var(--line-soft);
  background: var(--paper-flat);
  border-radius: var(--radius-lg);
  padding: 22px 24px 26px;
  margin: 0;
  min-width: 0;
}
.panel legend {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0 8px;
  margin-left: -8px;
}
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 14px; }
.fields .field { margin: 0; min-width: 0; }
.fields .full { grid-column: 1 / -1; }
.field textarea { resize: vertical; min-height: 64px; font-family: var(--font-body); }
.field label small, .lbl small { font-weight: 500; font-size: 13px; color: var(--ink-soft); }
.lbl {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
}

.photo-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.thumb {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--paper-dim) center / cover no-repeat;
  border: 1px solid var(--line);
  flex: none;
}
.vh:focus-visible + .btn { outline: 2px solid var(--signal); outline-offset: 2px; }

.btn-link {
  background: none;
  border: none;
  padding: 6px 0;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: underline;
  cursor: pointer;
  justify-self: start;
}
.btn-link:hover { color: var(--signal); }

.themes { display: flex; flex-wrap: wrap; gap: 14px; }
.sw {
  display: grid;
  gap: 8px;
  justify-items: center;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}
.sw .chip {
  position: relative;
  width: 68px;
  height: 44px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  box-shadow: inset 0 0 0 1px rgba(20, 21, 26, 0.16);
  overflow: hidden;
}
.sw .chip::after {
  content: "";
  position: absolute;
  right: 0; top: 0;
  width: 20px; height: 20px;
  background: var(--ac);
  border-bottom-left-radius: 100%;
}
.sw input:checked + .chip { outline: 2px solid var(--ink); outline-offset: 3px; }
.sw input:checked ~ span:last-child { color: var(--ink); font-weight: 700; }
.sw input:focus-visible + .chip { outline: 2px dashed var(--signal); outline-offset: 3px; }
.sw input:checked:focus-visible + .chip { outline: 2px solid var(--signal); }

/* ---------- buttons on this page ---------- */
.card-grid .btn { text-align: center; }
.btn-primary:focus-visible, .btn-ghost:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.need { font-size: 14px; color: var(--ink-soft); margin: 0 0 2px; }

/* ---------- output column ---------- */
.out { position: sticky; top: 92px; display: grid; gap: 16px; }

.card {
  --bg: #0E2A3B; --fg: #F4F7F8; --ac: #F2B544;
  position: relative;
  container-type: inline-size;
  aspect-ratio: 3.5 / 2;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  box-shadow: 0 0 0 1px rgba(20, 21, 26, 0.1), 0 18px 32px -18px rgba(20, 21, 26, 0.5);
}
.corner { position: absolute; top: 0; right: 0; width: 24cqw; height: 24cqw; background: var(--ac); border-bottom-left-radius: 100%; }
.photo {
  position: absolute;
  left: 80cqw; top: 6cqw;
  width: 14cqw; height: 14cqw;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  box-shadow: 0 0 0 0.8cqw var(--bg);
}
.head { position: absolute; left: 6cqw; top: 6cqw; width: 64cqw; }
.c-name {
  font-weight: 800;
  font-size: 7cqw;
  line-height: 1.08;
  letter-spacing: -0.02em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.c-title, .c-org { font-size: 3.4cqw; line-height: 4.6cqw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-title { margin-top: 1.6cqw; font-weight: 500; opacity: 0.9; }
.c-org { font-weight: 600; color: var(--ac); }
.rows { position: absolute; left: 6cqw; bottom: 6cqw; width: 54cqw; margin: 0; padding: 0; list-style: none; }
.rows li { display: flex; align-items: center; gap: 1.8cqw; height: 5.4cqw; font-size: 3.1cqw; }
.rows span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ic { width: 3.4cqw; height: 3.4cqw; flex: none; fill: none; stroke: var(--ac); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.qrtile { position: absolute; right: 6cqw; bottom: 6cqw; width: 30cqw; height: 30cqw; background: #fff; border-radius: 2.4cqw; padding: 2cqw; }
.qrtile svg { display: block; width: 100%; height: 100%; }
.ph { opacity: 0.5 !important; }
.dim { opacity: 0.3; }

.actions {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding: 18px;
}
.qrbox { border: 1px solid var(--line-soft); overflow: hidden; background: #fff; border-radius: var(--radius-sm); }
.qrbox svg { display: block; width: 100%; height: auto; }
.qrcap { font-size: 13px; color: var(--ink-soft); margin: 8px 0 0; line-height: 1.4; }
.btns { display: grid; gap: 8px; }
.split { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.fine { font-size: 13px; color: var(--ink-soft); margin: 0; line-height: 1.45; }
.warn { font-size: 13px; color: #9a3412; margin: 0; }

.vlinks { display: flex; flex-wrap: wrap; gap: 8px; }
.vlinks a {
  font-weight: 700;
  font-size: 15px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  background: var(--paper-flat);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
  transition: background-color 0.15s var(--ease);
}
.vlinks a:hover { background: var(--paper-dim); }
.vnote { margin: 0; font-size: 17px; }

.card-about { max-width: var(--max-width); }
.card-about > * { max-width: 72ch; }

body.view .editonly { display: none !important; }
body:not(.view) .viewonly { display: none !important; }
body.loading .card-grid { visibility: hidden; } /* opening a short link */
body.view .card-grid { grid-template-columns: minmax(0, 520px); justify-content: center; padding-top: 36px; }
body.view .out { position: static; }

dialog { border: 1px solid var(--line-soft); border-radius: var(--radius-lg); box-shadow: var(--shadow-panel); padding: 24px; width: min(92vw, 520px); text-align: center; color: var(--ink); background: var(--paper); }
dialog::backdrop { background: rgba(20, 21, 26, 0.76); }
dialog h2 { font-size: 24px; margin: 0 0 14px; }
dialog .big { border: 1px solid var(--line); overflow: hidden; margin: 0 auto 14px; width: min(78vw, 440px); background: #fff; }
dialog .big svg { display: block; width: 100%; height: auto; }
dialog p { margin: 0 0 16px; color: var(--ink-soft); }

#toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 15px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 30;
  max-width: 90vw;
}
#toast.on { opacity: 1; }

@media (max-width: 900px) {
  .card-grid { grid-template-columns: 1fr; }
  .out { position: static; }
}
@media (max-width: 520px) {
  .fields { grid-template-columns: 1fr; }
  .actions { grid-template-columns: 1fr; }
  .qrbox { max-width: 220px; }
  .panel { padding: 18px 16px 22px; }
}

/* Home Screen hint, shown only to iPhone/iPad Safari visitors. */
.tip {
  margin: 14px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--line, #d8d6cd);
  border-left: 3px solid var(--signal, #ff4b2e);
  border-radius: 6px;
  background: rgba(255, 75, 46, 0.06);
}
.tip p { margin: 0 0 6px; font-size: 14px; line-height: 1.5; }
.tip .ios-share {
  display: inline-block;
  padding: 0 5px;
  border: 1px solid currentColor;
  border-radius: 4px;
  font-size: 12px;
}
