/* ------------------------------------------------------------------
   The Endurance Training Reference - evanscoaching.com
   Identity: deep ink navy + electric cyan + signal amber, sharp
   corners, monospace metadata. Built on Pico CSS v2 (CDN).
   All content is visible with CSS alone; JavaScript is enhancement
   only and nothing is hidden waiting on it.
   ------------------------------------------------------------------ */

:root {
  --ink-900: #05101f;
  --ink-800: #0a1834;
  --ink-700: #12244a;
  --ink-600: #1c3563;
  --cyan-500: #25c6ee;
  --cyan-600: #0f9dc2;
  --cyan-050: #e6f7fc;
  --amber-500: #e8842c;
  --paper: #ffffff;
  --paper-alt: #f4f6f9;
  --rule: #d3dae4;
  --text: #16202f;
  --text-soft: #4d5b70;

  --measure: 68ch;
  --gap: clamp(1rem, 3vw, 2rem);

  /* Pico variable overrides */
  --pico-font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --pico-primary: var(--cyan-600);
  --pico-primary-hover: var(--ink-700);
  --pico-primary-focus: rgba(37, 198, 238, 0.35);
  --pico-color: var(--text);
  --pico-border-radius: 0;
  --pico-spacing: 1rem;
  --pico-typography-spacing-vertical: 1.15rem;
}

/* Sharp corners everywhere - a deliberate callback to the original's
   table-and-block layout, and the opposite of the rounded default. */
* { border-radius: 0 !important; }

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--text);
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.68;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }

.container {
  width: 100%;
  max-width: 1180px;
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2.5rem);
}

h1, h2, h3, h4 {
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink-800);
  line-height: 1.18;
}

a { color: var(--cyan-600); text-decoration: none; border-bottom: 1px solid rgba(15, 157, 194, 0.35); }
a:hover { color: var(--ink-700); border-bottom-color: var(--ink-700); background: var(--cyan-050); }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 99;
  background: var(--ink-800); color: #fff; padding: 0.6rem 1rem; border: 0;
}
.skip:focus { left: 0; }

/* ---------------- top bar ---------------- */
/* position: sticky (never fixed) so a taller wrapped bar can never
   cover the content beneath it. */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--ink-800);
  border-bottom: 3px solid var(--cyan-500);
}
.topbar-in {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
  min-width: 0;
  padding-block: 0.65rem;
}
.brand {
  display: flex; align-items: center; gap: 0.65rem;
  border: 0; color: #fff; flex: 0 1 auto; min-width: 0;
}
.brand:hover { background: transparent; color: var(--cyan-500); }
.brand-mark {
  width: 30px; height: 30px; flex: 0 0 auto;
  background:
    linear-gradient(135deg, transparent 46%, var(--cyan-500) 46%, var(--cyan-500) 54%, transparent 54%),
    linear-gradient(45deg, transparent 46%, var(--amber-500) 46%, var(--amber-500) 54%, transparent 54%),
    var(--ink-600);
}
.brand-txt { display: flex; flex-direction: column; line-height: 1.06; min-width: 0; }
.brand-1 {
  font-family: "Space Grotesk", sans-serif; font-weight: 700;
  font-size: 0.98rem; letter-spacing: 0.01em; color: #fff;
}
.brand-2 {
  font-family: "IBM Plex Mono", ui-monospace, monospace; font-weight: 500;
  font-size: 0.68rem; letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--cyan-500);
}

/* min-width:0 + flex-wrap: the documented fix for nav links being
   pushed past the viewport and clipped. The nav wraps to a second
   line instead of disappearing, and needs no JavaScript to be
   reachable on any width. */
.topnav {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 0.15rem 0.35rem;
  list-style: none; margin: 0; padding: 0;
  min-width: 0; flex: 1 1 auto; justify-content: flex-end;
}
.topnav li { margin: 0; padding: 0; min-width: 0; }
.topnav a {
  display: block;
  color: #c9d6e8; border: 0;
  font-size: 0.9rem; font-weight: 600;
  padding: 0.35rem 0.6rem;
  border-bottom: 2px solid transparent;
}
.topnav a:hover { color: #fff; background: var(--ink-700); border-bottom-color: var(--cyan-500); }
.topnav a[aria-current="page"] { color: #fff; border-bottom-color: var(--amber-500); }

/* ---------------- hero (home) ---------------- */
.hero { position: relative; background: var(--ink-900); }
.hero .shot { margin: 0; }
.hero .shot img {
  width: 100%; height: clamp(280px, 46vh, 520px); object-fit: cover;
  opacity: 0.5;
}
.hero-in {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: center;
  padding-block: 1.5rem;
}
.hero-in h1 {
  color: #fff; margin: 0.35rem 0 0.6rem;
  font-size: clamp(1.8rem, 5vw, 3.3rem);
  max-width: 20ch;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.55);
}
.hero-in .standfirst { color: #d9e4f2; max-width: 58ch; margin: 0; }
.hero-meta {
  display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 1rem 0 0;
}
.hero-meta span {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--cyan-500); border: 1px solid rgba(37, 198, 238, 0.45);
  padding: 0.2rem 0.55rem;
}

/* Small screens: stop overlaying text on the image - stack instead,
   so nothing is ever unreadable or clipped. */
@media (max-width: 700px) {
  .hero-in { position: static; background: var(--ink-800); padding-block: 1.6rem 1.9rem; }
  .hero .shot img { height: 200px; opacity: 0.75; }
}

/* ---------------- page header band ---------------- */
.pagehead {
  background: var(--ink-800);
  background-image:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.045) 0 1px, transparent 1px 44px),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.045) 0 1px, transparent 1px 44px);
  border-bottom: 3px solid var(--cyan-500);
  padding-block: clamp(1.6rem, 5vw, 3rem);
}
.pagehead h1 {
  color: #fff; margin: 0.4rem 0 0.7rem;
  font-size: clamp(1.6rem, 4.4vw, 2.7rem);
  max-width: 24ch;
}
.pagehead .standfirst { color: #cddaea; max-width: 62ch; margin: 0; font-size: 1.02rem; }

.eyebrow {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.7rem; letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--cyan-500); margin: 0;
}

