/* Plus One name card
   Design tokens sampled from the Company Website Figma, Design System
   frame 449:43417 — not eyeballed from a screenshot.

   Layering, and the reason for it:
     base      → both faces stacked and visible. This is what renders with
                 JavaScript off, and it is a complete, usable card.
     html.js   → below 56rem, the two faces become one flippable object.
     ≥56rem    → both faces side by side; the flip is dropped, not ported.
   The flip exists because a phone lacks width. A desktop never had that
   problem, and a QR you cannot reach without JS is a broken name card. */

:root {
  color-scheme: light dark;

  --blue: #0858F2;
  --orange: #FF7708;

  /* Brand blue is 5.1:1 on white but 2.7:1 on a dark ground, so the text
     token shifts with the scheme while the brand token never does. */
  --blue-text: #0858F2;

  --ink: #212529;
  --ink-2: #495057;
  --ink-3: #6C757D;
  --line: #DEE2E6;
  --ground: #F8F9FA;
  --surface: #FFFFFF;

  --radius-card: 20px;
  --radius: 12px;

  /* 8pt grid, per the Figma "Sizes & spacings" frame. */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --blue-text: #6AA0FF;
    --ink: #F8F9FA;
    --ink-2: #CED4DA;
    --ink-3: #ADB5BD;
    --line: #343A40;
    --ground: #16191C;
    --surface: #212529;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100svh;
  padding: var(--s6) var(--s4) var(--s7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s5);
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

:where(a, button):focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 3px;
  border-radius: var(--s1);
}

/* ── The card ──────────────────────────────────────────────────────────
   90×54mm is a real name card. Holding that ratio is what makes this
   read as an object rather than as an app screen. Everything inside is
   sized in cqi (1% of the card's own width) so the card scales as a
   single piece from a 320px phone to the desktop two-up. */

.deck { width: 100%; max-width: 30rem; }
.flip-inner { display: grid; gap: var(--s4); }

/* .face is the query container; .face-body is where cqi is actually
   usable, because an element is never its own container. */
.face-body { height: 100%; }

.face {
  container-type: inline-size;
  /* The back face is a <figure>, and the UA sheet gives it margin: 1em 40px.
     Unreset, that made the two faces different widths in the desktop grid
     (496 vs 416) and pushed the absolutely-positioned face 40px right on
     mobile, overflowing the viewport. */
  margin: 0;
  aspect-ratio: 90 / 54;
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: 0 1px 2px rgb(0 0 0 / .10), 0 12px 32px -8px rgb(8 88 242 / .28);
}

/* Front: solid Plus One blue. The brand colour lives on the object, not
   flooded across the page — that flood is what every reference app does,
   and it is why they all look like each other. */
