@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,400..700;1,6..72,400..700&family=Archivo:wdth,wght@62..125,400..700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  /* Ink -- warm near-blacks for text on light surfaces */
  --ink-1: #131210;
  --ink-2: #3b3833;
  --ink-3: #6d675f;
  --ink-4: #9a938a;

  /* Canvas -- dark surfaces (the "black canvas") */
  --canvas-1: #0e0d0b;
  --canvas-2: #181713;
  --canvas-3: #24221d;
  --canvas-line: #34312a;

  /* Paper -- warm off-white surfaces */
  --paper-1: #fcfbf7;
  --paper-2: #f6f3ec;
  --paper-3: #eeeae0;

  /* Hairlines & rules on light surfaces */
  --line-1: #e5e1d7;
  --line-2: #d4cec2;

  /* Text on dark surfaces */
  --ink-inverse-1: #f6f3ec;
  --ink-inverse-2: #b8b2a6;
  --ink-inverse-3: #807a6e;

  /* Gold -- the single accent */
  --gold-200: #ecdcba;
  --gold-300: #dcc189;
  --gold-400: #c8a75e;
  --gold-500: #b18b3e;
  --gold-600: #8f6f2f;
  --gold-700: #6e5524;

  /* Semantic aliases */
  --text-body: var(--ink-1);
  --text-secondary: var(--ink-2);
  --text-muted: var(--ink-3);
  --text-faint: var(--ink-4);
  --text-accent: var(--gold-600);
  --surface-page: var(--paper-1);
  --surface-card: #ffffff;
  --surface-recessed: var(--paper-2);
  --surface-inverse: var(--canvas-1);
  --surface-inverse-raised: var(--canvas-2);
  --border-hairline: var(--line-1);
  --border-strong: var(--line-2);
  --accent: var(--gold-500);
  --accent-strong: var(--gold-600);
  --accent-soft: var(--gold-200);
  --focus-ring: var(--gold-500);

  /* Spacing / radii / elevation */
  --radius-xs: 2px;
  --radius-sm: 3px;
  --radius-md: 6px;
  --radius-pill: 999px;
  --shadow-card: 0 1px 2px rgba(19, 18, 16, 0.05);
  --shadow-raised: 0 2px 8px rgba(19, 18, 16, 0.08);
  --shadow-overlay: 0 12px 40px rgba(19, 18, 16, 0.18);

  /* Typography */
  --font-serif-display: 'Newsreader', 'Times New Roman', serif;
  --font-sans: 'Archivo', 'Helvetica Neue', sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;

  --text-h1: 1.875rem;
  --text-body-sm: 0.8125rem;
  --text-caption: 0.75rem;
  --text-kicker: 0.6875rem;

  --leading-heading: 1.2;
  --leading-body: 1.6;

  --tracking-kicker: 0.14em;
  --tracking-display: -0.015em;

  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  background: var(--paper-2);
  font-family: var(--font-sans);
  color: var(--text-body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 16px;
  padding-top: max(48px, env(safe-area-inset-top));
  padding-bottom: max(48px, env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

a {
  color: var(--gold-600);
  text-decoration: none;
}
a:hover {
  color: var(--gold-700);
  text-decoration: underline;
}

.card {
  width: 100%;
  max-width: 440px;
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

/* Header */

.card-header {
  background: var(--canvas-1);
  padding: 48px 32px 36px;
  text-align: center;
}

.avatar {
  width: 104px;
  height: 104px;
  margin: 0 auto 20px;
  border-radius: 50%;
  border: 2px solid var(--canvas-line);
  overflow: hidden;
}
.avatar img,
.avatar svg {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gold-rule {
  width: 32px;
  height: 2px;
  background: var(--gold-500);
  margin: 0 auto 16px;
}

.name {
  margin: 0 0 6px;
  font-family: var(--font-serif-display);
  font-size: var(--text-h1);
  font-weight: var(--weight-regular);
  letter-spacing: var(--tracking-display);
  color: var(--ink-inverse-1);
  line-height: var(--leading-heading);
}

.tagline {
  font-family: var(--font-sans);
  font-size: var(--text-kicker);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-kicker);
  text-transform: uppercase;
  color: var(--gold-400);
  margin-bottom: 14px;
}

.bio {
  margin: 0 auto;
  max-width: 320px;
  font-size: var(--text-body-sm);
  line-height: var(--leading-body);
  color: var(--ink-inverse-2);
}

/* Buttons -- mirrors the design system's Button component */

.btn {
  position: relative;
  font-family: var(--font-sans);
  font-weight: var(--weight-medium);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: 0.01em;
  transition: background-color 160ms ease-out, border-color 160ms ease-out, color 160ms ease-out;
  border: 1px solid transparent;
  appearance: none;
}
@media (pointer: coarse) {
  /* Expand the tappable area of the 32px ghost/secondary-sm buttons to
     the ~44px touch-target minimum without changing their visual size. */
  .btn-sm::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 44px;
    min-width: 44px;
  }
}
.btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
.btn:focus-visible {
  outline: 2px solid var(--gold-500);
  outline-offset: 2px;
}

.btn-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.btn-ghost .btn-icon {
  width: 15px;
  height: 15px;
}

.btn-md { height: 40px; padding: 0 20px; font-size: 14px; }
.btn-sm { height: 32px; padding: 0 14px; font-size: 13px; }

.btn-primary {
  background: var(--ink-1);
  color: var(--ink-inverse-1);
  border-color: transparent;
}
.btn-primary:hover { background: #000000; }
.btn-primary:active { background: #000000; }

.btn-secondary {
  background: transparent;
  color: var(--ink-1);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--paper-2); }
.btn-secondary:active { background: var(--paper-3); }

.btn-ghost {
  background: transparent;
  color: var(--ink-2);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--paper-2); }
.btn-ghost:active { background: var(--paper-3); }

.actions-row {
  display: flex;
  gap: 12px;
  padding: 20px 32px 12px;
}
.action-btn {
  flex: 1;
}
@media (max-width: 480px) {
  .actions-row {
    flex-direction: column;
  }
  .action-btn {
    /* In column mode, flex:1 sets flex-basis:0 on the vertical axis, which
       collapses the button down to its content height regardless of the
       explicit height rule below. Swap to a plain full-width block instead
       so height is respected and each button gets its full, intended size. */
    flex: none;
    width: 100%;
  }
}
@media (pointer: coarse) {
  /* More breathing room between "Exchange contact" and "Save contact" so a
     thumb can't clip the neighboring button, plus a taller, easier target. */
  .actions-row {
    gap: 16px;
  }
  .btn-md {
    height: 48px;
  }
}

.share-row {
  text-align: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-hairline);
}

/* Panels (exchange / share) */

.panel {
  padding: 24px 32px;
  border-bottom: 1px solid var(--border-hairline);
  background: var(--surface-recessed);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.panel[hidden] {
  display: none;
}
.panel-center {
  text-align: center;
}

.panel-kicker {
  font-family: var(--font-sans);
  font-size: var(--text-kicker);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-kicker);
  text-transform: uppercase;
  color: var(--text-muted);
}

.qr-code {
  display: inline-block;
  align-self: center;
  margin: 10px 0 14px;
  padding: 12px;
  background: var(--paper-1);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  line-height: 0;
}
.qr-code svg {
  display: block;
  width: 152px;
  height: 152px;
}

.page-url {
  font-family: var(--font-mono);
  font-size: var(--text-caption);
  color: var(--text-muted);
  word-break: break-all;
  margin-bottom: 12px;
}

/* Form fields -- mirrors the design system's Input component */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--font-sans);
}

