/* ============================================================================
   Digital business card — obsidian & brass
   Mobile-first. One column, no breakpoint gymnastics: the card simply gains
   breathing room and a stronger edge on larger screens.
   ========================================================================== */

/* -- Typefaces (self-hosted, subset variable fonts) ------------------------- */

@font-face {
  font-family: "Newsreader";
  src: url("../fonts/newsreader-display.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Jost";
  src: url("../fonts/jost-ui.woff2") format("woff2");
  font-weight: 300 600;
  font-style: normal;
  font-display: swap;
}

/* -- Tokens ---------------------------------------------------------------- */

:root {
  --ink-void: #07090c;
  --ink-deep: #0b0e13;
  --ink-card-top: #141a24;
  --ink-card-bottom: #0c1016;

  --surface: rgba(255, 255, 255, 0.022);
  --surface-press: rgba(255, 255, 255, 0.055);
  --line: rgba(226, 214, 186, 0.1);
  --line-strong: rgba(226, 214, 186, 0.19);

  --brass-light: #f2e2bd;
  --brass: #e2cda2;
  --brass-mid: #d0b47b;
  --brass-deep: #bd9d61;

  --text: #f4f2ee;
  --text-muted: #a4aab5;
  --text-dim: #767d89;

  --font-display: "Newsreader", "Iowan Old Style", Georgia, serif;
  --font-ui: "Jost", "Helvetica Neue", Helvetica, Arial, sans-serif;

  --radius-card: 24px;
  --radius-panel: 16px;
  --radius-control: 14px;
}

/* -- Reset ----------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: clamp(12px, 3.4vw, 40px);
  padding-top: max(clamp(12px, 3.4vw, 40px), env(safe-area-inset-top));
  padding-bottom: max(clamp(12px, 3.4vw, 40px), env(safe-area-inset-bottom));
  background-color: var(--ink-deep);
  background-image: radial-gradient(120% 70% at 50% -10%, #171d28 0%, var(--ink-deep) 45%, var(--ink-void) 100%);
  color: var(--text);
  font-family: var(--font-ui);
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
svg {
  display: block;
  max-width: 100%;
}

h1,
p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
}

/* Fine grain over the whole viewport — fixed, so it never repaints on scroll. */
.texture {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* -- The card -------------------------------------------------------------- */

.card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 25.75rem;
  padding: 22px 21px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background-image: linear-gradient(176deg, var(--ink-card-top) 0%, var(--ink-card-bottom) 62%, #0a0d12 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 40px 80px -48px rgba(0, 0, 0, 0.95),
    0 8px 24px -16px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

/* Warm light spilling from the top edge. */
.card::before {
  content: "";
  position: absolute;
  top: -55%;
  left: 50%;
  width: 150%;
  aspect-ratio: 1;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(210, 180, 122, 0.11), transparent 70%);
  pointer-events: none;
}

/* Hairline sheen along the top edge, like a milled metal lip. */
.card::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(242, 226, 189, 0.32) 35%, rgba(242, 226, 189, 0.32) 65%, transparent);
  pointer-events: none;
}

.card > * {
  position: relative;
}

/* -- Masthead -------------------------------------------------------------- */

.masthead__strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 17px;
}

