/* ── Referrals ─────────────────────────────────────────────────────────
   The share sheet, the invite card on the profile, and the vouch line on a
   listing. Written narrow-first: every block below is the phone layout, and
   the only media query is the one at the bottom that turns the sheet back
   into a centred dialog once there is room for one.

   Colours are tokens throughout (variables.css), so light and dark both
   come out right without a second set of rules here. Corners stay square:
   var(--radius-md) is 2px sitewide and the pill radius is reserved. */

/* ── The share sheet ──────────────────────────────────────────────── */

.rshare-scrim {
  position: fixed;
  inset: 0;
  z-index: 950;
  background: rgba(0, 0, 0, .5);
  display: flex;
  /* Bottom of the screen on a phone: it is where the thumb is, and it is
     what the platform's own share sheet does. */
  align-items: flex-end;
  justify-content: center;
}
.rshare-scrim[hidden] { display: none; }

.rshare {
  width: 100%;
  max-width: 520px;
  background: var(--surface-raised, var(--surface));
  border-top: 1px solid var(--hairline);
  border-radius: 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom, 0px));
  max-height: 88vh;
  overflow-y: auto;
  animation: rshare-rise .26s var(--expo-out, ease) both;
}
@keyframes rshare-rise {
  from { transform: translateY(14px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .rshare { animation: none; }
}

.rshare-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.rshare-title {
  font-family: 'Newsreader', serif;
  font-weight: 500;
  font-size: 20px;
  line-height: 1.25;
  margin: 0;
  color: var(--ink);
}
.rshare-x {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  color: var(--muted);
  cursor: pointer;
}
.rshare-x svg { width: 15px; height: 15px; }
.rshare-x:hover { color: var(--ink); border-color: var(--bronze); }

.rshare-sub {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--muted);
  margin: 8px 0 0;
}
.rshare-sub[hidden] { display: none; }

.rshare-acts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}
.rshare-wa,
.rshare-copy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  /* 48px, because these are the two things the sheet exists to be tapped
     for and both sit in the thumb zone. */
  min-height: 48px;
  padding: 0 16px;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  transition: opacity .15s ease, border-color .15s ease, color .15s ease;
}
.rshare-wa {
  background: #25D366;
  border: 1px solid #25D366;
  color: #08130C;
}
.rshare-wa svg { width: 17px; height: 17px; }
.rshare-wa:hover { opacity: .9; }
.rshare-copy {
  background: transparent;
  border: 1px solid var(--hairline);
  color: var(--ink);
}
.rshare-copy:hover { border-color: var(--bronze); }

.rshare-code {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.rshare-code[hidden] { display: none; }
.rshare-code-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--bronze);
}
.rshare-code-value {
  font-family: var(--font-data, ui-monospace, monospace);
  font-size: 16px;
  letter-spacing: .06em;
  color: var(--ink);
  /* A code that is going to be read down a phone must not wrap. */
  white-space: nowrap;
}

.rshare-note {
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
  margin: 12px 0 0;
}
.rshare-note[hidden] { display: none; }

/* ── The share control on a listing ───────────────────────────────── */

.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
  padding: 0 14px;
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}
.share-btn:hover { border-color: var(--bronze); }
.share-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The same control on the sticky bar at the bottom of a listing, where it
   is an icon only: the bar has room for one worded button and that one is
   already spoken for by WhatsApp. */
.mobile-cta .share-btn {
  width: 46px;
  min-width: 46px;
  flex: 0 0 auto;
  margin-top: 0;
  padding: 0;
}
.mobile-cta .share-btn span { display: none; }

/* ── The vouch ────────────────────────────────────────────────────── */

/* Somebody Reside has verified put their name next to this landlord. Quiet
   by design: it is a fact about the listing, not a badge being sold. */
.vouch {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
  padding: 8px 11px;
  border: 1px solid var(--teal-border);
  border-radius: var(--radius-md);
  background: var(--teal-bg);
  font-size: 12px;
  line-height: 1.45;
  color: var(--teal-ink);
}
.vouch[hidden] { display: none; }
.vouch svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── The invite card on the profile ───────────────────────────────── */

