/**
 * Enrolment code gate (spec §5.1).
 *
 * Every component rule is scoped under `.psp-gate` on purpose. The theme ships
 * Tailwind preflight, whose `[type="submit"] { background-color: initial }` is
 * an attribute selector and therefore ties on specificity with a single class -
 * and the theme's stylesheet loads after this one, so the tie goes to it. A
 * bare `.psp-gate__submit` background silently loses and the button renders as
 * white text on nothing. The extra ancestor wins it back without !important.
 *
 * Deliberately quiet: this is the first thing a patient sees, often on a phone,
 * sometimes having been redirected mid-task from a page they wanted. It should
 * read as part of the site rather than as a security checkpoint.
 *
 * Typography is inherited from the theme rather than declared, so the gate
 * follows Zirkel/OpenSans and any future change to them. Only the brand orange
 * is stated outright, matching theme.json.
 */

.psp-gate {
  /* Fills the space between header and footer so the form sits optically
     centred instead of clinging to the top of an otherwise empty page. */
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 1.5rem;
  box-sizing: border-box;
}

.psp-gate .psp-gate__card {
  width: 100%;
  max-width: 55rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin: 0;
  padding: 3rem 2.75rem;
  background: #fff;
  border: 1px solid #e6e6e6;
  border-top: 3px solid #f29400;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .04), 0 8px 24px rgba(0, 0, 0, .05);
}

/* Intro copy above the field. The card is a flex column with its own gap, so
   these carry no margins of their own. */
.psp-gate .psp-gate__intro {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

/* The one place this file states a size rather than inheriting it: the theme
   renders body copy larger inside this template than it does in running text,
   which made the intro read as a heading. 1rem puts it back to ordinary
   website text. */
.psp-gate .psp-gate__text {
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
  color: #4a4a4a;
}

.psp-gate .psp-gate__text--advice {
  font-size: .9375rem;
  color: #6a6a6a;
}

.psp-gate .psp-gate__field {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .5rem;
}

.psp-gate .psp-gate__label {
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #6b6b6b;
}

.psp-gate .psp-gate__input {
  /* Sized to the content, not the card: an enrolment code is short, and a
     full-width field invites the patient to expect a long one. Capped so it
     still shrinks on a narrow phone. */
  width: 100%;
  max-width: 16rem;
  box-sizing: border-box;
  padding: .7rem .85rem;
  font: inherit;
  /* Enrolment codes are read off a letter and typed character by character;
     the extra tracking makes transcription errors easier to spot. */
  font-size: 1rem;
  letter-spacing: .06em;
  color: #1a1a1a;
  background: #fff;
  border: 1px solid #cfcfcf;
  border-radius: 0;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.psp-gate .psp-gate__input::placeholder {
  color: #b0b0b0;
  letter-spacing: normal;
}

.psp-gate .psp-gate__input:hover {
  border-color: #a8a8a8;
}

.psp-gate .psp-gate__input:focus {
  outline: none;
  border-color: #f29400;
  box-shadow: 0 0 0 3px rgba(242, 148, 0, .18);
}

/* Only colour the field red once a submission has actually failed - not while
   the visitor is still typing. */
.psp-gate--error .psp-gate__input {
  border-color: #b3261e;
}

.psp-gate--error .psp-gate__input:focus {
  box-shadow: 0 0 0 3px rgba(179, 38, 30, .15);
}

.psp-gate .psp-gate__error {
  margin: 0;
  font-size: .875rem;
  line-height: 1.5;
  color: #b3261e;
}

.psp-gate .psp-gate__submit {
  appearance: none;
  /* flex-start rather than the card's default stretch, so the button is as
     wide as its label instead of as wide as the card. */
  align-self: flex-start;
  padding: .7rem 1.5rem;
  font: inherit;
  font-size: .9375rem;
  font-weight: 600;
  letter-spacing: .02em;
  color: #fff;
  background: #f29400;
  border: 1px solid #f29400;
  border-radius: 0;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}

.psp-gate .psp-gate__submit:hover,
.psp-gate .psp-gate__submit:focus-visible {
  background: #d98400;
  border-color: #d98400;
}

.psp-gate .psp-gate__submit:focus-visible {
  outline: 2px solid #1a1a1a;
  outline-offset: 2px;
}

.psp-gate .psp-gate__submit:active {
  background: #c07600;
  border-color: #c07600;
}

@media (max-width: 30rem) {
  .psp-gate {
    padding: 2.5rem 1rem;
  }

  .psp-gate .psp-gate__card {
    padding: 2rem 1.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .psp-gate .psp-gate__input,
  .psp-gate .psp-gate__submit {
    transition: none;
  }
}

/* ---------------------------------------------------------------------------
 * Protected content block (Option 2) - the placeholder a locked-out visitor
 * sees in place of the content, and the editor's own outline.
 * ------------------------------------------------------------------------- */

.psp-protected {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
  padding: 2rem;
  background: #fff;
  border: 1px solid #e6e6e6;
  border-left: 3px solid #f29400;
}

.psp-protected .psp-protected__text {
  margin: 0;
  color: #4a4a4a;
}

/* Secondary line: present on every locked section, so it is set back from
   the prompt above it rather than competing with it. */
.psp-protected .psp-protected__text--advice {
  font-size: .9375em;
  color: #6a6a6a;
}

.psp-protected .psp-protected__link {
  display: inline-block;
  padding: .7rem 1.4rem;
  font-weight: 600;
  color: #fff;
  background: #f29400;
  border: 1px solid #f29400;
  text-decoration: none;
}

.psp-protected .psp-protected__link:hover,
.psp-protected .psp-protected__link:focus-visible {
  background: #d98400;
  border-color: #d98400;
  color: #fff;
}

/* Editor only: make the protected region obvious while authoring. */
.psp-protected-editor {
  border: 1px dashed #f29400;
  padding: .5rem 1rem 1rem;
}

.psp-protected-editor__label {
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #8a5300;
  margin-bottom: .5rem;
}
