/* ==========================================================================
   PacePot v5, shared foundation (app, landing and every static page).
   The world is an athletics track: a green track, painted white lines,
   one yellow pace light per goal. Colour does jobs; nothing here is a glow.
   ========================================================================== */

@font-face {
  font-family: "Big Shoulders";
  src: url("/assets/fonts/big-shoulders.woff2") format("woff2");
  font-weight: 800 900;
  font-display: swap;
}
@font-face {
  font-family: "Schibsted";
  src: url("/assets/fonts/schibsted.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}
@font-face {
  font-family: "Schibsted";
  src: url("/assets/fonts/schibsted-italic.woff2") format("woff2");
  font-weight: 400 600;
  font-style: italic;
  font-display: swap;
}

/* Lane positions are registered so they can transition: a runner moves
   from where it was to where it is, rather than jumping. */
@property --you { syntax: "<number>"; inherits: true; initial-value: 0; }
@property --pace { syntax: "<number>"; inherits: true; initial-value: 0; }

:root {
  --track: #1d5a3a;
  --track-deep: #15462d;
  --track-alt: #194f33;
  --paint: #fff8f1;
  --paint-2: #d9e6dd;
  --ink: #17130f;
  --ink-2: #4a4540;
  --ink-3: #6b665f;
  --ground: #eef0ec;
  --paper: #ffffff;
  --paper-2: #f6f7f4;
  --rule: #dcdfd8;
  --rule-strong: #b8bdb3;
  --lamp: #ffd21f;
  --lamp-deep: #e0b000;
  --lamp-soft: #fff1b8;
  --lamp-ink: #5c4300;
  --ahead: #1f6a3c;
  --ahead-soft: #e2efe4;
  --danger: #b3261e;
  --danger-soft: #fbe6e3;

  --display: "Big Shoulders", "Arial Narrow", sans-serif;
  --text: "Schibsted", system-ui, -apple-system, "Segoe UI", sans-serif;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --pill: 999px;
  --shadow-1: 0 1px 2px rgba(23, 19, 15, .07);
  --shadow-2: 0 2px 4px rgba(23, 19, 15, .05), 0 10px 24px -10px rgba(23, 19, 15, .22);
  --shadow-3: 0 4px 10px rgba(23, 19, 15, .08), 0 28px 60px -20px rgba(23, 19, 15, .4);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease: cubic-bezier(.3, .7, .2, 1);
  --gutter: clamp(16px, 4vw, 56px);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 96px; }
body {
  margin: 0;
  font-family: var(--text);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
[hidden] { display: none !important; }
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4, h5 { margin: 0; line-height: 1.1; text-wrap: balance; }
p { margin: 0; }
a { color: inherit; text-underline-offset: .2em; text-decoration-thickness: 1.5px; }
a:hover { text-decoration-thickness: 2.5px; }
::selection { background: var(--lamp); color: var(--ink); }
:focus-visible { outline: 3px solid var(--track); outline-offset: 3px; border-radius: 6px; }
.on-track :focus-visible, .on-track:focus-visible { outline-color: var(--lamp); }
.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; }
.display { font-family: var(--display); font-weight: 900; text-transform: uppercase; letter-spacing: .005em; line-height: .9; }
.nums { font-variant-numeric: lining-nums; }

/* ---------- logo ---------- */
.logo { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--paint); }
.logo svg { width: 32px; height: 32px; flex: none; }
.logo b { font: 900 28px/1 var(--display); text-transform: uppercase; letter-spacing: .01em; }
.logo:hover { text-decoration: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 46px; padding: 12px 22px; border-radius: var(--pill); border: 0;
  font: 700 16px/1.1 var(--text); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .16s var(--ease-out), background-color .16s, color .16s, box-shadow .16s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-lamp { background: var(--lamp); color: var(--ink); }
.btn-lamp:hover { background: #ffdb4d; }
.btn-ink { background: var(--ink); color: var(--paint); }
.btn-ink:hover { background: #000; }
.btn-paint { background: var(--paint); color: var(--ink); }
.btn-paint:hover { background: #fff; }
.btn-line { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--rule-strong); }
.btn-line:hover { box-shadow: inset 0 0 0 2px var(--ink); }
.on-track .btn-line { color: var(--paint); box-shadow: inset 0 0 0 2px rgba(255, 248, 241, .55); }
.on-track .btn-line:hover { box-shadow: inset 0 0 0 2px var(--paint); }

/* ---------- the race bib (the one object) ---------- */
.bib {
  position: relative; background: var(--paper); color: var(--ink);
  border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-2);
}
.bib-pin {
  position: absolute; z-index: 1; width: 10px; height: 10px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff 0 18%, #b9bec2 45%, #7d8388 100%);
  box-shadow: 0 1px 1px rgba(0, 0, 0, .3);
}
.bib-pin:nth-of-type(1) { top: 9px; left: 9px; }
.bib-pin:nth-of-type(2) { top: 9px; right: 9px; }
.bib-pin:nth-of-type(3) { bottom: 9px; left: 9px; }
.bib-pin:nth-of-type(4) { bottom: 9px; right: 9px; }
.bib-band {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--track); color: var(--paint); padding: 9px 30px 8px;
  font: 900 18px/1 var(--display); text-transform: uppercase; letter-spacing: .04em;
}
.bib-band svg { width: 20px; height: 20px; }
.bib-number {
  display: flex; justify-content: center; align-items: flex-start;
  font: 900 112px/.82 var(--display); letter-spacing: -.01em; font-variant-numeric: tabular-nums;
}
.bib-number small { font-size: .42em; line-height: 1; margin: .12em .04em 0 0; }

/* ---------- lanes (dashboard, goals, landing, calculators) ---------- */
.lane-run { position: relative; min-width: 0; }
.lane-run .light-trail {
  position: absolute; left: 0; bottom: 10px; height: 6px;
  width: calc(var(--pace) * 100%);
  background: repeating-linear-gradient(90deg, var(--lamp) 0 9px, transparent 9px 14px);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 45%);
  mask-image: linear-gradient(90deg, transparent, #000 45%);
}
.lane-run .light-head {
  position: absolute; bottom: 4px; left: clamp(15px, calc(var(--pace) * 100%), calc(100% - 15px));
  width: 26px; height: 18px; margin-left: -13px;
  background: var(--lamp); border: 2px solid var(--lamp-deep); border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
}
.lane-run .runner {
  position: absolute; top: 50%; left: clamp(40px, calc(var(--you) * 100%), calc(100% - 40px));
  transform: translate(-50%, -62%);
  background: var(--paper); color: var(--ink); border-radius: 6px; padding: 6px 10px 5px;
  font: 800 19px/1 var(--display); letter-spacing: .01em; font-variant-numeric: tabular-nums;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .25); white-space: nowrap;
}
.lane-run .runner::before, .lane-run .runner::after {
  content: ""; position: absolute; top: 4px; width: 4px; height: 4px; border-radius: 50%; background: var(--rule-strong);
}
.lane-run .runner::before { left: 4px; }
.lane-run .runner::after { right: 4px; }

[data-lane-id] { transition: --you 1.3s var(--ease-out), --pace 1.3s var(--ease-out); }
@media (prefers-reduced-motion: reduce) {
  [data-lane-id] { transition: none; }
  .btn { transition: none; }
}

.lane-fin { position: relative; }
.lane-fin::before {
  content: ""; position: absolute; left: -6px; top: 0; bottom: 0; width: 6px;
  background: repeating-linear-gradient(180deg, var(--paint) 0 6px, var(--ink) 6px 12px);
}
.arrow { display: inline-block; width: 1em; height: 1em; vertical-align: -.14em; flex: none; }

/* ---------- site header for static pages and the landing ---------- */
.site-nav {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 20px var(--gutter);
}
.site-nav ul { list-style: none; display: flex; align-items: center; gap: 28px; margin: 0; padding: 0; }
.site-nav ul a:not(.btn) { text-decoration: none; font-weight: 600; font-size: 16px; color: var(--paint); }
.site-nav ul a:not(.btn):hover { text-decoration: underline; }
.site-nav ul a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--lamp); text-decoration-thickness: 3px; }
.site-nav .btn { min-height: 42px; padding: 10px 18px; }
@media (max-width: 640px) {
  .site-nav ul { gap: 16px; }
  .site-nav ul li.nav-hide-sm { display: none; }
}

/* ---------- footer (finish line) ---------- */
.finish {
  background: var(--track-deep); color: var(--paint);
  border-top: 8px solid var(--paint);
  padding: 36px var(--gutter) 40px;
}
.finish-in { max-width: 1312px; margin: 0 auto; display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
.finish .logo b { font-size: 26px; }
.finish p { margin-top: 10px; font-size: 15px; max-width: 46ch; color: var(--paint-2); }
.finish p a { color: var(--paint); font-weight: 700; text-decoration-color: var(--lamp); }
.finish nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 22px; justify-content: flex-end; }
.finish nav a, .finish nav button {
  font: 600 15px/1.4 var(--text); color: var(--paint); background: none; border: 0; padding: 0; cursor: pointer;
  text-decoration: underline; text-decoration-color: rgba(255, 248, 241, .4); text-underline-offset: .25em;
}
.finish nav a:hover, .finish nav button:hover { text-decoration-color: var(--lamp); }
@media (max-width: 760px) {
  .finish-in { grid-template-columns: 1fr; }
  .finish nav ul { justify-content: flex-start; }
}
