/*
  RunRise Jozi shared stylesheet.
  Tokens and components are documented in /docs/03-design-system.md
  and /docs/08-ui-kit-component-library.md.
*/

/* Font: Archivo variable (weight 100 to 900), Latin subset, SIL OFL 1.1.
   Licence text is in /assets/fonts/OFL.txt */
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/archivo-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Colour */
  --rr-yellow: #f9e550;
  --rr-ink: #0f0f0f;
  --rr-charcoal: #222222;
  --rr-paper: #f4f4f4;
  --rr-white: #ffffff;
  --rr-chip: #e0e0e0;
  --rr-muted-on-dark: #b3b3b3;
  --rr-muted-on-light: #5c5c5c;
  --rr-border-input: #767676;
  --rr-error-on-light: #a40000;

  /* Type */
  --rr-font: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --rr-text-display: clamp(2rem, 8vw, 5rem);
  --rr-text-h1: clamp(1.75rem, 6vw, 2.5rem);
  --rr-text-h2: clamp(1.5rem, 5vw, 2.5rem);
  --rr-text-h3: 1.25rem;
  --rr-text-lead: 1.2rem;
  --rr-text-body: 1rem;
  --rr-text-small: 0.875rem;
  --rr-text-micro: 0.75rem;
  --rr-text-stat: 2rem;

  /* Space */
  --rr-space-1: 4px;
  --rr-space-2: 8px;
  --rr-space-3: 12px;
  --rr-space-4: 16px;
  --rr-space-5: 24px;
  --rr-space-6: 32px;
  --rr-space-7: 48px;
  --rr-space-8: 64px;

  /* Shape */
  --rr-radius-s: 4px;
  --rr-radius-m: 6px;
  --rr-radius-l: 8px;
  --rr-radius-xl: 12px;
  --rr-rule: 5px solid var(--rr-yellow);
  --rr-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);

  /* Layout */
  --rr-width-content: 900px;
  --rr-width-tool: 400px;

  /* Set per surface. Dark is the default. */
  --rr-focus: var(--rr-white);
  --rr-outline-hover-bg: var(--rr-white);
  --rr-outline-hover-fg: var(--rr-ink);
}

.rr-surface-light {
  --rr-focus: var(--rr-ink);
  --rr-outline-hover-bg: var(--rr-ink);
  --rr-outline-hover-fg: var(--rr-white);
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background-color: var(--rr-ink);
  color: var(--rr-white);
  font-family: var(--rr-font);
  font-size: var(--rr-text-body);
  line-height: 1.6;
}

main {
  flex: 1 0 auto;
}

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

a {
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--rr-focus);
  outline-offset: 3px;
}

/* Utilities */
.rr-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;
}

.rr-highlight {
  color: var(--rr-yellow);
}

.rr-micro {
  margin: 0;
  font-size: var(--rr-text-micro);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--rr-muted-on-light);
}

/* Skip link */
.rr-skip {
  position: absolute;
  left: var(--rr-space-4);
  top: -100px;
  z-index: 10;
  padding: var(--rr-space-3) var(--rr-space-4);
  background: var(--rr-yellow);
  color: var(--rr-ink);
  font-weight: 700;
  text-decoration: none;
  border-radius: var(--rr-radius-m);
}

.rr-skip:focus {
  top: var(--rr-space-4);
}

/* Site header */
.rr-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--rr-space-2) var(--rr-space-5);
  width: 100%;
  max-width: var(--rr-width-content);
  margin: 0 auto;
  padding: var(--rr-space-3) var(--rr-space-5);
}

.rr-header--home {
  justify-content: center;
}

.rr-logo {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.rr-logo img {
  display: block;
}

.rr-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 var(--rr-space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

.rr-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-decoration: none;
  border-bottom: 3px solid transparent;
}

.rr-nav a:hover {
  color: var(--rr-yellow);
}

.rr-nav a[aria-current="page"] {
  border-bottom-color: var(--rr-yellow);
}

@media (max-width: 599px) {
  .rr-header {
    justify-content: center;
    padding-left: var(--rr-space-4);
    padding-right: var(--rr-space-4);
  }

  /* Four links sit as a tidy two by two grid on phones */
  .rr-nav--main {
    display: grid;
    grid-template-columns: repeat(2, auto);
    justify-items: center;
    column-gap: var(--rr-space-6);
  }
}

@media (min-width: 600px) {
  .rr-nav {
    column-gap: var(--rr-space-5);
  }
}

/* Hero */
.rr-hero {
  min-height: 80vh;
  min-height: 80svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: var(--rr-space-5);
  background:
    linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)),
    url("/runrise-background.jpg") center / cover;
}

.rr-hero__logo {
  display: block;
  margin: 0 0 var(--rr-space-4);
}

