/* BikeTrials.com — the site stylesheet.
   One file, loaded by every page: inc/header.php wraps the 668 templated pages, and the
   homepage and 404 page go through the same include. Nothing is duplicated in a <head>
   any more; the two private copies of this CSS are what let the homepage drift away from
   the rest of the site (13px body text, no 1.4 line-height, an unstyled side menu).
   Cache-busted by filemtime in the <link>, so a deploy can't serve a stale copy. */

/* ---------- tokens ---------- */
:root{
  --navy:#0149A4;      /* links, tabs, the dark end of the menu bar */
  --navy-dk:#013683;
  --blue:#0054B6;      /* section bars */
  --sky:#3399FF;
  --pale:#C5E2FF;      /* hairlines and rules */
  --paper:#F4F4EA;     /* page background */
  --rule:#E2E2D8;
  --gold:#FFD843;      /* menu hover */
  --shell:990px;       /* the layout width this site has always used */
}
*,::before,::after{box-sizing:border-box}
body{background:var(--paper)}
img{max-width:100%;height:auto}
/* Every <img> now carries its intrinsic width/height so the browser can reserve the right
   box before the file arrives (no layout shift). Where a thumbnail pins its height inline,
   that pinned height beats the height:auto above, and the width attribute would then stretch
   it to full intrinsic width -- a 480x640 portrait rendering 480x120. Keeping width automatic
   lets the aspect ratio drive it back to 90x120. */
img[style*="height"]{width:auto}
main{line-height:1.4}            /* the standard body measure, archive pages included */
main a{text-decoration:none}
main a:hover{text-decoration:underline}
:focus-visible{outline:2px solid var(--navy);outline-offset:2px}

/* The shell is 990px wide; keep running text at a readable measure. Paragraphs that wrap an
   image, table or embed are layout, not prose - leave those alone. */
main p:not(:has(img)):not(:has(table)):not(:has(iframe)){max-width:80ch}

/* ---------- chrome ---------- */
/* .shell is the 990px column every band of the page shares: header, menu, content, footer.
   Before this it was five separate <table width="990"> elements. */
.shell{max-width:var(--shell);margin-inline:auto}

.skip{position:absolute;left:-9999px;top:0;z-index:10;background:#fff;color:var(--navy);
  font:bold 14px Arial,Helvetica,sans-serif;padding:10px 16px;border:2px solid var(--navy)}
.skip:focus{left:0}