/* ---------------- article ---------------- */
main { padding-block: clamp(1.8rem, 5vw, 3.2rem) clamp(2rem, 6vw, 3.6rem); }

.prose { max-width: var(--measure); }
.prose > h2 {
  font-size: clamp(1.25rem, 2.6vw, 1.6rem);
  margin: 2.3rem 0 0.75rem;
  padding-top: 0.9rem;
  border-top: 2px solid var(--ink-800);
}
.prose > h3 {
  font-size: 1.08rem; color: var(--ink-700);
  margin: 1.7rem 0 0.5rem;
}
.prose > h3::before {
  content: ""; display: inline-block;
  width: 10px; height: 10px; margin-right: 0.55rem;
  background: var(--amber-500); vertical-align: 1px;
}
.prose p { margin: 0 0 1.05rem; }
.prose ul, .prose ol { margin: 0 0 1.25rem; padding-left: 1.25rem; }
.prose li { margin-bottom: 0.5rem; }
.prose ul { list-style: none; padding-left: 0; }
.prose ul li { position: relative; padding-left: 1.4rem; }
.prose ul li::before {
  content: ""; position: absolute; left: 0; top: 0.62em;
  width: 8px; height: 2px; background: var(--cyan-600);
}
.prose ol { counter-reset: step; list-style: none; padding-left: 0; }
.prose ol li { position: relative; padding-left: 2.1rem; counter-increment: step; }
.prose ol li::before {
  content: counter(step); position: absolute; left: 0; top: 0.1em;
  font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 0.78rem;
  color: #fff; background: var(--ink-700);
  width: 1.5rem; height: 1.5rem; display: grid; place-items: center;
}
.prose strong { color: var(--ink-800); font-weight: 600; }

figure.shot { margin: 0 0 2rem; }
figure.shot img {
  width: 100%;
  border-left: 4px solid var(--cyan-500);
}
main .prose > figure.shot { max-width: 100%; }

/* ---------------- related ---------------- */
.related {
  margin-top: 3rem; padding-top: 1.4rem;
  border-top: 2px solid var(--rule);
  max-width: 100%;
}
.related h2 {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem; letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--text-soft); font-weight: 500; margin: 0 0 0.9rem;
}
.related ul {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 0.7rem;
  grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr));
}
.related li { margin: 0; min-width: 0; }
.related a {
  display: block; min-width: 0;
  border: 1px solid var(--rule); border-left: 4px solid var(--ink-700);
  padding: 0.8rem 0.95rem; background: var(--paper-alt);
  color: var(--ink-800);
}
.related a:hover { background: var(--cyan-050); border-left-color: var(--cyan-500); }
.rel-k {
  display: block;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.64rem; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--text-soft); margin-bottom: 0.2rem;
}
.rel-t { display: block; font-weight: 600; font-size: 0.98rem; line-height: 1.35; }

/* ---------------- footer ---------------- */
.sitefoot {
  background: var(--ink-900); color: #b9c7db;
  border-top: 3px solid var(--cyan-500);
  padding-block: clamp(2rem, 5vw, 3rem) 1.6rem;
  margin-top: 2rem;
}
.foot-grid {
  display: grid; gap: 1.6rem;
  grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr));
}
.foot-col { min-width: 0; }
.foot-h {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.68rem; letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--cyan-500); font-weight: 500; margin: 0 0 0.7rem;
}
.foot-col ul { list-style: none; margin: 0; padding: 0; }
.foot-col li { margin: 0 0 0.4rem; }
.foot-col a { color: #b9c7db; border: 0; font-size: 0.93rem; }
.foot-col a:hover { color: #fff; background: transparent; text-decoration: underline; }
.foot-note {
  margin: 2rem 0 0.5rem; padding-top: 1.2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 0.84rem; color: #8ea0ba; max-width: 78ch;
}
.foot-copy {
  margin: 0;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem; letter-spacing: 0.1em; color: #6e809b;
}

/* ---------------- progress bar (enhancement only) ---------------- */
.readbar {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: var(--amber-500); z-index: 60; pointer-events: none;
  transition: width 0.08s linear;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .readbar { transition: none; }
}

@media print {
  .topbar, .sitefoot, .related, .readbar { display: none; }
  body { font-size: 11pt; }
  .pagehead { background: none; border-bottom: 1px solid #000; }
  .pagehead h1, .pagehead .standfirst, .eyebrow { color: #000; }
}