.inv-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.inv-card {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 16px;
}
.inv-card h3 {
  font-size: 14.5px;
  font-weight: 700;
  margin: 0 0 5px;
  color: var(--ink);
}
.inv-card p {
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0 0 12px;
}
.inv-card .btn,
.inv-card .share-btn { margin-top: 0; }

/* The code, and the copy control that is the whole point of the card. */
.inv-code-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 10px;
}
.inv-code {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  padding: 0 12px;
  min-height: 46px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  background: var(--bg);
  font-family: var(--font-data, ui-monospace, monospace);
  font-size: 15px;
  letter-spacing: .06em;
  color: var(--ink);
  /* The code never wraps and never truncates: it is the thing being read. */
  white-space: nowrap;
  overflow-x: auto;
}
.inv-copy {
  flex: 0 0 auto;
  min-height: 46px;
  padding: 0 16px;
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}
.inv-copy:hover { border-color: var(--bronze); }

/* Three numbers: what the shares did, who joined, what it earned. */
.inv-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 14px;
  background: var(--hairline);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.inv-stat {
  background: var(--surface);
  padding: 12px 10px;
  text-align: center;
}
.inv-stat b {
  display: block;
  font-family: var(--font-data, ui-monospace, monospace);
  font-variant-numeric: tabular-nums;
  font-size: 19px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
}
.inv-stat span {
  display: block;
  margin-top: 3px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.35;
}

/* The Featured days, when there are any. Gold, because that is what
   Featured is everywhere else on the site. */
.inv-wallet {
  display: flex;
  /* Baseline, not centre: the number is a word in the sentence beside it,
     and centring it against a three-line paragraph floats it into the
     middle of nowhere. */
  align-items: baseline;
  gap: 10px;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--amber-border);
  border-radius: var(--radius-md);
  background: var(--amber-bg);
}
.inv-wallet[hidden] { display: none; }
.inv-wallet b {
  font-family: var(--font-data, ui-monospace, monospace);
  font-size: 20px;
  font-weight: 700;
  color: var(--amber-ink);
  line-height: 1;
}
.inv-wallet span {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--amber-ink);
}

/* Who joined. First names only — see referral_panel() in api/referrals.php. */
.inv-people {
  margin-top: 14px;
  border-top: 1px solid var(--hairline);
  padding-top: 12px;
}
.inv-person {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  font-size: 13px;
  color: var(--ink);
}
.inv-person + .inv-person { border-top: 1px solid var(--hairline); }
.inv-person em {
  font-style: normal;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.inv-person em.done { color: var(--teal-ink); }
.inv-person em.held { color: var(--amber-ink); }

.inv-empty {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
  margin: 12px 0 0;
}

/* ── Signup: who sent you ─────────────────────────────────────────── */

.ref-welcome {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid var(--teal-border);
  border-radius: var(--radius-md);
  background: var(--teal-bg);
  font-size: 13px;
  line-height: 1.55;
  color: var(--teal-ink);
}
.ref-welcome[hidden] { display: none; }
.ref-welcome svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 1px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ref-welcome strong { font-weight: 700; }

/* ── Wider screens ────────────────────────────────────────────────── */

@media (min-width: 641px) {
  /* Enough room for a dialog, so it stops being a sheet. */
  .rshare-scrim {
    align-items: center;
    padding: 24px;
  }
  .rshare {
    border: 1px solid var(--hairline);
    border-radius: var(--radius-lg);
    padding: 26px;
    box-shadow: var(--shadow-lg);
  }
  .rshare-acts {
    flex-direction: row;
  }
  .rshare-acts > * { flex: 1; }
  .rshare-title { font-size: 21px; }

  .inv-grid { grid-template-columns: 1fr 1fr; }
  /* The code card carries the code, the stats and the list, so it takes
     the full width above the two invite cards. */
  .inv-grid .inv-card.inv-wide { grid-column: 1 / -1; }
}
