/* The public site. Clean and straightforward for the work, with light running touches.
   The accent colour comes from the editor (Site tab) as --accent, and the route line colour as --route.
   Light or dark comes from a class on <html>: "dark", or "auto" to match the visitor's phone. */

:root {
  --ink: #141414;
  --muted: #5a5a5a;
  --paper: #f7f6f2;
  --card: #ffffff;
  --line: #e2dfd7;
  --soft: #e8e4da;
  --field-line: #9d9a92;
  --radius: 14px;
  --wide: 110rem; /* the page fills a laptop screen, up to very wide monitors */
  --gutter: clamp(1.25rem, 3.5vw, 3rem);
  --read: 40rem;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
/* Dark: near-black background, dark grey cards, like a running app at night. */
html.dark {
  --ink: #f3f3f3; --muted: #a6a6a6; --paper: #0b0b0b; --card: #1c1c1e; --line: #333335; --soft: #26262a; --field-line: #5a5a5f;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  html.auto {
    --ink: #f3f3f3; --muted: #a6a6a6; --paper: #0b0b0b; --card: #1c1c1e; --line: #333335; --soft: #26262a; --field-line: #5a5a5f;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 17px/1.6 var(--font);
  color: var(--ink);
  background: var(--paper);
}
img, video { max-width: 100%; height: auto; display: block; }
audio { width: 100%; }
a { color: inherit; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 3px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.1; letter-spacing: -0.02em; margin: 0; }
p { margin: 0 0 1em; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: -999px; top: 0; padding: 0.75rem 1rem; background: var(--ink); color: var(--paper); z-index: 10; }
.skip:focus { left: 0.5rem; top: 0.5rem; }
.small { font-size: 0.85rem; color: var(--muted); }
.empty { color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 46px; padding: 0.55rem 1.2rem; border-radius: 999px;
  border: 2px solid var(--ink); background: transparent; color: var(--ink);
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(0.92); }

/* Kilometre marker badges */
.km {
  display: inline-flex; align-items: center; gap: 0.2em;
  padding: 0.2rem 0.55rem; border-radius: 999px;
  background: var(--accent); color: var(--on-accent);
  font-size: 0.75rem; font-weight: 800; letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}

.eyebrow {
  font-size: 0.8rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted);
}

/* Route-line divider */
.route { max-width: var(--wide); margin: 2.5rem auto; padding: 0 var(--gutter); }
.route svg { display: block; width: 100%; height: 40px; overflow: visible; }
.route path { fill: none; stroke: var(--route); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.dotted .route path { stroke-dasharray: 0.5 9; }
.route circle { fill: var(--paper); stroke: var(--route); stroke-width: 3; vector-effect: non-scaling-stroke; }
.route circle.finish { fill: var(--route); }

/* Clean Work and project pages: no running route, just a thin straight line (or nothing),
   plain numbers instead of KM badges, and no coloured dots. Chosen in the Site tab. */
.clean .route svg { display: none; }
.clean.lines-straight .route { border-top: 1px solid var(--ink); opacity: 0.85; margin-top: 2.5rem; margin-bottom: 2.5rem; padding: 0; width: calc(100% - 2 * var(--gutter)); }
.clean.lines-none .route { margin: 1.5rem auto; border: 0; }
.clean .km { background: none; color: var(--muted); padding: 0; font-weight: 700; letter-spacing: 0.04em; }
.clean .km-word { display: none; }
.clean .card-media .km { background: var(--paper); color: var(--ink); padding: 0.15rem 0.45rem; border-radius: 4px; }
.clean .meta li::before { display: none; }
.clean .meta { gap: 0.35rem 0.75rem; }
.clean .meta li + li::before { display: block; content: "·"; width: auto; height: auto; background: none; border-radius: 0; }
.clean .block > h2::before { display: none; }
.clean .site-nav .me-link img { border-color: var(--line); }

/* Header and footer */
.site-head {
  max-width: var(--wide); margin: 0 auto; padding: 1rem var(--gutter);
  display: flex; flex-wrap: wrap; row-gap: 0.5rem; align-items: center; justify-content: space-between;
}
.wordmark { font-weight: 800; letter-spacing: -0.02em; text-decoration: none; font-size: 1.05rem; }
.site-foot { padding: 0 0 2rem; text-align: center; color: var(--muted); font-size: 0.9rem; }
.site-foot .route { margin-top: 4rem; }
[data-c] { cursor: default; user-select: none; padding: 0.25rem; }

/* Work page intro */
.intro { max-width: var(--wide); margin: 0 auto; padding: 2.5rem var(--gutter) 0; }
.intro h1 { font-size: clamp(2.75rem, 11vw, 6rem); font-weight: 800; letter-spacing: -0.045em; }
.lede { font-size: clamp(1.15rem, 3.4vw, 1.5rem); line-height: 1.4; max-width: 34rem; margin: 0.75rem 0 1rem; }
.meta { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.35rem 1.25rem; color: var(--muted); font-size: 0.9rem; }
.meta li { display: flex; align-items: center; gap: 0.45rem; }
.meta li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

/* Work grid */
.work { max-width: var(--wide); margin: 0 auto; padding: 0 var(--gutter); }
.work .eyebrow { margin-bottom: 1rem; }
.grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 1.5rem; }
@media (min-width: 44rem) { .grid { grid-template-columns: repeat(2, 1fr); gap: 2rem 1.5rem; } }
@media (min-width: 64rem) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 80rem) { .grid { grid-template-columns: repeat(4, 1fr); gap: 2rem 1.25rem; } }

