/* Adthletics - sign up (register.html). Loads after site.css.

   Two halves: the stage (ink, left), a still of the landing's 3D athlete
   wearing a race bib with the athlete's details (athletes) or the brand's
   print on a quadriceps (brands); the form (right) sits on the page, no card. On
   phones the stage becomes a band above the form. */

:root {
  --danger: #c62d2d;
  --danger-tint: rgba(198, 45, 45, 0.08);
}

.signup {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  border-top: 1px solid var(--ink-line);
}

/* ---------- The stage ---------- */

.signup-stage {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  container-type: size;
  color: var(--cream);
  background:
    radial-gradient(55% 45% at 55% 55%, rgba(0, 119, 255, 0.34), rgba(0, 119, 255, 0) 72%),
    var(--ink);
}

/* The still (3:4), placed so the print sits at (--ax, --ay) of the stage and
   scaled to overfill it; its edges fade out in case one comes into view.
   --fw is its width. */
.stage-shot {
  --zoom: 1.15;
  --ax: 50cqw;
  --ay: 54cqh;
  --fw: calc(max(100cqw, 75cqh) * var(--zoom));
  position: absolute;
  left: calc(var(--ax) - var(--x) * var(--fw));
  top: calc(var(--ay) - var(--y) * var(--fw) * 4 / 3);
  width: var(--fw);
  margin: 0;
  opacity: 0;
  transform: scale(1.04);
  -webkit-mask-image:
    linear-gradient(to right, transparent, #000 7%, #000 90%, transparent),
    linear-gradient(transparent, #000 7%, #000 93%, transparent);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to right, transparent, #000 7%, #000 90%, transparent),
    linear-gradient(transparent, #000 7%, #000 93%, transparent);
  mask-composite: intersect;
  transition: opacity 0.45s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.stage-shot img {
  display: block;
  width: 100%;
  height: auto;
}

/* Where the bib / print lands in each still, from tools/render-spot.html
   (window.spotBox): centre (x, y as fractions of the picture), width and
   height (fractions of the picture's width), and the angle of its top edge.
   Re-render a still = update these. --turn lays the text along the print.
   The athlete stills report the waistband below the abs spot, and the bib is
   a 200 mm wide sheet there (--bib = twice the 100 mm abs print). Male:
     ?body=male&spot=abs&side=1&phi=0&d=2.07&h=0&dy=0.13&sy=-0.1
   female (the same framing, scaled to her height):
     ?body=female&spot=abs&side=1&phi=0&d=1.93&h=0&dy=0.12&sy=-0.093
   at 1200 x 1600 on a transparent background. The still shown follows the
   gender picked in the form (.signup[data-gender], male until then).
   The stills are framed head to thighs; the stage zooms in to chest-to-thighs
   so the bib reads. */
.stage-shot[data-for="athlete"] { --x: 0.5; --y: 0.6172; --bib: 0.2404; --angle: 0deg; --zoom: 1.5; --ay: 60cqh; }
.signup[data-gender="female"] .stage-shot[data-for="athlete"] { --y: 0.616; --bib: 0.2578; --angle: -0.1deg; }

.signup:not([data-gender="female"]) .stage-shot .shot-female,
.signup[data-gender="female"] .stage-shot .shot-male { display: none; }
/* The brand still: the female figure's right quadriceps, from the front:
     ?body=female&spot=quadriceps&side=-1&phi=0&d=1.53&h=0&dx=0.068&dy=0.031
   Measured for the 80 x 140 mm print; --pw / --ph scaled to 90 x 150 mm
   (2026-10-01), same camera and centre. */
.stage-shot[data-for="brand"] { --x: 0.3894; --y: 0.5378; --pw: 0.1458; --ph: 0.1798; --angle: 0.7deg; --turn: -90deg; }

.signup[data-type="athlete"] .stage-shot[data-for="athlete"],
.signup[data-type="brand"] .stage-shot[data-for="brand"] {
  opacity: 1;
  transform: none;
}

/* The print, at its real size on the body, in the tour's colours. Multiply
   lets the skin's shading through, like a transfer. */
.stage-print {
  position: absolute;
  left: calc(var(--x) * 100%);
  top: calc(var(--y) * 100%);
  display: grid;
  place-items: center;
  width: calc(var(--pw) * var(--fw));
  height: calc(var(--ph) * var(--fw));
  border-radius: 999px;
  background: var(--accent-bright);
  mix-blend-mode: multiply;
  transform: translate(-50%, -50%) rotate(var(--angle));
}

/* The text runs along the print and shrinks with its length (--chars, set by
   the page script) to fit. */
.stage-print-text {
  display: block;
  max-width: calc(var(--ph) * var(--fw) * 0.84);
  overflow: hidden;
  font-weight: 800;
  font-size: min(
    calc(var(--ph) * var(--fw) * 0.8 / (var(--chars, 9) * 0.64)),
    calc(var(--pw) * var(--fw) * 0.44)
  );
  line-height: 1.1;
  letter-spacing: 0.02em;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-transform: uppercase;
  color: var(--ink);
  transform: rotate(var(--turn));
}

/* The athlete's race bib: a paper sheet pinned at the corners, turned a
   little with the body (the still looks at it from 20 degrees to the side).
   Everything inside scales with the bib (cqi = 1% of its width). */
.stage-bib {
  position: absolute;
  left: calc(var(--x) * 100%);
  top: calc(var(--y) * 100%);
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  align-items: center;
  width: calc(var(--bib) * var(--fw));
  aspect-ratio: 4 / 3;
  padding-bottom: 6cqi;
  overflow: hidden;
  container-type: inline-size;
  border-radius: 2.5cqi;
  color: var(--ink);
  text-align: center;
  background-color: #fbfaf6;
  box-shadow: 0 1.5cqi 5cqi rgba(17, 17, 17, 0.4);
  transform: translate(-50%, -50%) perspective(900px) rotateY(-12deg) rotate(var(--angle));
}

/* The four safety pins. */
.stage-bib::after {
  --pin: radial-gradient(circle, #efece5 0 30%, #8f8b82 34% 52%, transparent 56%);
  content: "";
  position: absolute;
  inset: 1.8cqi;
  background:
    var(--pin) left top / 4.4cqi 4.4cqi no-repeat,
    var(--pin) right top / 4.4cqi 4.4cqi no-repeat,
    var(--pin) left bottom / 4.4cqi 4.4cqi no-repeat,
    var(--pin) right bottom / 4.4cqi 4.4cqi no-repeat;
  pointer-events: none;
}

.bib-band {
  display: flex;
  justify-content: space-between;
  padding: 2.4cqi 8cqi;
  font-size: 4.2cqi;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ffffff;
  background: var(--accent);
}

.bib-number {
  font-family: var(--display);
  font-weight: 900;
  font-stretch: 125%;
  font-size: 29cqi;
  font-variant-numeric: tabular-nums;
  line-height: 0.9;
  letter-spacing: -0.02em;
}

.bib-name,
.bib-meta {
  overflow: hidden;
  padding-inline: 7cqi;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-transform: uppercase;
}

/* The name shrinks with its length (--chars, set by the page script). */
.bib-name {
  font-family: var(--display);
  font-weight: 800;
  font-stretch: 110%;
  font-size: min(9.5cqi, calc(84cqi / (var(--chars, 9) * 0.74)));
  line-height: 1.1;
}

.bib-meta {
  display: flex;
  justify-content: center;
  gap: 4cqi;
  margin-top: 1.5cqi;
  font-size: 4.2cqi;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.bib-meta span { overflow: hidden; text-overflow: ellipsis; }
.bib-meta span:empty { display: none; }

/* What the stage says: the spot and its size, then one line. */
.stage-caption {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 1;
  padding: clamp(28px, 4.5cqw, 56px);
  padding-bottom: 80px;
  background: linear-gradient(rgba(17, 17, 17, 0.72), rgba(17, 17, 17, 0));
}

.stage-spot {
  display: flex;
  gap: 12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-bright);
}

.stage-spot span + span {
  color: var(--cream-soft);
  font-variant-numeric: tabular-nums;
}

.stage-line {
  max-width: 13ch;
  margin-top: 14px;
  font-size: clamp(30px, 5.6cqw, 54px);
  overflow-wrap: anywhere;
}

.signup[data-type="athlete"] .stage-caption [data-for="brand"],
.signup[data-type="brand"] .stage-caption [data-for="athlete"] { display: none; }

/* ---------- The form ---------- */

.signup-panel {
  width: 100%;
  max-width: 640px;
  padding: clamp(40px, 6vw, 88px) clamp(20px, 6vw, 88px) clamp(64px, 8vw, 112px);
}

.signup-title { font-size: clamp(40px, 4.4vw, 64px); }

.signup-lead {
  margin-top: 14px;
  font-size: 18px;
  color: var(--ink-soft);
}

.signup fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

/* Athlete / brand: one ink frame, the chosen half filled. */
.type-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin-top: 36px !important;
  padding: 4px !important;
  border: 1.5px solid var(--ink) !important;
  border-radius: 16px;
}

.type-switch label {
  position: relative;
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 14px 16px 15px;
  border-radius: 12px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* The real radio stays in the page (keyboard, screen readers), unseen. */
.type-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.type-switch label:has(input:focus-visible) {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.type-switch label:not(:has(input:checked)):hover { background: rgba(17, 17, 17, 0.06); }

.type-switch label:has(input:checked) {
  color: var(--cream);
  background: var(--ink);
}

.type-name {
  font-family: var(--display);
  font-weight: 800;
  font-stretch: 115%;
  font-size: 19px;
  line-height: 1.1;
}

.type-hint {
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink-soft);
}

.type-switch label:has(input:checked) .type-hint { color: var(--cream-soft); }

/* Fields: a label and a ruled line, like an entry form. */
.form-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 26px 24px;
  margin-top: 34px !important;
}

.line-field {
  display: grid;
  align-content: start;
  gap: 4px;
}

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

.line-field label {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.optional {
  margin-left: 4px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: rgba(17, 17, 17, 0.45);
}

.line-field input,
.line-field select {
  width: 100%;
  min-height: 46px;
  padding: 8px 0;
  border: 0;
  border-bottom: 1.5px solid rgba(17, 17, 17, 0.3);
  border-radius: 0;
  font: inherit;
  font-size: 19px;
  color: var(--ink);
  background: transparent;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.line-field input::placeholder { color: rgba(17, 17, 17, 0.35); }
.line-field input:hover,
.line-field select:hover { border-bottom-color: var(--ink); }

/* A chevron on the line instead of the native arrow. */
.line-field select {
  appearance: none;
  padding-right: 28px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%23111111' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 4px center / 14px 9px;
  cursor: pointer;
}

.line-field select:has(option[value=""]:checked) { color: rgba(17, 17, 17, 0.45); }

/* Focus: the line turns accent and thickens (it replaces the outline). */
.line-field input:focus,
.line-field input:focus-visible,
.line-field select:focus,
.line-field select:focus-visible {
  outline: none;
  border-bottom-color: var(--accent);
  box-shadow: 0 1.5px 0 var(--accent);
}

.line-field input[aria-invalid="true"],
.line-field select[aria-invalid="true"] {
  border-bottom-color: var(--danger);
  box-shadow: 0 1.5px 0 var(--danger);
}

.line-field:has([aria-invalid="true"]) label { color: var(--danger); }

/* Password with a show/hide toggle on the line. */
.pw-field { position: relative; }
.pw-field input { padding-right: 64px; }

.pw-toggle {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  padding: 6px 0 6px 10px;
  border: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  background: transparent;
  cursor: pointer;
}

.pw-toggle:hover { color: var(--ink); }

/* Consents. */
.checks {
  display: grid;
  gap: 14px;
  margin-top: 36px !important;
  padding-top: 26px !important;
  border-top: 1px solid var(--ink-line) !important;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 15.5px;
  line-height: 1.5;
  cursor: pointer;
}

.check-row input {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 0;
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  background: transparent center / 14px no-repeat;
  appearance: none;
  cursor: pointer;
}

.check-row input:checked {
  background-color: var(--ink);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M2.5 7.5l3 3 6-7' fill='none' stroke='%23f4f1ea' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.check-row a {
  color: var(--accent);
  text-underline-offset: 2px;
}

.check-row:has(input[aria-invalid="true"]) { color: var(--danger); }
.check-row input[aria-invalid="true"] { border-color: var(--danger); }

/* Messages and the way out. */
.msg {
  display: none;
  margin-top: 24px;
  padding: 14px 16px;
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.5;
}

.msg.show { display: block; }

.msg.error {
  color: var(--danger);
  background: var(--danger-tint);
}

.msg.success {
  color: var(--ink);
  background: rgba(0, 119, 255, 0.1);
}

.form-submit { margin-top: 30px; }
.form-submit:hover { color: var(--cream); background: var(--accent); }

.signup-switch {
  margin-top: 22px;
  color: var(--ink-soft);
}

.signup-switch a {
  font-weight: 700;
  color: var(--ink);
  text-underline-offset: 3px;
}

.signup-switch a:hover { color: var(--accent); }

/* ---------- After sign-up: "check your inbox" ---------- */

.signup-done .signup-title:focus { outline: none; }

.done-email {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.done-hint {
  margin-top: 18px;
  color: var(--ink-soft);
}

/* ---------- Responsive ---------- */

/* Phones and tablets: the stage is a band above the form, the print bigger
   in it. */
@media (max-width: 899px) {
  .signup { grid-template-columns: minmax(0, 1fr); }
  .signup-stage {
    position: relative;
    height: clamp(300px, 52svh, 440px);
  }
  .stage-shot { --zoom: 1.75; --ay: 60cqh; }
  .stage-shot[data-for="athlete"] { --zoom: 1.55; --ay: 64cqh; }
  .stage-caption { padding: 22px 20px 64px; }
  .stage-line { margin-top: 10px; font-size: clamp(26px, 7.4cqw, 40px); max-width: 15ch; }
  .signup-panel { max-width: 640px; margin-inline: auto; padding-top: 36px; }
}

@media (max-width: 560px) {
  .form-group { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .type-switch label { padding: 12px 12px 13px; }
  .type-name { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  .stage-shot,
  .type-switch label,
  .line-field input { transition: none; }
  .stage-shot { transform: none; }
}