.face--front { background: var(--blue); color: #fff; }
.face--front .face-body {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 7cqi;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 2.2cqi;
  font-size: 4.2cqi;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.wordmark svg { width: 4.6cqi; height: 4.6cqi; display: block; flex: none; }

.who { align-self: end; display: grid; gap: 1.2cqi; }
.who h1 {
  margin: 0;
  font-size: 9.6cqi;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.02;
}
.who p {
  margin: 0;
  font-size: 3.5cqi;
  font-weight: 400;
  line-height: 1.35;
  color: rgb(255 255 255 / .82);
  max-width: 62cqi;
}

.portrait {
  position: absolute;
  top: 7cqi;
  right: 7cqi;
  width: 21cqi;
  height: 21cqi;
  border-radius: 50%;
  object-fit: cover;
  border: 0.6cqi solid rgb(255 255 255 / .30);
}

/* Back: a QR must be dark-on-light to scan reliably, so this face stays
   light in dark mode too. Deliberate exception — an inverted QR is a QR
   that some phone cameras simply refuse to read. */
.face--back { background: #fff; }
.face--back .face-body {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 5cqi;
  padding: 6cqi;
}
/* A square code in a landscape card leaves both side margins empty. Naming
   the card in that space means a photo of the back still says whose code
   it is — and it lets the QR take the card's full height instead of
   competing with a caption for it. */
/* Height from the grid area, not cqi: same circularity as above, and the
   area's height is already definite from the card's aspect ratio. */
.face--back .qr { height: 100%; width: auto; display: block; align-self: stretch; }
.qr-who {
  margin: 0;
  display: grid;
  gap: 1.6cqi;
  min-width: 0;
  letter-spacing: -0.01em;
}
.qr-mark {
  display: flex;
  align-items: center;
  gap: 2cqi;
  font-size: 4cqi;
  font-weight: 600;
  color: var(--blue);
}
.qr-mark svg { width: 4.4cqi; height: 4.4cqi; display: block; flex: none; }
.qr-who b { font-size: 5.6cqi; font-weight: 700; color: #212529; letter-spacing: -0.03em; }
.qr-who small { font-size: 2.9cqi; color: #6C757D; overflow-wrap: anywhere; }

.flip-toggle { display: none; }

/* ── Flip mode: JS on, narrow viewport only ────────────────────────── */

@media (max-width: 55.999rem) {
  .js .deck { perspective: 1400px; }
  .js .flip { position: relative; aspect-ratio: 90 / 54; }
  .js .flip-inner {
    display: block;
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
    transition: transform 620ms cubic-bezier(.2, .7, .2, 1);
  }
  .js .flip[data-flipped="true"] .flip-inner { transform: rotateY(180deg); }
  .js .face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
  }
  .js .face--back { transform: rotateY(180deg); }

  .js .flip-toggle {
    display: block;
    margin: 0 auto;
    background: none;
    border: 0;
    padding: var(--s2) var(--s3);
    font: inherit;
    font-size: 14px;
    /* ink-2, not ink-3: #6C757D on the #F8F9FA ground is 4.45:1 and misses
       AA for normal text by 0.05. Close enough to pass a visual review. */
    color: var(--ink-2);
    cursor: pointer;
  }
}

@media (prefers-reduced-motion: reduce) {
  .js .flip-inner { transition: none; }
}

/* ── Actions ───────────────────────────────────────────────────────── */

/* Mobile: does nothing, children stack in the body flow.
   Desktop: becomes the two-column grid beneath the cards. */
.below { display: contents; }

.actions { width: 100%; max-width: 30rem; display: grid; gap: var(--s3); }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 52px;
  padding: 0 var(--s5);
  border-radius: var(--radius);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 120ms ease;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--ink); color: var(--ground); }
.btn--secondary {
  background: var(--surface);
  color: var(--blue-text);
  border-color: var(--line);
}

/* ── Contact rows ──────────────────────────────────────────────────── */

.rows {
  width: 100%;
  max-width: 30rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
/* Stacked, not the two-column label→value the reference apps use. A
   47-character email right-aligned against a label wraps ragged and looks
   broken; stacking is robust for any value length and needs no per-row
   special-casing. */
.row {
  display: grid;
  gap: 2px;
  padding: var(--s3) var(--s5);
  text-decoration: none;
  color: inherit;
  border-top: 1px solid var(--line);
}
.row:first-child { border-top: 0; }
.row:hover { background: var(--ground); }
.row-label { font-weight: 600; letter-spacing: -0.01em; }
.row-detail {
  color: var(--ink-3);
  font-size: 14px;
  /* break-word, not anywhere: the <wbr> after the @ is a better break
     point than mid-word, and anywhere would win over it. */
  overflow-wrap: break-word;
}

/* The only job the orange has: marking the route Aaron actually wants
   people to use. A shape, never small text — #FF7708 is 2.6:1 on white
   and fails AA, so it can never carry meaning by itself. The button
   still says "WhatsApp"; the dot only adds emphasis. */
.preferred::after {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--orange);
  flex: none;
}

.utility {
  display: flex;
  gap: var(--s5);
  justify-content: center;
  width: 100%;
  max-width: 30rem;
}
.utility button {
  background: none;
  border: 0;
  padding: var(--s2);
  font: inherit;
  font-size: 14px;
  color: var(--blue-text);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
/* No Web Share API (most desktop browsers) — hide rather than offer a
   button that does nothing. */
.no-share .share-btn { display: none; }

.foot { font-size: 13px; color: var(--ink-2); text-align: center; margin: 0; }

.said {
  position: fixed;
  left: 50%;
  bottom: var(--s5);
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--ground);
  padding: var(--s3) var(--s5);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  transition: opacity 180ms ease;
  pointer-events: none;
}
.said[data-shown] { opacity: 1; }

/* ── Desktop ───────────────────────────────────────────────────────── */

@media (min-width: 56rem) {
  body { padding: var(--s8) var(--s7); gap: var(--s6); }

  /* Equal columns: these are two faces of one card, so they must be the
     same size. Unequal widths read as two unrelated cards and shrink the
     QR panel's type into fragments. */
  .deck { max-width: 64rem; }
  .flip-inner {
    grid-template-columns: 1fr 1fr;
    gap: var(--s6);
  }

  .below {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: var(--s6);
    row-gap: var(--s5);
    align-items: start;
    width: 100%;
    max-width: 64rem;
  }
  /* Utility spans both columns on its own row rather than sitting under
     the actions — a spanning .rows would otherwise stretch the row it
     shares and open a dead gap above Share/Copy. */
  .actions { grid-column: 1; grid-row: 1; }
  .rows    { grid-column: 2; grid-row: 1; }
  .utility { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; }
  .actions, .rows, .utility { max-width: none; }
}
