/* CANPL data pages (/results, /lifters, /rankings): the shared stylesheet, mobile first.
   Matches www.powerlifting.ca: white header with a Barlow text nav, grey page, white cards,
   uppercase headings, black table headers. Section styles live in results.css, lifters.css
   and rankings.css (loaded through the layout's $styles). No inline styles anywhere (CSP 'self').

   Contents: fonts · tokens · base · header and nav · preview banner · breadcrumb · cards and
   headings · text · tables (scroll cue, tr:target, phone columns, sticky first column) ·
   attempts, tags, statuses · forms and buttons · lists and paging · error page · footer ·
   helpers · print.

   Colour rules: text links #C22026 (5.9:1 on white); the brighter reds #E13A44 / #ED1C24 only
   for fills, rules and large text. Nothing may widen the page beyond the screen: wide tables
   scroll inside .table-wrap.

   For the section stylesheets (FX-G, 29 Sep 2026; docs/phase34/build/FX_G.md):
   - Wide pages: the layout's $wide adds body.layout-wide. Every .wrap (header, banner, main,
     footer) then widens together to a 1400 px content column, and cards get 24 px padding.
   - Scroll cue: every .table-wrap shows an edge shadow on a side where the table runs on
     (background-attachment: local; no JS). It is painted behind the table, so stripes must stay
     translucent: use var(--row-alt) (not a solid grey) and leave cells without a background.
   - tr:target: the row a link's #fragment points at is yellow with a red outline, and scrolls
     to 88 px below the top. Link to a result row as …/results/2015/683-x#r{id}.
   - Phone tables: .cols-optional on a th/td hides that column below 640 px. An optional "Show
     all columns" switch brings them back; the checkbox must be a sibling before the .table-wrap
     (every later sibling .table-wrap responds):
       <input type="checkbox" class="show-cols" id="cols-x">
       <label class="show-cols-label" for="cols-x">Show all columns</label>
       <div class="table-wrap" tabindex="0" role="region" aria-labelledby="…"><table>…
     Both are shown below 640 px only. (results.css has its own .cols-toggle at 760 px.)
   - .sticky-first on a .table-wrap or <table>: the first cell of each row stays at the left
     while the table scrolls. Its background matches the row: a stylesheet that stripes other
     rows than site.css's even ones sets --row-tint: var(--row-alt) on them too. */

/* ---------------------------------------------------------------- fonts */
/* Barlow Medium (500), Latin subset, self-hosted from Google Fonts; SIL Open Font License
   (fonts/OFL.txt). Used for the header nav only, as on the main site. */
