/* Therapy Center: the team cards (build brief 4; shared since card #87)
   One person's card, wherever team members are shown: Meet the Team (the clinical team) and Careers ("Our leadership
   team", since card #87, 2026-10-24). The markup is src/lib/profile-card.mjs; the "Read more" that brings a card
   forward is /assets/js/team-cards.js (card #54). Both pages load this file; Meet the Team's own parts are team.css.
   Builds on the tokens and components in /assets/css/site.css (the shared .more disclosure is styled there and not
   restyled here). Pattern: the sister site's team page. A grid of profile cards, two across from 960px; each card a
   round photo, the name with the credentials on their own line under it, the title, a short summary and the
   "Read more" disclosure.

   Calm standard (docs/CALM-STANDARD.md): generous whitespace, no floating motif (the gold ring frames each photo, Tim's
   choice of 2026-10-22), a readable measure, left-aligned text. Class prefixes: .profiles .profile* .profile-dialog*.
   Text/background pairs used here are role tokens from site.css (heading, text, muted and label on the surface), all
   checked by tools/check-contrast.py; the focused card (card #54) uses the same ones, and its Close icon is the heading
   colour on the surface (a UI pair there). */

/* ======================================================================
   The cards
   ====================================================================== */
/* One column until 960px. A single-column track can't be widened by a long word, so the page never scrolls sideways. */
.profiles { display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(1rem, 0.75rem + 1vw, 1.5rem); }
@media (min-width: 960px) {
  /* Cards in a row share one height, so a shorter summary never leaves a hole beside a longer one. */
  .profiles { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
}
.profile {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  grid-template-areas: "photo head" "body body";
  gap: 1rem 1.1rem;
  align-items: center;
  align-content: start; /* a card stretched to its row's height keeps the spare space at the bottom */
  padding: clamp(1.25rem, 1rem + 1vw, 1.75rem);
  background: var(--color-surface);
  border: 1px solid rgba(var(--edge-rgb), 0.07);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  scroll-margin-top: calc(var(--header-h) + 1rem); /* a link to #<slug> lands below the sticky header */
}
@media (min-width: 560px) {
  .profile {
    grid-template-columns: 120px minmax(0, 1fr);
    grid-template-areas: "photo head" "photo body";
    gap: 0.6rem 1.75rem;
    align-items: start;
  }
}
.profile__photo { grid-area: photo; position: relative; width: 100%; aspect-ratio: 1; }
.profile__photo img {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: 50% 50%; /* the files are square and face-centred (tools/make-team-photos.py) */
  border-radius: 50%;
  background: var(--color-tint);
  box-shadow: 0 0 0 1px rgba(var(--edge-rgb), 0.12); /* a hairline edge, so a light photo keeps its circle on the surface */
}
/* The dark theme dims the photos a little, so faces don't glare on the dark page. Both dark blocks, as in site.css. */
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .profile__photo img { filter: brightness(0.92); }
}
@media screen {
  :root[data-theme="dark"] .profile__photo img { filter: brightness(0.92); }
}
/* The gold ring (Tim, 2026-10-22, shown teal and gold: "Gold (Recommended)"): the sister site's headshot ring, two open
   arcs (ringArc() in components.mjs, in the HTML as built) just outside the round photo, 7% on each side, turned -12deg,
   in the gold token (--color-accent: the light theme's deep gold, the dark theme's bright one; the pair on the card
   surface is checked by tools/check-contrast.py). It frames the photo, so it is not one of the calm standard's floating
   motifs. Decorative: hidden from screen readers in the markup, and hidden in forced colours below. */
.profile__ring {
  position: absolute;
  inset: -7%;
  width: 114%;
  height: 114%;
  max-width: none;
  color: var(--color-accent);
  transform: rotate(-12deg);
  pointer-events: none;
}
@media (forced-colors: active) {
  .profile__ring { display: none; }
}
.profile__head { grid-area: head; min-width: 0; }
.profile__body { grid-area: body; min-width: 0; }
.profile__name { font-size: var(--step-1); margin: 0 0 0.2em; line-height: 1.2; }
@media (min-width: 560px) { .profile__name { font-size: var(--step-2); } }
/* Credentials always sit on their own line under the name, so every card reads the same and a long list (Stephani's
   four) never leaves a comma hanging after the name. The comma stays for screen readers (visually hidden), so the
   heading still reads "Name, credentials". */
