@layer base {
/* ========== Person pages — the public profile and the share card ==========
   Semantic tokens only (METIS-pub#499). The profile sets its own three, from
   the primitive tier, so it keeps the look it has always had — the cream
   canvas, green-grey labels, a green hairline — without wearing an app theme:
   putting the Gathering's theme on pages other than its own is a separate
   decision (METIS-pub#490). The share card sets the same three, so its
   labels, chevrons and QR frame stay green beside the profile it came from;
   only its canvas differs. Body text is the reading face (--font-body),
   headings the display face, as before. */

body.person-page,
body.person-share-page {
  --color-bg: var(--cream);
  --color-text-muted: var(--green-500);
  --color-border: color-mix(in oklab, var(--green-900) 10%, transparent);
  color: var(--color-text);
  font-family: var(--font-body);
}

body.person-page { background: var(--color-bg); }

body.person-share-page { background: var(--color-surface); }

body.person-page .view-nav {
  background: var(--color-bg);
}

/* ========== Layout ========== */

.person-wrap {
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  padding: 120px var(--space-6) var(--space-16);
  box-sizing: border-box;
}

/* The profile is wide on a desktop — the reel and every list run full width
   — and keeps a 16px gutter on a phone. */
.person-page .person-wrap {
  max-width: 1120px;
  padding-inline: var(--space-4);
}

/* ========== Header: photo + name ========== */

.person-header {
  text-align: center;
  padding-bottom: var(--space-6);
}

/* The name, then the links on their own row under it, both from the start
   edge at every width (METIS-pub#607, the approved mock). */
.person-page .person-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-4);
  padding-bottom: 0;
  text-align: left;
}

.person-identity {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-4);
  min-width: 0;
}

.person-photo {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto var(--space-4);
  display: block;
}

.person-photo-placeholder {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: color-mix(in oklab, var(--color-text) 8%, var(--color-bg));
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-4);
  color: var(--color-text-muted);
}

.person-identity :is(.person-photo, .person-photo-placeholder) { margin: 0; }

.person-photo-placeholder svg {
  width: 48px;
  height: 48px;
}

.person-name {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.6rem, 5vw, 2.25rem);
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: var(--color-text);
}

/* ========== Link buttons ==========
   Each link is a pill: its icon, then its address (`display_text`, the
   record's own label or the trimmed address), in a row that wraps
   (METIS-pub#607). A button never grows wider than the row: a long address
   ends in an ellipsis, and the full one is in the button's title. */

.person-icon-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: var(--space-2);
  max-width: 100%;
}

.person-icon-btn {
  width: auto;
  height: auto;
  max-width: 100%;
  box-sizing: border-box;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-full);
  background: color-mix(in oklab, var(--color-text) 5%, var(--color-bg));
  border: 1.5px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text);
  text-decoration: none;
  transition: background var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.person-icon-btn__text {
  font-size: var(--text-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.person-icon-btn:hover:not(:disabled) {
  background: color-mix(in oklab, var(--color-text) 10%, var(--color-bg));
  border-color: color-mix(in oklab, var(--color-text) 20%, transparent);
}

.person-icon-btn .icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* The conversation reel's arrows: the round form of the same button. They
   render `hidden` and view.js reveals them only when the reel overflows; the
   button sets `display`, so `[hidden]` must say so again or the UA rule loses. */
.person-reel-arrow {
  width: 40px;
  height: 40px;
  padding: 0;
  flex-shrink: 0;
  cursor: pointer;
  font: inherit;
}

.person-reel-arrow[hidden] { display: none; }

.person-reel-arrow:disabled {
  opacity: 0.4;
  cursor: default;
}

.person-reel-arrow svg {
  width: 20px;
  height: 20px;
}

/* ========== Sections ========== */

.d1-links a { color: var(--color-text); }

/* A public person-fields group's title (view/includes/info_field_groups.html
   writes it as .d1-label) reads as this page's own section heading, on both
   pages: the share card loads no design-1-base.css (METIS-pub#302). */
.person-section-label,
.person-section > .d1-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
}

.person-section { min-width: 0; }

/* The lead section's heading row: label and count at the start, the arrows
   at the end. The label keeps its own text; the count sits beside it. */
.person-section-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.person-section-head .person-section-label { margin-bottom: 0; }

.person-section-count {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.person-section-head .person-reel-arrow:first-of-type { margin-left: auto; }

/* About + "Part of" sit straight under the header (METIS-pub#607: the profile
   comes first). The reel, then the grid lists, each open on a hairline. */
.person-story,
.person-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  margin-top: var(--space-8);
  min-width: 0;
}

.person-page .person-section--lead,
.person-grid {
  margin-top: var(--space-8);
  padding-top: var(--space-8);
  border-top: 1px solid var(--color-border);
}

.person-aside {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  min-width: 0;
}

/* One column of cards per section; wider than 700px a grid section's cards
   run side by side across the full width (below). */
.person-cards {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
}

/* ========== Contact Links (share card) ========== */

.person-links {
  padding: var(--space-6) 0 0;
}

.person-link-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px var(--space-3);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--color-text);
  background: transparent;
  -webkit-tap-highlight-color: transparent;
}

