/* Shared contact-card stylesheet.
 *
 * Published ONCE per org as assets/card.<hash>.css and referenced by every card, so a
 * design change ships by replacing one file instead of re-rendering every profile.
 * Everything org-specific lives in the sibling assets/brand.<hash>.css as custom
 * properties — nothing in this file may hardcode a brand colour.
 *
 * The filename carries a content hash, so this can be served immutable/max-age=31536000.
 */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;          /* keep in sync with LIGHT_SURFACE in brand.py */
  --text: #14171a;
  --text-muted: #5b6470;
  --border: #e7e9ec;
  --row-hover: #f7f8fa;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.06);
  /* --accent / --accent-contrast / --brand-ink and the type tokens (--font-stack,
   * --display-stack, --mono-stack, --heading-weight, --label-transform,
   * --label-tracking) come from brand.<hash>.css. Three type roles: body for labels and
   * running text, display for the name and the wordmark, mono for contact lines. All
   * three default to the body stack, so a brand that sets one stack gets one voice. */
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101214;
    --surface: #16191d;        /* keep in sync with DARK_SURFACE in brand.py */
    --text: #f1f2f4;
    --text-muted: #9aa2ab;
    --border: #24282e;
    --row-hover: #1b1f24;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }

body {
  font-family: var(--font-stack);
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 2.5rem 1.25rem;
  display: flex;
  justify-content: center;
  line-height: 1.5;
}