.rr-display {
  margin: 0 0 var(--rr-space-6);
  font-size: var(--rr-text-display);
  font-weight: 900;
  line-height: 0.95;
  text-transform: uppercase;
  text-wrap: balance;
}

.rr-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--rr-space-4);
}

.rr-hero__new {
  margin: var(--rr-space-5) 0 0;
  font-weight: 700;
}

.rr-hero__new a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration-color: var(--rr-yellow);
  text-decoration-thickness: 3px;
  text-underline-offset: 6px;
}

.rr-hero__new a:hover {
  color: var(--rr-yellow);
}

/* Buttons */
.rr-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: var(--rr-space-4) var(--rr-space-6);
  background: var(--rr-yellow);
  color: var(--rr-ink);
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-transform: uppercase;
  text-decoration: none;
  border: 2px solid transparent;
  border-radius: var(--rr-radius-m);
  cursor: pointer;
  transition: transform 0.2s;
}

.rr-btn:hover {
  transform: scale(1.05);
}

.rr-btn:active {
  transform: scale(0.98);
}

.rr-btn--outline {
  background: transparent;
  color: inherit;
  border-color: currentColor;
}

.rr-btn--outline:hover {
  background: var(--rr-outline-hover-bg);
  color: var(--rr-outline-hover-fg);
  border-color: var(--rr-outline-hover-bg);
  transform: none;
}

.rr-btn--dark {
  background: var(--rr-ink);
  color: var(--rr-white);
  font-weight: 900;
  letter-spacing: 1px;
}

.rr-btn--block {
  display: flex;
  width: 100%;
}

.rr-btn--block:hover {
  transform: none;
}

.rr-btn--small {
  padding: var(--rr-space-3) var(--rr-space-5);
  font-size: var(--rr-text-small);
}

/* Sections */
.rr-section {
  max-width: var(--rr-width-content);
  margin: 0 auto;
  padding: var(--rr-space-8) var(--rr-space-5);
}

.rr-section--tight {
  padding-top: 0;
}

.rr-heading {
  margin: 0 0 var(--rr-space-6);
  padding-left: var(--rr-space-4);
  font-size: var(--rr-text-h2);
  font-weight: 900;
  line-height: 1.1;
  text-transform: uppercase;
  border-left: var(--rr-rule);
}

.rr-lead {
  max-width: 65ch;
  margin: 0;
  font-size: var(--rr-text-lead);
}

/* Run cards */
.rr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--rr-space-5);
  margin: 0;
  padding: 0;
  list-style: none;
}

.rr-run {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: var(--rr-space-5);
  background: var(--rr-charcoal);
  border-radius: var(--rr-radius-l);
  border-bottom: 3px solid transparent;
  transition: border-color 0.3s;
}

.rr-run:hover {
  border-bottom-color: var(--rr-yellow);
}

