@font-face { font-family: "JD Name"; src: url(fonts/jd-name.woff2) format("woff2"); font-display: block; }
@font-face { font-family: "JD Text"; src: url(fonts/jd-text.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "JD SC"; src: url(fonts/jd-sc.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "JD Brand"; src: url(fonts/jd-brand.woff2) format("woff2"); font-display: swap; }

:root {
  --ground: #080808;
  --ink: #dedcd6;
  --mute: #8c8a84;
  --rule: rgba(222, 220, 214, 0.24);
}
* { box-sizing: border-box; }
html { background: var(--ground); color: var(--ink); -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100svh; font-family: "JD Text", Georgia, serif; -webkit-font-smoothing: antialiased; }

#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; }
.no-gl #gl { display: none; }

main { position: relative; z-index: 1; display: flex; flex-direction: column; min-height: 100svh; }

.stage {
  flex: 0 0 auto;
  height: min(66svh, 720px);
  min-height: 340px;
  cursor: pointer;
  outline: none;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  position: relative;
}
.stage:focus-visible::after {
  content: "";
  position: absolute;
  inset: 6% 18%;
  border: 1px solid var(--rule);
}
.still { display: block; width: 100%; height: 100%; object-fit: contain; }
.still[hidden] { display: none; }

.under {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 2px 24px calc(28px + env(safe-area-inset-bottom));
  animation: arrive 0.9s cubic-bezier(.2, .7, .2, 1) 1.5s both;
}
@keyframes arrive { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.hint, .tilt {
  font-family: "JD SC", Georgia, serif;
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--mute);
  margin: 0;
  line-height: 18px;
}
.hint { transition: opacity 0.6s ease; }
.flipped:not(.on-back) .hint { opacity: 0; }
.saved .hint { opacity: 1; color: var(--ink); }
.tilt {
  background: none;
  border: 0;
  border-bottom: 1px solid var(--rule);
  padding: 2px 0 3px;
  color: var(--ink);
  cursor: pointer;
}
.tilt[hidden] { display: none; }

.actions {
  width: 100%;
  max-width: 340px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 50px;
  border: 1px solid var(--rule);
  border-radius: 1px;
  color: var(--ink);
  background: rgba(8, 8, 8, 0.4);
  text-decoration: none;
  font-family: "JD SC", Georgia, serif;
  font-size: 15px;
  letter-spacing: 0.15em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}
.btn.primary { grid-column: 1 / -1; height: 60px; font-size: 18px; font-weight: 600; letter-spacing: 0.12em; background: #dcdad4; border-color: #dcdad4; color: #0a0a0a; }
.btn:hover { border-color: rgba(222, 220, 214, 0.5); }
.btn.primary:hover { background: #ecebe6; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .links a:focus-visible, .tilt:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }

.links { display: flex; gap: 22px; margin: 4px 0 0; font-size: 15px; font-variant-numeric: lining-nums; }
.links a {
  color: #b2b0aa;
  text-decoration: none;
  border-bottom: 1px solid rgba(178, 176, 170, 0.3);
  padding-bottom: 2px;
}
.links a:hover { color: var(--ink); border-bottom-color: var(--ink); }

/* share: full-screen QR. Black on white with the quiet zone drawn into the canvas; the dark
   ground around it is the card's stage, nothing sits on or near the symbol. */
.qr {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: #080808;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: calc(24px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
  outline: none;
  cursor: pointer;
}
.qr[hidden] { display: none; }
.qr-name { margin: 0 0 4px; font-family: "JD Name", Georgia, serif; font-size: 22px; letter-spacing: -0.005em; color: var(--ink); }
.qr-code { display: block; image-rendering: pixelated; image-rendering: crisp-edges; background: #fff; }
.qr-label, .qr-close {
  margin: 0;
  font-family: "JD SC", Georgia, serif;
  letter-spacing: 0.16em;
  text-align: center;
}
.qr-label { font-size: 14px; color: var(--ink); }
.qr-close { font-size: 11px; color: var(--mute); }
.qr-mode {
  background: none;
  border: 0;
  border-bottom: 1px solid var(--rule);
  padding: 4px 0;
  color: #b2b0aa;
  font-family: "JD SC", Georgia, serif;
  font-size: 12px;
  letter-spacing: 0.16em;
  cursor: pointer;
}
.qr-mode:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }
.qr-open main > :not(.qr) { visibility: hidden; }
.qr-open #gl { visibility: hidden; }

/* save sheet (iOS browsers that are not Safari hand a vCard to Files, not to Contacts) */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 11;
  background: rgba(4, 4, 4, 0.72);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  outline: none;
}
.sheet[hidden] { display: none; }
.sheet-card {
  width: 100%;
  max-width: 360px;
  background: #121211;
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 22px 20px 14px;
  display: grid;
  gap: 10px;
  text-align: center;
}
.sheet-title { margin: 0 0 6px; font-size: 17px; line-height: 1.35; color: var(--ink); }
.sheet-link {
  background: none;
  border: 0;
  color: #b2b0aa;
  font-family: "JD SC", Georgia, serif;
  font-size: 12px;
  letter-spacing: 0.16em;
  padding: 8px 0;
  text-decoration: none;
  cursor: pointer;
}
.sheet-link:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }
.sheet-close { color: var(--mute); }
.sheet-open main > :not(.sheet) { visibility: hidden; }

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

@media (max-height: 700px) and (orientation: portrait) {
  .stage { height: 58svh; min-height: 300px; }
}
@media (min-width: 700px) {
  .stage { height: min(70vh, 760px); }
}
@media (max-height: 560px) and (orientation: landscape) {
  main { flex-direction: row; align-items: center; }
  .stage { height: 100svh; flex: 1 1 60%; }
  .under { flex: 1 1 40%; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .under { animation: none; }
  .hint { transition: none; }
}

.nf { align-items: center; justify-content: center; font-family: "JD Name", Georgia, serif; font-size: 22px; }
.nf a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--rule); }
