/* ==========================================================================
   Request access — the AxoGrid access form.
   Values come from tokens.css only.
   ========================================================================== */

/* The page shrinks to a few lines once the request is sent, so the footer is
   held to the bottom of the window rather than floating mid-screen. */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

main {
  flex: 1;
}

.request {
  padding-bottom: var(--space-24);
}

.request__inner {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: var(--space-16);
  align-items: start;
}

.request__intro {
  container-type: inline-size;
}

.request__intro > * + * {
  margin-top: var(--space-6);
}

/* "Request access." is about 7.4 times its size wide, and a two word title
   split over two lines reads as a mistake, so beside the form it scales to
   the column rather than wrap. */
.request__intro .headline-xl {
  font-size: min(var(--text-h1), 100cqi / 7.5);
}

.request__intro .eyebrow + .headline-xl {
  margin-top: var(--space-4);
}

.request__panel {
  padding: var(--space-8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  box-shadow: var(--shadow-sm);
}

@media (max-width: 900px) {
  .request__inner {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-8);
  }
}

@media (max-width: 480px) {
  .request__panel {
    padding: var(--space-6);
  }
}

/* ---- form layout ---- */

.form > * + * {
  margin-top: var(--space-6);
}

.form__note {
  color: var(--text-tertiary);
  font-size: var(--text-xs);
}

.form__row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-6);
}

@media (max-width: 620px) {
  .form__row {
    grid-template-columns: minmax(0, 1fr);
  }
}

.form__actions {
  display: flex;
  justify-content: flex-end;
}

/* Off-screen rather than display: none, which some bots check for. */
.form__trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Turnstile's own iframe is 65px tall; reserving it stops the button jumping. */
.form__challenge:not([hidden]) {
  min-height: 65px;
}

.form__status {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-sm);
  background: var(--danger-tint);
  color: var(--danger);
  font-size: var(--text-sm);
}

.form__status a {
  color: inherit;
  text-decoration: underline;
}

/* ---- fields ---- */

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

.field__label {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
}

.field__hint {
  margin-top: calc(var(--space-1) * -1);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
}

.field__input {
  width: 100%;
  min-height: calc(var(--unit) * 3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-base);
  color: var(--text-primary);
  font: inherit;
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  transition:
    border-color var(--duration-fast) var(--ease),
    box-shadow var(--duration-fast) var(--ease),
    background-color var(--duration-fast) var(--ease);
}

.field__input:hover {
  border-color: var(--text-tertiary);
}

/* The ring is drawn in solid accent, not a tint: a pale halo on a white card
   does not change contrast enough to read as focus. */
.field__input:focus-visible,
.field__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
  background: var(--surface-raised);
}

.field__input--area {
  min-height: calc(var(--unit) * 10);
  resize: vertical;
}

/* Invalid fields keep the same thin-to-thick step as valid ones, so focus is
   still visible on a field that is already red. */
.field__input[aria-invalid="true"] {
  border-color: var(--danger);
}

.field__input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 1px var(--danger);
}

.field__error {
  color: var(--danger);
  font-size: var(--text-sm);
}

/* The native select arrow is replaced so it sits on the same inset as the
   text and takes its colour from the tokens. */
.field__select {
  position: relative;
}

.field__select select {
  appearance: none;
  padding-right: var(--space-12);
  cursor: pointer;
}

.field__select::after {
  content: "";
  position: absolute;
  top: 50%;
  right: var(--space-4);
  width: var(--space-2);
  height: var(--space-2);
  border-right: 1.5px solid var(--text-secondary);
  border-bottom: 1.5px solid var(--text-secondary);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

/* ---- outcomes ---- */

.outcome {
  display: none;
}

.outcome:target,
.outcome.is-shown {
  display: block;
}

.outcome:focus {
  outline: none;
}

.outcome > * + * {
  margin-top: var(--space-4);
}

.outcome__title {
  font-size: var(--text-h3);
}

.outcome__body {
  color: var(--text-secondary);
}

.outcome__email {
  color: var(--text-primary);
  font-weight: var(--weight-medium);
  overflow-wrap: anywhere;
}

.outcome__actions {
  margin-top: var(--space-8);
}

.outcome--failed {
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-8);
  border-bottom: 1px solid var(--border-subtle);
}

.outcome--failed .outcome__title {
  color: var(--danger);
}

.outcome--failed a {
  color: var(--accent);
}

/* Once the request is sent the form has done its job. */
.outcome--sent:target ~ .form,
.request__panel.is-sent .form,
.request__panel.is-sent .outcome--failed {
  display: none;
}