/* Hover: .lift .lift--ground (shared.css). The tap tint stays. */
.person-link-row:active {
  background: color-mix(in oklab, var(--color-text) 5%, transparent);
}

.person-link-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: color-mix(in oklab, var(--color-text) 5%, var(--color-bg));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--color-text);
}

.person-link-icon .icon {
  width: 18px;
  height: 18px;
}

.person-link-text {
  flex: 1;
  min-width: 0;
}

.person-link-label {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-text-muted);
  margin-bottom: 1px;
}

.person-link-value {
  display: block;
  font-size: var(--text-md);
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.person-link-arrow {
  color: var(--color-text-faint);
  flex-shrink: 0;
}

/* ========== Description ========== */

/* On the share card, About and the Conversations under it each open on a
   hairline (#608). */
.person-share-page .person-description,
.share-story .person-section--lead {
  padding-top: var(--space-8);
  border-top: 1px solid var(--color-border);
  margin-top: var(--space-8);
}

.person-description { min-width: 0; }

.person-description-label {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--color-text-muted);
  margin-bottom: 14px;
}

.person-description-body {
  font-size: var(--text-lg);
  line-height: 1.75;
  color: var(--color-text);
}

/* ========== Desktop ==========
   Wider than 700px — the breakpoint design-1-detail.css already uses. */
@media (min-width: 701px) {
  .person-page .person-identity {
    flex-direction: row;
    align-items: center;
    gap: var(--space-6);
  }

  .person-story {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: var(--space-12);
    align-items: start;
  }

  /* No About: "Part of" takes the row rather than a third of it. */
  .person-story > .person-aside:only-child { grid-column: 1 / -1; }

  /* Each grid section runs full width, its cards three across on a desktop
     (METIS-pub#607); "Part of" in the aside keeps its single column. */
  .person-section--grid .person-cards {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
  }
}

/* ========== Share page ========== */

/* Narrow card layout — matches the original /view/person/ design */
.share-wrap {
  max-width: 440px;
  padding: 40px 20px 60px;
}

/* Original 80px photo size */
.share-photo {
  width: 80px;
  height: 80px;
}

.share-photo-placeholder {
  width: 80px;
  height: 80px;
}

.share-photo-placeholder svg {
  width: 36px;
  height: 36px;
}

/* QR section */
.person-qr-section {
  text-align: center;
  padding: 0 0 var(--space-6);
}

body.person-share-page .person-header {
  padding-bottom: var(--space-2);
}

body.person-share-page .person-name {
  font-size: clamp(1.92rem, 6vw, 2.4rem);
}


.person-qr-frame {
  width: 196px;
  padding: 10px;
  /* A QR code needs white behind it, whatever the page's surface. */
  background: var(--white);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: top;
}

#person-qr {
  width: 176px;
  height: 176px;
  overflow: hidden;
}

#person-qr canvas,
#person-qr img {
  display: block;
  width: 176px !important;
  height: 176px !important;
}

#person-qr table {
  width: 176px !important;
  height: 176px !important;
  table-layout: fixed;
  border-collapse: collapse;
}

/* vCard button, then one Book a call button per Calendar link (#608) */
.share-vcard-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: 0 0 20px;
}

.person-vcard-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 20px;
  background: var(--color-text);
  color: var(--color-text-invert);
  border-radius: var(--radius-md);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 500;
  letter-spacing: 0.02em;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/* Fills on hover; .lift (shared.css) carries the transition and the rise. */
.person-vcard-btn:hover { background: color-mix(in oklab, var(--color-text) 85%, var(--white)); }
.person-vcard-btn:active { opacity: 0.85; }
.person-vcard-btn .icon { width: 18px; height: 18px; flex-shrink: 0; }

/* Book a call: the page's accent, so it reads as the invitation it is.
   Accent and accent-text always travel as a pair. */
.person-vcard-btn--accent {
  background: var(--color-accent);
  color: var(--color-accent-text);
}
.person-vcard-btn--accent:hover { background: color-mix(in oklab, var(--color-accent) 85%, var(--color-text)); }

/* Description is italic on the share page (original style) */
.share-description-body {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  line-height: 1.7;
  font-style: italic;
}

/* ========== Share page, desktop ==========
   Two columns from 901px, not the profile's 701px: below about 900px the
   right column is too narrow for video cards beside a 20rem contact card.
   The contact card stays in view while the profile scrolls. One taller than
   the window scrolls with the page rather than gaining a scrollbar of its
   own, so every link stays in one card (#608, Approvals row 4). */
@media (min-width: 901px) {
  .share-wrap {
    max-width: 1120px;
    display: grid;
    grid-template-columns: 20rem minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    column-gap: var(--space-12);
    align-items: start;
  }

  .share-links {
    grid-column: 1;
    grid-row: 1 / -1;
    position: sticky;
    top: var(--space-8);
    padding: var(--space-6);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
  }

  body.person-share-page .person-header {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    align-items: center;
    gap: var(--space-6);
    text-align: left;
  }

  body.person-share-page .person-header :is(.share-photo, .share-photo-placeholder) {
    width: 120px;
    height: 120px;
    margin: 0;
    flex-shrink: 0;
  }

  .share-story {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
  }
}
}