.site-head{background:#fff;max-width:var(--shell);margin-inline:auto}
.head-bar{display:flex;align-items:flex-end;gap:10px;padding:5px 0 0}
.head-bar .logo{display:block;line-height:0}
/* The logo is an SVG with no intrinsic size: without an explicit width it takes the
   container's, which is why the old rules had to cap it at 86vw on phones. */
.head-bar .logo img{width:336px;max-width:100%;height:auto}
.head-date{margin:0 0 2px auto;font:400 80% Arial,Helvetica,sans-serif;color:#000;white-space:nowrap}

/* Menu bar. The five section cells carry the old left-to-right gradient of blues; the strip
   they sit on is the lightest shade, so it fills whatever is left over to the right. */
.nav{max-width:var(--shell);margin-inline:auto;background:#0082FF}
.nav-in{display:flex;align-items:stretch;min-height:27px}
.nav-list{display:flex;margin:0;padding:0;list-style:none}
.nav-list a{display:block;padding:6px 14px;border-right:1px solid #fff;white-space:nowrap;
  font:bold 80%/1.15 Arial,Helvetica,sans-serif;color:#fff;text-decoration:none}
.nav-list a:hover,.nav-list a:focus-visible{color:var(--gold);text-decoration:none}
.nav-list li:nth-child(1) a{background:var(--navy-dk)}
.nav-list li:nth-child(2) a{background:#005EC9}
.nav-list li:nth-child(3) a{background:#0066D5}
.nav-list li:nth-child(4) a{background:#006FE4}
.nav-list li:nth-child(5) a{background:#0078F2}
.nav-list a[aria-current]{box-shadow:inset 0 -3px 0 var(--gold)}
.m-ham{margin-left:auto;background:transparent;color:#fff;border:0;padding:6px 14px;
  font:bold 80% Arial,Helvetica,sans-serif;cursor:pointer;white-space:nowrap}
.m-ham:hover{color:var(--gold)}
/* The two hairlines under the menu: 2px #3399FF over 2px #C5E2FF. */
.rule{max-width:var(--shell);margin-inline:auto;height:4px;
  background:linear-gradient(var(--sky) 0 2px,var(--pale) 2px 4px)}

/* Every-section menu behind the hamburger. [hidden] does the hiding, so the button's
   aria-expanded and the panel's state can never disagree. */
.side-menu{max-width:var(--shell);margin:0 auto 12px;background:var(--paper);
  border:1px solid var(--pale);border-top:0}
.side-menu ul{margin:0;padding:6px 0;list-style:none}
.side-menu a{display:block;padding:8px 18px;font:bold 14px Arial,Helvetica,sans-serif;
  color:var(--navy);text-decoration:none;border-bottom:1px solid var(--rule)}
.side-menu li:last-child a{border-bottom:0}
.side-menu a:hover{background:var(--navy);color:#fff;text-decoration:none}

/* 13px of padding against a 990px white column read as flush against the edge; the text
   needs a real margin to sit in. Horizontal is the one that shows, so it gets the most. */
.shell-main{background:#fff;padding:18px 26px;min-height:60px}
.crumbs{font:400 78%/1.4 Arial,Helvetica,sans-serif;color:#000;padding:0 0 10px}

.site-foot{max-width:var(--shell);margin:0 auto;padding:24px 0 0;text-align:center;
  font:400 80%/1.7 Arial,Helvetica,sans-serif;color:#000}
.foot-nav{border-top:1px solid var(--pale);padding-top:8px}
 /* flex, not inline: inline items also collect the newline between each <li>, which added
   about 50px of invisible whitespace and bumped the last two links onto a second line. */
.foot-nav ul{display:flex;flex-wrap:wrap;justify-content:center;margin:0;padding:0;list-style:none}
.foot-nav li{display:inline-flex}
.foot-nav li::after{content:"|";padding:0 5px;color:#9ab}
.foot-nav li:last-child::after{content:none}
.foot-copy{margin:18px 0 24px}
.foot-copy .disclaimer{font-size:87%;font-style:italic}

/* ---------- type scale (opt in with $bt_styleguide, which puts .bt on <main>) ---------- */
main.bt{font-family:Arial,Helvetica,sans-serif;font-size:95%;color:#333}
main.bt h1{font:bold 200% Arial,Helvetica,sans-serif;color:navy;margin:0 0 10px;line-height:1.15}
main.bt h2{font:bold 150% Arial,Helvetica,sans-serif;color:navy;margin:30px 0 8px;line-height:1.2}
main.bt h3{font:bold 115% Arial,Helvetica,sans-serif;color:navy;margin:20px 0 6px}
/* The body size is declared ONCE, on main.bt, and everything inherits it. Stating 95% on both
   p and td compounded to 14.4px wherever a paragraph sat inside the old 990px table shell. */
main.bt p{margin:0 0 12px}
main.bt p.bt-lead{color:#555;max-width:76ch}
main.bt .bt-note{font-size:88%;color:#666}
main.bt .bt-micro{font-size:80%;color:#7a93ab}
main.bt table{border-collapse:collapse}
main.bt .bt-box,main.bt details.bt-box{background:#F1F7FF;border:1px solid var(--pale);
  border-radius:6px;padding:10px 14px;margin:0 0 22px;max-width:76ch;font-size:88%;color:#666}
main.bt details.bt-box>summary{cursor:pointer;font-weight:bold;color:var(--navy);list-style:none;
  display:flex;align-items:baseline;gap:7px}
main.bt details.bt-box>summary::-webkit-details-marker{display:none}
main.bt details.bt-box>summary::before{content:"\25B8";display:inline-block;transition:transform .15s;font-size:90%}
main.bt details.bt-box[open]>summary::before{transform:rotate(90deg)}
main.bt details.bt-box>p{margin:9px 0 2px}
@media (prefers-reduced-motion:reduce){main.bt details.bt-box>summary::before{transition:none}}

/* Governing-body badge. Written once here rather than on each span: these render inside the
   results loop, and at 150 bytes a badge the two variants were 215 KB of /results/ by themselves. */
.org{display:inline-block;font:bold 70% Arial,Helvetica,sans-serif;color:#fff;background:var(--navy);
  padding:1px 6px;border-radius:4px;vertical-align:middle;letter-spacing:.03em}
.org-biu{background:#1a7a3a}
/* The Senyera, drawn inline because the ES-CT emoji only renders as a flag on Apple platforms. */
.flag-svg{height:.72em;width:1.05em;vertical-align:-.05em;border-radius:1px}

/* ---------- data tables ----------
   The results, riders, records and event tables are built in loops, so anything written as an
   inline style on a cell is paid for once per row: /results/ alone carried 8,115 style attributes
   and 453 KB of the page's 916 KB. These classes say it once. Declarations here must match what
   the inline styles used to compute to -- verified cell by cell against a computed-style snapshot
   taken before the change, not by eye. */
table.dt{width:100%;max-width:100%;table-layout:fixed}
.dt thead tr{text-align:left;border-bottom:2px solid var(--navy);color:var(--navy)}
.dt th,.dt td{padding:8px 10px}
.dt th:first-child,.dt td:first-child{padding-left:0;white-space:nowrap}
.dt tbody tr{border-bottom:1px solid var(--rule)}
.dt td.col-type{color:#666}
.dt th.nw,.dt td.nw{white-space:nowrap}
.dt .empty{padding:12px 0;color:#777}
.dt .dash{color:#aaa}

/* riders index: same idea, tighter rows */
table.dt-r th,table.dt-r td{padding:5px 10px}
table.dt-r th:first-child,table.dt-r td:first-child{padding-left:0}
.dt-r td.ell{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.dt-r td.num{padding-right:6px;color:#999;font-variant-numeric:tabular-nums;white-space:nowrap;line-height:1.25}

.dt-r .sortrow{cursor:pointer}
.dt-r th.pl0,.dt-r td.pl0{padding:5px 10px 5px 0}
.dt-r th.col-rank{padding:5px 8px 5px 0}
.dt-r .rt-pri{color:var(--navy)}
.dt-r .rt-sec{color:#999;white-space:nowrap}
.dt-r .dash2{color:#BBB}
.dt-r a.plain{text-decoration:none;color:inherit}
.dt-r .mv.sm{font-size:80%}
.dt-r .mv-new{color:#0a7d33;font-weight:bold;font-size:88%}
.dt-r .mv-up{color:#0a7d33}
.dt-r .mv-dn{color:#c0392b}
.dt-r .mv-nil{color:#bbb}

/* rider profile: the career table. 578 cells on Hermance's page carried the same
   ellipsis rule inline; that one declaration was ~55 KB of a 240 KB page. */
table.dt-p th,table.dt-p td{padding:5px 14px 5px 0}
.dt-p tbody tr.nw{white-space:nowrap}
.dt-p td.ell{overflow:hidden;text-overflow:ellipsis}
.dt-p td.loc{padding:5px 0;color:#666}
.dt-p td.pos{font-weight:normal;color:inherit}
.dt-p td.pos.pod{font-weight:bold}
.dt-p td.pos.win{color:#B8860B}
.meta-sm{color:#888;font-size:88%}
.xc-tag{background:#EFE6FA;border:1px solid #C3A6E0;color:#5b3d86;
  font:bold 80% Arial,Helvetica,sans-serif;padding:0 5px;border-radius:3px;vertical-align:middle}

/* event page: the results grid */
table.dt-e{width:100%;table-layout:fixed;margin:0 0 6px}
table.dt-e th{padding:3px 10px 3px 0}
table.dt-e td{padding:4px 10px 4px 0}
.dt-e th.r,.dt-e td.r{text-align:right}
.dt-e th.p0,.dt-e td.p0{padding-left:0;padding-right:0}
.dt-e tbody tr{border-bottom:1px solid #EDEDE4}
.dt-e tbody tr.nw{white-space:nowrap}
.dt-e td.ell{overflow:hidden;text-overflow:ellipsis}
.dt-e td.mut{color:#666}
.dt-e td.pos{font-weight:normal;color:inherit}
.dt-e td.pos.pod{font-weight:bold}
.dt-e td.pos.win{color:#B8860B}
.sep{color:#ccc}

/* records */
table.dt-k{min-width:420px}
.dt-k th{padding:6px 10px}
.dt-k td{padding:5px 10px;border-bottom:1px solid #E6EFF9}
.dt-k th.r,.dt-k td.r{text-align:right}
.dt-k tr.hd{background:var(--navy);color:#fff;text-align:left}
.dt-k tbody tr.alt{background:#F6FAFF}
.dt-k td.num{text-align:right;font-variant-numeric:tabular-nums}
.dt-k td.rank{color:#7a93ab}
.dt-k td.b{font-weight:bold}
.dt-k td.prem{font-weight:bold;color:var(--navy)}
.dt-k td.allc{color:#555}
.dt-k td.yrs{font-size:88%;color:#666;font-variant-numeric:tabular-nums}

/* ---------- homepage ---------- */
/* Content first in the source, sidebar second; the grid puts the sidebar back on the left for
   wide screens. What a crawler and a screen reader meet first is the article, not 40 links.
   These selectors carry main.bt because the type scale above is written at that weight: a bare
   .home-side p loses to main.bt p and the sidebar silently falls back to body margins. */
.home{display:grid;grid-template-columns:150px 1fr;column-gap:12px;align-items:start}
.home-main{grid-column:2;grid-row:1;min-width:0}
.home-side{grid-column:1;grid-row:1}
main.bt .home-side p{margin:16px 0 2px;font:bold 15px/1.3 Arial,Helvetica,sans-serif;color:var(--navy-dk)}
main.bt .home-side p:first-child{margin-top:2px}
main.bt .home-side p a{font:inherit;color:inherit;font-weight:bold}
.home-side ul{margin:0;padding:0;list-style:none}
main.bt .home-side a{font:400 13px/1.55 Arial,Helvetica,sans-serif;color:var(--navy);
  text-decoration:none;display:block}
main.bt .home-side a:hover{text-decoration:underline}

main.bt .home h1{color:var(--navy-dk);margin:2px 0 4px}
main.bt .home .tagline{font:bold 12px Arial,Helvetica,sans-serif;color:#7D7D7D;margin:0 0 14px}
/* The intro contains its own float, the way the old intro table did. Without it the first
   section bar — a flex container, so an independent formatting context — sits beside the photo
   instead of below it and renders half width. */
.home .intro{display:flow-root}
.home figure{float:right;width:240px;max-width:45%;margin:2px 0 10px 16px;text-align:center}
.home figure img{border:1px solid var(--pale);width:auto;max-width:100%;height:auto}
.home figcaption{font-size:80%;line-height:1.4;color:#7D7D7D;padding-top:4px}
/* The subject's name links to his profile. It keeps the caption's grey rather than taking
   link colour -- a blue name would pull the eye off the photo it is captioning -- so the
   underline is the only thing marking it as a link, and has to stay. */
.home figcaption a:any-link{color:inherit;text-decoration:underline;text-underline-offset:2px}
.home figcaption a:any-link:is(:hover,:focus-visible){color:var(--navy)}
/* Scoped to .home-main, not .home: .home is the grid wrapper and holds the sidebar too, so
   the emphasis meant for the article's own links also hit all 24 sidebar links. They have the
   same specificity as the sidebar's own rule and come later, so they won -- every link in the
   side menu rendered bold --navy-dk, identical to the section headings above it, and the
   column lost the heading/link distinction the old homepage had (regular 13px #0149A4). */
.home-main :is(p,li) a:any-link{color:var(--navy-dk);font-weight:bold}
.home-main :is(p,li) a:any-link:is(:hover,:focus-visible){text-decoration:underline;text-underline-offset:2px}

/* The blue section bar: a dark label block, the 22px diagonal, then the lighter strip running
   to the right edge. That used to be a four-cell table and a transparent GIF. */
.sec{margin:0 0 16px}
main.bt h2.sec-bar{display:flex;align-items:stretch;background:var(--sky);margin:22px 0 8px;
  min-height:22px;font:bold 88%/1.2 Arial,Helvetica,sans-serif;color:#fff;letter-spacing:.3px}
main.bt h2.sec-bar>span{display:flex;align-items:center;background:var(--blue);
  padding:3px 30px 3px 12px}
main.bt h2.sec-bar::after{content:"";flex:0 0 22px;background:var(--blue);
  clip-path:polygon(0 0,0 100%,100% 100%)}
.sec-body{padding:0 2px}
main.bt .sec-body>:last-child{margin-bottom:0}
.sec-cols{columns:2;margin:2px 0 10px;padding-left:20px;list-style:square}
main.bt .home-explore{line-height:2;margin:0}

/* ---------- legacy page bodies ----------
   656 pages still carry 1999 markup (<font>, width attributes, class="rkr"). These rules are
   what keeps them legible; they are not used by anything written since. */
.lwb{font:bold 87% Arial,Helvetica,sans-serif;color:#FFFFFF}
.lkb{font:bold 87% Arial,Helvetica,sans-serif;color:#000000}
.rwr{font:400 80% Arial,Helvetica,sans-serif;color:#FFFFFF}
.rwb{font:bold 80% Arial,Helvetica,sans-serif;color:#FFFFFF}
.title{font:400 100% Arial,Helvetica,sans-serif;color:#000000}
.rkr{font:400 80% Arial,Helvetica,sans-serif;color:#000000}
.skr{font:400 60% Arial,Helvetica,sans-serif;color:#000000}
.sgr{font:400 60% Arial,Helvetica,sans-serif;color:#7D7D7D}
a.title:link,a.title:visited,a.title:active{font:bold 80% Arial,Helvetica,sans-serif;
  color:#000000;text-decoration:none}
a.menu:link,a.menu:visited,a.menu:active{font:bold 80% Arial,Helvetica,sans-serif;
  color:#ffffff;text-decoration:none}
a.menu:hover{color:var(--gold)}
a.memberbar:link,a.memberbar:visited{font:bold 80% Arial,Helvetica,sans-serif;color:#0054B6}
a.memberbar:active{font:bold 80% Arial,Helvetica,sans-serif;color:var(--gold)}
a.ad:link,a.ad:visited,a.ad:active{font:bold 80% Arial,Helvetica,sans-serif;color:#fff;text-decoration:none}
a.ad:hover{color:var(--gold)}
.evd{font-family:'Courier New',Courier,monospace;display:inline-block;min-width:12ch;vertical-align:baseline}

/* ---------- responsive ---------- */
@media screen and (max-width:1060px){
  html,body{max-width:100%;overflow-x:hidden;-webkit-text-size-adjust:100%}
}
/* The menu bar is the one band with a hard minimum width: five nowrap cells plus the hamburger
   measure about 500px, which used to push every page ~44px wider than a phone screen. Below
   700px only Home and the hamburger stay; the panel it opens lists all seventeen destinations. */
@media screen and (max-width:700px){
  .nav-sec{display:none}
  .head-date{display:none}
}
/* Legacy bodies only: unstack their fixed inner tables and let text wrap. */
@media screen and (max-width:820px){
  table{max-width:100%}
  table[width]:not([width$="%"]){width:auto!important}
  [width]:not(img):not(table):not(source){max-width:100%}
  td,th,nobr{white-space:normal;overflow-wrap:break-word}
  .home{grid-template-columns:1fr}
  .home-main,.home-side{grid-column:1}
  .home-side{grid-row:auto;border-top:1px solid var(--pale);padding-top:10px;margin-top:6px}
  .home-side ul{columns:2}
  .home figure{float:none;width:240px;max-width:70%;margin:0 auto 12px}
  .sec-cols{columns:1}
  .shell-main{padding:14px 14px}
}
