/* F1 team principals (racing-principals.js): names as links, the card on hover, the principal's page */

a.rpp-a { color: inherit; text-decoration: none; }
a.rpp-a:hover { text-decoration: underline; text-underline-offset: 3px; }
a.rpp-a:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; border-radius: 2px; }

/* The portrait, or the initials on a plain square where there is none (as the drivers') */
.rpp-pic, .rpp-ph {
  display: block;
  flex: none;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}
.rpp-pic img { display: block; width: 100%; height: 100%; object-fit: cover; }
.rpp-ph {
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 600;
  color: var(--muted);
  user-select: none;
}

.rppk .sp-flag, .rpp-hc .sp-flag {
  display: inline-block;
  height: .85em;
  aspect-ratio: 4 / 3;
  margin-right: .4em;
  vertical-align: -.06em;
  outline: 1px solid var(--line);
}

/* ─── The card ─────────────────────────────────────────── */

.rppk {
  position: fixed;
  z-index: 61;
  top: 0;
  left: 0;
  width: 312px;
  max-width: calc(100vw - 16px);
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 400;
  text-align: left;
  white-space: normal;
  cursor: pointer;
}
.rppk-top { display: flex; align-items: center; gap: 12px; }
.rppk-pic { width: 60px; height: 60px; font-size: 22px; }
.rppk-id { min-width: 0; }
.rppk-n { margin: 0; font: 600 20px/1.15 var(--display); }
.rppk-c { margin: 3px 0 0; color: var(--muted); }
.rppk-r { margin: 10px 0 0; line-height: 1.35; font-weight: 600; }
.rppk-r span { color: var(--muted); font-weight: 400; }
.rppk-st { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(max-content, 1fr); gap: 8px; margin: 10px 0 0; }
.rppk-st dt, .rpp-st dt {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.rppk-st dd { margin: 1px 0 0; font: 600 21px/1.1 var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* The spells in charge, newest first: the team, which may wrap, and its years, never cut */
.rppk-e {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 2px 12px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  line-height: 18px;
  color: var(--muted);
}
.rppk-e li { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; align-items: baseline; }
.rppk-tn { min-width: 0; color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }
.rppk-ty { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ─── The principal's page ─────────────────────────────── */

.rpp-nav { margin: 0 2px -8px; font-size: 14px; }
.rpp-nav a { color: var(--muted); text-decoration: none; font-weight: 600; }
.rpp-nav a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.rpp-nav a:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 2px; }

.rpp-head { display: flex; align-items: flex-start; gap: 20px; padding: 18px; }
.rpp-hpic { width: 132px; height: 132px; font-size: 44px; }
.rpp-hid { min-width: 0; flex: 1 1 auto; }
.rpp-hn { margin: 0; font: 600 32px/1.1 var(--display); }
.rpp-hc, .rpp-role { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.rpp-role { color: var(--ink); }
.rpp-rn { font-weight: 600; }
.rpp-role a { color: var(--ink); font-weight: 600; text-decoration: none; }
.rpp-role a:hover { text-decoration: underline; text-underline-offset: 3px; }
.rpp-role a:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; border-radius: 2px; }
.rpp-yrs { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rpp-lead { max-width: 62ch; margin: 10px 0 0; font-size: 14px; line-height: 1.45; color: var(--muted); }
.rpp-st { display: flex; flex-wrap: wrap; gap: 6px 28px; margin: 14px 0 0; }
.rpp-st dd { margin: 0; font: 600 30px/1.05 var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* The team's logo at the right, linked to its page, on white (racing-teams.css draws it) */
.rpp-tl { flex: none; margin-left: auto; border-radius: 8px; text-decoration: none; }
.rpp-tl:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.rpp-tlb { width: 144px; height: 96px; padding: 14px; }

/* Highlights: a grid of lines; on phones one line runs into its detail */
.rpp-cap {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px 28px;
  margin: 0;
  padding: 16px 18px;
  list-style: none;
}
.rpp-cap li { min-width: 0; }
.rpp-cap b { display: block; font: 600 19px/1.2 var(--display); }
.rpp-cap span { display: block; margin-top: 2px; font-size: 13px; line-height: 1.35; color: var(--muted); }

/* The tables: numbers in columns wide enough for any of them, never cut */
.rpp-t td { vertical-align: baseline; }
.rpp-t .rpp-n { width: 70px; }
.rpp-t .rpp-pd { width: 84px; }
.rpp-t td.rpp-n { color: var(--muted); font-variant-numeric: tabular-nums; }
.rpp-t td.rpp-hi { color: var(--ink); font-weight: 700; }
.rpp-t a { font-weight: 600; }

/* Each spell: the team's logo or mark, its name, the role and who came before and after under it */
.rpp-stints td { vertical-align: middle; }
.rpp-stints td.rpp-tc { white-space: normal; }
.rpp-stints td.rpp-n { font-size: 15px; }
.rpp-tw { display: flex; align-items: center; gap: 12px; min-width: 0; }
.rpp-tlogo { width: 54px; height: 36px; padding: 4px; border-radius: 6px; font-size: 13px; }
.rpp-tx { display: flex; flex-direction: column; min-width: 0; }
.rpp-tx .rpp-tm { align-self: flex-start; }
.rpp-ro { font-size: 13px; color: var(--muted); }
.rpp-sy { display: none; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rpp-kin { display: flex; flex-wrap: wrap; gap: 0 12px; font-size: 12.5px; color: var(--muted); }
.rpp-kin a { color: var(--ink); font-weight: 500; }
.rpp-stints .rpp-yl { width: 150px; }
.rpp-stints td.rpp-yl { white-space: normal; font-variant-numeric: tabular-nums; }

/* Other roles: the years in a column of their own, never cut, the role beside them */
.rpp-other {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 22px;
  margin: 0;
  padding: 14px 18px;
  list-style: none;
  font-size: 14px;
  line-height: 1.4;
}
.rpp-other li { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; align-items: baseline; }
.rpp-oy { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rpp-or { min-width: 0; }
.rpp-or a { color: var(--ink); font-weight: 600; text-decoration: none; }
.rpp-or a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Season by season */
.rpp-ss .rpp-yr { width: 164px; }
.rpp-ss td.rpp-yr { white-space: nowrap; }
.rpp-ss .rpp-pos { width: 60px; }
.rpp-ss td.rpp-pos { font-weight: 600; }
.rpp-ss td.rpp-champ { color: var(--win); font-weight: 700; }
.rpp-ss td.rpp-tms { white-space: normal; }
.rpp-note { margin-left: 8px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rpp-dc { margin-left: 10px; font-size: 13px; color: var(--muted); }
.rpp-dc a { font-weight: 500; }

.rpp-src { margin: -8px 2px 0; font-size: 12.5px; color: var(--muted); }
.rpp-src a { color: inherit; }

@media (max-width: 600px) {
  /* Phones: the portrait beside the name, the rest under both */
  .rpp-head { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 0 14px; align-items: center; padding: 14px; }
  .rpp-hpic { grid-row: 1 / span 2; width: 88px; height: 88px; font-size: 30px; }
  .rpp-hid { display: contents; }
  .rpp-hn { grid-column: 2; align-self: end; font-size: 25px; }
  .rpp-hc { grid-column: 2; align-self: start; font-size: 13px; gap: 2px 12px; }
  .rpp-role { grid-column: 1 / -1; margin-top: 12px; font-size: 13px; gap: 2px 12px; }
  .rpp-lead { grid-column: 1 / -1; font-size: 13px; }
  .rpp-st { grid-column: 1 / -1; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; margin-top: 12px; }
  .rpp-st dd { font-size: 22px; }
  .rpp-st dt { font-size: 9.5px; letter-spacing: .05em; }
  /* The team's logo, small, at the right of the name */
  .rpp-head.rpp-hl { grid-template-columns: 88px minmax(0, 1fr) auto; }
  .rpp-hl .rpp-hn, .rpp-hl .rpp-hc { grid-column: 2; }
  .rpp-tl { grid-column: 3; grid-row: 1 / span 2; align-self: start; margin: 0; }
  .rpp-tl, .rpp-tl .rpp-tlb { border-radius: 6px; }
  .rpp-tlb { width: 60px; height: 40px; padding: 5px; }
  .rpp-cap { grid-template-columns: 1fr; gap: 9px; padding: 12px 14px; }
  .rpp-cap b { display: inline; font-size: 17px; }
  .rpp-cap span { display: inline; margin: 0 0 0 4px; }
  /* Phones: podiums and poles go; a spell's years under its team */
  .rpp-t .rpp-n { width: 50px; }
  .rpp-t .rpp-pd, .rpp-t .rpp-po { width: 0; padding: 0; font-size: 0; }
  .rpp-stints .rpp-yl { width: 0; padding: 0; font-size: 0; }
  .rpp-sy { display: block; }
  .rpp-tw { gap: 10px; }
  .rpp-tlogo { width: 42px; height: 28px; padding: 3px; font-size: 11px; }
  .rpp-ss .rpp-yr { width: 92px; }
  .rpp-ss .rpp-pos { width: 44px; }
  .rpp-note { display: block; margin: 1px 0 0; font-size: 11.5px; }
  .rpp-dc { display: block; margin: 1px 0 0; font-size: 12px; }
  .rpp-other { grid-template-columns: 1fr; gap: 10px; padding: 12px 14px; font-size: 13px; }
  .rpp-other li { display: block; }
  .rpp-oy { display: block; font-size: 12px; }
}