.kicker {
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.icon--nfc {
  width: 17px;
  height: 17px;
  color: var(--brass-deep);
  opacity: 0.8;
}

.portrait {
  position: relative;
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  margin-bottom: 15px;
  border-radius: 34%;
  overflow: hidden;
  background-image: radial-gradient(125% 125% at 28% 18%, #222a37 0%, #141922 55%, #0e131a 100%);
  box-shadow:
    0 0 0 1px rgba(226, 214, 186, 0.14) inset,
    0 1px 0 rgba(255, 255, 255, 0.07) inset,
    0 18px 34px -22px rgba(0, 0, 0, 0.95);
}

.portrait__initials {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.65rem;
  letter-spacing: 0.05em;
  background-image: linear-gradient(168deg, var(--brass-light), var(--brass-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding-left: 0.05em;
}

/* Hidden until the photo actually decodes, so a missing file leaves the
   initials in place with no flash of a broken image. */
.portrait__photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.portrait__photo.is-loaded {
  opacity: 1;
}

.name {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.8rem, 7.8vw, 2.15rem);
  line-height: 1.04;
  letter-spacing: -0.016em;
  text-wrap: balance;
  color: var(--text);
}

.role {
  margin-top: 11px;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--brass);
}

.background {
  margin-top: 7px;
  font-size: 0.8125rem;
  letter-spacing: 0.015em;
  color: var(--text-muted);
}

/* -- Engraved divider ------------------------------------------------------ */

.rule {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 17px 0 15px;
}

.rule span {
  flex: 1;
  height: 1px;
}

.rule span:first-child {
  background: linear-gradient(90deg, transparent, var(--line-strong));
}

.rule span:last-child {
  background: linear-gradient(90deg, var(--line-strong), transparent);
}

.rule i {
  width: 5px;
  height: 5px;
  transform: rotate(45deg);
  background: var(--brass-mid);
  opacity: 0.75;
}

/* -- Primary action -------------------------------------------------------- */

.taphint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.185em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.taphint .icon {
  width: 14px;
  height: 14px;
  color: var(--brass-deep);
}

.save {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: var(--radius-control);
  color: #141009;
  background-image: linear-gradient(168deg, #f4e3ba 0%, #e0c48f 46%, #c4a367 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.55) inset,
    0 -1px 0 rgba(122, 94, 42, 0.3) inset,
    0 16px 30px -18px rgba(199, 165, 102, 0.55),
    0 3px 10px -5px rgba(0, 0, 0, 0.7);
  transition:
    transform 0.14s ease,
    box-shadow 0.14s ease,
    filter 0.14s ease;
}

.icon--save {
  width: 23px;
  height: 23px;
  color: rgba(26, 19, 6, 0.8);
}

.save strong {
  display: block;
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: 0.004em;
}

.save small {
  display: block;
  margin-top: 1px;
  font-size: 0.6875rem;
  letter-spacing: 0.015em;
  color: rgba(28, 21, 8, 0.66);
}

.save:active {
  transform: translateY(1px) scale(0.993);
  filter: brightness(1.04);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.5) inset,
    0 8px 18px -14px rgba(199, 165, 102, 0.5),
    0 2px 6px -4px rgba(0, 0, 0, 0.7);
}

/* -- Direct contact rows --------------------------------------------------- */

.group {
  margin-top: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--surface);
  overflow: hidden;
}

.row {
  display: grid;
  grid-template-columns: 38px 1fr 16px;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  padding: 10px 14px;
  transition: background 0.14s ease;
}

.row + .row {
  border-top: 1px solid var(--line);
}

.row__icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: 0 0 0 1px var(--line) inset;
  color: var(--brass);
}

.row__icon .icon {
  width: 18px;
  height: 18px;
}

.row__label {
  display: block;
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: 0.006em;
  color: var(--text);
}

.row__value {
  display: block;
  margin-top: 1px;
  font-size: 0.75rem;
  letter-spacing: 0.015em;
  color: var(--text-dim);
}

.icon--chevron {
  width: 16px;
  height: 16px;
  color: rgba(255, 255, 255, 0.2);
}

.row:active {
  background: var(--surface-press);
}

/* -- Profile tiles --------------------------------------------------------- */

.tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  min-height: 71px;
  padding: 12px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface);
  transition: background 0.14s ease;
}

.tile .icon {
  width: 19px;
  height: 19px;
  color: var(--brass);
}

.tile__label {
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.tile:active {
  background: var(--surface-press);
}

/* -- QR disclosure --------------------------------------------------------- */

.qr {
  margin-top: 12px;
}

.qr__summary {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  cursor: pointer;
  font-size: 0.8125rem;
  letter-spacing: 0.035em;
  color: var(--text-muted);
  list-style: none;
}

.qr__summary::-webkit-details-marker {
  display: none;
}

.qr__summary > span {
  flex: 1;
}

.qr__summary > .icon:first-child {
  width: 17px;
  height: 17px;
  color: var(--brass-mid);
}

.qr__summary .icon--chevron {
  transform: rotate(90deg);
  transition: transform 0.2s ease;
}

.qr[open] .qr__summary .icon--chevron {
  transform: rotate(-90deg);
}

.qr__panel {
  display: grid;
  place-items: center;
  gap: 12px;
  margin-top: 9px;
  padding: 18px;
  border-radius: 13px;
  background: #f6f3ec;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35) inset;
}

.qr__panel img {
  width: 180px;
  height: 180px;
}

.qr__caption {
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #6c6658;
}

/* -- Footer ---------------------------------------------------------------- */

.foot {
  margin-top: 17px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
  text-align: center;
}

.copyright {
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

/* -- Focus, hover, motion -------------------------------------------------- */

:focus-visible {
  outline: 2px solid var(--brass-mid);
  outline-offset: 3px;
}

.save:focus-visible {
  outline-offset: 4px;
}

@media (hover: hover) and (pointer: fine) {
  .save:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
  }

  .row:hover,
  .tile:hover,
  .qr__summary:hover {
    background: rgba(255, 255, 255, 0.045);
  }
}

/* A single settling motion as the card opens — nothing loops, nothing moves
   after the first half second. */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(9px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.reveal {
  animation: rise 0.5s cubic-bezier(0.22, 0.7, 0.3, 1) both;
  animation-delay: calc(var(--step, 0) * 55ms);
}

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .save,
  .qr__summary .icon--chevron,
  .portrait__photo {
    animation: none;
    transition: none;
  }
}

/* Slightly more presence once there is room for the card to sit on a surface. */
@media (min-width: 30rem) {
  .card {
    padding: 26px 25px 18px;
    border-radius: 26px;
  }
}
