/* ==========================================================================
   Avantrex – site-wide stylesheet
   One stylesheet for every page. Content width is capped at 1000px.
   ========================================================================== */

:root {
  --max: 1000px;
  --gutter: 16px;
  --bg: #eef1f5;
  --surface: #ffffff;
  --text: #1e2530;
  --muted: #5d6673;
  --line: #d9dee6;
  --brand: #17365f;        /* deep navy from the Avantrex logo */
  --brand-2: #1f4f8a;
  --link: #1a56a8;
  --link-visited: #6a3d91;
  --accent: #2e7d4f;       /* earth green */
  --notice-bg: #fff6e0;
  --notice-line: #e2b450;
  --dead: #a33a3a;
  --radius: 8px;
  /* One serif family everywhere (content, headings, menu and footer) */
  --serif: Georgia, "Times New Roman", Times, serif;
  --sans: var(--serif);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-wrap: break-word;
}

.wrap {
  width: 100%;
  max-width: var(--max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--brand); color: #fff; padding: .5rem 1rem; z-index: 100;
  font-family: var(--sans);
}
.skip-link:focus { left: 1rem; top: 1rem; }

/* ---------- Header ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .5rem 1.5rem; padding-top: 14px; padding-bottom: 12px;
}
.brand { display: block; line-height: 0; flex: 0 1 460px; }
.brand img { width: 100%; max-width: 460px; height: auto; border-radius: 4px; }
.memorial {
  margin: 0; flex: 1 1 260px; max-width: 420px;
  font-family: var(--serif); font-style: italic; font-size: .95rem; line-height: 1.45;
  color: var(--muted); text-align: right;
}

/* ---------- Main navigation ---------- */
.site-nav { background: var(--brand); font-family: var(--sans); position: relative; z-index: 20; }
.nav-inner { position: relative; }
.menu { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; }
.menu > li { position: relative; display: flex; align-items: stretch; }
.menu a { text-decoration: none; }
.menu > li > a {
  display: block; padding: .8rem .7rem; color: #fff;
  font-size: .9rem; font-weight: 600; letter-spacing: .01em; white-space: nowrap;
}
.menu > li > a:hover, .menu > li > a:focus-visible,
.menu > li.active > a, .menu > li > a[aria-current="page"] { background: var(--brand-2); }
.menu > li.active > a { box-shadow: inset 0 -3px 0 #9cc3f0; }

.sub-toggle {
  display: none; border: 0; background: transparent; color: #fff; cursor: pointer;
  width: 2.75rem; font: inherit;
}
.sub-toggle::before {
  content: ""; display: inline-block; width: .5rem; height: .5rem;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px); transition: transform .15s;
}
.sub-toggle[aria-expanded="true"]::before { transform: rotate(-135deg) translateY(-2px); }