.rr-run__when {
  display: flex;
  align-items: center;
  gap: var(--rr-space-2);
  margin: 0 0 var(--rr-space-3);
  color: var(--rr-yellow);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.rr-run__when svg {
  flex: none;
}

.rr-run__where {
  margin: 0 0 var(--rr-space-2);
  font-size: var(--rr-text-h3);
  font-weight: 700;
  line-height: 1.3;
}

.rr-run__distance {
  margin: 0 0 var(--rr-space-2);
}

.rr-run__note {
  margin: 0 0 var(--rr-space-5);
  font-size: var(--rr-text-small);
  color: var(--rr-muted-on-dark);
}

.rr-run .rr-btn {
  margin-top: auto;
}

/* Reading pages */
.rr-prose > * {
  max-width: 65ch;
}

.rr-prose h1.rr-heading {
  font-size: var(--rr-text-h1);
  margin-bottom: var(--rr-space-5);
}

.rr-prose h2:not(.rr-heading) {
  margin: var(--rr-space-7) 0 var(--rr-space-2);
  font-size: var(--rr-text-h3);
  font-weight: 800;
  line-height: 1.3;
}

.rr-prose p,
.rr-prose ul {
  margin: 0 0 var(--rr-space-4);
}

.rr-prose ul {
  padding-left: 1.25rem;
}

.rr-prose li {
  margin-bottom: var(--rr-space-1);
}

.rr-prose li::marker {
  color: var(--rr-yellow);
}

.rr-prose time {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.rr-prose__cta {
  margin-top: var(--rr-space-7);
}

.rr-prose__note {
  margin: var(--rr-space-3) 0 0;
  font-size: var(--rr-text-small);
  color: var(--rr-muted-on-dark);
}

.rr-callout {
  margin: var(--rr-space-5) 0 0;
  padding: var(--rr-space-4) var(--rr-space-5);
  background: var(--rr-charcoal);
  border-left: var(--rr-rule);
  border-radius: 0 var(--rr-radius-l) var(--rr-radius-l) 0;
}

.rr-callout p {
  margin: 0;
}

.rr-faq {
  border-bottom: 1px solid #3d3d3d;
}

.rr-faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--rr-space-4);
  min-height: 44px;
  padding: var(--rr-space-3) 0;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.rr-faq summary::-webkit-details-marker {
  display: none;
}

.rr-faq summary::after {
  content: "+";
  flex: none;
  color: var(--rr-yellow);
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 1;
}

.rr-faq[open] summary::after {
  content: "\2212";
}

.rr-faq summary:hover {
  color: var(--rr-yellow);
}

.rr-faq p {
  margin: 0 0 var(--rr-space-4);
  color: var(--rr-muted-on-dark);
}

/* Tool pages */
.rr-tool-main {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: var(--rr-space-5) var(--rr-space-4) var(--rr-space-7);
}

.rr-panel {
  width: 100%;
  max-width: var(--rr-width-tool);
  padding: var(--rr-space-6);
  background: var(--rr-paper);
  color: var(--rr-ink);
  border-radius: var(--rr-radius-xl);
  box-shadow: var(--rr-shadow);
}

.rr-panel h1 {
  margin: 0 0 var(--rr-space-4);
  font-size: clamp(1.5rem, 7vw, 2rem);
  letter-spacing: -1px;
}

.rr-panel__intro {
  margin: 0 0 var(--rr-space-5);
  font-size: 0.9rem;
  color: var(--rr-muted-on-light);
}

.rr-field {
  margin: 0 0 var(--rr-space-5);
}

fieldset.rr-field {
  min-width: 0;
  padding: 0;
  border: 0;
}

.rr-field label,
.rr-field legend {
  display: block;
  margin-bottom: var(--rr-space-2);
  padding: 0;
  font-size: var(--rr-text-small);
  font-weight: 700;
}

.rr-field input {
  width: 100%;
  min-height: 44px;
  padding: var(--rr-space-3);
  background: var(--rr-white);
  color: var(--rr-ink);
  font: inherit;
  border: 1px solid var(--rr-border-input);
  border-radius: var(--rr-radius-m);
}

.rr-field input[aria-invalid="true"] {
  border: 2px solid var(--rr-error-on-light);
}

.rr-chips {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--rr-space-2);
  margin-bottom: var(--rr-space-3);
}

.rr-chip {
  min-height: 44px;
  padding: 0;
  background: var(--rr-chip);
  color: var(--rr-ink);
  font: inherit;
  font-size: var(--rr-text-micro);
  font-weight: 800;
  border: 0;
  border-radius: var(--rr-radius-s);
  cursor: pointer;
}

.rr-chip:hover {
  background: var(--rr-ink);
  color: var(--rr-white);
}

.rr-time {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--rr-space-2);
}

.rr-time > div {
  min-width: 0;
}

.rr-error {
  min-height: 1.5rem;
  margin: calc(-1 * var(--rr-space-3)) 0 var(--rr-space-3);
  color: var(--rr-error-on-light);
  font-size: var(--rr-text-small);
  font-weight: 700;
}

.rr-result {
  margin-top: var(--rr-space-4);
  padding: var(--rr-space-4);
  background: var(--rr-white);
  border-left: 6px solid var(--rr-yellow);
  border-radius: var(--rr-radius-l);
}

.rr-result__empty {
  margin: 0;
  font-size: 0.9rem;
  color: var(--rr-muted-on-light);
}

.rr-result__title {
  display: inline-block;
  margin: 0 0 var(--rr-space-1);
  font-size: 1rem;
  border-bottom: 2px solid var(--rr-yellow);
}

.rr-result__note {
  margin: var(--rr-space-3) 0 0;
  font-size: var(--rr-text-small);
  color: var(--rr-muted-on-light);
}

.rr-stat {
  margin: var(--rr-space-2) 0 0;
  font-size: var(--rr-text-stat);
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.rr-stat small {
  font-size: 1.1rem;
  font-weight: 400;
}

.rr-predictions {
  margin: 0;
}

.rr-prediction {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--rr-space-3);
  padding: var(--rr-space-3) 0;
  border-bottom: 1px solid #eeeeee;
}

.rr-prediction dt {
  display: flex;
  flex-direction: column;
  font-weight: 800;
}

.rr-prediction dd {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.rr-panel__back {
  margin-top: var(--rr-space-4);
}

.rr-noscript {
  margin: 0 0 var(--rr-space-4);
  font-weight: 700;
}

/* Footer */
.rr-footer {
  padding: var(--rr-space-7) var(--rr-space-5);
  text-align: center;
  color: var(--rr-muted-on-dark);
  font-size: var(--rr-text-small);
}

.rr-footer p {
  margin: 0;
}

.rr-footer__line {
  color: var(--rr-white);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rr-footer .rr-nav {
  margin: var(--rr-space-2) 0;
}

/* Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }

  .rr-btn:hover,
  .rr-btn:active {
    transform: none;
  }
}