.profile__creds {
  display: block;
  margin-top: 0.3em;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--color-label);
}
.profile__role { margin: 0; font-size: 0.9375rem; font-weight: 600; color: var(--color-muted); }
.profile__summary { margin: 0; max-width: var(--measure); }
.profile .more { margin-top: 0.5rem; }
.profile .more__body { max-width: var(--measure); }
/* A link shown as a site's own logo (card 128: Tim's LinkedIn, LinkedIn's [in] logo, unaltered): 26px tall, in a 44 x 44
   tap target, the site's focus ring (nothing here changes it). One file per theme, with the site's own theme rules (the
   same two dark blocks as site.css): the blue one on the light theme, the white one on the dark. Under forced colours
   (Windows high contrast) the blue one always shows: it keeps at least 3:1 against both a black and a white background,
   where the white one would vanish on white. No filter, background or colour: the logo is LinkedIn's, as it is. */
.profile__logo-link { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; }
.profile__logo { display: block; width: auto; height: 26px; }
.profile__logo--dark { display: none; }
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .profile__logo--light { display: none; }
  :root:not([data-theme="light"]) .profile__logo--dark { display: block; }
}
@media screen {
  :root[data-theme="dark"] .profile__logo--light { display: none; }
  :root[data-theme="dark"] .profile__logo--dark { display: block; }
}
@media (forced-colors: active) {
  .profile__logo--light { display: block !important; }
  .profile__logo--dark { display: none !important; }
}

/* ======================================================================
   "Read more" brings the card forward (card #54)
   ====================================================================== */
/* Tim, 2026-10-22: the sister site's feature, with its rulings. With scripting on, /assets/js/team-cards.js turns each
   card's "Read more about <first name>" into a button that opens a native <dialog> holding the whole card, photo
   included; without it the <details class="more"> above works as built. A card with no bio has neither.
   The trigger: the disclosure's look (.more__summary, site.css) on a <button>. Only the button's own chrome is reset
   here (the summary's font, weight, colour, padding and chevron stay), and the card's disclosure margin is copied
   (.profile .more above), so the words sit exactly where the disclosure's did. */
.profile__more { margin: 0.5rem 0 0; border: 0; background: none; font-size: inherit; line-height: inherit; letter-spacing: inherit; text-align: left; appearance: none; }
/* The focused card. Phones first (under 640px): a full-screen sheet, the full visible height (100dvh, 100vh where dvh
   is unknown), square to the screen's edges; the content scrolls inside it and the Close button stays at the top. No
   padding of its own: the card inside carries it and covers the dialog's box, so team-cards.js closes only on a press
   outside that box, on the dimmed page; on the sheet there is none. */
.profile-dialog {
  width: 100%;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--color-surface);
  color: var(--color-text);
  overflow: auto;
  overscroll-behavior: contain;
}
/* The dimmed page: the brand navy at 60% in both themes (written out: a ::backdrop did not read custom properties in
   every browser). The page behind does not scroll, and does not shift: the gutter stays where the scrollbar was. The
   lock is on <body>, not <html>: <body>'s overflow then passes to the window, as its overflow-x: hidden (site.css) does
   today, so the sticky header stays at the top. Hidden on <html> would make <body> a scroll box of its own, and the
   header would stick to that and leave the screen while the card is open. */
.profile-dialog::backdrop { background: rgba(0, 39, 76, 0.6); }
html.profile-dialog-open { scrollbar-gutter: stable; }
html.profile-dialog-open body { overflow: hidden; }
/* The lift and zoom (the 200 ms motion rule): the card from slightly smaller and transparent to full size, the backdrop
   fading in, both in the site's --dur (180 ms), eased out. Closing is instant. None under reduced motion. */