main {
  width: 100%;
  max-width: 26rem;
  background: var(--surface);
  border-radius: 1.25rem;
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* ---- org chrome ---------------------------------------------------------- */

.masthead {
  display: flex;
  /* A column: the masthead carries the wordmark AND the org's tagline beneath it. Left
   * as a row, the two would sit side by side. */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.125rem 1.75rem 0;
  min-height: 1.5rem;
}
/* Height comes from brand.css (--wordmark-height), computed per org from the asset's
 * aspect: a wide text wordmark stays at the old 1.25rem, a squarer lockup gets more
 * height so it does not read as an afterthought. The fallback keeps the previous
 * behaviour if brand.css is missing. */
.masthead img { height: var(--wordmark-height, 1.25rem); width: auto; }
/* Shown when no wordmark asset is configured, and the fallback when one fails to
 * load. The card must read correctly with images blocked — same rule as the
 * signature. */
.masthead .wordmark-text {
  font-family: var(--display-stack);
  font-size: 0.8125rem;
  font-weight: var(--heading-weight);
  letter-spacing: var(--label-tracking);
  text-transform: var(--label-transform);
  color: var(--text-muted);
}
.masthead img.dark-only { display: none; }
@media (prefers-color-scheme: dark) {
  .masthead img.light-only { display: none; }
  .masthead img.dark-only { display: block; }
}

/* ---- identity ------------------------------------------------------------ */

.identity { padding: 1.5rem 1.75rem 1.5rem; text-align: center; }

/* The ring, the portrait or initials disc, and the transparent corners are all in
 * the PNG (see avatar.py) — nothing here draws a disc, or the ring would sit on a
 * second ground and read as a border rather than the mark it is. */
.avatar {
  display: block;
  width: 6rem;
  height: 6rem;
  margin: 0 auto 1rem;
}

h1 {
  font-family: var(--display-stack);
  font-size: 1.375rem;
  font-weight: var(--heading-weight);
  margin: 0;
}
.job-title { color: var(--text-muted); font-size: 0.9375rem; margin: 0.25rem 0 0; }
.pronouns {
  color: var(--text-muted);
  font-size: 0.8125rem;
  margin: 0.2rem 0 0;
  letter-spacing: 0.01em;
}
.bio { color: var(--text-muted); font-size: 0.9375rem; margin: 0.75rem 0 0; }

/* Deliberately NOT flex: a long "City, Region, Country" plus the local-time hint has
 * to wrap, and as flex children each part wraps independently into its own ragged
 * column. As normal inline flow it wraps like the sentence it is. */
.location {
  margin: 0.75rem 0 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
}
.location svg {
  width: 0.9rem;
  height: 0.9rem;
  vertical-align: -0.15em;
  margin-right: 0.35rem;
}
.local-time { white-space: nowrap; }
.local-time::before { content: "·"; margin: 0 0.4rem; }

/* ---- action rows --------------------------------------------------------- */

.actions { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.actions li + li { border-top: 1px solid var(--border); }
.actions a {
  position: relative;
  display: flex;
  /* A value that does not fit beside its label drops whole onto a second line, still
   * right-aligned, rather than breaking mid-word — an address split across lines is
   * not an address. The chevron is taken out of the flow (below) so it stays on the
   * right edge, vertically centred, instead of wrapping onto a line of its own. */
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.875rem;
  padding: 0.9rem 3.25rem 0.9rem 1.75rem;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
}
.actions a:hover, .actions a:focus-visible { background: var(--row-hover); }
.actions a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.actions svg { flex: none; width: 1.125rem; height: 1.125rem; color: var(--text-muted); }
/* The primary action gets the brand colour as *text*, so it uses --brand-ink (the
 * 4.5:1-guaranteed derivation), never --accent, which is only guaranteed 3:1. */
.actions .primary a { color: var(--brand-ink); font-weight: 600; }
.actions .primary svg { color: var(--brand-ink); }
/* Field rows: the link fills the row and the copy button sits beside it, outside
 * the link (a button inside an anchor is not valid HTML and is read as one control).
 * The value is underlined as an ordinary hyperlink is, so the row reads as "this
 * opens" and the button as "this copies". */
.actions .field { display: flex; align-items: stretch; }
.actions .field > a { flex: 1 1 auto; min-width: 0; padding-right: 0.75rem; }
.actions .field .row-value {
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
.actions .field > a:hover .row-value,
.actions .field > a:focus-visible .row-value { text-decoration-color: currentColor; }
.actions .copy {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  cursor: pointer;
}
.actions .copy[hidden] { display: none; }
.actions .copy:hover, .actions .copy:focus-visible { background: var(--row-hover); }
.actions .copy:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.actions .copy svg { width: 1rem; height: 1rem; }
.actions .copy .check { display: none; }
.actions .copy.copied .copy-glyph { display: none; }
.actions .copy.copied .check { display: block; color: var(--brand-ink); }
/* The launch cap on an outbound row. Same box as the copy button — equal width, the
 * same divider — so the two read as one family, but it sits INSIDE the anchor and is
 * inert: the row's own hover and focus carry it, and there is no second tab stop to
 * the same destination. The arrow points NE because that is the convention for
 * "leaves this page", where the chevron below means "continues here". */
.actions .launch {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 3.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-left: 1px solid var(--border);
  color: var(--text-muted);
}
.actions .launch svg { width: 1rem; height: 1rem; }
.actions .chevron {
  position: absolute;
  right: 1.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 0.8rem;
  height: 0.8rem;
  color: var(--border);
}

/* ---- social -------------------------------------------------------------- */

.social {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 1.125rem 1.75rem;
  border-top: 1px solid var(--border);
  margin: 0;
  list-style: none;
}
.social a {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
}
/* Sized in em so it tracks the pill's own font-size, and currentColor so it picks up
 * the hover and dark-mode colours without a second rule. */
/* Both an inline <svg> glyph and a fetched <img> mark land here. object-fit keeps a
 * non-square favicon from being stretched into the square box. */
.social-glyph { width: 1em; height: 1em; flex: none; object-fit: contain; }
.social a:hover, .social a:focus-visible {
  border-color: var(--accent);
  color: var(--brand-ink);
}
.social a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- reciprocal contact exchange ----------------------------------------- */

/* Lives inside the actions list now (li.exchange-row); the list draws the rules. */
.exchange { border-top: 0; }
.exchange > summary {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.9rem 3.25rem 0.9rem 1.75rem;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
}
.exchange > summary::-webkit-details-marker { display: none; }
.exchange > summary { position: relative; }
.exchange[open] > summary .disclosure { transform: translateY(-50%) rotate(180deg); }
@media (prefers-reduced-motion: no-preference) {
  .exchange > summary .disclosure { transition: transform 160ms ease; }
}
.exchange > summary:hover, .exchange > summary:focus-visible { background: var(--row-hover); }
.exchange > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.exchange > summary svg { flex: none; width: 1.125rem; height: 1.125rem; color: var(--text-muted); }
.exchange-form { padding: 0 1.75rem 1.375rem; }
.exchange-form label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  margin: 0.75rem 0 0.25rem;
}
.exchange-form input, .exchange-form textarea {
  width: 100%;
  font: inherit;
  font-size: 0.9375rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.5rem 0.6rem;
}
.exchange-form input:focus-visible, .exchange-form textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.exchange-form textarea { resize: vertical; min-height: 4rem; }
.exchange-form button {
  margin-top: 1rem;
  width: 100%;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  padding: 0.65rem 1rem;
  border: 0;
  border-radius: 0.5rem;
  background: var(--accent);
  color: var(--accent-contrast);
  cursor: pointer;
}
.exchange-form button:focus-visible { outline: 2px solid var(--brand-ink); outline-offset: 2px; }
.consent {
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--text-muted);
  margin: 0.875rem 0 0;
}
.consent a { color: var(--brand-ink); }
/* Populated by the form's own script; empty and inert until then. role=status makes
 * the result announced to screen readers without stealing focus. */
.exchange-status:not(:empty) {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: var(--brand-ink);
}

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

.qr { text-align: center; padding: 1.5rem 1.75rem 1.75rem; border-top: 1px solid var(--border); }
.qr img {
  width: 9rem;
  height: 9rem;
  padding: 0.6rem;
  background: #ffffff;   /* never themed: a dark-inverted QR fails to scan */
  border-radius: 0.75rem;
  border: 1px solid var(--border);
}
.qr p { color: var(--text-muted); font-size: 0.8125rem; margin: 0.75rem 0 0; }

/* ---- footer -------------------------------------------------------------- */

.legal {
  padding: 0 1.75rem 1.5rem;
  margin: 0;
  text-align: center;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--text-muted);
}