@font-face {
  font-family: "Barlow";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/barlow-500-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------------------------------------------------------------- tokens */
:root {
  --red-text: #c22026;     /* logo red: text links (AA on white) */
  --red-dark: #881924;     /* hover, tags */
  --red: #e13a44;          /* accent: rules, current nav item, large text */
  --red-bright: #ed1c24;   /* palette red: fills */
  --text: #303030;
  --heading: #000;
  --muted: #606060;
  --faint: #8f8f8f;
  --line: #d9d9d9;
  --row-alt: rgba(0, 0, 0, .04);   /* stripes: translucent, so .table-wrap's scroll shadows show through (#f5f5f5 on white) */
  --row-alt-solid: #f5f5f5;         /* the same grey, opaque (a sticky cell) */
  --target: #fff3c4;                /* tr:target */
  --page: #dbdbdb;
  --card: #fff;
  --font: "Avenir Next", Avenir, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-nav: "Barlow", "Avenir Next", Avenir, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --gutter: 8px;                    /* the page's side margin: 8 px on a phone, 16 px from 480 px */
  --shadow: rgba(0, 0, 0, .2);      /* scroll cue */
}
@media (min-width: 480px) {
  :root { --gutter: 16px; }
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.5 var(--font);
  color: var(--text);
  background: var(--page);
  overflow-wrap: break-word;
}
img, svg { max-width: 100%; height: auto; }
.wrap { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 var(--gutter); }
/* $wide pages (results tables): a content column of min(100% - 32px, 1400px), header and footer
   included so the edges stay aligned. */
.layout-wide .wrap { max-width: calc(1400px + 2 * var(--gutter)); }

a { color: var(--red-text); text-decoration: underline; text-underline-offset: .15em; }
a:hover { color: var(--red-dark); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
summary:focus-visible, .table-wrap:focus-visible {
  outline: 3px solid var(--red); outline-offset: 2px;
}

.skip-link {
  position: absolute; left: -9999px; top: 8px; z-index: 10;
  background: #000; color: #fff; padding: 8px 12px; text-decoration: none;
}
.skip-link:focus { left: var(--gutter); color: #fff; }

/* ---------------------------------------------------------------- header and nav */
/* Phones: the logo (140 px) on one row, the nav on the next as one row that scrolls sideways,
   with an edge shadow where more links are (the same technique as .table-wrap); every link is
   44 px tall. From 760 px: the main site's 88 px bar, logo left, nav right. */
.site-header { background: #fff; }
.header-inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0 24px; padding-top: 6px;
}
.brand { display: block; line-height: 0; flex: 0 0 auto; padding: 2px 0; }
.brand img { width: 140px; height: auto; }
.site-nav {
  flex: 0 0 auto; width: calc(100% + 2 * var(--gutter));
  margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter);
  overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
  background:
    linear-gradient(to right, #fff 40%, rgba(255, 255, 255, 0)) left center / 40px 100% no-repeat local,
    linear-gradient(to left, #fff 40%, rgba(255, 255, 255, 0)) right center / 40px 100% no-repeat local,
    linear-gradient(to right, var(--shadow), rgba(0, 0, 0, 0)) left center / 12px 100% no-repeat scroll,
    linear-gradient(to left, var(--shadow), rgba(0, 0, 0, 0)) right center / 12px 100% no-repeat scroll;
  background-color: #fff;
}
.site-nav::-webkit-scrollbar { display: none; }
.site-nav ul {
  display: flex; flex-wrap: nowrap; gap: 0 20px;
  margin: 0; padding: 0; list-style: none; white-space: nowrap;
  font: 500 15px/1.4 var(--font-nav);
}
.site-nav a {
  display: flex; align-items: center; min-height: 44px; padding: 2px 0 0;
  color: #000; text-decoration: none; border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--red-text); }
.site-nav a[aria-current="page"] { border-bottom-color: var(--red); }
.site-nav .nav-home a { color: var(--red-text); }
@media (min-width: 760px) {
  .header-inner { min-height: 88px; gap: 8px 24px; padding-top: 12px; padding-bottom: 12px; }
  .brand { padding: 0; }
  .brand img { width: 221px; }
  .site-nav { flex: 0 1 auto; width: auto; margin: 0; padding: 0; overflow: visible; background: none; }
  .site-nav ul { flex-wrap: wrap; justify-content: flex-end; gap: 0 18px; }
}

/* ---------------------------------------------------------------- preview banner */
/* One line on a phone: "Preview — not yet official. Official pages →". The link's padding makes
   a taller tap target without making the bar taller. */
.preview-banner { background: var(--text); color: #fff; font-size: .8125rem; line-height: 1.4; }
.preview-banner p { margin: 0 auto; padding-top: 8px; padding-bottom: 8px; }
.preview-banner a { display: inline-block; margin: -8px 0; padding: 8px 0; color: #fff; }
.preview-banner a:hover { color: #f5b8bc; }
.preview-banner a:focus-visible { outline-color: #fff; outline-offset: -2px; }
@media (min-width: 760px) {
  .preview-banner { font-size: .9375rem; }
}

/* ---------------------------------------------------------------- breadcrumb */
/* The separator ends an item (never starts a line), and a long current item (a meet's name,
   repeated by the H1) is cut with "…" rather than wrapping. Links are 36 px tall. */
.breadcrumb { margin: 4px 0 0; font-size: .875rem; }
.breadcrumb ol { display: flex; flex-wrap: nowrap; align-items: center; margin: 0; padding: 0; list-style: none; }
.breadcrumb li { flex: 0 0 auto; white-space: nowrap; }
.breadcrumb li:last-child { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.breadcrumb li:not(:last-child)::after { content: "\203A"; padding: 0 .5em; color: var(--muted); }
.breadcrumb a { display: inline-block; padding: 8px 0; color: var(--text); }
.breadcrumb [aria-current="page"] { color: var(--muted); }

/* ---------------------------------------------------------------- cards and headings */
.site-main { padding-top: 0; padding-bottom: 8px; }
.card {
  background: var(--card); margin: 12px 0; padding: 12px;
  min-width: 0;   /* lets a .table-wrap inside scroll instead of widening the card */
}
@media (min-width: 480px) {
  .card { margin: 16px 0; padding: 16px; }
}
@media (min-width: 760px) {
  .card { padding: 24px 32px; }
  .layout-wide .card { padding: 24px; }
}
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }

h1, h2, h3, h4 {
  color: var(--heading); font-weight: 800; text-transform: uppercase;
  letter-spacing: .12em; line-height: 1.25; overflow-wrap: anywhere;
}
h1 { font-size: 1.375rem; margin: 0 0 .6em; }
h2 { font-size: 1.125rem; margin: 1.6em 0 .6em; }
h3 { font-size: 1rem; margin: 1.4em 0 .5em; letter-spacing: .08em; }
h4 { font-size: .9375rem; margin: 1.2em 0 .4em; letter-spacing: .06em; }
@media (min-width: 760px) {
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.25rem; }
}
.subhead { margin: -.3em 0 1em; color: var(--muted); }

/* ---------------------------------------------------------------- text */
p { margin: 0 0 1em; }
.lede { font-size: 1.0625rem; margin-top: 0; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.notice {
  margin: 0 0 1em; padding: 10px 14px;
  border-left: 4px solid var(--red); background: #fdf1f2;
}
.notice > :last-child { margin-bottom: 0; }
.meta { margin: 0 0 1em; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 4px 18px; }
dl.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 16px; margin: 0 0 1em; }
dl.facts dt { font-weight: 600; }
dl.facts dd { margin: 0; }

/* ---------------------------------------------------------------- tables */
/* Every table sits in <div class="table-wrap">, which scrolls sideways on a phone instead of
   widening the page. For a keyboard: <div class="table-wrap" tabindex="0" role="region" aria-label="…">.
   Scroll cue (C1): two white "covers" scroll with the table (attachment local) and two shadows
   stay at the wrap's edges (scroll); at an end of the table its cover hides that side's shadow,
   so a shadow shows only where more of the table is out of view. Pure CSS, so it works where
   scrollbars are hidden (macOS, iOS). The layers sit behind the table: they show through rows
   and cells without an opaque background (stripes are translucent, --row-alt). */
.table-wrap {
  position: relative;   /* keeps absolutely positioned .visually-hidden text inside the scroller */
  max-width: 100%; overflow-x: auto;
  margin: 0 0 1.25em;
  background:
    linear-gradient(to right, var(--card) 40%, rgba(255, 255, 255, 0)) left center / 48px 100% no-repeat local,
    linear-gradient(to left, var(--card) 40%, rgba(255, 255, 255, 0)) right center / 48px 100% no-repeat local,
    linear-gradient(to right, var(--shadow), rgba(0, 0, 0, 0)) left center / 14px 100% no-repeat scroll,
    linear-gradient(to left, var(--shadow), rgba(0, 0, 0, 0)) right center / 14px 100% no-repeat scroll;
  background-color: var(--card);
}
table { border-collapse: collapse; width: 100%; font-size: .9375rem; }
caption { text-align: left; font-weight: 600; padding: 0 0 6px; }
th, td { padding: 6px 10px; text-align: left; vertical-align: top; white-space: nowrap; border-bottom: 1px solid var(--line); }
thead th { background: #000; color: #fff; font-weight: 600; vertical-align: bottom; border-bottom: 0; }
thead th a { color: #fff; }
tbody tr:nth-child(even) { background: var(--row-alt); --row-tint: var(--row-alt); }
tbody th { font-weight: 600; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
td.wrap-ok, th.wrap-ok { white-space: normal; min-width: 12em; }
tbody tr.group-head { background: transparent; --row-tint: transparent; }
tr.group-head th, tr.group-head td { color: var(--heading); font-weight: 700; border-bottom: 2px solid var(--red); }

/* The row a link's #fragment points at (C4: a meet link from a profile, a search or a ranking
   ends in #r{result id}). Cells, not the row, get the colour, so it wins over a section's own
   row stripes. scroll-margin-top keeps it clear of the top edge and a sticky head row. */
tr:target { outline: 2px solid var(--red); outline-offset: -2px; scroll-margin-top: 88px; --row-tint: var(--target); }
tr:target > th, tr:target > td { background-color: var(--target); }
:target { scroll-margin-top: 16px; }

/* Phone tables (C3): .cols-optional columns show from 640 px, or when "Show all columns" (a
   checkbox .show-cols before the .table-wrap, see the top of this file) is ticked. */
.cols-optional { display: none; }
.show-cols:checked ~ .table-wrap .cols-optional { display: table-cell; }
.show-cols { width: 22px; height: 22px; margin: 0 8px 0 0; vertical-align: middle; accent-color: var(--red-text); }
.show-cols-label { display: inline-block; padding: 11px 0; font-weight: 600; cursor: pointer; }
.show-cols:focus-visible + .show-cols-label { outline: 3px solid var(--red); outline-offset: 2px; }
@media (min-width: 640px) {
  .cols-optional { display: table-cell; }
  .show-cols, .show-cols-label { display: none; }
}

/* .sticky-first (on a .table-wrap or a <table>): the first cell of each row stays at the left
   edge while the table scrolls. It needs an opaque background: white under the row's tint
   (--row-tint: the stripe, or the :target yellow); black in the head. A group head's cell
   spans the table, so it can't stick: put its text in a <span> and that stays in view. */
.sticky-first tr > :first-child {
  position: sticky; left: 0; z-index: 1;
  background-color: var(--card);
  background-image: linear-gradient(var(--row-tint, transparent), var(--row-tint, transparent));
  box-shadow: inset -1px 0 0 var(--line);
}
.sticky-first thead tr > :first-child { background: #000; box-shadow: inset -1px 0 0 #444; z-index: 2; }
.sticky-first tr.group-head > :first-child { position: static; background: transparent; box-shadow: none; }
.sticky-first tr.group-head > :first-child > span { position: sticky; left: 10px; display: inline-block; }   /* a group head's text in a <span> stays in view */
.sticky-first tr:target > :first-child { background: var(--target); }

/* ---------------------------------------------------------------- attempts, tags, statuses */
/* pub_attempt()'s classes (att-good needs no style). A miss is struck through and keeps its
   minus sign, so it isn't shown by colour alone. */
.att-miss { text-decoration: line-through; color: var(--muted); }
.att-none { color: var(--faint); }
/* A small label beside a name, e.g. "Special Olympics" (pub_row_name()['so']). */
.tag {
  display: inline-block; margin-left: .35em; padding: 0 6px;
  font-size: .75rem; line-height: 1.5; font-weight: 600; white-space: nowrap;
  color: var(--red-dark); border: 1px solid var(--red-dark); border-radius: 2px; vertical-align: 1px;
}
/* A status printed instead of a place (pub_status()['label']). */
.status { font-weight: 600; color: var(--red-dark); white-space: normal; }   /* wraps ("DQ / (doping)") rather than widening a column (C1) */
/* A class derived from the bodyweight (pub_class()['derived']), shown with "≈". */
.derived { color: var(--muted); }

/* ---------------------------------------------------------------- forms and buttons */
label { font-weight: 600; }
input[type="text"], input[type="search"], input[type="number"], select {
  font: inherit; color: inherit; background: #fff;
  min-height: 44px; max-width: 100%; padding: 8px 10px;
  border: 1px solid var(--faint); border-radius: 0;
}
input[type="search"] { -webkit-appearance: none; appearance: none; }
.btn, button[type="submit"] {
  display: inline-block; min-height: 44px; padding: 10px 18px;
  font: 700 1rem/1.5 var(--font); color: #fff; background: var(--red-text);
  border: 0; border-radius: 0; cursor: pointer; text-decoration: none;
}
.btn:hover, button[type="submit"]:hover { background: var(--red-dark); color: #fff; }
.btn-plain { background: transparent; color: var(--red-text); border: 1px solid var(--red-text); }
.btn-plain:hover { background: #fdf1f2; color: var(--red-dark); }
.field { display: flex; flex-direction: column; gap: 4px; margin: 0 0 12px; min-width: 0; }
.fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 16px; }
@media (min-width: 600px) { .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px) { .fields { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
details { margin: 0 0 1em; }
summary { cursor: pointer; font-weight: 600; color: var(--red-text); padding: 6px 0; }

/* ---------------------------------------------------------------- lists and paging */
.link-list, .meet-list { list-style: none; margin: 0 0 1em; padding: 0; }
.link-list li { padding: 4px 0; }
.meet-list li { display: flex; flex-direction: column; padding: 10px 0; border-bottom: 1px solid var(--line); }
.meet-list li:last-child { border-bottom: 0; }
.meet-list a { font-weight: 600; }
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 1em 0; padding: 0; list-style: none; }
.pager a, .pager span { display: inline-block; min-width: 44px; min-height: 44px; padding: 10px 12px; text-align: center; }
.pager a { border: 1px solid var(--line); text-decoration: none; }
.pager [aria-current="page"] { background: #000; color: #fff; }

/* ---------------------------------------------------------------- error page */
/* A 404's search box (templates/error.php): lifters by name, or meets on /results/. */
.error-search { margin: 0 0 1.25em; }
.error-search label { display: block; margin: 0 0 4px; }
.error-search-row { display: flex; gap: 8px; max-width: 36em; }
.error-search-row input[type="search"] { flex: 1 1 auto; min-width: 0; -webkit-appearance: none; appearance: none; }
.error-search-row button { flex: 0 0 auto; }

/* ---------------------------------------------------------------- footer */
.site-footer { background: #fff; margin-top: 24px; padding: 20px 0; font-size: .875rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; }
.footer-inner p { margin: 0; }
.social { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0; padding: 0; list-style: none; }

/* ---------------------------------------------------------------- helpers */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.nowrap { white-space: nowrap; }

/* ---------------------------------------------------------------- print */
@media print {
  body { background: #fff; }
  .site-nav, .preview-banner, .skip-link, .site-footer .social, .show-cols, .show-cols-label, .error-search { display: none; }
  .card { margin: 0; padding: 0; }
  .table-wrap { overflow: visible; background: none; }
  .cols-optional { display: table-cell !important; }
  .sticky-first tr > :first-child { position: static; }
  thead th { background: #fff; color: #000; border-bottom: 2px solid #000; }
  a { color: inherit; text-decoration: none; }
}