.sub {
  list-style: none; margin: 0; padding: .5rem 0;
  position: absolute; left: 0; top: 100%; min-width: 16rem;
  background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--brand-2);
  border-radius: 0 0 var(--radius) var(--radius); box-shadow: 0 10px 24px rgba(15, 30, 55, .18);
  display: none;
}
.sub.cols-2 { column-count: 2; min-width: 30rem; }
.sub.cols-3 { column-count: 3; min-width: 44rem; }
.sub li { break-inside: avoid; }
.sub a {
  display: block; padding: .35rem 1rem; color: var(--text); font-size: .88rem; line-height: 1.35;
}
.sub a:hover, .sub a:focus-visible { background: #eaf1fb; color: var(--brand); }
.sub a[aria-current="page"] { font-weight: 700; color: var(--brand); }
.menu > li:nth-last-child(-n+4) > .sub { left: auto; right: 0; }
@media (min-width: 901px) {
  /* multi-column menus span the whole navigation bar so they never run off-screen */
  .menu > li:has(> .sub.cols-2), .menu > li:has(> .sub.cols-3) { position: static; }
  .sub.cols-2, .sub.cols-3 { left: var(--gutter); right: var(--gutter); min-width: 0; }
  .sub.cols-2 { column-count: 2; }
}

@media (hover: hover) and (min-width: 901px) {
  .menu > li.has-sub:hover > .sub { display: block; }
}
@media (min-width: 901px) {
  .menu > li.has-sub:focus-within > .sub, .menu > li.has-sub.open > .sub { display: block; }
}

.nav-toggle {
  display: none; align-items: center; gap: .6rem;
  border: 0; background: transparent; color: #fff; cursor: pointer;
  font: 600 1rem var(--sans); padding: .8rem 0;
}
.nav-toggle .bars, .nav-toggle .bars::before, .nav-toggle .bars::after {
  display: block; width: 22px; height: 2px; background: currentColor; position: relative; content: "";
}
.nav-toggle .bars::before { position: absolute; top: -7px; }
.nav-toggle .bars::after  { position: absolute; top: 7px; }

/* Mobile / tablet navigation */
@media (max-width: 900px) {
  .js .nav-toggle { display: inline-flex; }
  .js .menu { display: none; }
  .js .site-nav.open .menu { display: block; padding-bottom: .5rem; }
  .menu > li { flex-wrap: wrap; border-top: 1px solid rgba(255, 255, 255, .12); }
  .menu > li > a { flex: 1; padding: .75rem .25rem; font-size: 1rem; }
  .js .sub-toggle { display: block; }
  .sub, .sub.cols-2, .sub.cols-3 {
    position: static; width: 100%; min-width: 0; column-count: 1;
    border: 0; border-radius: 0; box-shadow: none; background: rgba(255, 255, 255, .06);
  }
  .js .sub { display: none; }
  .js .has-sub.open > .sub { display: block; }
  .sub a { color: #e6eefa; padding: .55rem 1rem .55rem 1.25rem; font-size: .95rem; }
  .sub a:hover, .sub a:focus-visible { background: rgba(255, 255, 255, .1); color: #fff; }
  .sub a[aria-current="page"] { color: #fff; }
  .memorial { text-align: left; max-width: none; }
}
@media (max-width: 900px) {
  html:not(.js) .sub { display: block; }
}

/* ---------- Main content ---------- */
.site-main { padding-top: 1.25rem; padding-bottom: 2.5rem; }

.breadcrumb {
  font-family: var(--sans); font-size: .85rem; color: var(--muted); margin: 0 0 .75rem;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb .sep { margin: 0 .35rem; }

.content {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2rem 2.5rem;
  box-shadow: 0 1px 2px rgba(15, 30, 55, .05);
}
@media (max-width: 640px) {
  .content { padding: 1.25rem 1rem; border-radius: 0; border-left: 0; border-right: 0; margin: 0 calc(-1 * var(--gutter)); }
}

.content > :first-child { margin-top: 0; }

/* Typography inside articles */
.content h1, .content h2, .content h3, .content h4, .content h5, .content h6 {
  font-family: var(--sans); color: var(--brand); line-height: 1.25; margin: 1.6em 0 .6em;
}
.content h1 { font-size: 1.85rem; }
.content h2 { font-size: 1.5rem; }
.content h3 { font-size: 1.25rem; }
.content h4 { font-size: 1.1rem; }
.content h5, .content h6 { font-size: 1rem; }
.content p { margin: 0 0 1em; }
.content ul, .content ol { padding-left: 1.6em; margin: 0 0 1em; }
.content li { margin: .2em 0; }
.content blockquote {
  margin: 1em 0; padding: .5em 1.2em; border-left: 4px solid var(--line); background: #f7f9fc;
}
.content blockquote blockquote { background: transparent; border-left-color: #e8ecf2; }
.content hr { border: 0; border-top: 1px solid var(--line); margin: 1.75em auto; width: 100%; }
.content pre { white-space: pre-wrap; font-size: .9em; }
.content sup, .content sub { line-height: 0; }

/* Legacy font sizes, mapped to a calm scale (size 3 is normal text) */
.fs-1 { font-size: .78em; }
.fs-2 { font-size: .9em; }
.fs-4 { font-size: 1.12em; }
.fs-5 { font-size: 1.3em; line-height: 1.35; }
.fs-6 { font-size: 1.6em; line-height: 1.25; color: var(--brand); }
.fs-7 { font-size: 1.9em; line-height: 1.2; color: var(--brand); }
.fs-6 .fs-4, .fs-6 .fs-2, .fs-7 .fs-4 { font-size: 1em; }   /* nested legacy fonts shouldn't compound */
.fs-5 .fs-5, .fs-6 .fs-6, .fs-7 .fs-7, .fs-6 .fs-5, .fs-7 .fs-6 { font-size: 1em; }
.fs-4 .fs-4, .fs-4 .fs-5 { font-size: 1em; }

.center { text-align: center; }
.right { text-align: right; }
.center > table, table.center { margin-left: auto; margin-right: auto; }

/* Links */
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:visited { color: var(--link-visited); }
a:hover { color: var(--brand); text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible { outline: 3px solid #f3b33d; outline-offset: 2px; }

/* External links open in a new tab and carry a ↗ marker */
a[target="_blank"]::after {
  content: "\00a0\2197";
  content: "\00a0\2197" / " (opens in a new tab)";
  font-size: .85em; text-decoration: none; display: inline-block;
}
a[target="_blank"]:has(> img)::after { content: none; }   /* no marker under linked pictures */

.dead-link {
  font-family: var(--sans); font-size: .72em; font-weight: 600; color: var(--dead);
  white-space: nowrap; vertical-align: .1em;
}

/* Images & media */
img { max-width: 100%; height: auto; vertical-align: middle; }
.float-left  { float: left;  margin: .3em 1.2em .8em 0; max-width: 50%; }
.float-right { float: right; margin: .3em 0 .8em 1.2em; max-width: 50%; }
.content::after { content: ""; display: table; clear: both; }
/* Photos floated beside the text (marathon pages, book cover) */
figure.photo { margin: .35em 0 1em; max-width: 45%; clear: both; }   /* never two photos side by side */
figure.photo.float-right { float: right; margin-left: 1.5em; }
figure.photo.float-left  { float: left;  margin-right: 1.5em; }
figure.photo img { display: block; max-width: 100%; height: auto; border-radius: 4px; box-shadow: 0 1px 4px rgba(15, 30, 55, .18); }
figure.photo.pair { display: flex; gap: .5rem; align-items: flex-start; max-width: 52%; }
figure.photo.pair img { width: calc(50% - .25rem); }
figure.photo figcaption { font-size: .85rem; line-height: 1.4; color: var(--muted); margin-top: .45em; }
figure.photo figcaption .fs-1, figure.photo figcaption .fs-2 { font-size: 1em; }
figure.video { margin: 1.25em auto; max-width: 720px; }
figure.video video { width: 100%; height: auto; background: #000; border-radius: 6px; display: block; }
figure.video figcaption { font-family: var(--sans); font-size: .9rem; color: var(--muted); margin-top: .4em; text-align: center; }

/* Tables: legacy layout tables vs real data tables */
table { border-collapse: collapse; max-width: 100%; }
table.layout { width: 100%; margin: 1em 0; }
table.layout td, table.layout th { vertical-align: top; padding: .5rem .75rem; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 1em 0; }
table.data { margin: 0 auto; font-size: .95em; }
table.data td, table.data th { border: 1px solid var(--line); padding: .45rem .65rem; vertical-align: top; text-align: left; }
table.data th { background: #f1f4f8; font-family: var(--sans); }
table.data tr:nth-child(even) td { background: #fafbfd; }

@media (max-width: 700px) {
  table.layout, table.layout > tbody, table.layout > tbody > tr, table.layout > tbody > tr > td,
  table.layout > tbody > tr > th, table.layout > thead, table.layout > thead > tr, table.layout > thead > tr > th {
    display: block; width: 100% !important;
  }
  table.layout td, table.layout th { padding: .35rem 0; }
  .float-left:not(figure), .float-right:not(figure) { float: none; display: block; margin: 1em auto; max-width: 100%; }
}
@media (max-width: 480px) {
  figure.photo, figure.photo.float-left, figure.photo.float-right { float: none; max-width: 100%; margin: 1em auto; width: fit-content; }
}

/* ---------- Home page (memorial) ---------- */
.tribute-hero {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 2rem 2.5rem; align-items: center;
  margin: 0 0 2.5rem; padding-bottom: 2.25rem; border-bottom: 1px solid var(--line);
}
.tribute-photo { margin: 0; }
.tribute-photo img { display: block; width: 100%; height: auto; border-radius: 6px; box-shadow: 0 6px 24px rgba(15, 30, 55, .22); }
.content .tribute-kicker { margin: 0 0 .3rem; font-size: .85rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.content .tribute-intro h1 { margin: 0; font-size: 2.3rem; line-height: 1.15; }
.content .tribute-dates { margin: .35rem 0 .75rem; font-size: 1.2rem; color: var(--muted); }
.content .tribute-roles { margin: 0 0 1.25rem; font-style: italic; color: var(--brand-2); line-height: 1.5; }
.explore-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 1rem; margin: 1.25rem 0 .5rem; }
.content a.explore-card {
  display: block; text-decoration: none; color: var(--text);
  border: 1px solid var(--line); border-top: 4px solid var(--brand-2); border-radius: var(--radius);
  padding: 1rem 1.1rem; background: #fbfcfe; transition: box-shadow .15s, transform .15s, border-color .15s;
}
.content a.explore-card:hover, .content a.explore-card:focus-visible {
  box-shadow: 0 6px 18px rgba(15, 30, 55, .14); transform: translateY(-2px); border-top-color: var(--accent);
}
.explore-title { display: block; font-size: 1.15rem; font-weight: 700; color: var(--brand); margin-bottom: .3rem; }
.explore-text { display: block; font-size: .93rem; line-height: 1.5; color: var(--muted); }
@media (max-width: 760px) {
  .tribute-hero { grid-template-columns: 1fr; }
  .tribute-photo { max-width: 420px; margin: 0 auto; }
  .content .tribute-intro h1 { font-size: 1.9rem; }
}

/* ---------- Music and Running section pages ---------- */
.music-item, .running-item { margin: 0 0 1.5rem; }
.content .music-item h2, .content .running-item h2 { margin: 0 0 .35rem; font-size: 1.3rem; }
.music-item h2 a, .running-item h2 a { text-decoration: none; }
.music-item h2 a:hover, .running-item h2 a:hover { text-decoration: underline; }
.content .music-item p, .content .running-item p { margin: 0; }
.running-list { clear: both; margin-top: 1.75rem; }

/* ---------- Race history page ---------- */
.runner-card {
  display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem 2rem;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.5rem; margin: 0 0 2rem;
  background: #f7f9fc;
}
.runner-photo {
  width: 132px; height: 132px; object-fit: cover; object-position: center 20%;
  border-radius: 50%; border: 6px solid #1aa3e8; box-shadow: 0 0 0 5px #fff, 0 1px 6px rgba(15, 30, 55, .25);
}
.runner-body { flex: 1 1 420px; }
.content .runner-name { font-size: 1.9rem; font-weight: 700; color: var(--brand); margin: 0; line-height: 1.2; }
.content .runner-meta { color: var(--muted); margin: .15rem 0 1rem; }
.content .stat-heading { margin: 0 0 .35rem; }
.runner-stats { display: flex; flex-wrap: wrap; gap: 1rem 2.5rem; }
.stat-heading { font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 .35rem; }
.stats { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; margin: 0; }
.stats > div { min-width: 6.5rem; border-top: 1px solid var(--line); padding-top: .35rem; }
.stats dt { font-size: .85rem; color: var(--muted); }
.stats dd { margin: 0; font-size: 1.6rem; font-weight: 700; line-height: 1.2; color: var(--text); }
.stats dd.sub { font-size: .78rem; font-weight: 400; color: var(--muted); }

.pr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 1.25rem 2rem; margin: 0 0 2rem; }
.pr p { margin: 0; }
.pr-dist { font-size: .85rem; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: .2rem; margin-bottom: .3rem !important; }
.pr-time { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.pr-top { font-size: .8rem; font-weight: 400; color: var(--muted); }
.pr-race { font-size: .9rem; font-weight: 700; line-height: 1.3; }
.pr-date { font-size: .8rem; color: var(--muted); }

table.results { width: 100%; font-size: .92em; }
table.results th, table.results td { text-align: center; vertical-align: middle; }
table.results thead th { font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
table.results td.event { text-align: left; }
table.results .race-name { display: block; font-weight: 700; }
table.results .race-meta { display: block; font-size: .85em; color: var(--muted); }
table.results .of { display: block; font-size: .78em; color: var(--muted); }
table.results td.final { font-weight: 700; white-space: nowrap; }
table.results tr.year-row th {
  text-align: left; background: var(--brand); color: #fff; font-size: 1.05rem; letter-spacing: .04em; padding: .4rem .65rem;
}
table.results tr:nth-child(even) td { background: #fafbfd; }
.source-note { font-size: .85rem; color: var(--muted); margin-top: 1.5rem; }

@media (max-width: 640px) {
  .runner-card { padding: 1rem; }
  table.results, table.results tbody, table.results tr, table.results td, table.results th { display: block; width: 100%; }
  table.results thead { display: none; }
  table.results tr { border: 1px solid var(--line); border-radius: 6px; margin: 0 0 .6rem; padding: .5rem .65rem; }
  table.results tr.year-row { border: 0; padding: 0; margin-top: 1rem; }
  table.results td { border: 0; padding: .15rem 0; text-align: left; display: flex; justify-content: space-between; gap: 1rem; background: none !important; }
  table.results td.event { display: block; padding-bottom: .35rem; }
  table.results td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: .85em; }
  table.results .of { display: inline; margin-left: .3em; }
  .table-scroll:has(> table.results) { overflow: visible; }
}

/* Historical notice for business-opportunity pages */
.historical-notice {
  font-family: var(--sans); font-size: .95rem; line-height: 1.5;
  background: var(--notice-bg); border: 1px solid var(--notice-line); border-left-width: 6px;
  border-radius: var(--radius); padding: .85rem 1.1rem; margin: 0 0 1.5rem;
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--brand); color: #d6e2f3; font-family: var(--sans); font-size: .9rem;
  padding: 1.5rem 0; text-align: center;
}
.site-footer p { margin: .25rem 0; }
.site-footer a { color: #fff; }
.site-footer a:visited { color: #fff; }
.copyright { color: #b5c6de; }

/* ---------- Print ---------- */
@media print {
  .site-nav, .skip-link, .breadcrumb, .sub-toggle { display: none !important; }
  body { background: #fff; font-size: 11pt; }
  .content { border: 0; box-shadow: none; padding: 0; }
  .site-footer { background: none; color: #444; }
  .site-footer a { color: #444; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .8em; color: #555; }
}