@media (prefers-reduced-motion: no-preference) {
  .actions a, .social a, .exchange > summary { transition: background-color 120ms ease; }
}

/* Cloudflare Turnstile widget, injected into the exchange form on first open. Sized to
 * the widget's own 300x65 so the form doesn't jump when it renders. */
.turnstile {
  margin-top: 1rem;
  min-height: 65px;
}

/* Opt-in geolocation control. Hidden by default and revealed by script only when the
 * browser can satisfy it, so it is never offered and then broken. */
.geo { margin-top: 1rem; }
/* `.exchange-form button` (0,1,1) outranks a bare `.geo-button` (0,1,0), which would
 * render this as a second full-width primary button competing with Send. Scope it. */
.exchange-form .geo-button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: none;
  color: var(--brand-ink);
  cursor: pointer;
}
.exchange-form .geo-button svg { width: 0.9rem; height: 0.9rem; flex: none; }
.exchange-form .geo-button:hover { border-color: var(--accent); }
.exchange-form .geo-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.geo-status:not(:empty) {
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Secondary value on an action row — a phone number beside its label, an assistant's
 * name beside "Assistant". Right-aligned and muted so the row still scans as one
 * tappable thing rather than two competing pieces of text. */
/* Present to assistive technology, selection, copy and search engines; not drawn.
 * The standard clip pattern rather than display:none, which would remove it from
 * all of those. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.actions .row-value {
  margin-left: auto;
  padding-left: 0.75rem;
  font-family: var(--mono-stack);
  font-weight: 400;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
}


.office { padding: 1.125rem 1.75rem; border-top: 1px solid var(--border); }
.office h2 {
  margin: 0 0 0.25rem;
  font-size: 0.75rem;
  font-weight: var(--heading-weight);
  letter-spacing: var(--label-tracking);
  text-transform: var(--label-transform);
  color: var(--text-muted);
}
.office p { margin: 0; font-size: 0.9375rem; line-height: 1.5; }
.office a { color: var(--brand-ink); }

/* In the masthead now, so horizontal padding comes from there rather than from here.
 * Quieter than it was as a footer block: it introduces the person rather than closing
 * the card, and must not compete with the name directly beneath it. max-width keeps a
 * 90-character claim to two comfortable lines rather than one very wide one. */
.tagline {
  margin: 0.5rem 0 0;
  text-align: center;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--text-muted);
  max-width: 26rem;
}