.profile-dialog[open] { animation: profile-dialog-in var(--dur) var(--ease) both; }
.profile-dialog[open]::backdrop { animation: profile-dialog-dim 180ms ease-out both; }
@keyframes profile-dialog-in { from { opacity: 0; transform: translateY(16px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes profile-dialog-dim { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .profile-dialog[open], .profile-dialog[open]::backdrop { animation: none; }
}
/* The Close button stays at the top right while the card scrolls under it: a sticky bar of no height and no padding (the
   button's offset is its own margin), so the card starts at the dialog's very top and a card of the sheet's height is
   exactly the sheet. The button is the site's round icon button (as the theme switch, site.css), its surface behind it;
   the site's focus ring reaches it. On phones it clears the screen's safe areas. */
.profile-dialog__bar {
  position: sticky; top: 0; z-index: 1;
  display: flex;
  justify-content: flex-end;
  height: 0;
}
.profile-dialog__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 44px;
  height: 44px;
  margin: calc(0.75rem + env(safe-area-inset-top, 0px)) calc(0.75rem + env(safe-area-inset-right, 0px)) 0 0;
  padding: 0;
  border: 1.5px solid rgba(var(--edge-rgb), 0.2);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-heading);
  cursor: pointer;
}
.profile-dialog__close:hover { border-color: var(--color-heading); }
.profile-dialog__close .icon { display: block; }
/* The card inside: the card's own rules without its box (the dialog is the box). Phones: the photo at the top, then the
   name, then the body, the card at least the sheet's height (border-box, site.css), so a short bio leaves no bare sheet,
   with the safe areas inside its padding. The photo keeps the card's round, face-centred crop (never cut), at 128px.
   Focus lands on the name when the dialog opens (tabindex -1; the site's ring shows for keyboard users). */
.profile-dialog .profile {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "photo" "head" "body";
  gap: 1rem;
  align-items: start;
  min-height: 100%;
  padding: calc(1.25rem + env(safe-area-inset-top, 0px)) calc(1.25rem + env(safe-area-inset-right, 0px)) calc(1.5rem + env(safe-area-inset-bottom, 0px)) calc(1.25rem + env(safe-area-inset-left, 0px));
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  scroll-margin-top: 0;
}
.profile-dialog .profile__photo { width: 128px; }
/* The summary reads as wide as the bio under it (the card on the page keeps its measure, .profile__summary above). */
.profile-dialog .profile__summary { max-width: none; }
.profile-dialog .profile__bio { margin-top: 1rem; }
.profile-dialog .profile__bio > :last-child { margin-bottom: 0; }
/* Computers (640px and wider): centred, at most 40rem wide and 85% of the window tall, as tall as its card and scrolling
   inside when a bio is long; the site's border, large radius (a squircle where the browser draws one, site.css section
   1) and shadow. The photo beside the name, the body below across the card; the name keeps clear of the Close button. */
@media (min-width: 640px) {
  .profile-dialog {
    width: min(40rem, calc(100% - 2rem));
    height: fit-content;
    max-height: 85vh;
    max-height: 85dvh;
    margin: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
  }
  .profile-dialog__close { margin: 0.75rem 0.75rem 0 0; }
  .profile-dialog .profile {
    grid-template-columns: 128px minmax(0, 1fr);
    grid-template-areas: "photo head" "body body";
    gap: 1.25rem 1.75rem;
    align-items: center;
    min-height: 0;
    padding: clamp(1.25rem, 1rem + 1vw, 1.75rem);
  }
  .profile-dialog .profile__head { padding-right: 3rem; }
  .profile-dialog .profile__body { align-self: start; }
}
/* Windows high contrast: the dialog keeps a visible border (the phone sheet has none of its own) and the Close button
   its own. After the 640px block, so they win on every size. */
@media (forced-colors: active) {
  .profile-dialog { border: 2px solid CanvasText; }
  .profile-dialog__close { border: 1px solid ButtonText; }
}

/* ======================================================================
   Print
   ====================================================================== */
@media print {
  .profile { box-shadow: none; break-inside: avoid; }
  .profile__photo img { filter: none; }
}