.field-label {
  font-size: var(--text-kicker);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-kicker);
  text-transform: uppercase;
  color: var(--ink-2);
}

.field-input {
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  color: var(--ink-1);
  background: var(--surface-card);
  border: 1px solid var(--border-strong);
  outline: none;
  border-radius: var(--radius-sm);
  height: 40px;
  padding: 0 12px;
  transition: border-color 160ms ease-out, box-shadow 160ms ease-out;
  width: 100%;
}
@media (pointer: coarse) {
  /* 16px prevents iOS Safari from auto-zooming the page on input focus. */
  .field-input {
    font-size: 16px;
  }
}
.field-input:focus {
  border-color: var(--gold-500);
  box-shadow: 0 0 0 2px var(--gold-200);
}
.field-input::placeholder {
  color: var(--ink-4);
}
.field-input:focus-visible {
  outline: none;
}

/* Contacts list */

.contacts-list {
  display: block;
}

.contact-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border-hairline);
  text-decoration: none;
}
.contact-row:hover {
  background: var(--paper-2);
  text-decoration: none;
}
.contact-row:focus-visible {
  outline: 2px solid var(--gold-500);
  outline-offset: -2px;
  background: var(--paper-2);
}

.contact-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: var(--text-muted);
}
.contact-icon svg {
  width: 100%;
  height: 100%;
}

.contact-text {
  min-width: 0;
  flex: 1;
}

.contact-label {
  font-family: var(--font-sans);
  font-size: var(--text-kicker);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-kicker);
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.contact-value {
  font-family: var(--font-mono);
  font-size: var(--text-body-sm);
  color: var(--ink-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-arrow {
  flex-shrink: 0;
  color: var(--gold-600);
  font-size: 16px;
}

/* Footer */

.footer-note {
  padding: 20px 32px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--text-caption);
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.001ms !important;
  }
}
