:root {
  color-scheme: light;
  --ink: #071329;
  --ink-soft: #344158;
  --paper: #f7f8fb;
  --white: #ffffff;
  --blue: #0c4ab4;
  --blue-dark: #061a45;
  --red: #d61027;
  --gold: #e7b85b;
  --line: rgba(7, 19, 41, 0.12);
  --shadow: 0 18px 50px rgba(7, 19, 41, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
}

.site-header {
  position: fixed;
  z-index: 10;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.91);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 850;
  text-decoration: none;
}

.brand img,
.hero__logo {
  display: block;
  object-fit: cover;
  border: 2px solid rgba(231, 184, 91, 0.9);
  border-radius: 50%;
}

.brand img {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
}

.language-toggle {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(7, 19, 41, 0.1);
  cursor: pointer;
  font-size: 1.35rem;
}

.language-toggle:focus-visible,
.button:focus-visible {
  outline: 3px solid rgba(12, 74, 180, 0.35);
  outline-offset: 3px;
}

.hero {
  display: grid;
  min-height: 92svh;
  padding: 104px 18px 42px;
  background:
    radial-gradient(circle at 18% 18%, rgba(214, 16, 39, 0.34), transparent 27%),
    linear-gradient(145deg, rgba(6, 26, 69, 0.98), rgba(10, 40, 103, 0.92) 52%, rgba(12, 74, 180, 0.82)),
    var(--blue-dark);
  color: var(--white);
}

.hero__content {
  display: flex;
  width: min(100%, 680px);
  margin: auto;
  flex-direction: column;
  align-items: flex-start;
}

.hero__logo {
  width: clamp(92px, 30vw, 150px);
  height: clamp(92px, 30vw, 150px);
  align-self: center;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 12ch;
  margin: 0;
  font-size: clamp(2.55rem, 12.5vw, 4.4rem);
  line-height: 0.92;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: clamp(1.55rem, 8vw, 3rem);
  line-height: 1;
  letter-spacing: 0;
}

.hero__copy {
  max-width: 36rem;
  margin: 16px 0 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 1.08rem;
}

.hero__actions,
.signup__intro {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.hero__actions {
  width: 100%;
  margin-top: 22px;
}

.button {
  display: inline-flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  padding: 13px 20px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 850;
  text-align: center;
  text-decoration: none;
}

.button--primary {
  background: var(--red);
  color: var(--white);
  box-shadow: 0 12px 24px rgba(214, 16, 39, 0.28);
}

.button--messenger {
  background: #0866ff;
  color: var(--white);
  box-shadow: 0 12px 24px rgba(8, 102, 255, 0.24);
}

.button--ghost {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.38);
  color: var(--white);
}

.quick-info,
.signup {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: 36px 18px;
}

.quick-info {
  display: grid;
  gap: 12px;
}

