/*
 * Components the old Next.js site never had: forms, flash messages and the
 * registration status card.
 *
 * Kept in its own file rather than appended to site.css, because site.css is a
 * verbatim port of the original stylesheet and is worth being able to diff
 * against it. Everything here builds on the same custom properties, so the
 * admin's palette choices reach these components too.
 */

/* ------------------------------------------------------------------ */
/* Flash messages                                                      */
/* ------------------------------------------------------------------ */

.site-flash {
  border-left: 4px solid var(--sun);
  border-radius: 0 10px 10px 0;
  font-size: 15px;
  line-height: 1.55;
  margin: 96px clamp(24px, 5vw, 76px) 0;
  padding: 16px 20px;
}

.site-flash p {
  margin: 0;
}

.site-flash ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.site-flash-success {
  background: rgba(115, 198, 106, 0.16);
  border-left-color: var(--leaf);
}

.site-flash-error {
  background: rgba(255, 107, 74, 0.14);
  border-left-color: var(--coral);
}

.site-flash-info {
  background: rgba(89, 200, 230, 0.16);
  border-left-color: var(--sky);
}

/* ------------------------------------------------------------------ */
/* Forms                                                               */
/* ------------------------------------------------------------------ */

.site-form {
  margin: 0 auto;
  max-width: 900px;
  width: 100%;
}

/*
 * The registration form lives inside .registration-cta, which site.css builds
 * as a near-black gradient with white text and a 1.35fr/0.65fr grid -- right
 * for the short marketing call-to-action it originally held, wrong for a
 * twenty-field form. Two things had to change:
 *
 *   1. The grid squeezed the form into the narrow 0.65fr column.
 *   2. Every helper text, legend and hint below is dark ink chosen for a light
 *      surface, so on that background the add-on description and the waiver
 *      were effectively invisible.
 *
 * The fix is a light card rather than a second, dark colour set for every form
 * component -- one surface to reason about, and long text to read on the
 * background reading is easiest on. The heading above the card stays on the
 * dark section, where the yellow kicker and white type already work.
 */
.registration-form-section {
  display: block;
  padding: 90px clamp(20px, 6vw, 90px);
}

.registration-form-section .section-heading {
  margin: 0 auto 34px;
  max-width: 900px;
}

.registration-form-section .site-form {
  background: var(--white);
  border-radius: 22px;
  /* Explicit, not inherited: the section sets color:white, which every piece of
     text in the card would otherwise pick up. */
  color: var(--ink);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.3);
  padding: clamp(22px, 4vw, 46px);
}

/* Sits on the card, so it needs the card's ink rather than the section's. */
.registration-form-section .site-form .fine-print {
  color: #776c62;
}

.registration-form-section .site-form .fine-print a {
  color: var(--rust);
  font-weight: 700;
}

.site-form fieldset {
  border: 1px solid rgba(40, 32, 26, 0.14);
  border-radius: 16px;
  margin: 0 0 28px;
  padding: 26px clamp(18px, 3vw, 30px) 30px;
}

.site-form legend {
  color: var(--rust);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  padding: 0 10px;
  text-transform: uppercase;
}