.card a { display: block; text-decoration: none; }
.card-media {
  position: relative; aspect-ratio: 4 / 3; overflow: hidden;
  border-radius: var(--radius); background: var(--soft);
}
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.card a:hover .card-media img { transform: scale(1.03); }
.no-cover { position: absolute; inset: 0; background: repeating-linear-gradient(135deg, var(--soft) 0 12px, var(--paper) 12px 24px); }
.card-media .km { position: absolute; top: 0.75rem; left: 0.75rem; }
.card-logo {
  position: absolute; left: 0.75rem; bottom: 0.75rem;
  display: grid; place-items: center; height: 2.75rem; padding: 0.4rem 0.75rem;
  background: #fff; border-radius: 10px; box-shadow: 0 2px 10px #0002;
}
.card-logo img { max-height: 1.9rem; width: auto; max-width: 6rem; object-fit: contain; }
.card-text { padding: 0.9rem 0.15rem 0; }
.card-text h3 { font-size: 1.35rem; }
.card a:hover h3 { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 3px; text-underline-offset: 4px; }
.card-text p { margin: 0.3rem 0 0; }
.stat { display: inline-flex; gap: 0.4rem; margin-top: 0.5rem !important; font-size: 0.85rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-weight: 400; }

/* Project page */
.project { max-width: var(--wide); margin: 0 auto; padding: 1.5rem var(--gutter) 0; }
.project-head { max-width: 50rem; }
.project-head .eyebrow { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1.25rem; }
.project-logo img { max-height: 3.5rem; width: auto; max-width: 10rem; object-fit: contain; margin-bottom: 1rem; }
.project-head h1 { font-size: clamp(2.25rem, 8vw, 4.5rem); font-weight: 800; letter-spacing: -0.04em; }
.project-head .meta { display: block; }

