/*
  The Racing Portal design system ("D1": pit lane on black).
  Shared by public pages; loaded via partials/trp_head.html.
  Everything is prefixed `trp-` so it can coexist with Tailwind during the migration.
*/

/* ---------- Fonts (local files in /static/fonts) ---------- */
@font-face { font-family: "Orbitron"; src: url("/static/fonts/Orbitron-VariableFont_wght.ttf") format("truetype"); font-weight: 400 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Saira Condensed"; src: url("/static/fonts/SairaCondensed-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Saira Condensed"; src: url("/static/fonts/SairaCondensed-Medium.ttf") format("truetype"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Saira Condensed"; src: url("/static/fonts/SairaCondensed-SemiBold.ttf") format("truetype"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Saira Condensed"; src: url("/static/fonts/SairaCondensed-Bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Saira Condensed"; src: url("/static/fonts/SairaCondensed-ExtraBold.ttf") format("truetype"); font-weight: 800; font-style: normal; font-display: swap; }
/* Saira Condensed ships no italic; browsers synthesize the slant, which is the intended look. */

/* ---------- Tokens ---------- */
:root {
  --trp-ground: #08090A;     /* page background */
  --trp-surface: #111315;    /* cards, panels */
  --trp-raised: #1C1F22;     /* hover rows, inline tags */
  --trp-control: #22262A;    /* dark buttons */
  --trp-line: rgba(255, 255, 255, .09);
  --trp-line-strong: rgba(255, 255, 255, .14);
  --trp-text: #F2F4F3;
  --trp-text-2: #B9BEC2;     /* body copy on dark */
  --trp-muted: #9EA3A8;      /* labels */
  --trp-faint: #8E949A;      /* captions, mono meta */
  --trp-accent: #2BD982;     /* green flag: the one action color */
  --trp-on-accent: #04110B;  /* text on green (white on green fails contrast) */
  --trp-curb: #E63B2E;
  --trp-purple: #C084FC;     /* "closest / best" timing color */
  --trp-font-body: "Saira Condensed", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --trp-font-logo: "Orbitron", ui-sans-serif, system-ui, sans-serif;
  --trp-font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---------- Base ---------- */
.trp-page { background: var(--trp-ground); color: var(--trp-text); font-family: var(--trp-font-body); }
/* Plain text links only; classed links (buttons, wordmark, menu items) style themselves */
.trp-page a:not([class]) { color: var(--trp-accent); }
.trp-page a:not([class]):hover { color: #7CF0B5; }

/* ---------- Type ---------- */
.trp-display { font-family: var(--trp-font-body); font-weight: 800; font-style: italic; text-transform: uppercase; letter-spacing: -.01em; line-height: .86; }
.trp-heading { font-family: var(--trp-font-body); font-weight: 800; font-style: italic; text-transform: uppercase; letter-spacing: .01em; line-height: 1; }
/* Green block behind a word in italic display type. Only the block is slanted, at the italic's own
   14° (the angle browsers use for synthesized italics, measured in Chrome), so its edges run parallel
   to the letters. Skewing the whole span slanted the already-italic letters a second time. */
.trp-highlight { position: relative; z-index: 0; display: inline-block; padding: 0 .16em; color: var(--trp-on-accent); }
.trp-highlight::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--trp-accent); transform: skewX(-14deg); }
.trp-label { font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--trp-muted); }
.trp-mono { font-family: var(--trp-font-mono); }
.trp-logo-word { font-family: var(--trp-font-logo); }

/* ---------- Shapes & motifs ---------- */
.trp-chamfer { clip-path: polygon(0 0, calc(100% - var(--trp-cut, 22px)) 0, 100% var(--trp-cut, 22px), 100% 100%, var(--trp-cut, 22px) 100%, 0 calc(100% - var(--trp-cut, 22px))); }
.trp-card { background: var(--trp-surface); position: relative; }
/* Card shape for the turn curb: chamfered bottom-left, rounded top-right (the "turn").
   The polygon leaves the top-right corner square so border-radius can round it. */
.trp-chamfer--turn { clip-path: polygon(0 0, 100% 0, 100% 100%, 22px 100%, 0 calc(100% - 22px)); border-top-right-radius: var(--trp-turn-r, 48px); }
/* Turn curb (partials/turn_curb.html): wraps the outside of a card's top-right corner.
   12px band + 6px gap = 18px outside the card. */
.trp-turn-curb { position: absolute; top: -18px; right: -18px; z-index: 2; pointer-events: none; overflow: visible; }
.trp-checker-strip { height: 24px;
  background-image: linear-gradient(45deg, #000 25%, transparent 25%, transparent 75%, #000 75%), linear-gradient(45deg, #000 25%, transparent 25%, transparent 75%, #000 75%);
  background-size: 12px 12px; background-position: 0 0, 6px 6px; background-color: var(--trp-text); }

/* Liveries use .trp-btn.trp-btn--x (two classes) so Tailwind preflight, injected after this file, can't reset their background. */
/* ---------- Buttons: one shape (cut corners), four liveries, checkered-flag tail that runs further on hover ---------- */
.trp-btn {
  --cut: 10px; --chk: var(--trp-on-accent); --chk-o: .3; --sq: 14px;
  position: relative; isolation: isolate; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border: 0; cursor: pointer; text-decoration: none; white-space: nowrap;
  font-family: var(--trp-font-body); font-weight: 800; font-style: italic; text-transform: uppercase; letter-spacing: .06em; line-height: 1;
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
  transition: transform .15s, filter .15s, background-color .15s, color .15s;
}
.trp-btn::before {
  content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 46%; z-index: -1; opacity: var(--chk-o);
  background-image: linear-gradient(45deg, var(--chk) 25%, transparent 25%, transparent 75%, var(--chk) 75%), linear-gradient(45deg, var(--chk) 25%, transparent 25%, transparent 75%, var(--chk) 75%);
  background-size: var(--sq) var(--sq); background-position: 0 0, calc(var(--sq) / 2) calc(var(--sq) / 2);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 85%); mask-image: linear-gradient(90deg, transparent, #000 85%);
  transition: width .35s ease, opacity .35s ease;
}
.trp-btn:hover::before { width: 78%; opacity: calc(var(--chk-o) + .12); }
.trp-btn:active { transform: translateY(1px); }
/* clip-path clips outlines, so focus is an inset ring */
.trp-btn:focus-visible { outline: none; box-shadow: inset 0 0 0 3px var(--chk); }
.trp-btn[disabled], .trp-btn[aria-disabled="true"] { opacity: .4; cursor: not-allowed; }
.trp-btn .trp-arrow { transition: transform .2s ease; }
.trp-btn:hover .trp-arrow { transform: translateX(5px); }

.trp-btn.trp-btn--go, .trp-btn.trp-btn--go:hover { background-color: var(--trp-accent); color: var(--trp-on-accent); --chk: var(--trp-on-accent); }
.trp-btn.trp-btn--go:hover { filter: brightness(1.06); }
.trp-btn.trp-btn--light, .trp-btn.trp-btn--light:hover { background-color: var(--trp-text); color: #0A0B0C; --chk: #0A0B0C; --chk-o: .14; }
.trp-btn.trp-btn--dark, .trp-btn.trp-btn--dark:hover { background-color: var(--trp-control); color: var(--trp-text); --chk: var(--trp-text); --chk-o: .1; }
.trp-btn.trp-btn--dark:hover { background-color: #2B3034; }
.trp-btn.trp-btn--ghost, .trp-btn.trp-btn--ghost:hover { background-color: transparent; color: var(--trp-text-2); --chk: var(--trp-text); --chk-o: 0; }
.trp-btn.trp-btn--ghost:hover { background-color: var(--trp-raised); color: var(--trp-text); --chk-o: .06; }

/* Secondary on light backgrounds (admin): white with a hairline edge */
.trp-btn.trp-btn--outline, .trp-btn.trp-btn--outline:hover { background-color: #fff; color: #1C1F22; --chk: #1C1F22; --chk-o: .08; box-shadow: inset 0 0 0 1px #8A9096; }
.trp-btn.trp-btn--outline:hover { background-color: #F1F2F0; }
.trp-btn.trp-btn--outline:focus-visible { box-shadow: inset 0 0 0 3px #1C1F22; }

.trp-btn--lg { height: 64px; padding: 0 34px; font-size: 26px; --cut: 14px; --sq: 16px; }
.trp-btn--md { height: 52px; padding: 0 24px; font-size: 19px; --sq: 13px; }
.trp-btn--sm { height: 42px; padding: 0 16px; font-size: 16px; --cut: 7px; --sq: 10px; }
.trp-btn--xs { height: 34px; padding: 0 10px; font-size: 14px; --cut: 6px; --sq: 8px; }
.trp-btn--block { display: flex; width: 100%; }

/* Segmented control: selected = light, others = ghost. No underlines. */
.trp-seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; padding: 4px; background: var(--trp-ground);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px); }
/* Use --raised when the control sits directly on the page background instead of inside a card */
.trp-seg--raised { background: var(--trp-surface); }
/* Small tag inside a segment button, e.g. "Archive" on past seasons */
.trp-seg-note { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; opacity: .7; margin-left: 6px; }
.trp-season-note { margin: 0; font-size: 15px; color: var(--trp-text-2); }

/* ---------- Forms ---------- */
/* Field edges at 36% white meet the 3:1 non-text contrast minimum against both the page and cards */
.trp-field { font: inherit; font-size: 17px; color: var(--trp-text); background: var(--trp-ground); border: 1px solid rgba(255, 255, 255, .36); border-radius: 10px;
  padding: 12px 14px; height: 50px; box-sizing: border-box; width: 100%; }
.trp-field::placeholder { color: #80868C; }
/* Dropdowns draw their own arrow, 16px in from the right edge; the browser's arrow ignores padding
   and sat against the edge (and the year box in the date pickers). */
select.trp-field { -webkit-appearance: none; appearance: none; padding-right: 44px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23B9BEC2' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center; background-size: 14px; }
.trp-field:focus { outline: none; border-color: var(--trp-accent); box-shadow: 0 0 0 3px rgba(43, 217, 130, .25); }
.trp-check { width: 20px; height: 20px; accent-color: var(--trp-accent); }
/* Select + fixed suffix (e.g. the year) */
.trp-field-group { display: flex; }
.trp-field-group .trp-field { border-top-right-radius: 0; border-bottom-right-radius: 0; flex: 1; min-width: 0; text-transform: none; letter-spacing: 0; font-weight: 400; }
.trp-field-addon { display: inline-flex; align-items: center; padding: 0 14px; border: 1px solid rgba(255, 255, 255, .36); border-left: 0; border-radius: 0 10px 10px 0;
  background: var(--trp-raised); color: var(--trp-muted); font-size: 16px; font-weight: 600; letter-spacing: 0; }
.trp-label .trp-field { text-transform: none; letter-spacing: 0; font-weight: 400; }
/* Typeahead results */
.trp-listbox { max-height: 12rem; overflow: auto; background: var(--trp-ground); border: 1px solid rgba(255, 255, 255, .36); border-radius: 10px; font-size: 17px; }
.trp-listbox button { display: block; width: 100%; text-align: left; padding: 10px 14px; background: none; border: 0; border-bottom: 1px solid var(--trp-line); color: var(--trp-text); font: inherit; cursor: pointer; }
.trp-listbox button:last-child { border-bottom: 0; }
.trp-listbox button:hover, .trp-listbox button:focus-visible { background: var(--trp-raised); outline: none; }
.trp-listbox button[data-disabled="1"] { opacity: .4; cursor: not-allowed; }
.trp-icon-btn { display: inline-grid; place-items: center; width: 28px; height: 28px; margin: -6px 0; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--trp-muted); cursor: help; }
.trp-icon-btn:hover, .trp-icon-btn:focus-visible { color: var(--trp-text); background: var(--trp-raised); outline: none; }

/* ---------- Layout helpers ---------- */
.trp-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.trp-stack { display: flex; flex-direction: column; gap: var(--trp-gap, 8px); }
/* Scripts toggle a `hidden` class on these; make it win over their display (scoped so it can't break Tailwind's responsive `hidden sm:inline`) */
.trp-grid-2.hidden, .trp-stack.hidden, .trp-listbox.hidden { display: none; }

/* ---------- Tooltip (portal; created by page scripts) ---------- */
.trp-tooltip { position: fixed; z-index: 6000; max-width: 90vw; padding: 12px 14px; font-size: 15px; line-height: 1.35; pointer-events: none;
  background: var(--trp-surface); color: var(--trp-text); border: 1px solid var(--trp-line-strong); box-shadow: 0 20px 40px rgba(0, 0, 0, .5); }

/* ---------- Scrollbars ----------
   Dark, thin, square scrollbars to match the theme instead of the light system ones.
   scrollbar-color covers Firefox and Chrome 121+; ::-webkit-scrollbar covers Safari. */
:root:has(body.trp-page), .trp-page, .trp-page * { scrollbar-width: thin; scrollbar-color: #3A3F44 transparent; }
.trp-page ::-webkit-scrollbar, :root:has(body.trp-page)::-webkit-scrollbar { width: 10px; height: 10px; }
.trp-page ::-webkit-scrollbar-track, :root:has(body.trp-page)::-webkit-scrollbar-track { background: transparent; }
.trp-page ::-webkit-scrollbar-thumb, :root:has(body.trp-page)::-webkit-scrollbar-thumb { background: #3A3F44; border: 2px solid transparent; background-clip: padding-box; }
.trp-page ::-webkit-scrollbar-thumb:hover, :root:has(body.trp-page)::-webkit-scrollbar-thumb:hover { background-color: #565C62; }
.trp-page ::-webkit-scrollbar-corner { background: transparent; }

/* ---------- Data bits ---------- */
.trp-badge { display: inline-block; font-size: 13px; font-weight: 800; font-style: italic; letter-spacing: .08em; text-transform: uppercase; padding: 4px 9px;
  clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px); background: rgba(255, 255, 255, .08); color: var(--trp-text-2); }
.trp-badge--hpde { background: rgba(43, 217, 130, .16); color: #A7F3D0; }
.trp-badge--sprint { background: rgba(250, 204, 21, .16); color: #FDE68A; }
.trp-badge--endurance { background: rgba(56, 189, 248, .16); color: #BAE6FD; }
.trp-badge--vintage { background: rgba(251, 146, 60, .16); color: #FED7AA; }
.trp-badge--time-trial { background: rgba(244, 114, 182, .16); color: #FBCFE8; }
.trp-badge--school { background: rgba(168, 85, 247, .18); color: #D8B4FE; }
/* Admin-set family color: --c is the type's shade (see app/type_colors.py). */
.trp-badge--c { background: color-mix(in srgb, var(--c) 24%, transparent); color: color-mix(in srgb, var(--c) 45%, #fff); box-shadow: inset 3px 0 0 var(--c); }
.trp-type-dot { display: inline-block; width: 9px; height: 9px; margin-right: 7px; border-radius: 50%; vertical-align: 1px; flex: none; }
/* Family icons (Font Awesome), so types can be told apart without relying on color. */
.trp-badge__icon { margin-right: 6px; font-style: normal; font-size: .9em; }
.trp-type-icon { margin-right: 7px; font-style: normal; font-size: 12px; flex: none; }
.trp-ev__icon { margin-right: 4px; font-size: .9em; }
/* Leaflet positions .trp-pin absolutely, so it's already the icon's containing block. */
.trp-pin__icon { position: absolute; left: 14px; top: 13.5px; transform: translate(-50%, -50%); font-size: 11px; line-height: 1; pointer-events: none; }
.trp-code { font-family: var(--trp-font-mono); font-size: 12px; color: var(--trp-muted); background: var(--trp-raised); padding: 2px 6px; }
.trp-time { font-family: var(--trp-font-mono); font-weight: 600; color: var(--trp-text-2); }
.trp-time--best { color: var(--trp-purple); }
.trp-time--near { color: var(--trp-accent); }

/* Numbered "number board" roundel used for the 1-2-3 steps */
.trp-roundel { width: 38px; height: 38px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  background: var(--trp-text); color: #0A0B0C; font-family: var(--trp-font-logo); font-weight: 900; font-size: 18px; font-style: normal; }

/* "Green flag" status pill */
.trp-pill { display: inline-flex; align-items: center; gap: 10px; padding: 7px 14px 7px 10px; border-radius: 999px; border: 1px solid rgba(43, 217, 130, .4);
  background: rgba(8, 9, 10, .7); font-size: 14px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: #BDF5D8; }
.trp-pill::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--trp-accent); box-shadow: 0 0 0 4px rgba(43, 217, 130, .2); }


/* ---------- Event lists (search results, My Schedule) ---------- */
/* Light "pit board" heading strip over dark rows, so each weekend stands out from the black page */
.trp-weekend { margin-bottom: 18px; --trp-cut: 18px; background: #15181B; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }
.trp-weekend__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 16px 20px 14px; background: var(--trp-text); color: var(--trp-ground); }
.trp-weekend__kicker { font-family: var(--trp-font-mono); font-size: 12px; letter-spacing: .08em; color: #4A5056; }
.trp-weekend__title { margin: 0; font-size: 32px; }
.trp-weekend__rule { flex: 1 1 40px; min-width: 40px; height: 10px; opacity: .3;
  background-image: linear-gradient(45deg, #000 25%, transparent 25%, transparent 75%, #000 75%), linear-gradient(45deg, #000 25%, transparent 25%, transparent 75%, #000 75%);
  background-size: 10px 10px; background-position: 0 0, 5px 5px; background-color: var(--trp-ground);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 30%, #000 70%, transparent); mask-image: linear-gradient(90deg, transparent, #000 30%, #000 70%, transparent); }
.trp-weekend__count { font-family: var(--trp-font-mono); font-size: 13px; font-weight: 700; color: #0B6B3D; }
.trp-cols { display: flex; gap: 16px; padding: 6px 20px; font-size: 12px; font-weight: 700; letter-spacing: .14em; color: #80868C; }
.trp-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 12px 20px; border-top: 1px solid rgba(255, 255, 255, .08); transition: background-color .12s; }
.trp-row:hover { background-color: #1E2226; }
.trp-col-day { flex: 0 0 64px; font-family: var(--trp-font-mono); font-size: 14px; color: var(--trp-faint); }
.trp-col-track { flex: 2 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.trp-col-track__name { font-size: 20px; font-weight: 700; line-height: 1.15; }
.trp-col-track__name .trp-code { margin-left: 6px; vertical-align: 2px; }
.trp-col-sub { font-size: 15px; color: var(--trp-faint); }
.trp-col-series { flex: 1 1 170px; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 17px; }
.trp-col-type { flex: 0 0 130px; display: flex; flex-wrap: wrap; gap: 4px; }
.trp-col-drive { flex: 0 0 96px; text-align: right; font-size: 16px; }
/* Joint events: one Register button per organization, stacked */
.trp-col-drive--joint { flex: 0 0 auto; min-width: 96px; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.trp-col-save { flex: 0 0 36px; display: flex; justify-content: flex-end; }
.trp-row__extra { flex: 1 0 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding-left: 80px; font-size: 15px; color: var(--trp-text-2); }
@media (max-width: 767px) {
  .trp-cols { display: none; }
  .trp-col-day { flex-basis: 100%; }
  .trp-col-drive { flex: 0 0 auto; text-align: left; }
  .trp-col-drive--joint { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .trp-col-type { flex: 0 0 auto; }
  .trp-col-save { margin-left: auto; }
  .trp-row__extra { padding-left: 0; }
}
.trp-save-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; background: none; cursor: pointer; font-size: 18px; color: #80868C; }
.trp-save-btn:hover, .trp-save-btn:focus-visible { color: var(--trp-text); background: var(--trp-raised); outline: none; }
.trp-save-btn[aria-pressed="true"] { color: var(--trp-accent); }
.trp-link-btn { padding: 0; border: 0; background: none; cursor: pointer; font: inherit; font-weight: 700; color: var(--trp-accent); }
.trp-link-btn:hover { text-decoration: underline; }
.trp-notice { padding: 14px 18px; background: rgba(250, 204, 21, .07); border: 1px solid rgba(250, 204, 21, .28); color: #FDE68A; font-size: 16px; }
.trp-notice strong { display: block; font-weight: 700; }
.trp-empty { height: 100%; min-height: 320px; display: grid; place-items: center; text-align: center; color: var(--trp-muted); font-size: 17px; }
.trp-page .trp-row a:not(.trp-btn) { color: var(--trp-text); text-decoration: none; }
.trp-page .trp-row a:not(.trp-btn):hover { color: var(--trp-accent); text-decoration: underline; }
/* The owner's GPM track rating, linking to his write-up (search results, My Schedule) */
/* The owner's track rating: GPM logo, "Track rating", score. Links to his write-up. */
.trp-gpm-rating, .trp-page .trp-row a.trp-gpm-rating { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px 2px 6px; border: 1px solid rgba(43, 217, 130, .38);
  background: rgba(43, 217, 130, .08); color: #BDF5D8; font-style: normal; line-height: 1.4; white-space: nowrap; text-decoration: none; vertical-align: 2px; }
.trp-gpm-rating__logo { display: block; height: 11px; width: auto; }
.trp-gpm-rating__label { font-family: var(--trp-font-body); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.trp-gpm-rating b { font-family: var(--trp-font-mono); font-size: 13px; font-weight: 700; color: var(--trp-accent); }
a.trp-gpm-rating:hover, .trp-page .trp-row a.trp-gpm-rating:hover { border-color: var(--trp-accent); background: rgba(43, 217, 130, .18); text-decoration: none; }
.trp-col-track__name .trp-gpm-rating { margin-left: 6px; }

/* ---------- Waving checkered-flag background (partials/flag_bg.html) ----------
   Every moving part animates `transform` only, so the browser rasterizes the rippled
   cloth once and the compositor moves the layers: no repaints per frame (measured:
   ~120 paints/s when the mask itself was animated, 0 now).
     .trp-flag            clip box
       .trp-flag__window  carries the soft-patch mask; wanders around (transform)
         .trp-flag__counter  moves exactly opposite, so the cloth stays put while the patches drift over it
           .trp-flag__cloth  rippled checker (SVG filter), slow drift
           .trp-flag__folds  rolling shadow folds, slides sideways */
.trp-flag { position: absolute; inset: 0 0 auto 0; pointer-events: none; overflow: hidden; z-index: 0; }
.trp-flag__window { position: absolute; inset: -12%; will-change: transform;
  -webkit-mask-image: radial-gradient(closest-side, #000 0%, rgba(0,0,0,.55) 50%, transparent 100%), radial-gradient(closest-side, #000 0%, rgba(0,0,0,.45) 55%, transparent 100%), radial-gradient(closest-side, rgba(0,0,0,.8) 0%, transparent 100%);
          mask-image: radial-gradient(closest-side, #000 0%, rgba(0,0,0,.55) 50%, transparent 100%), radial-gradient(closest-side, #000 0%, rgba(0,0,0,.45) 55%, transparent 100%), radial-gradient(closest-side, rgba(0,0,0,.8) 0%, transparent 100%);
  -webkit-mask-size: 980px 640px, 760px 560px, 820px 520px; mask-size: 980px 640px, 760px 560px, 820px 520px;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: 22% 22%, 78% 34%, 50% 70%; mask-position: 22% 22%, 78% 34%, 50% 70%; }
.trp-flag__counter { position: absolute; inset: 0; will-change: transform; }
.trp-flag__cloth { position: absolute; left: -80px; top: -80px; width: calc(100% + 160px); height: calc(100% + 160px); will-change: transform; }
.trp-flag__folds { position: absolute; top: 0; bottom: 0; left: -640px; width: calc(100% + 640px); will-change: transform; background-repeat: repeat-x; background-size: 640px 100%;
  background-image: linear-gradient(100deg, rgba(0,0,0,0) 0%, rgba(255,255,255,.07) 22%, rgba(0,0,0,.55) 48%, rgba(255,255,255,.04) 70%, rgba(0,0,0,0) 100%); }
.trp-flag--animated .trp-flag__window { animation: trp-flag-wander 42s ease-in-out infinite alternate; }
.trp-flag--animated .trp-flag__counter { animation: trp-flag-wander-back 42s ease-in-out infinite alternate; }
.trp-flag--animated .trp-flag__cloth { animation: trp-flag-drift 26s ease-in-out infinite alternate; }
.trp-flag--animated .trp-flag__folds { animation: trp-flag-folds 18s linear infinite; }
@keyframes trp-flag-wander {
  0% { transform: translate(0, 0); } 33% { transform: translate(9%, 7%); } 66% { transform: translate(-7%, 11%); } 100% { transform: translate(5%, -6%); } }
@keyframes trp-flag-wander-back {
  0% { transform: translate(0, 0); } 33% { transform: translate(-9%, -7%); } 66% { transform: translate(7%, -11%); } 100% { transform: translate(-5%, 6%); } }
@keyframes trp-flag-drift { from { transform: translate(0, 0); } to { transform: translate(-56px, 22px); } }
@keyframes trp-flag-folds { from { transform: translateX(0); } to { transform: translateX(640px); } }
/* Home-page variant (partials/flag_wave.html): a WebGL canvas that really waves. The static
   SVG flag above is its fallback and is hidden once the shader is running. */
.trp-wave { position: absolute; inset: 0 0 auto 0; pointer-events: none; overflow: hidden; z-index: 0; }
.trp-wave__gl { position: absolute; top: 0; left: 0; width: 100%; display: none; }
.trp-wave.is-gl .trp-wave__gl { display: block; }
.trp-wave.is-gl .trp-flag { display: none; }
/* Soft green glow behind hero headlines so the green reads on black */
.trp-glow { position: absolute; left: 50%; top: 120px; width: min(900px, 100%); height: 420px; transform: translateX(-50%); pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(43, 217, 130, .16), transparent 65%); }

/* ---------- Site header / user menu (partials/site_header.html) ---------- */
.trp-header { position: relative; z-index: 40; background: rgba(8, 9, 10, .7); border-bottom: 1px solid var(--trp-line); }
.trp-header__inner { max-width: 1240px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.trp-header--wide .trp-header__inner { max-width: none; }
.trp-wordmark { display: inline-flex; flex-direction: column; line-height: 1; color: var(--trp-text); text-decoration: none; }
.trp-wordmark__the { font-family: var(--trp-font-logo); font-size: 9px; letter-spacing: .5em; opacity: .7; }
.trp-wordmark__name { font-family: var(--trp-font-logo); font-size: 19px; font-weight: 800; letter-spacing: .08em; display: inline-block; transform: skewX(-6deg); }
.trp-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.trp-nav__user { margin-left: 8px; }
/* Phones: one row. The wordmark is the home link, the user menu holds My Schedule, initials stand in for the name. */
@media (max-width: 640px) {
  .trp-header__inner { padding: 10px 16px; gap: 8px; flex-wrap: nowrap; }
  .trp-header__by, .trp-nav__home, .trp-nav__my_schedule, .trp-nav__name, .trp-nav__sep { display: none; }
  .trp-wordmark__name { font-size: 15px; white-space: nowrap; }
  #gpmLogo { height: 16px !important; }
  .trp-nav { flex-wrap: nowrap; }
  .trp-nav .trp-btn--sm { height: 36px; padding: 0 10px; font-size: 14px; }
  .trp-nav__user { margin-left: 0; }
}
/* Small phones, signed out: Sign in + Sign up need the room, so drop the Search link (the home page is the search) and the GPM mark */
@media (max-width: 440px) {
  .trp-header--anon .trp-nav__search, .trp-header--anon .trp-header__gpm { display: none !important; }
}
.trp-menu { position: absolute; right: 0; top: calc(100% + 8px); width: 220px; z-index: 50; background: var(--trp-surface); border: 1px solid var(--trp-line); padding: 6px 0;
  box-shadow: 0 20px 40px rgba(0, 0, 0, .5); font-size: 16px; }
.trp-menu__email { padding: 8px 14px; color: var(--trp-faint); font-size: 13px; border-bottom: 1px solid var(--trp-line); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trp-menu__item { display: block; width: 100%; text-align: left; padding: 10px 14px; color: var(--trp-text-2); background: none; border: 0; font: inherit; cursor: pointer; text-decoration: none; }
.trp-menu__item:hover { background: var(--trp-raised); color: var(--trp-text); }
.trp-avatar { width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--trp-accent); color: var(--trp-on-accent);
  font-family: var(--trp-font-logo); font-style: normal; font-weight: 800; font-size: 10px; }

/* ---------- License help (Facebook group callout, partials/license_help.html) ---------- */
.trp-license-help { margin-top: 4px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; background: var(--trp-ground); box-shadow: inset 3px 0 0 var(--trp-accent); }
.trp-license-help__text { margin: 0; font-size: 16px; line-height: 1.35; color: var(--trp-text-2); }
.trp-license-help__text strong { color: var(--trp-text); font-weight: 700; }
.trp-license-help__link { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 700; color: var(--trp-accent); text-decoration: none; }
.trp-license-help__link:hover { color: #7CF0B5; }
.trp-license-help__link:hover .trp-arrow { transform: translateX(4px); }
.trp-license-help__link:focus-visible { outline: 2px solid var(--trp-accent); outline-offset: 3px; }
.trp-license-help__link .trp-arrow { transition: transform .2s ease; }
.trp-license-card { box-shadow: inset 0 3px 0 var(--trp-accent); }
.trp-license-card__kicker { display: inline-flex; align-items: center; gap: 8px; }
.trp-license-card__text { margin: 0; font-size: 18px; line-height: 1.4; color: var(--trp-text-2); }
.trp-fb-icon { flex: none; }

/* ---------- Racer ratings (partials/event_ratings.html) ----------
   Racers' 1–5 stars, in amber so they never read as the green GPM rating of a track. */
:root { --trp-star: #FBBF24; }
.trp-rating { display: inline-flex; align-items: baseline; gap: 5px; width: fit-content; padding: 2px 6px 2px 0; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: 15px; color: var(--trp-text-2); white-space: nowrap; }
.trp-rating .fa-star { font-size: 13px; color: var(--trp-star); }
.trp-rating__avg { font-family: var(--trp-font-mono); font-size: 14px; font-weight: 600; color: var(--trp-text); }
.trp-rating__count { font-size: 14px; color: var(--trp-faint); }
.trp-rating:hover .trp-rating__avg, .trp-rating:focus-visible .trp-rating__avg { text-decoration: underline; }
.trp-rating:focus-visible { outline: 2px solid var(--trp-star); outline-offset: 2px; }
.trp-stars { display: inline-flex; gap: 2px; color: var(--trp-star); font-size: 13px; }
.trp-stars .fa-regular { color: #5B5F63; }
/* Star rating and the racer's own rate control on one line */
.trp-rating-line { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.trp-rate-btn { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border: 1px solid rgba(251, 191, 36, .45); border-radius: 999px; background: none; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 700; line-height: 1.4; color: var(--trp-star); white-space: nowrap; }
.trp-rate-btn .fa-star { font-size: 11px; }
.trp-rate-btn:hover { background: rgba(251, 191, 36, .14); border-color: var(--trp-star); }
.trp-rate-btn:focus-visible { outline: 2px solid var(--trp-star); outline-offset: 2px; }
.trp-rating-mine { display: inline-flex; align-items: center; gap: 8px; padding: 0; border: 0; background: none; cursor: pointer; font: inherit; font-size: 15px; color: var(--trp-text-2); }
.trp-rating-mine__edit { font-weight: 700; color: var(--trp-accent); }
.trp-rating-mine:hover .trp-rating-mine__edit { text-decoration: underline; }
.trp-rating-modal { position: fixed; inset: 0; z-index: 3000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.trp-rating-modal[hidden] { display: none; }
.trp-rating-modal__backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .65); }
.trp-rating-modal__card { position: relative; width: 100%; max-width: 34rem; max-height: calc(100vh - 32px); overflow-y: auto; padding: 24px 26px 26px; box-shadow: 0 40px 90px rgba(0, 0, 0, .7); }
.trp-rating-modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.trp-rating-modal__kicker { font-family: var(--trp-font-mono); font-size: 13px; color: var(--trp-star); letter-spacing: .04em; }
.trp-rating-modal__sub { margin: 6px 0 0; font-size: 16px; color: var(--trp-faint); }
.trp-rating-modal__summary { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.trp-rating-modal__avg { font-family: var(--trp-font-mono); font-size: 34px; font-weight: 600; line-height: 1; }
.trp-rating-modal__comments { list-style: none; margin: 16px 0 0; padding: 0; }
.trp-rating-modal__comment { padding: 10px 0; border-top: 1px solid var(--trp-line); font-size: 16px; color: var(--trp-text-2); }
.trp-rating-modal__comment-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; font-family: var(--trp-font-mono); font-size: 12px; color: var(--trp-faint); }
.trp-rating-form { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--trp-line-strong); }
.trp-star-input { display: inline-flex; gap: 4px; margin-top: 8px; }
.trp-star-input button { width: 40px; height: 40px; padding: 0; border: 0; background: none; cursor: pointer; font-size: 26px; color: #5B5F63; }
.trp-star-input button.is-on { color: var(--trp-star); }
.trp-star-input button:focus-visible { outline: 2px solid var(--trp-star); outline-offset: -2px; }
.trp-rating-form textarea.trp-field { width: 100%; box-sizing: border-box; min-height: 84px; resize: vertical; }

/* ---------- Footer ---------- */
.trp-footer__inner { max-width: 1240px; margin: 0 auto; padding: 24px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 15px; color: var(--trp-faint); }

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  .trp-flag--animated .trp-flag__window, .trp-flag--animated .trp-flag__counter, .trp-flag--animated .trp-flag__cloth, .trp-flag--animated .trp-flag__folds { animation: none; }
  .trp-btn, .trp-btn::before, .trp-btn .trp-arrow { transition: none; }
}
