/* ==========================================================================
   Base: element defaults, typography, focus and page-level utilities.
   Loaded on every page (public site and admin) after tokens.css.
   ========================================================================== */

/* ---------- Web fonts (self-hosted; licence: OFL.txt in each static/fonts folder) ----------
   Inter: one variable file (weights 400-700 used). Barlow Semi Condensed: 700
   (headings; the only weight they use). Latin first; the latin-ext files load
   only for characters outside it (accented names, currency signs). swap: the
   fallback from tokens.css shows until the font arrives. Files from Fontsource
   5.3.0. firebase.json caches them for a year: a changed font needs a new
   file name. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter/inter-latin-wght-normal.woff2") format("woff2-variations"),
       url("../fonts/inter/inter-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;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter/inter-latin-ext-wght-normal.woff2") format("woff2-variations"),
       url("../fonts/inter/inter-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Barlow Semi Condensed";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/barlow-semi-condensed/barlow-semi-condensed-latin-700-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;
}
@font-face {
  font-family: "Barlow Semi Condensed";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/barlow-semi-condensed/barlow-semi-condensed-latin-ext-700-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

html {
  -webkit-text-size-adjust: 100%;
  /* Anchor jumps and focused fields land below the sticky header (WCAG 2.4.11). */
  scroll-padding-top: calc(var(--gk-header-h) + var(--gk-space-4));
  /* Admin pages: admin.css sets this from the sticky chrome (--admin-bar-h). */
}

/* Stop a stray wide element from scrolling the page sideways. clip, not
   hidden: hidden on <body> makes it a scroll container, and then nothing
   with position: sticky sticks (site header, admin chrome, the race wizard's
   action dock, the builder's summary and price bar). Browsers without clip
   (Safari < 16) keep the hidden line and simply don't stick. */
html,
body {
  background: var(--gk-bg);
  overflow-x: hidden;
  overflow-x: clip;
}

body {
  color: var(--gk-text);
  font-family: var(--gk-font-sans);
  font-size: var(--gk-text-base);
  line-height: var(--gk-leading-normal);
  font-feature-settings: "cv11", "ss01"; /* Inter: single-storey a, open digits */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3,
.h1, .h2, .h3 {
  font-family: var(--gk-font-heading);
  font-weight: var(--gk-weight-bold);
  line-height: var(--gk-leading-tight);
  letter-spacing: 0;
  color: var(--gk-ink);
  text-wrap: balance;
}
h4, h5, h6,
.h4, .h5, .h6 {
  font-family: var(--gk-font-sans);
  font-weight: var(--gk-weight-semibold);
  line-height: var(--gk-leading-snug);
  color: var(--gk-ink);
}

p {
  text-wrap: pretty;
}

a {
  color: var(--gk-link);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}
a:hover {
  color: var(--gk-link-hover);
}

strong, b {
  font-weight: var(--gk-weight-bold);
}

code, kbd, pre, samp {
  font-family: var(--gk-font-mono);
}

::selection {
  background: rgba(0, 245, 255, 0.35);
  color: var(--gk-ink);
}

.tabular {
  font-variant-numeric: tabular-nums;
}

/* ---------- Focus: one visible ring for every interactive element ---------- */
:focus-visible {
  outline: 3px solid var(--gk-focus);
  outline-offset: 2px;
}
.on-dark :focus-visible {
  outline-color: #ffffff;
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: -999px;
  top: var(--gk-space-2);
  z-index: 2000;
  padding: var(--gk-space-2) var(--gk-space-3);
  border-radius: var(--gk-radius-sm);
  background: var(--gk-surface);
  color: var(--gk-primary-active);
  font-weight: var(--gk-weight-semibold);
  box-shadow: var(--gk-shadow-md);
}
.skip-link:focus {
  left: var(--gk-space-2);
}

/* ---------- Staging banner ---------- */
/* Scrolls away with the page: the site header is the one sticky bar (both
   sticking at top: 0 would stack the banner over the header). */
.gk-staging-banner {
  position: relative;
  z-index: var(--gk-z-banner);
  width: 100%;
  margin: 0;
  padding: var(--gk-space-3) var(--gk-space-4);
  background: var(--gk-key);
  color: var(--gk-yellow);
  text-align: center;
  font-size: var(--gk-text-sm);
  font-weight: var(--gk-weight-semibold);
  border-bottom: 2px solid var(--gk-yellow);
}
.gk-staging-banner strong {
  color: var(--gk-yellow);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.gk-staging-banner span {
  color: #ffffff;
  font-weight: var(--gk-weight-medium);
  margin-left: 0.35em;
}

/* ---------- Flash messages (base.html) ---------- */
.gk-flash {
  width: min(var(--gk-container-lg), calc(100% - 2 * var(--gk-gutter)));
  margin: var(--gk-space-4) auto 0;
}
.gk-flash .alert {
  margin-bottom: var(--gk-space-2);
}
.gk-email-verify-banner {
  border-radius: 0;
  text-align: center;
}
.gk-email-verify-banner svg {
  margin-right: var(--gk-space-1);
  vertical-align: -2px;
}

/* ---------- Action-button loading state (window.gkSetButtonLoading) ---------- */
.btn.is-loading,
.gk-btn.is-loading,
button.is-loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--gk-space-2);
  cursor: wait !important;
  pointer-events: none;
  opacity: 0.88;
}
.gk-btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: gk-btn-spin 0.65s linear infinite;
  flex-shrink: 0;
}
@keyframes gk-btn-spin {
  to { transform: rotate(360deg); }
}

/* ---------- Bug-report popup window ---------- */
body.is-bug-popup {
  background: var(--gk-bg);
}
body.is-bug-popup .container.mt-3 {
  max-width: var(--gk-container-sm);
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