.form-grid {
  display: grid;
  gap: 20px 22px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

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

.field > span {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* The required marker. A <b> rather than a bare asterisk in the label text so
   it can be coloured without wrapping every label in extra markup, and
   aria-hidden in the HTML because "required" is already on the input. */
.field > span b {
  color: var(--coral);
  margin-left: 2px;
}

.field > small {
  /* 0.70, not 0.62. At 0.62 this lands on 4.54:1 against the card -- over the
     4.5 AA line by four hundredths, which is not a margin. 0.70 gives 5.9:1. */
  color: rgba(40, 32, 26, 0.7);
  font-size: 12px;
  line-height: 1.45;
}

.field input,
.field select,
.field textarea {
  background: var(--white);
  border: 1px solid rgba(40, 32, 26, 0.24);
  border-radius: 10px;
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
  padding: 12px 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
}

.field textarea {
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--rust);
  box-shadow: 0 0 0 3px rgba(255, 211, 78, 0.36);
  outline: none;
}

.field input:invalid:not(:placeholder-shown) {
  border-color: var(--coral);
}

/* Set by site.js when the entered date of birth makes the runner a minor on
   race day. A hint only -- the server is what actually enforces it. */
.field-required-now input {
  border-color: var(--coral);
}

.field-required-now > span::after {
  color: var(--coral);
  content: " *";
  font-weight: 800;
}

.checkbox-field {
  align-items: flex-start;
  display: flex;
  gap: 13px;
}

.checkbox-field input {
  accent-color: var(--rust);
  height: 20px;
  margin-top: 2px;
  min-width: 20px;
  width: 20px;
}

.checkbox-field span {
  display: block;
}

.checkbox-field strong {
  display: block;
  font-size: 15px;
  margin-bottom: 4px;
}

.checkbox-field small {
  /* The waiver lives here -- a paragraph of liability text somebody is being
     asked to accept. 0.78 gives 7.7:1, which is AAA. Legal text people are
     agreeing to should not be the faintest thing on the page. */
  color: rgba(40, 32, 26, 0.78);
  font-size: 13px;
  line-height: 1.6;
}

.button-large {
  font-size: 16px;
  padding: 16px 34px;
  width: 100%;
}

/* ------------------------------------------------------------------ */
/* Race picker                                                         */
/* ------------------------------------------------------------------ */

.race-choice-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.race-choice {
  cursor: pointer;
  display: block;
  position: relative;
}

/* Visually hidden rather than display:none -- the radio still has to be
   focusable and reachable by keyboard and screen reader; the visible state is
   drawn on the sibling below. */
.race-choice input {
  height: 1px;
  opacity: 0;
  position: absolute;
  width: 1px;
}

.race-choice-body {
  background: var(--white);
  border: 2px solid rgba(40, 32, 26, 0.16);
  border-radius: 16px;
  display: block;
  height: 100%;
  padding: 20px 18px;
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.race-choice input:checked + .race-choice-body {
  border-color: var(--rust);
  box-shadow: 0 12px 28px rgba(40, 32, 26, 0.14);
  transform: translateY(-2px);
}

.race-choice input:focus-visible + .race-choice-body {
  box-shadow: 0 0 0 3px rgba(255, 211, 78, 0.55);
}

.race-choice-body b {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 30px;
  line-height: 1;
}

.race-choice-body strong {
  display: block;
  font-size: 14px;
  margin-top: 6px;
}

.race-choice-body em {
  color: var(--rust);
  display: block;
  font-size: 19px;
  font-style: normal;
  font-weight: 800;
  margin-top: 8px;
}

.race-choice-body small {
  color: rgba(40, 32, 26, 0.66);
  display: block;
  font-size: 12px;
  line-height: 1.5;
  margin-top: 6px;
}

.race-choice-body .race-remaining {
  color: var(--coral);
  display: block;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-top: 8px;
  text-transform: uppercase;
}

.race-choice.sun .race-choice-body b { color: var(--sun); }
.race-choice.olive .race-choice-body b { color: var(--olive); }
.race-choice.coral .race-choice-body b { color: var(--coral); }
.race-choice.sky .race-choice-body b { color: var(--sky); }
.race-choice.purple .race-choice-body b { color: var(--purple); }
.race-choice.leaf .race-choice-body b { color: var(--leaf); }

.distance-closed {
  color: var(--coral);
  display: inline-block;
  font-style: normal;
  font-weight: 700;
  margin-left: 6px;
  text-transform: uppercase;
}

/* ------------------------------------------------------------------ */
/* Total                                                               */
/* ------------------------------------------------------------------ */

.registration-total {
  align-items: baseline;
  background: var(--midnight);
  border-radius: 16px;
  color: var(--white);
  display: flex;
  justify-content: space-between;
  margin-bottom: 22px;
  padding: 20px 26px;
}

.registration-total span {
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.registration-total strong {
  color: var(--sun);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 32px;
}

.registration-notice,
.registration-closed {
  background: rgba(89, 200, 230, 0.14);
  border-radius: 16px;
  margin: 0 auto 28px;
  max-width: 900px;
  padding: 22px 26px;
  text-align: center;
}

.registration-closed .button {
  margin-top: 14px;
}

/* ------------------------------------------------------------------ */
/* Status card                                                         */
/* ------------------------------------------------------------------ */

.status-section {
  display: flex;
  justify-content: center;
  padding: 150px clamp(24px, 5vw, 76px) 90px;
}

.status-card {
  background: var(--white);
  border: 1px solid rgba(40, 32, 26, 0.14);
  border-radius: 24px;
  border-top: 6px solid var(--sun);
  box-shadow: 0 22px 60px rgba(40, 32, 26, 0.1);
  max-width: 780px;
  padding: clamp(28px, 5vw, 52px);
  width: 100%;
}

.status-card.is-paid { border-top-color: var(--leaf); }
.status-card.is-cancelled { border-top-color: var(--coral); }
.status-card.is-pending { border-top-color: var(--sun); }

.status-card h1 {
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.15;
  margin: 6px 0 14px;
}

.status-reference {
  background: var(--midnight);
  border-radius: 16px;
  color: var(--white);
  margin: 26px 0;
  padding: 20px 24px;
  text-align: center;
}

.status-reference span {
  display: block;
  font-size: 11px;
  letter-spacing: 0.2em;
  opacity: 0.75;
  text-transform: uppercase;
}

.status-reference strong {
  color: var(--sun);
  display: block;
  font-family: "Courier New", Courier, monospace;
  font-size: clamp(26px, 5vw, 36px);
  letter-spacing: 0.1em;
  margin-top: 6px;
}

.status-facts {
  display: grid;
  gap: 16px 24px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin: 0 0 22px;
}

.status-facts-private {
  border-top: 1px solid rgba(40, 32, 26, 0.12);
  padding-top: 22px;
}

.status-facts div { margin: 0; }

.status-facts dt {
  font-size: 11px;
  letter-spacing: 0.14em;
  opacity: 0.6;
  text-transform: uppercase;
}

.status-facts dd {
  font-size: 16px;
  font-weight: 700;
  margin: 4px 0 0;
}

.status-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin: 26px 0 18px;
}

.status-actions form { margin: 0; }

.status-actions .text-link {
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  padding: 0;
}

/* ------------------------------------------------------------------ */
/* Sponsor enquiry section                                             */
/* ------------------------------------------------------------------ */

.sponsor-form-section {
  padding: 90px clamp(24px, 5vw, 76px);
}

.sponsor-form-section .section-heading {
  margin-bottom: 34px;
}

@media (max-width: 700px) {
  .site-flash {
    margin: 88px 20px 0;
  }

  .status-section {
    padding: 120px 20px 70px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}
