:root {
  --accent: #1f4fd8;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #14171c;
  --muted: #5b6573;
  --line: #e4e7ec;
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #171a20;
    --text: #f1f3f6;
    --muted: #9aa3b0;
    --line: #262b33;
  }
}

/* Accent used for text/icons: lightened in dark mode for contrast */
:root { --accent-ui: var(--accent); }
@media (prefers-color-scheme: dark) {
  :root { --accent-ui: color-mix(in srgb, var(--accent) 60%, #ffffff); }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.card {
  max-width: 480px;
  margin: 0 auto;
  padding: 32px 16px calc(32px + env(safe-area-inset-bottom));
}

.loading { text-align: center; color: var(--muted); }

/* Header */
.header { text-align: center; padding: 8px 8px 24px; }

.logo {
  width: 96px; height: 96px;
  border-radius: 24px;
  object-fit: contain;
  background: var(--surface);
  border: 1px solid var(--line);
  display: block;
  margin: 0 auto 20px;
}

.initials {
  width: 96px; height: 96px;
  border-radius: 24px;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; font-weight: 600; letter-spacing: 1px;
  margin: 0 auto 20px;
}

h1 { margin: 0; font-size: 24px; font-weight: 650; letter-spacing: -0.01em; }
.person { margin: 6px 0 0; font-size: 15px; color: var(--text); }
.tagline { margin: 6px 0 0; font-size: 15px; color: var(--muted); }

/* Primary button */
.save {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 16px;
  border: 0; border-radius: 12px;
  background: var(--accent); color: #fff;
  font: inherit; font-weight: 600; font-size: 16px;
  cursor: pointer;
  margin-bottom: 20px;
}
.save:focus-visible, .row:focus-visible, .pill:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px;
}
.save:active { opacity: .9; }

/* Contact rows */
.list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 0 0 20px; padding: 0; list-style: none;
}

.row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  color: inherit; text-decoration: none;
  border-top: 1px solid var(--line);
  min-height: 56px;
}
.list li:first-child .row { border-top: 0; }
.row:active { background: var(--bg); }

.icon {
  flex: none;
  width: 36px; height: 36px; border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent-ui);
  display: flex; align-items: center; justify-content: center;
}
.icon svg { width: 18px; height: 18px; }

.row-text { min-width: 0; }
.row-label { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.row-value { display: block; font-size: 15px; overflow-wrap: anywhere; }

/* Sections */
.section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 16px;
  margin-bottom: 20px;
}
.section h2 { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.section p { margin: 0; font-size: 15px; }

.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text); text-decoration: none; font-size: 14px;
}

.footer { text-align: center; font-size: 12px; color: var(--muted); margin-top: 28px; }

/* Hover only on devices that have it (computers) */
@media (hover: hover) {
  .save { transition: filter .15s; }
  .save:hover { filter: brightness(1.08); }
  .row:hover { background: var(--bg); }
  .pill:hover { border-color: var(--accent-ui); color: var(--accent-ui); }
}

/* Tablet: roomier single column */
@media (min-width: 600px) {
  .card { max-width: 560px; padding-top: 56px; }
}

/* Computer: two columns, identity on the left, details on the right */
@media (min-width: 960px) {
  .card {
    max-width: 1040px;
    display: grid;
    grid-template-columns: 340px 1fr;
    column-gap: 56px;
    align-items: start;
    padding: 88px 32px 48px;
  }
  .side { position: sticky; top: 88px; }
  .header { padding-bottom: 28px; }
  .logo, .initials { width: 120px; height: 120px; border-radius: 28px; }
  h1 { font-size: 28px; }
  .footer { grid-column: 1 / -1; margin-top: 56px; }
  .row { padding: 16px 20px; }
  .section { padding: 22px 20px; }
}

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