/* Stats shown like run splits */
.splits {
  display: flex; flex-wrap: wrap; gap: 0; margin: 1.5rem 0 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.splits div { padding: 0.75rem 1.5rem 0.75rem 0; margin-right: 1.5rem; }
.splits div + div { padding-left: 1.5rem; border-left: 1px solid var(--line); }
.splits dt { font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.splits dd { margin: 0; font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; }

.hero { margin: 2rem 0 0; }
.hero { background: var(--soft); border-radius: var(--radius); display: grid; place-items: center; overflow: hidden; }
.hero img { width: auto; max-width: 100%; max-height: 80vh; }

.project-body { margin-top: 1rem; }
.block { padding: 2rem 0 0; }
.block > h2 {
  display: flex; align-items: center; gap: 0.6rem;
  font-size: 0.8rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted);
  margin-bottom: 0.75rem;
}
.block > h2::before { content: ""; width: 9px; height: 9px; border-radius: 50%; border: 2.5px solid var(--accent); }
.block > p, .block > dl { max-width: var(--read); }
.block p { font-size: 1.1rem; }

.process { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: 1rem; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 44rem) { .process { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 64rem) { .process { grid-template-columns: repeat(4, 1fr); } }
.process img { border-radius: 10px; background: #fff; }
figure { margin: 0; }
figcaption { font-size: 0.9rem; color: var(--muted); margin-top: 0.5rem; }

.executions { list-style: none; padding: 0; margin: 0; display: grid; gap: 2rem 1.25rem; }
@media (min-width: 44rem) { .executions { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 64rem) { .executions { grid-template-columns: repeat(3, 1fr); } }
/* Every image sits in the same-sized frame: the whole image shows, never stretched or cropped. */
.frame {
  display: grid; place-items: center; width: 100%; aspect-ratio: 4 / 3; padding: 0.6rem; border: 0; margin: 0;
  background: var(--soft); border-radius: var(--radius); cursor: zoom-in; overflow: hidden;
}
.frame img { width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; background: transparent !important; }
.frame:hover img { transform: scale(1.02); transition: transform 0.3s ease; }
.zoom { max-width: calc(100% - 1rem); max-height: calc(100% - 1rem); width: auto; padding: 0; background: transparent; }
.zoom img { max-width: 100%; max-height: calc(100vh - 5rem); width: auto; height: auto; margin: 0 auto; border-radius: 8px; }
.zoom form { text-align: right; margin: 0 0 0.5rem; }
.exec-media video { width: 100%; border-radius: var(--radius); background: #000; }
.piece figcaption { max-width: var(--read); font-size: 1rem; color: var(--ink); margin-top: 0.75rem; }
.piece figcaption p { margin: 0.25rem 0; }
/* The finished pieces: rows where every piece is the same height (by its shape), stacked on phones. */
.exec-stack { display: grid; gap: 2rem; }
.exec-row { display: flex; flex-direction: column; gap: 1.5rem; }
@media (min-width: 44rem) {
  .exec-row { flex-direction: row; align-items: flex-start; gap: 1.25rem; }
  .exec-row .piece { flex: var(--r) 1 0; min-width: 0; }
}
.exec-row.single .piece { width: 100%; max-width: min(100%, calc(82vh * var(--r))); margin: 0 auto; }
.zoomable { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: var(--radius); overflow: hidden; }
.zoomable img { width: 100%; height: auto; display: block; transition: transform 0.35s ease; }
.zoomable:hover img { transform: scale(1.015); }
.exec-grid { display: grid; gap: 1.5rem 1.25rem; }
@media (min-width: 44rem) { .exec-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 64rem) { .exec-grid { grid-template-columns: repeat(3, 1fr); } }
.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.tag {
  padding: 0.15rem 0.6rem; border-radius: 999px; border: 2px solid var(--ink);
  font-size: 0.75rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
}
.where { color: var(--muted); font-size: 0.9rem; }

.credits { margin: 0; }
.credits div { display: grid; grid-template-columns: minmax(7rem, 12rem) 1fr; gap: 1rem; padding: 0.6rem 0; border-bottom: 1px solid var(--line); }
.credits dt { color: var(--muted); }
.credits dd { margin: 0; font-weight: 600; }

.share { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin: 3rem 0 0; }
.share-status { color: var(--muted); font-size: 0.9rem; }
.kudos { display: inline-flex; align-items: center; gap: 0.4rem; }
.kudos svg { opacity: 0.35; }
.kudos[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.kudos[aria-pressed="true"] svg { opacity: 1; }
.hello { font-weight: 700; color: var(--accent); margin: 0 0 0.25rem; }
.made-for { order: 3; flex-basis: 100%; display: flex; align-items: center; gap: 0.5rem; margin: 0; font-size: 0.85rem; color: var(--muted); }
.made-for img { height: 1.5rem; width: auto; max-width: 5rem; object-fit: contain; }
@media (min-width: 44rem) { .made-for { order: 0; flex-basis: auto; margin: 0 auto 0 1rem; padding-left: 1rem; border-left: 1px solid var(--line); } }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 2.5rem 0 0; }
.pager a {
  display: flex; flex-direction: column; gap: 0.2rem; padding: 1rem 1.1rem;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; font-weight: 800; line-height: 1.25;
}
.pager a:hover { border-color: var(--ink); }
.pager .next { text-align: right; }
.back { margin: 1.5rem 0 0; }

/* Header navigation (Work / Me) */
.site-nav { display: flex; align-items: center; gap: 1rem; font-weight: 700; font-size: 0.95rem; }
.site-nav a { text-decoration: none; padding: 0.35rem 0; border-bottom: 2px solid transparent; }
.site-nav a[aria-current="page"] { border-bottom-color: var(--accent); }
.me-link { display: inline-flex; align-items: center; gap: 0.45rem; }
.site-nav .me-link img { width: 2rem; height: 2rem; border-radius: 50%; object-fit: cover; object-position: 50% var(--photo-y, 20%); border: 2px solid var(--accent); }

/* Me: the athlete profile, laid out like a running app */
.me { max-width: 40rem; margin: 0 auto; padding: 1rem 1.25rem 0; }
.athlete-top { display: flex; align-items: center; gap: 1.1rem; }
.avatar {
  position: relative; flex: none; width: 6.5rem; height: 6.5rem; margin: 0; border-radius: 50%; overflow: hidden;
  border: 3px solid var(--accent); background: var(--soft); display: grid; place-items: center;
  font-size: 2.5rem; font-weight: 800;
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% var(--photo-y, 20%); }
.athlete-id { min-width: 0; }
.athlete h1 { font-size: clamp(1.75rem, 7vw, 2.5rem); font-weight: 800; letter-spacing: -0.025em; overflow-wrap: anywhere; }
.location { display: flex; align-items: center; gap: 0.3rem; color: var(--muted); margin: 0.3rem 0 0; }
.icon { width: 1.1em; height: 1.1em; fill: none; stroke: currentColor; stroke-width: 2; }
.bio { margin: 1.25rem 0 0; }
.athlete-links { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: 0.6rem; }
.athlete-links .btn { width: 100%; }
.btn.small { min-height: 40px; padding: 0.35rem 0.95rem; font-size: 0.9rem; }
.btn.ghost { border-color: var(--line); }
.on-me .btn.ghost { background: var(--card); }
.on-me .btn.ghost:hover { border-color: var(--ink); color: var(--ink); }

/* Stats and the weekly chart sit on cards: big numbers over small labels */
.athlete-stats, .weeks { background: var(--card); border: 1px solid var(--line); border-radius: 18px; margin: 1.25rem 0 0; }
.dark .athlete-stats, .dark .weeks { border-color: transparent; }
/* Stats: evenly spaced across the card with thin dividers, a big number and a small unit. */
.athlete-stats { display: grid; grid-template-columns: repeat(var(--n-phone), 1fr); padding: 1.1rem 0.25rem; row-gap: 1.1rem; }
@media (min-width: 36rem) { .athlete-stats { grid-template-columns: repeat(var(--n), 1fr); } }
.athlete-stats div { padding: 0 1rem; border-left: 1px solid var(--line); min-width: 0; display: flex; flex-direction: column; justify-content: space-between; }
.athlete-stats div:first-child { border-left: 0; }
@media (max-width: 35.99rem) { .athlete-stats div:nth-child(3n + 1) { border-left: 0; } }
.athlete-stats dt, .week-now dt { font-size: 0.8rem; color: var(--muted); line-height: 1.3; }
.athlete-stats dd { margin: 0.25rem 0 0; display: flex; align-items: baseline; gap: 0.15rem; white-space: nowrap; }
@media (max-width: 35.99rem) { .athlete-stats div { padding: 0 0.7rem; } .stat-u { font-size: 0.8rem; } }
.stat-n { font-size: clamp(1.5rem, 6vw, 1.9rem); line-height: 1; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-u { font-size: 0.95rem; font-weight: 700; color: var(--muted); }
.week-now dd { margin: 0.25rem 0 0; display: flex; align-items: baseline; gap: 0.2rem; flex-wrap: wrap; }
.week-now .stat-n { font-size: clamp(1.3rem, 5vw, 1.6rem); }
.weeks { padding: 1.1rem 1.25rem 0.9rem; }
.weeks h2 { font-size: 1.35rem; font-weight: 800; margin: 0 0 0.75rem; }
.week-now { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 0; }
.weeks-label { font-size: 0.85rem; color: var(--muted); margin: 1.1rem 0 0.25rem; }
.week-chart { display: block; width: 100%; height: auto; overflow: visible; }
.week-chart .grid { stroke: var(--line); stroke-width: 1; }
.week-chart .axis { fill: var(--muted); font: 600 9px/1 var(--font); }
.week-chart .trend { fill: none; stroke: var(--route); stroke-width: 2.5; stroke-linejoin: round; }
.week-chart circle { fill: var(--card); stroke: var(--route); stroke-width: 2.5; }
.week-chart circle.now { fill: var(--route); stroke: color-mix(in srgb, var(--route) 35%, transparent); stroke-width: 6; }
.week-chart .now-line { stroke: var(--ink); stroke-width: 2; }

/* Journey: a recorded activity */
.journey h2, .book h2, .playlist h2 { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 0.75rem; }
.activity-summary {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr)); gap: 0.5rem; margin: 0 0 0.75rem;
}
.activity-summary div { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 0.6rem 0.8rem; }
.activity-summary dt { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.activity-summary dd { margin: 0; font-weight: 800; font-size: 1.1rem; }
.journey-map { --row: 6.5rem; position: relative; height: calc(var(--stops) * var(--row)); margin-top: 1rem; }
.journey-line { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.journey-line path { fill: none; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.journey-line .ghost { stroke: var(--line); stroke-width: 4; }
.journey-line .drawn { stroke: var(--route); stroke-width: 4; stroke-dasharray: 1; stroke-dashoffset: 0; }
.stops { list-style: none; margin: 0; padding: 0; position: relative; }
.stops li { position: relative; height: var(--row); }
.stop {
  position: absolute; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; gap: 0.7rem; padding: 0.3rem; border: 0; background: none;
  font: inherit; color: inherit; text-align: left; cursor: pointer; max-width: 70%;
}
.left .stop { left: calc(28% - 0.95rem); }
.right .stop { right: calc(28% - 0.95rem); flex-direction: row-reverse; text-align: right; }
.dot {
  flex: none; width: 1.3rem; height: 1.3rem; border-radius: 50%;
  background: var(--paper); border: 4px solid var(--line); transition: border-color 0.3s, background 0.3s;
}
.reached .dot, .no-draw .dot { border-color: var(--accent); }
.latest .dot { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 25%, transparent); }
.stop-label { display: flex; flex-direction: column; background: var(--paper); padding: 0.15rem 0.35rem; border-radius: 6px; }
.stop-label strong { line-height: 1.2; }
.stop-label span { font-size: 0.85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.stop:hover strong { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; }

/* Pop-up cards (journey stops, process book pages) */
dialog { border: 0; padding: 0; background: transparent; max-width: min(40rem, calc(100% - 1.5rem)); width: 100%; }
dialog::backdrop { background: #000a; }
.sheet-body { background: var(--card); border-radius: var(--radius); padding: 1.25rem; max-height: 85vh; overflow: auto; }
.sheet-body img { border-radius: 10px; margin-bottom: 1rem; width: 100%; }
.sheet-body h3 { font-size: 1.5rem; margin: 0.25rem 0 0.75rem; }

/* CV pop-up (computers only; phones open the PDF on its own) */
.cv-viewer { max-width: min(60rem, calc(100% - 2rem)); }
.cv-body { background: var(--card); border-radius: var(--radius); padding: 0.75rem; }
.cv-bar { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.6rem; }
.cv-bar h2 { font-size: 1rem; margin-right: auto; }
.cv-bar form { margin: 0; }
.cv-body iframe { display: block; width: 100%; height: 78vh; border: 0; border-radius: 8px; background: #fff; }

/* Training log: the process books, folded away at the bottom of the Me page */
.training-log { margin: 3.5rem 0 0; border-top: 1px solid var(--line); }
.training-log summary {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: 1rem 0;
  cursor: pointer; list-style: none; color: var(--muted);
}
.training-log summary::-webkit-details-marker { display: none; }
.training-log summary::after { content: "+"; font-weight: 800; color: var(--route); font-size: 1.2rem; line-height: 1; }
.training-log[open] summary::after { content: "\2212"; }
.log-title { font-size: 0.8rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.log-count { margin-left: auto; font-size: 0.85rem; }
.training-log summary:hover .log-title { color: var(--ink); }
.log-books { list-style: none; margin: 0; padding: 0 0 0 1.1rem; border-left: 3px solid var(--route); }
.log-book { position: relative; display: flex; gap: 0.9rem; align-items: center; padding: 0.75rem 0; }
.log-book::before { content: ""; position: absolute; left: calc(-1.1rem - 8px); top: 50%; width: 13px; height: 13px; margin-top: -6.5px; border-radius: 50%; background: var(--paper); border: 3px solid var(--route); }
.log-week { font-size: 0.75rem; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.log-cover img { width: 4rem; height: 4rem; object-fit: cover; border-radius: 8px; }
.log-text { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.log-label { font-size: 0.8rem; color: var(--muted); }
.log-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.35rem; }
.log-viewer { max-width: min(64rem, calc(100% - 0.75rem)); width: 100%; }
.log-viewer-body { background: var(--card); border-radius: var(--radius); padding: 0.6rem; }
.log-viewer .cv-bar { flex-wrap: wrap; }
.log-viewer-count { font-size: 0.85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.log-stage { position: relative; display: grid; place-items: center; background: #111; border-radius: 8px; min-height: 40vh; }
.log-stage img { max-height: 68vh; width: auto; max-width: 100%; height: auto; }
.log-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: rgba(0,0,0,0.55); color: #fff; cursor: pointer; display: grid; place-items: center;
}
.log-nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.log-nav.prev { left: 0.4rem; }
.log-nav.next { right: 0.4rem; }
.log-thumbs { list-style: none; margin: 0.6rem 0 0; padding: 0 0 0.3rem; display: flex; gap: 0.4rem; overflow-x: auto; }
.log-thumbs button { padding: 0; border: 2px solid transparent; border-radius: 5px; background: none; cursor: pointer; display: block; }
.log-thumbs button[aria-current] { border-color: var(--route); }
.log-thumbs li { flex: none; }
.log-thumbs img { width: 90px; height: 60px; max-width: none; object-fit: cover; border-radius: 3px; display: block; background: var(--soft); }
.canva-viewer { max-width: min(60rem, calc(100% - 1rem)); }
.canva-viewer iframe { display: block; width: 100%; aspect-ratio: 16 / 10; max-height: 75vh; border: 0; border-radius: 8px; background: #111; }

/* Process book: a photo strip */
.book, .playlist { margin-top: 3rem; }
.strip { list-style: none; padding: 0 0 0.5rem; margin: 0; display: flex; gap: 0.6rem; overflow-x: auto; scroll-snap-type: x mandatory; }
.strip li { flex: none; scroll-snap-align: start; }
.strip-item { display: block; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 10px; overflow: hidden; }
.strip-item img { height: 11rem; width: auto; max-width: none; }
.book-cover img { max-width: 16rem; border-radius: 10px; box-shadow: 0 6px 24px #0002; margin-bottom: 1rem; }
.viewer { max-width: min(60rem, calc(100% - 1rem)); }
.viewer-body { background: var(--card); border-radius: var(--radius); padding: 0.75rem; }
.viewer-body img { max-height: 70vh; width: auto; margin: 0 auto; }
.viewer-caption { text-align: center; color: var(--muted); margin: 0.5rem 0 0; min-height: 1.2em; }
.viewer-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.5rem; margin-top: 0.5rem; }
.viewer-controls form { margin: 0; }
.spotify iframe { width: 100%; height: 352px; border: 0; border-radius: 12px; }

/* The game */
.avatar-game { padding: 0; cursor: pointer; font: inherit; color: inherit; position: relative; }
.avatar-game:hover { transform: translateY(-2px) rotate(-3deg); transition: transform 0.2s; }
.game-hint {
  display: inline-flex; align-items: center; gap: 0.4rem; margin: 0.45rem 0 0;
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.game-hint::before { content: ""; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--accent); animation: hint 1.6s ease-in-out infinite; }
@keyframes hint { 50% { transform: scale(1.6); opacity: 0.5; } }
body.game-open { overflow: hidden; }
.game { --ink: #141414; --muted: #5a5a5a; --line: #e2dfd7; --card: #fff; color: var(--ink); color-scheme: light; position: fixed; inset: 0; z-index: 100; background: #f7f6f2; touch-action: none; user-select: none; -webkit-user-select: none; }
.game.pop { animation: game-pop 0.55s cubic-bezier(.2,.8,.2,1); }
@keyframes game-pop { from { clip-path: circle(2.5rem at var(--from-x) var(--from-y)); } to { clip-path: circle(150% at var(--from-x) var(--from-y)); } }
.game canvas { display: block; width: 100%; height: 100%; }
.game-hud {
  position: absolute; top: max(0.75rem, env(safe-area-inset-top)); left: 0.75rem; display: flex; gap: 0.4rem; flex-wrap: wrap;
  font-weight: 800; font-variant-numeric: tabular-nums;
}
.game-hud span { background: #141414; color: #fff; padding: 0.3rem 0.7rem; border-radius: 999px; font-size: 0.95rem; }
.game-hud .hud-boost { background: var(--accent); color: var(--on-accent); }
.game-buttons { position: absolute; top: max(0.75rem, env(safe-area-inset-top)); right: 0.75rem; display: flex; gap: 0.4rem; }
.game-btn { min-height: 44px; padding: 0.3rem 0.9rem; border-radius: 999px; border: 2px solid #141414; background: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.game-panel { position: absolute; inset: 0; display: grid; place-items: center; padding: 4.5rem 1rem 1rem; background: #f7f6f2cc; overflow: auto; }
.game-panel[hidden] { display: none; }
.game-card { width: min(28rem, 100%); background: #fff; border: 2px solid #141414; border-radius: 18px; padding: 1.25rem; box-shadow: 0 10px 40px #0002; }
.game-card h2 { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; margin: 0.25rem 0 0.6rem; }
.game-card h3 { font-size: 1rem; margin: 1rem 0 0.4rem; }
.game-card .how { padding-left: 1.1rem; margin: 0.5rem 0; }
.game-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.run-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin: 0.75rem 0; }
.run-stats div { background: #fff; padding: 0.6rem 0.75rem; }
.run-stats dt { font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.run-stats dd { margin: 0; font-size: 1.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.pb { margin: 0.25rem 0; }
.pb strong { color: var(--accent); }
.board { list-style: none; counter-reset: rank; padding: 0; margin: 0; font-variant-numeric: tabular-nums; }
.board li { counter-increment: rank; display: grid; grid-template-columns: 2rem 1fr auto; padding: 0.3rem 0; border-bottom: 1px solid var(--line); font-weight: 700; }
.board li::before { content: counter(rank); color: var(--muted); }
.board-agency { font-weight: 400; font-size: 0.8rem; color: var(--muted); }
.board-leads { font-size: 0.9rem; margin: 0 0 0.5rem; }
.initials { margin-bottom: 0.75rem; }
.initials label { display: block; font-weight: 700; margin-bottom: 0.3rem; }
.initials div { display: flex; gap: 0.5rem; }
.initials input { width: 6rem; min-height: 46px; padding: 0.4rem 0.6rem; font: inherit; font-size: 1.3rem; font-weight: 800; letter-spacing: 0.2em; text-transform: uppercase; border: 2px solid #141414; border-radius: 10px; }

/* Preview banner (used from step 4) */
.preview-banner {
  position: sticky; top: 0; z-index: 20; padding: 0.6rem 1rem; text-align: center;
  background: var(--ink); color: var(--paper); font-size: 0.9rem; font-weight: 600;
}

/* Feedback, crits and the privacy page */
.under-work { max-width: var(--wide); margin: 3rem auto 0; padding: 0 var(--gutter); display: flex; flex-wrap: wrap; gap: 0.75rem; }
.quick-feedback { margin: 3rem 0 0; padding: 1.25rem; border: 1px solid var(--line); border-radius: 12px; background: var(--card); max-width: 40rem; }
.quick-feedback.standalone { border: 0; padding: 0; background: none; margin-top: 0; }
.quick-feedback .eyebrow { margin: 0 0 0.25rem; }
.verdicts { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.75rem 0 0; }
.verdict[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.feedback-more { margin-top: 1rem; }
.form-page { max-width: 44rem; }
.form-page h1 { font-size: clamp(2.25rem, 8vw, 3.75rem); }
.field { margin: 0 0 1rem; }
.field label { display: block; font-weight: 700; font-size: 0.95rem; margin-bottom: 0.3rem; }
.field input, .field select, .field textarea {
  width: 100%; font: inherit; padding: 0.65rem 0.75rem; border: 1.5px solid var(--field-line); border-radius: 8px; background: var(--card); color: var(--ink);
}
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; border-color: var(--ink); }
.field-row { display: grid; gap: 0 1rem; }
@media (min-width: 36rem) { .field-row { grid-template-columns: 1fr 1fr; } }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-status { min-height: 1.5em; margin: 0.75rem 0 0; font-weight: 600; }
.crit-form { margin-top: 1.5rem; }
.form-page h2.eyebrow { margin-top: 2rem; }
.prose { max-width: 44rem; }
.prose h2 { font-size: 1.25rem; margin: 2rem 0 0.5rem; }
.prose ul { padding-left: 1.2rem; }
.prose li { margin: 0.3rem 0; }
.opt-out { margin: 1.5rem 0; padding: 1rem 1.25rem; border-left: 4px solid var(--accent); background: var(--card); border-radius: 0 8px 8px 0; }
.opt-out p { margin: 0 0 0.75rem; }
.latest-run { margin: 0.75rem 0 0; }
.trip { width: min(100%, 26rem); height: auto; display: block; margin: 0 0 1rem; }
.trip line, .trip path, .trip rect, .trip circle { fill: none; stroke: var(--ink); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.trip .ground { stroke: var(--line); }
.trip .board rect { fill: var(--card); }
.trip text { font: 800 20px/1 system-ui, sans-serif; fill: var(--accent); stroke: none; letter-spacing: 0.08em; }
.trip .head { fill: var(--accent); stroke: var(--accent); }
.trip .runner path { stroke: var(--accent); }
.trip .stars path { fill: var(--ink); stroke: none; transform-box: fill-box; transform-origin: center; animation: dizzy 1.6s ease-in-out infinite alternate; }
.trip .stars path:nth-child(2) { animation-delay: 0.3s; }
.trip .stars path:nth-child(3) { animation-delay: 0.6s; }
@keyframes dizzy { from { transform: translateY(0) rotate(0deg); opacity: 0.5; } to { transform: translateY(-4px) rotate(20deg); opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .trip .stars path { animation: none; }
  .game-hint::before { animation: none; }
  .avatar-game:hover { transform: none; }
  .journey-line .drawn { stroke-dashoffset: 0 !important; }
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .card a:hover .card-media img { transform: none; }
}

/* The game's own page (behind the game, and what shows if scripts are off) */
.game-page { max-width: 40rem; margin: 0 auto; padding: 3rem var(--gutter, 1.25rem); text-align: center; }
.game-page h1 { font-size: clamp(2.25rem, 9vw, 3.5rem); font-weight: 800; letter-spacing: -0.03em; margin-bottom: 0.75rem; }
.game-page .btn { margin: 1rem 0; }
