/* ─────────────────────────────────────────────────────────────────────────
   PLACE CARD — a page opened inside a place (METIS-pub#793 Design 6).

   A quest, a person, a conversation, a journey, a holon's configuration or
   history, opened under the place band: the page sits in a card whose first
   row (crm/partials/_place_card_head.html) says what it is, where it is and
   under which tab. A holon's and a person's own page have no such row: the
   band's header is theirs (picture, name, History, Go in; METIS-pub#826). Nesting is drawn as a
   card rather than a link trail, so there are no back links (CLAUDE.md, UI).

   Also a place's Overview's welcome blocks (.place-overview), which lead the
   page above the holon's own sections (Design 7).

   Lifted from the round 4 prototype (METIS-specs future/navigation/source/
   place-band.css); tokens only.
   ───────────────────────────────────────────────────────────────────────── */

@layer components {
  .place-card {
    margin: var(--space-6);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    box-shadow: var(--elev-1);
    /* clip, never hidden (METIS-pub#826 B1): hidden makes the card a scroll
       container, which (a) as a flex item lets it shrink to the window and
       cut its page off with no scrollbar, and (b) lets an anchor link
       (#section) scroll it part-way down with no way back up. clip rounds
       the corners without either. */
    overflow: clip;
    /* The page inside keeps its own layout; the card is its edge. Padded
       here, with the head pulled out to the card's edge, rather than per
       page, because each page's top level differs (a grid, a column, a
       config frame, loose blocks). */
    padding: 0 var(--space-4) var(--space-4);
  }

  /* A two-pane page (a person, a holon: .detail-grid--chat-*) in a card. On
     a wide screen .main is a fixed-height flex column and each pane scrolls
     on its own (detail.css); the card is what now sits between them, so the
     card fills .main and hands the remaining height to the grid. Without
     this the grid grows to its content and nothing scrolls (B1). */
  .place-card:has(> .detail-grid--chat-left, > .detail-grid--chat-right) {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    padding-bottom: 0;
  }

  .place-card:has(> .detail-grid--chat-left, > .detail-grid--chat-right) > .place-card__head {
    flex: none;
  }

  /* A holon's or a person's own page has no head row: its header is the
     band's (place-header.css, METIS-pub#826), so the card opens on its page. */
  .place-card:not(:has(> .place-card__head)) {
    padding-top: var(--space-4);
  }

  .place-card__head {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin: 0 calc(-1 * var(--space-4)) var(--space-4);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border);
    background: color-mix(in oklab, var(--color-accent) 3%, var(--color-surface));
  }

  /* #786: nothing on these pages below --text-md, so the where-line is the
     body size, set apart by case and spacing rather than by shrinking. */
  .place-card__where {
    flex: 1;
    min-width: 0;
    margin: 0;
    font-size: var(--text-md);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .place-card__head .btn[aria-current="page"] {
    color: var(--color-text-strong);
    text-decoration: underline;
    text-underline-offset: var(--space-1);
  }

  .place-overview {
    padding: var(--space-4) var(--space-6) 0;
  }

  @media (max-width: 768px) {
    /* On a phone .main is the one scroller (detail.css, 48rem): the card
       is a plain block again and the page scrolls as a whole. */
    .place-card,
    .place-card:has(> .detail-grid--chat-left, > .detail-grid--chat-right) {
      display: block;
      margin: var(--space-3) 0;
      border-radius: 0;
      border-left: 0;
      border-right: 0;
    }

    .place-overview {
      padding: var(--space-3) var(--space-3) 0;
    }
  }
}
