/* Wayne Coates – Running Adventures : shared site styles */
:root {
  --bg: #f7f3ec;
  --surface: #ffffff;
  --surface-2: #f1ebe1;
  --ink: #1d2327;
  --muted: #5d6870;
  --line: #e2d9cb;
  --accent: #c0532a;      /* desert terracotta */
  --accent-ink: #ffffff;
  --sky: #1c7288;         /* nod to the original blue */
  --shadow: 0 1px 2px rgba(40,30,20,.06), 0 4px 16px rgba(40,30,20,.06);
  --radius: 12px;
  --maxw: 1180px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15191c; --surface: #1d2327; --surface-2: #242b30;
    --ink: #ece7df; --muted: #a3acb2; --line: #333c42;
    --accent: #e0774b; --sky: #5bb3c8;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0 !important;
  background: var(--bg) !important;
  color: var(--ink) !important;
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
/* neutralise old presentational markup */
font[face], .style1, .style2, .style3 { font-family: inherit !important; }
font[color] { color: inherit !important; }
center, [align="center"] { text-align: center; }
a { color: var(--sky); text-underline-offset: 2px; }
a:hover { color: var(--accent); }
img { max-width: 100%; height: auto; border: 0; }
p { margin: .35em 0; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.15; margin: .4em 0; letter-spacing: -.01em; }

/* ---------- header ---------- */
.wcr-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.wcr-header-in {
  max-width: var(--maxw); margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.wcr-brand {
  font-weight: 800; letter-spacing: -.01em; color: var(--ink); text-decoration: none;
  display: flex; align-items: center; gap: 10px; white-space: nowrap;
}
.wcr-brand svg { flex: none; }
.wcr-brand small { display: block; font-weight: 500; color: var(--muted); font-size: .75rem; letter-spacing: .04em; text-transform: uppercase; }
.wcr-nav { display: flex; flex-wrap: wrap; gap: 4px; margin-left: auto; }
.wcr-nav a {
  text-decoration: none; color: var(--ink); font-size: .92rem; font-weight: 600;
  padding: 6px 10px; border-radius: 999px;
}
.wcr-nav a:hover { background: var(--surface-2); color: var(--accent); }
.wcr-nav a[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }
.wcr-menu-btn { display: none; }
@media (max-width: 820px) {
  .wcr-menu-btn {
    display: inline-flex; margin-left: auto; background: none; border: 1px solid var(--line);
    color: var(--ink); border-radius: 8px; padding: 6px 10px; font: inherit; font-weight: 600; cursor: pointer;
  }
  .wcr-nav { display: none; width: 100%; margin: 0; padding-bottom: 6px; }
  .wcr-header.open .wcr-nav { display: flex; }
}

/* ---------- main content ---------- */
.wcr-main { max-width: var(--maxw); margin: 0 auto; padding: 24px 16px 48px; }
.wcr-main p { overflow-wrap: break-word; }
.wcr-main > div[align="center"] > p:first-child font[size],
.wcr-main > p:first-child font[size],
.wcr-main font[size="7"], .wcr-main font[size="+7"], .wcr-main font[size="6"] {
  font-size: clamp(1.8rem, 4.5vw, 2.6rem) !important; font-weight: 800; letter-spacing: -.01em; line-height: 1.15;
}
.wcr-main font[size="5"] { font-size: 1.5rem !important; }
.wcr-main font[size="4"] { font-size: 1.25rem !important; }

/* tables: all old layout tables become clean cards */
.wcr-main table {
  border-collapse: separate !important; border-spacing: 0 !important;
  background: var(--surface); border: 1px solid var(--line) !important;
  border-radius: var(--radius); box-shadow: var(--shadow);
  margin: 16px auto; max-width: 100%; width: auto !important;
}
.wcr-main table.wcr-racelist { width: 100% !important; }
.wcr-racelist td:first-child { width: 42%; }
.wcr-main td img { max-width: none; }
.wcr-main td, .wcr-main th {
  border: 0 !important; border-bottom: 1px solid var(--line) !important;
  padding: 12px 14px !important; vertical-align: top; background: transparent !important;
}
.wcr-main tr:last-child > td { border-bottom: 0 !important; }
.wcr-main th { background: var(--surface-2) !important; font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.wcr-main tr:first-child > th:first-child { border-top-left-radius: var(--radius); }
.wcr-main tr:first-child > th:last-child { border-top-right-radius: var(--radius); }
.wcr-main td img { border-radius: 6px; margin: 3px; vertical-align: middle; transition: transform .15s, box-shadow .15s; }
.wcr-main a:hover img { transform: translateY(-2px); box-shadow: var(--shadow); }

/* race list pages: first line of each race is its name */
.wcr-racelist td:first-child > p:first-child,
.wcr-racelist td:first-child > p[align]:first-child { font-weight: 700; font-size: 1.05rem; color: var(--ink); }
.wcr-racelist td:first-child p { color: var(--muted); }
.wcr-racelist td:first-child p:first-child { color: var(--ink); }
.wcr-racelist tr:hover > td { background: color-mix(in srgb, var(--surface-2) 55%, transparent) !important; }

/* data tables scroll sideways on small screens */
.wcr-scroll { overflow-x: auto; margin: 16px 0; -webkit-overflow-scrolling: touch; }
.wcr-scroll > table { margin: 0 auto; }
.wcr-data td, .wcr-data th { text-align: center; white-space: nowrap; padding: 8px 12px !important; }
.wcr-data tr:nth-child(even) > td { background: color-mix(in srgb, var(--surface-2) 60%, transparent) !important; }
.wcr-data tr:last-child > td { font-weight: 800; background: var(--surface-2) !important; }

/* stacked race cards on phones */
@media (max-width: 700px) {
  .wcr-racelist, .wcr-racelist tbody, .wcr-racelist tr, .wcr-racelist td { display: block; width: 100% !important; }
  .wcr-racelist tr { border-bottom: 1px solid var(--line); }
  .wcr-racelist tr:last-child { border-bottom: 0; }
  .wcr-racelist td { border-bottom: 0 !important; padding: 10px 14px !important; }
  .wcr-racelist td img { max-width: 44%; }
  .wcr-gallery, .wcr-gallery tbody, .wcr-gallery tr { display: block; }
  .wcr-gallery tr { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
  .wcr-gallery td { flex: 1 1 50%; border-bottom: 0 !important; }
  .wcr-gallery td img { max-width: 100%; }
}

/* big chart pages (comparisons / times) */
.wcr-main > img[width="1000"], .wcr-main img[width="1000"] {
  display: block; margin: 20px auto; background: #fff; padding: 8px;
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}

/* ---------- footer ---------- */
.wcr-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
.wcr-footer-in { max-width: var(--maxw); margin: 0 auto; padding: 20px 16px 32px; display: flex; gap: 16px; flex-wrap: wrap; justify-content: space-between; }
.wcr-footer a { color: var(--muted); }

/* ---------- lightbox ---------- */
.wcr-lb {
  position: fixed; inset: 0; z-index: 100; display: none;
  background: rgba(10,12,14,.92); align-items: center; justify-content: center; padding: 48px 12px;
}
.wcr-lb.show { display: flex; }
.wcr-lb img { max-width: 100%; max-height: 100%; border-radius: 6px; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.wcr-lb button {
  position: absolute; background: rgba(255,255,255,.12); color: #fff; border: 0;
  width: 44px; height: 44px; border-radius: 50%; font-size: 22px; cursor: pointer; line-height: 1;
}
.wcr-lb button:hover { background: rgba(255,255,255,.25); }
.wcr-lb .lb-close { top: 12px; right: 12px; }
.wcr-lb .lb-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.wcr-lb .lb-next { right: 12px; top: 50%; transform: translateY(-50%); }
.wcr-lb .lb-cap { position: absolute; bottom: 12px; left: 0; right: 0; text-align: center; color: #ddd; font-size: .9rem; padding: 0 60px; }

/* ---------- home page ---------- */
.home-hero {
  position: relative; overflow: hidden;
  background: linear-gradient(160deg, #1c7288 0%, #2d5f6e 45%, #c0532a 130%);
  color: #fff; border-radius: 20px; padding: clamp(28px, 6vw, 64px); margin-bottom: 28px;
}
.home-hero h1 { margin: 0 0 6px; font-size: clamp(2rem, 6vw, 3.4rem); }
.home-hero .kicker { text-transform: uppercase; letter-spacing: .12em; font-size: .8rem; opacity: .85; font-weight: 700; }
.home-hero p.lede { max-width: 62ch; font-size: 1.08rem; line-height: 1.65; opacity: .95; margin-top: 14px; }
.home-hero svg.ridge { position: absolute; left: 0; right: 0; bottom: -1px; width: 100%; height: 70px; opacity: .25; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin: -8px 0 32px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 1.7rem; line-height: 1.1; color: var(--accent); font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .85rem; }
.section-title { font-size: 1.25rem; margin: 30px 0 12px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.card {
  display: block; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); transition: transform .15s, border-color .15s;
}
.card:hover { transform: translateY(-3px); border-color: var(--accent); color: var(--ink); }
.card h3 { margin: 0 0 4px; font-size: 1.1rem; display: flex; align-items: center; gap: 8px; }
.card p { margin: 0; color: var(--muted); font-size: .92rem; }
.card .dist { margin-left: auto; font-size: .75rem; font-weight: 700; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); padding: 2px 8px; border-radius: 999px; }
.wcr-main a:has(img) { text-decoration: none; }