.quick-info article {
  padding: 22px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.quick-info span {
  display: block;
  margin-bottom: 18px;
  color: var(--red);
  font-weight: 950;
}

.quick-info h2 {
  font-size: 1.35rem;
}

.quick-info p,
.signup p,
.medal-band p {
  color: var(--ink-soft);
}

.medal-band {
  display: grid;
  gap: 18px;
  padding: 42px 18px;
  background: var(--white);
  border-block: 1px solid var(--line);
}

.medal-band > * {
  width: min(100%, 1120px);
  margin: 0 auto;
}

.medal-band h2 {
  max-width: 15ch;
}

.signup {
  display: grid;
  gap: 24px;
  overflow: hidden;
}

.signup__intro {
  align-items: flex-start;
}

.signup__intro p {
  margin: 0;
}

.race-gallery {
  display: grid;
  grid-auto-columns: minmax(82%, 1fr);
  grid-auto-flow: column;
  gap: 16px;
  margin-inline: -18px;
  padding: 4px 18px 18px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-padding-inline: 18px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.race-gallery::-webkit-scrollbar {
  display: none;
}

.race-card {
  display: flex;
  min-height: 520px;
  flex-direction: column;
  align-items: flex-start;
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: inherit;
  scroll-snap-align: center;
  text-decoration: none;
}

.race-card--active {
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.race-card--active:hover {
  border-color: rgba(214, 16, 39, 0.36);
  box-shadow: 0 22px 56px rgba(7, 19, 41, 0.2);
  transform: translateY(-2px);
}

.race-card--active:focus-visible {
  outline: 3px solid rgba(12, 74, 180, 0.35);
  outline-offset: 4px;
}

.race-card__image,
.race-card__placeholder {
  width: 100%;
  aspect-ratio: 4 / 5;
}

.race-card__image {
  object-fit: cover;
}

.race-card__placeholder {
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(12, 74, 180, 0.12), rgba(214, 16, 39, 0.12)),
    var(--paper);
}

.race-card__placeholder span {
  display: grid;
  width: 96px;
  height: 96px;
  place-items: center;
  color: var(--blue);
  font-size: 2rem;
  font-weight: 950;
  border: 3px solid rgba(231, 184, 91, 0.95);
  border-radius: 50%;
}

.race-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  padding: 22px;
}

.race-card__status {
  margin: 0 0 10px;
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.race-card h3 {
  margin: 0;
  font-size: clamp(1.8rem, 8vw, 3.1rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.race-card p:not(.race-card__status) {
  margin: 14px 0 22px;
}

.race-card .button {
  width: 100%;
  margin-top: auto;
}

.race-card--disabled {
  opacity: 0.72;
}

.button--disabled {
  background: #d8dce5;
  color: #586274;
  cursor: not-allowed;
  box-shadow: none;
}

.registration-page {
  background: var(--white);
}

.registration-hero {
  display: grid;
  gap: 22px;
  padding: 96px 18px 32px;
  background:
    linear-gradient(145deg, rgba(6, 26, 69, 0.98), rgba(10, 40, 103, 0.94) 58%, rgba(214, 16, 39, 0.8)),
    var(--blue-dark);
  color: var(--white);
}

.registration-hero__content,
.registration-layout {
  width: min(100%, 1120px);
  margin: 0 auto;
}

.registration-hero__content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.registration-hero h1 {
  max-width: 10ch;
}

.registration-hero__image {
  width: min(100%, 520px);
  aspect-ratio: 4 / 5;
  margin: 0 auto;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.back-link {
  display: inline-flex;
  margin-bottom: 18px;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 850;
  text-decoration: none;
}

.back-link::before {
  content: "<";
  margin-right: 8px;
}

.registration-layout {
  display: grid;
  gap: 24px;
  padding: 34px 18px 56px;
}

.race-summary {
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.race-summary h2 {
  max-width: 13ch;
}

.race-summary p {
  color: var(--ink-soft);
}

.registration-form {
  display: grid;
  gap: 20px;
}

.form-grid {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-weight: 850;
}

.field input,
.field textarea {
  width: 100%;
  min-height: 52px;
  padding: 13px 14px;
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.field textarea {
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  border-color: rgba(12, 74, 180, 0.58);
  outline: 3px solid rgba(12, 74, 180, 0.18);
}

.field small {
  color: var(--ink-soft);
  font-weight: 650;
}

.proof-field input {
  min-height: auto;
  padding: 12px;
}

.form-status {
  min-height: 24px;
  margin: 0;
  color: var(--ink-soft);
  font-weight: 750;
}

.form-status[data-tone="success"] {
  color: #126b38;
}

.form-status[data-tone="error"] {
  color: var(--red);
}

.registration-form .button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.screen-reader-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

footer {
  padding: 26px 18px 34px;
  color: var(--ink-soft);
  text-align: center;
}

@media (min-width: 560px) {
  .hero__actions {
    width: auto;
    flex-direction: row;
  }

  .button {
    min-width: 178px;
  }
}

@media (min-width: 780px) {
  .site-header {
    padding-inline: 28px;
  }

  .hero {
    min-height: 88svh;
    padding-inline: 40px;
  }

  .hero__content {
    margin-left: max(40px, calc((100vw - 1120px) / 2));
  }

  .hero__logo {
    align-self: flex-start;
  }

  h1 {
    font-size: clamp(4rem, 8vw, 5.7rem);
  }

  .quick-info {
    grid-template-columns: repeat(3, 1fr);
    padding-block: 56px;
  }

  .medal-band {
    grid-template-columns: 1.1fr 0.9fr;
    padding-block: 64px;
  }

  .signup {
    grid-template-columns: 0.8fr 1.2fr;
    align-items: start;
    padding-block: 64px;
  }

  .race-gallery {
    grid-auto-columns: minmax(340px, 1fr);
    margin-inline: 0;
    padding-inline: 0;
    scroll-padding-inline: 0;
  }

  .registration-hero {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 420px);
    align-items: center;
    padding: 112px 40px 52px;
  }

  .registration-hero__content {
    margin-left: max(0px, calc((100vw - 1120px) / 2));
  }

  .registration-hero__image {
    width: min(34vw, 420px);
    margin-right: max(0px, calc((100vw - 1120px) / 2));
  }

  .registration-layout {
    grid-template-columns: 0.72fr 1.28fr;
    align-items: start;
    padding-block: 56px 72px;
  }

  .race-summary {
    padding: 0 28px 0 0;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field--full {
    grid-column: 1 / -1;
  }
}
