/* MAR-3127 (RFC-023) — the records family: the seafarer identity card,
   the vessel flag mark (MAR-3135) and certificates grouped by category (partner/_components.html,
   `seafarer_identity_card` + `grouped_certificates`). Design:
   docs/design/partner-portal/rfc-023/SeafarerIdentity.dc.html.

   SHARED because every per-person and per-vessel page uses the pattern
   (Port seafarer + vessel, crew member, vessel detail); its own sheet per the
   portal.css convention. It shares no class with any other sheet, so its
   position in the layer is free (the MAR-1782 / MAR-2675 precedent).

   Tokens only — the design's paper colours map onto --mp-beige* / --mp-rule*,
   and the guilloche tints are color-mix() of --mp-navy / --mp-bronze rather
   than literal rgba(). */

/* ── identity card ─────────────────────────────────────────────────────── */
.pp-idcard {
  position: relative;
  max-width: 1000px;
  overflow: hidden;
  border: 1px solid var(--mp-card-border);
  border-radius: var(--r-lg);
  background-color: var(--mp-beige-3);
  background-image:
    repeating-radial-gradient(circle at 78% 40%, color-mix(in srgb, var(--mp-navy) 4%, transparent) 0 1px, transparent 1px 9px),
    repeating-linear-gradient(115deg, color-mix(in srgb, var(--mp-bronze) 5%, transparent) 0 1px, transparent 1px 14px);
  margin-bottom: 20px;
}
.pp-idcard__band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 28px;
  background: var(--mp-navy);
  color: var(--mp-cream);
  text-transform: uppercase;
}
.pp-idcard__brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: .18em;
}
.pp-idcard__anchor { color: var(--mp-gold-soft); flex: none; }
.pp-idcard__rec {
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: var(--ls-label);
  color: var(--mp-gold-soft);
}
.pp-idcard__body {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 32px;
  padding: 28px 28px 24px;
}
.pp-idcard__photo { flex: none; }
.pp-idcard__body--nophoto { grid-template-columns: minmax(0, 1fr); }
.pp-idcard__img,
.pp-idcard__nophoto {
  display: block;
  width: 190px;
  height: 244px;
  border: 1px solid var(--mp-card-border);
  border-radius: 6px;
  object-fit: cover;
}
.pp-idcard__nophoto {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--mp-beige-2);
  color: var(--ink-2);
  font-size: var(--text-xs);
  font-weight: 500;
}
.pp-idcard__fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 28px;
  row-gap: 18px;
  align-content: start;
  margin: 0;
}
.pp-idcard__f { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pp-idcard__f--name { grid-column: 1 / -1; }
.pp-idcard__l {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--ink-2);
}
.pp-idcard__v {
  margin: 0;
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.pp-idcard__f--name .pp-idcard__v {
  font-size: var(--text-xl);
  font-weight: 500;
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  color: var(--mp-navy);
}
.pp-idcard__f--name:first-child .pp-idcard__v { font-size: 26px; font-weight: 600; }

/* ── certificate groups ────────────────────────────────────────────────── */
.pp-cg { display: flex; flex-direction: column; gap: 12px; }
.pp-cg__summary { margin: 0; font-size: 14px; color: var(--ink-2); text-align: right; }
/* No overflow clip on the group (MAR-3143): it clipped the row ⋯ menu of a
   short group table. The rounded frame is kept by the radii on the header
   and the body's table instead. */
.pp-cg__group {
  border: 1px solid var(--mp-rule);
  border-radius: var(--r-md);
  background: var(--bg-surface);
}
.pp-cg__hd {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 16px 22px;
  border-radius: calc(var(--r-md) - 1px);
  background: var(--mp-beige-3);
  cursor: pointer;
  list-style: none;
}
.pp-cg__group[open] > .pp-cg__hd {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.pp-cg__hd::-webkit-details-marker { display: none; }
.pp-cg__chev { color: var(--mp-navy); flex: none; transition: transform .15s; }
.pp-cg__group[open] > .pp-cg__hd .pp-cg__chev { transform: rotate(90deg); }
.pp-cg__name { font-size: var(--text-md); font-weight: 600; color: var(--mp-navy); }
.pp-cg__count { font-size: var(--text-sm); color: var(--ink-2); }
.pp-cg__end { display: inline-flex; align-items: center; gap: 14px; margin-left: auto; }
.pp-cg__date {
  min-width: 190px;
  font-size: var(--text-sm);
  color: var(--ink-2);
  text-align: right;
  white-space: nowrap;
}
.pp-cg__bd > div {
  margin: 0;
  border: 0;
  border-radius: 0;
  border-bottom-left-radius: calc(var(--r-md) - 1px);
  border-bottom-right-radius: calc(var(--r-md) - 1px);
}
.pp-cg__pillslot { display: inline-flex; justify-content: flex-end; min-width: 9.5rem; }
/* MAR-3328: every group's table shares one fixed geometry, declared by the
   caller's <colgroup>, so the columns line up across groups. The first column
   (the certificate name, or the number on the medical page) is a bare <col>
   with no width: it takes the remainder and wraps. On desktop no cell is
   forced onto one line (the widths are sized for dates and pills, and
   `.pp-pill` is nowrap itself); below 700px the fluid layout and the old
   nowrap return inside the scrolling `.pp-tw`. */
.pp-cg__t { table-layout: fixed; }
/* Widths = content + the 2×18px `.pp-t td` padding: a bold ISO date ~75px,
   the widest status pill ("Expiring Soon") ~107px. Kept tight so the
   five-column vessel page, beside its aside, still leaves the name column
   ~180px. A fixed column never widens for its content — overflow draws over
   the next column — so on desktop a pill or a header (both nowrap by default)
   wraps inside its cell instead: the PSSR pre-2026 marker (RUL-STCW-031) and
   the Spanish headers are far wider than any sane column. */
.pp-cg__col--date { width: 7rem; }
.pp-cg__col--status { width: 9rem; }
.pp-cg__col--doc { width: 6.5rem; }
.pp-cg__col--actions { width: 3.5rem; }
.pp-cg__col--standard { width: 8.5rem; }
.pp-cg__col--flag { width: 9rem; }
.pp-cg__col--filedby { width: 8rem; }
.pp-cg__t td:first-child { overflow-wrap: break-word; }
/* every pill in these tables is a direct child span of its cell */
.pp-cg__t th, .pp-cg__t td > span { white-space: normal; }

@media (max-width: 700px) {
  .pp-idcard__body { grid-template-columns: minmax(0, 1fr); }
  .pp-idcard__fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pp-cg__date { min-width: 0; }
  .pp-cg__pillslot { min-width: 0; justify-content: flex-start; }
  .pp-cg__t { table-layout: auto; }
  .pp-cg__bd td:nth-child(n+2) > span { white-space: nowrap; }
  .pp-cg__bd td:nth-child(n+2) { white-space: nowrap; }
}


/* ── flag mark (MAR-3135, RFC-023 PortBoardFlag.dc.html) — the flag a vessel
      sails under, on the Port board card, the port-calls list and the vessel
      header. A round code/country badge, with the flag state's logo laid over
      it when there is one: a logo that fails to load leaves the code showing.
      Records family (MAR-3135): every per-vessel Port page draws it. `.pp-top__title`
      is page_header's optional `lead` row — the vessel title with its flag.
      Tokens only. ── */
.pp-flag { display:inline-flex; flex-direction:column; align-items:center; gap:4px;
  flex:none; vertical-align:middle; }
.pp-flag__disc { position:relative; display:grid; place-items:center; overflow:hidden;
  width:52px; height:52px; border-radius:var(--r-pill); border:1px solid var(--rule);
  background:var(--tint-hover); color:var(--mp-navy); }
.pp-flag__code { font-weight:700; letter-spacing:0.04em; }
.pp-flag__logo { position:absolute; inset:0; width:100%; height:100%;
  object-fit:contain; background:var(--bg-surface); }
.pp-flag__name { font-size:11px; line-height:1.2; color:var(--ink-2);
  max-width:84px; text-align:center; overflow-wrap:anywhere; }
.pp-flag--card .pp-flag__code { font-size:15px; }
.pp-flag--logo .pp-flag__disc { width:56px; height:56px; border:0;
  background:transparent; }
.pp-flag--header .pp-flag__disc { width:40px; height:40px; }
.pp-flag--header .pp-flag__code { font-size:12px; }
.pp-flag--compact { flex-direction:row; gap:6px; }
.pp-flag--compact .pp-flag__disc { width:28px; height:28px; }
.pp-flag--compact .pp-flag__code { font-size:10px; letter-spacing:0.02em; }
.pp-flag--compact .pp-flag__name { text-align:left; }
.pp-top__title { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }

/* ── MAR-3153 (RFC-023): the flag certificate detail ─────────────────────
   docs/design/partner-portal/rfc-023/CertificateDetail.dc.html. The two
   columns are `.pp-split` (portal.primitives.css); this sheet adds only the
   Certificate block's labelled-field grid, the STCW tables' muted code, and
   the Sealed document card's thumbnail + definition list. Tokens only. */
.pp-fieldgrid { display:grid; grid-template-columns:repeat(4, minmax(0, 1fr));
  gap:12px 18px; margin:0; }
.pp-fieldgrid__f { min-width:0; }
.pp-fieldgrid__f--wide { grid-column:1 / -1; }
.pp-fieldgrid dt { font-size:11.5px; color:var(--ink-2); margin:0 0 2px; }
.pp-fieldgrid dd { margin:0; color:var(--mp-navy); overflow-wrap:anywhere; }
@media (max-width:820px) { .pp-fieldgrid { grid-template-columns:repeat(2, minmax(0, 1fr)); } }
.pp-stcw { margin:0 0 12px; }
.pp-stcw__code { color:var(--ink-2); font-size:11.5px; margin-left:6px; }
.pp-sealed__thumb { display:block; max-width:220px; margin:0 auto 12px; text-decoration:none; color:inherit; }
.pp-sealed__thumbname { margin:0 0 4px; font-weight:600; color:var(--mp-navy); }
.pp-sealed__thumbdoc { margin:0; font-size:11px; color:var(--ink-2); }
.pp-sealed__dl { display:grid; grid-template-columns:auto 1fr; gap:6px 12px; margin:0 0 12px; }
.pp-sealed__dl dt { color:var(--ink-2); }
.pp-sealed__dl dd { margin:0; overflow-wrap:anywhere; }

/* ── MAR-3331 (RFC-023): the Port Inspections list ───────────────────────
   Scoped to `.pp-t--insp` so no other `.pp-t` table changes. Fixed layout
   over the template's nine-column colgroup, so widths stop drifting with
   content; the 900px floor (the prototype says 960, tuned from the render
   so the table fits a 1280px viewport beside the sidebar) means a narrow
   viewport scrolls inside `.pp-tw` instead of crushing columns. The vessel name and
   its IMO line are one line each, ellipsed. Tokens only. */
.pp-t--insp { table-layout:fixed; min-width:900px; }
.pp-insp-col--vessel { width:17%; }
.pp-insp-col--flag { width:15%; }
.pp-insp-col--from { width:10%; }
.pp-insp-col--port { width:11%; }
.pp-insp-col--arrival { width:10%; }
.pp-insp-col--stage { width:8%; }
.pp-insp-col--crew { width:7%; }
.pp-insp-col--certs { width:13%; }
.pp-insp-col--actions { width:9%; }
.pp-insp__name { display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.pp-insp__imo { display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.pp-insp__nowrap { white-space:nowrap; }
.pp-t--insp th, .pp-t--insp td { padding-left:12px; padding-right:12px; }
.pp-t--insp th { overflow:hidden; text-overflow:ellipsis; }
.pp-t--insp .pp-flag--compact { max-width:100%; min-width:0; }
.pp-t--insp .pp-flag--compact .pp-flag__name { max-width:none; min-width:0;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; overflow-wrap:normal; }
