/* SolutionTee Edu Academy — controls
   =========================================================================
   Every control on the site: fields, choices, fieldsets, the shapes a
   form is built from. Loaded last, so it wins over anything the older
   stylesheets said about an input.

   The governing constraint is not aesthetic. A student filling this in is
   sixteen, on a phone, on a bad connection, possibly tired, and a form
   they cannot complete is a student who does not enrol. So:

     - Every border uses --edge-control, the one border token measured to
       clear 3:1. The decorative --edge tokens are not good enough here:
       a field whose boundary you cannot see is not a field.
     - Every target is at least 44px tall. No exceptions, including the
       checkbox, whose hit area is the whole label.
     - Font size never drops below 16px on a text input. iOS Safari zooms
       the viewport on focus below that, and a page that jumps when you
       tap a box feels broken in a way no styling recovers from.
     - Error state is never colour alone: the border changes, a glyph
       appears, the text says what is wrong, and aria-describedby ties it
       to the input.
   ====================================================================== */


/* ==========================================================================
   FIELD
   ========================================================================== */

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

.field__label,
.form label > span,
label.field__label {
  font-size: var(--step--1);
  font-weight: var(--weight-semibold);
  color: var(--ink);
  line-height: var(--lh-snug);
}

/* WTForms renders <label> directly, so the element selector has to carry
   it too — the macro adds .field__label but a hand-written form may not. */
.field > label {
  font-size: var(--step--1);
  font-weight: var(--weight-semibold);
  color: var(--ink);
}

.field__help,
.field__hint {
  font-size: var(--step--2);
  line-height: var(--lh-snug);
  color: var(--ink-faint);
}

/* ---- The error --------------------------------------------------------
   The glyph is a pseudo-element rather than a character in the template,
   so it can never be read out by a screen reader — the message text
   already says what is wrong, and "warning sign warning sign" before
   every error is noise. */
.field__error {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--step--2);
  font-weight: var(--weight-semibold);
  line-height: var(--lh-snug);
  color: var(--danger);
}

.field__error::before {
  content: "!";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 15px;
  block-size: 15px;
  flex: none;
  margin-block-start: 1px;
  background: var(--danger);
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 0.66rem;
  font-weight: var(--weight-bold);
  color: var(--canvas-deep);
  speak: never;
}


/* ==========================================================================
   TEXT INPUTS
   ========================================================================== */

.input,
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="tel"],
.field input[type="url"],
.field input[type="number"],
.field input[type="search"],
.field input[type="date"],
.field input[type="datetime-local"],
.field input[type="time"],
.field textarea,
.field select,
.form input[type="text"],
.form input[type="email"],
.form input[type="password"],
.form textarea,
.form select {
  inline-size: 100%;
  min-block-size: 44px;
  padding: 0.7em 0.9em;
  background: var(--panel-sunken);
  border: 1px solid var(--edge-control);
  border-radius: var(--r-3);
  color: var(--ink);
  font-family: var(--font-body);
  /* 16px floor: below this iOS Safari zooms the viewport on focus. */
  font-size: max(16px, var(--step-0));
  line-height: 1.4;
  transition: border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out),
              background-color var(--dur-fast) var(--ease-out);
}

.input::placeholder,
.field input::placeholder,
.field textarea::placeholder {
  color: var(--ink-faint);
  opacity: 1;   /* Firefox dims placeholders by default, twice over */
}

.input:hover,
.field input:hover,
.field textarea:hover,
.field select:hover {
  border-color: var(--edge-bright);
}

.input:focus-visible,
.field input:focus-visible,
.field textarea:focus-visible,
.field select:focus-visible,
.form input:focus-visible,
.form textarea:focus-visible,
.form select:focus-visible {
  outline: none;
  border-color: var(--focus);
  background: var(--panel);
  box-shadow: var(--ring-soft);
}

.field textarea,
.form textarea {
  min-block-size: 8rem;
  resize: vertical;
  line-height: var(--lh-body);
}

.input:disabled,
.field input:disabled,
.field textarea:disabled,
.field select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---- Invalid ----------------------------------------------------------
   Driven by aria-invalid and by the wrapper the macro sets, never by
   :invalid — the browser applies :invalid before anybody has typed
   anything, so an empty required field is red on arrival. */
.field:has(.field__error) .input,
.field:has(.field__error) input,
.field:has(.field__error) textarea,
.field:has(.field__error) select,
.input[aria-invalid="true"],
[aria-invalid="true"].input {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-bg);
}

/* ---- Select -----------------------------------------------------------
   The native arrow is drawn by the OS in the OS's colour, which on a dark
   field is either invisible or a bright wedge. Replaced with an inline
   SVG that inherits the theme. The background-image cannot use a CSS
   variable, so the two themes each declare one. Light is the default, so
   the base rule carries the dark-ink arrow and the dark theme overrides
   it with a light one. */
.field select,
.form select,
select.input {
  appearance: none;
  padding-inline-end: 2.6rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none'%3E%3Cpath d='M3.5 6L8 10.5L12.5 6' stroke='%2345577A' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  cursor: pointer;
}

:root[data-theme="dark"] .field select,
:root[data-theme="dark"] .form select,
:root[data-theme="dark"] select.input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none'%3E%3Cpath d='M3.5 6L8 10.5L12.5 6' stroke='%239DAAC5' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* The dropdown list itself is painted by the OS and ignores almost
   everything. These two are the only properties it honours, and without
   them a dark page opens a white list. */
.field select option,
.form select option {
  background: var(--panel);
  color: var(--ink);
}


/* ==========================================================================
   CHECKBOX AND RADIO
   ==========================================================================
   The native control is kept and restyled rather than hidden behind a
   drawn one. A hidden input loses the OS focus ring, the OS
   high-contrast treatment and, on some Android browsers, the ability to
   be toggled at all. accent-color does most of the work; the rest is
   size and a hit area.
   ========================================================================== */

.checkbox,
.radio {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  /* The whole label is the target, and it clears 44px. A 16px box on its
     own is a quarter of the minimum and is the single most missed tap on
     any sign-up form. */
  min-block-size: 44px;
  padding-block: var(--space-2);
  font-size: var(--step--1);
  line-height: var(--lh-snug);
  color: var(--ink-muted);
  cursor: pointer;
}

.checkbox input[type="checkbox"],
.radio input[type="radio"],
.field input[type="checkbox"],
.field input[type="radio"] {
  inline-size: 20px;
  block-size: 20px;
  flex: none;
  margin: 0;
  margin-block-start: 1px;
  accent-color: var(--accent);
  cursor: pointer;
}

.checkbox:hover,
.radio:hover {
  color: var(--ink);
}

.checkbox input:focus-visible,
.radio input:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

/* ---- A choice as a card ------------------------------------------------
   For the places where the options are the decision and not a detail —
   picking a payment plan, picking online or physical. The whole card is
   the label. */
.choice {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--glass-1);
  border: 1px solid var(--edge-control);
  border-radius: var(--r-3);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out);
}

.choice:hover {
  background: var(--glass-2);
  border-color: var(--edge-bright);
}

/* :has() is progressive. Without it the card simply never highlights,
   and the native radio dot still says which one is chosen — so the
   information is never lost, only the emphasis. */
.choice:has(input:checked) {
  background: var(--warning-bg);
  border-color: var(--edge-gold);
}

.choice:has(input:focus-visible) {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

.choice__text { min-inline-size: 0; }

.choice__label {
  display: block;
  font-family: var(--font-display);
  font-size: var(--step-0);
  font-weight: var(--weight-bold);
  color: var(--ink);
}

.choice__detail {
  display: block;
  margin-block-start: 2px;
  font-size: var(--step--2);
  line-height: var(--lh-snug);
  color: var(--ink-faint);
}


/* ==========================================================================
   FIELDSET
   ========================================================================== */

.fieldset {
  min-inline-size: 0;   /* fieldset defaults to min-content and overflows */
  margin: 0;
  padding: 0;
  border: none;
}

.fieldset__legend,
.fieldset > legend {
  padding: 0;
  margin-block-end: var(--space-3);
  font-family: var(--font-display);
  font-size: var(--step--2);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--ink-faint);
}


/* ==========================================================================
   FORM LAYOUT
   ========================================================================== */

.form,
.auth__form {
  display: grid;
  gap: var(--space-5);
  min-inline-size: 0;
}

.form--tight { gap: var(--space-4); }

/* Two fields side by side where they are genuinely one thing — first and
   last name, day and month. Never for unrelated fields: a form that
   zig-zags is measurably slower to complete than one straight column. */
.form__row {
  display: grid;
  gap: var(--space-4);
}

@media (min-width: 560px) {
  .form__row--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.form__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  margin-block-start: var(--space-2);
}

.form__foot {
  padding-block-start: var(--space-5);
  border-block-start: 1px solid var(--edge);
  font-size: var(--step--1);
  color: var(--ink-muted);
}


/* ==========================================================================
   ERROR SUMMARY
   ==========================================================================
   For a long form where the first failure may be off-screen. Focusable
   so the submit handler can move the caret to it, and every entry links
   to the field it names.
   ========================================================================== */

.errors {
  padding: var(--space-5);
  background: var(--danger-bg);
  border: 1px solid var(--danger-edge);
  border-inline-start: 3px solid var(--danger);
  border-radius: var(--r-3);
}

.errors:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
}

.errors__title {
  font-family: var(--font-display);
  font-size: var(--step-0);
  font-weight: var(--weight-bold);
  color: var(--danger);
}

.errors__list {
  display: grid;
  gap: var(--space-2);
  margin-block-start: var(--space-3);
}

.errors__list a {
  font-size: var(--step--1);
  color: var(--ink);
  text-decoration-color: var(--danger);
}


/* ==========================================================================
   TURNSTILE
   ==========================================================================
   Cloudflare renders this in an iframe it controls and the widget picks
   its own theme. All that can be done from here is stop it sitting
   flush against the button above it.
   ========================================================================== */

.cf-turnstile {
  min-block-size: 65px;
}


/* ==========================================================================
   THE AUTH SHELL
   ==========================================================================
   Two columns: the form on the left, one panel on the right saying who
   the page is for. Below 900px the panel drops entirely rather than
   stacking under the form — somebody here has one job, and making them
   scroll past marketing to reach a sign-in button on a phone is the
   whole reason this layout exists.
   ========================================================================== */

.auth {
  min-block-size: 100vh;
  background: var(--aurora-calm), var(--canvas);
}

.auth__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-block-size: var(--header-h);
  padding-inline: var(--gutter);
  position: relative;
  z-index: 2;
}

.auth__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  min-block-size: 44px;   /* the mark alone made this a 32px target */
  text-decoration: none;
  color: var(--ink);
}

.auth__brand-mark {
  inline-size: 32px;
  block-size: 32px;
}

.auth__brand-name {
  font-family: var(--font-display);
  font-size: var(--step-0);
  font-weight: var(--weight-bold);
  letter-spacing: -0.02em;
}

.auth__bar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.auth__back {
  font-size: var(--step--1);
  color: var(--ink-muted);
  text-decoration: none;
}

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

@media (max-width: 520px) {
  .auth__back { display: none; }
}

.auth__main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-7) var(--gutter) var(--space-9);
  position: relative;
  z-index: 1;
}

.auth__card {
  inline-size: 100%;
  max-inline-size: 26rem;
}

.auth__title {
  margin-block-end: var(--space-5);
  font-size: var(--step-4);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-display);
  line-height: var(--lh-tight);
  color: var(--ink);
}

.auth__intro {
  margin-block-end: var(--space-6);
  font-size: var(--step-0);
  line-height: var(--lh-snug);
  color: var(--ink-muted);
}

.auth__messages {
  display: grid;
  gap: var(--space-3);
  margin-block-end: var(--space-5);
}

.auth__aside {
  margin-block-start: var(--space-6);
  padding-block-start: var(--space-5);
  border-block-start: 1px solid var(--edge);
  font-size: var(--step--1);
  line-height: var(--lh-loose);
  color: var(--ink-muted);
}


/* ---- A link on the label's line ----------------------------------------
   "Forgotten?" beside the Password label. Two things make this work and
   both are easy to miss:

   `align-items: baseline` so the small link sits on the label's baseline
   rather than being centred against it, which at two different sizes
   reads as a misalignment.

   The padding/negative-margin pair gives the link a finger-sized hit area
   without making the row taller. A 12px link with no padding is a 12px
   target, and this is a phone.
   ======================================================================== */
.field__labelrow {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
}

.field__action {
  flex: none;
  font-size: var(--step--1);
  font-weight: var(--weight-semibold);
  padding-inline: var(--space-2);
  padding-block: var(--space-2);
  margin-inline-end: calc(var(--space-2) * -1);
  margin-block: calc(var(--space-2) * -1);
}


/* ---- The other door ----------------------------------------------------
   Sign in ↔ create an account. NOT `.auth__aside`, which is for the pages
   that have something to explain (an unconfirmed guardian, a code that
   has not arrived). Those want quiet small print. This wants to be
   found: somebody on the wrong page has one thing to do and it is this.

   Centred, because it is the only thing below the form and a
   left-aligned line under a full-width button looks dropped rather than
   placed. The question stays muted so the link is the thing the eye
   lands on.
   ======================================================================== */
.auth__switch {
  margin-block-start: var(--space-7);
  padding-block-start: var(--space-5);
  border-block-start: 1px solid var(--edge);
  font-size: var(--step-0);
  line-height: var(--lh-snug);
  text-align: center;
  color: var(--ink-muted);
}

.auth__switch-link {
  font-weight: var(--weight-semibold);
  /* Full-strength underline. A link that is the page's only exit should
     not be relying on colour alone to look like one. */
  text-decoration-color: currentColor;
  white-space: nowrap;
}

/* ---- The panel --------------------------------------------------------- */
.auth__panel {
  display: none;
}

@media (min-width: 900px) {
  .auth {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr);
    grid-template-rows: auto 1fr;
  }

  .auth__bar { grid-column: 1; grid-row: 1; }
  .auth__main { grid-column: 1; grid-row: 2; padding-block-start: 0; }

  .auth__panel {
    position: relative;
    grid-column: 2;
    grid-row: 1 / span 2;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: var(--space-7);
    padding: var(--space-8) var(--space-7);
    background: var(--band);
    border-inline-start: 1px solid var(--edge-strong);
    overflow: hidden;
  }

  /* The panel is a navy band, so it takes the lifted ink scale — the
     same tokens .on-band declares, applied here because the element is
     the band rather than containing one. */
  .auth__panel {
    --ink: #F2F5FB;
    --ink-muted: #B9C5DC;
    --ink-faint: #95A5C4;
    --edge: rgba(143, 189, 245, 0.16);
    color: var(--ink-muted);
  }

  .auth__panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(80% 50% at 100% 0%,
                rgba(242, 178, 51, 0.12), transparent 62%),
                radial-gradient(70% 50% at 0% 100%,
                rgba(37, 99, 179, 0.32), transparent 66%);
    pointer-events: none;
  }

  /* The body and foot lift above the texture layers; the watermark and
     the scanlines stay at z-index 0 behind them. Scoped to these two
     rather than `> *`, which would also have raised the watermark. */
  .auth__panel-body,
  .auth__panel-foot {
    position: relative;
    z-index: 1;
  }
}

/* ---- The watermark -----------------------------------------------------
   A large, very faint mark bleeding off the bottom-right corner. This is
   the old treatment kept on purpose: at 62% of the panel it reads as
   considered branding, where a 40px logo in the corner reads as a
   favicon somebody pasted in.

   EVERY property is restated, including the ones that look redundant.
   The first attempt set only the size, which left `position: absolute`
   and the negative offsets from the pre-rebuild rule in force — so the
   mark came out of flow and sat on top of the eyebrow. Overriding half
   of an absolutely-positioned element is how you get an overlap that
   looks like a flexbox bug and is not one. */
.auth__panel-mark {
  position: absolute;
  inset-block-start: auto;
  inset-inline-start: auto;
  inset-inline-end: -12%;
  inset-block-end: -10%;
  inline-size: 62%;
  block-size: auto;
  opacity: 0.05;
  pointer-events: none;
  z-index: 0;
  /* The ground here is always navy, in either theme, so the mark's
     tokens are pinned rather than following the page. */
  --mark-trace: #EEF4FF;
  --mark-crossbar: #EEF4FF;
  --mark-node: #EEF4FF;
  --mark-trace: #EEF4FF;
  --mark-crossbar: #EEF4FF;
  --mark-node: #EEF4FF;
}

/* ---- Scanlines ---------------------------------------------------------
   A one-pixel rule every 34px, masked to fade out at the edges, with a
   gold bloom low-left. It is the one overtly technical texture on the
   site and it belongs here: this is the panel that says what the system
   is, on the page where somebody is about to enter it.

   Very low alpha on purpose. You are not meant to see lines; you are
   meant to notice the surface is not flat. */
.auth__panel-rules {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.05) 0 1px,
      transparent 1px 34px
    ),
    radial-gradient(70% 55% at 10% 88%,
                    rgba(242, 178, 51, 0.16), transparent 68%);
  -webkit-mask-image:
    radial-gradient(125% 95% at 50% 35%, #000 38%, transparent 90%);
  mask-image:
    radial-gradient(125% 95% at 50% 35%, #000 38%, transparent 90%);
}

@media (forced-colors: active) {
  .auth__panel-rules,
  .auth__panel-mark { display: none; }
}

.auth__panel-eyebrow {
  font-family: var(--font-display);
  font-size: var(--step--2);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--gold-500);
}

.auth__panel-title {
  margin-block-start: var(--space-3);
  font-size: var(--step-3);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-display);
  line-height: var(--lh-heading);
  color: var(--ink);
}

.auth__panel-text {
  margin-block-start: var(--space-4);
  max-inline-size: 42ch;
  line-height: var(--lh-snug);
  color: var(--ink-muted);
}

.auth__panel-list {
  display: grid;
  gap: var(--space-4);
  margin-block-start: var(--space-7);
}

.auth__panel-list > li {
  display: grid;
  gap: 2px;
  padding-inline-start: var(--space-4);
  border-inline-start: 2px solid var(--edge-gold);
}

.auth__panel-who {
  font-family: var(--font-display);
  font-size: var(--step--1);
  font-weight: var(--weight-bold);
  color: var(--ink);
}

.auth__panel-what {
  font-size: var(--step--2);
  line-height: var(--lh-snug);
  color: var(--ink-faint);
}

.auth__panel-foot {
  font-size: var(--step--2);
  line-height: var(--lh-snug);
  color: var(--ink-faint);
  max-inline-size: 44ch;
}


/* ==========================================================================
   REGISTRATION ODDS
   ========================================================================== */

.auth__lede {
  margin-block-start: var(--space-4);
  font-size: var(--step-0);
  line-height: var(--lh-snug);
  color: var(--ink-muted);
}

.auth__resend {
  margin-block-start: var(--space-4);
}

.password-rules {
  display: grid;
  gap: .4rem;
  margin: calc(var(--space-3) * -1) 0 var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--edge);
  border-radius: var(--r-2);
  background: var(--glass-1);
  list-style: none;
  font-size: var(--step--2);
  color: var(--ink-muted);
}
.password-rules li::before { content: "○"; margin-inline-end: .55rem; }
.password-rules li.is-met { color: var(--success); }
.password-rules li.is-met::before { content: "✓"; }
.auth__resend-countdown { margin-inline-start: var(--space-2); font-size: var(--step--2); color: var(--ink-faint); }

/* A pair of role choices side by side — student or parent. Two columns
   because the choice is binary and stacking it makes the second option
   look like an afterthought. */
.choices {
  display: grid;
  gap: var(--space-2);
  margin-block-start: var(--space-2);
}

@media (min-width: 420px) {
  .choices {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* The guardian block appears only for a candidate under 18, so it is
   marked as a distinct region rather than blending into the form: a
   parent's email is being collected and that should be visibly its own
   thing. */
.guardian-fields {
  display: grid;
  gap: var(--space-5);
  padding: var(--space-5);
  background: var(--warning-bg);
  border: 1px solid var(--edge-gold);
  border-inline-start: 3px solid var(--accent);
  border-radius: var(--r-3);
}

/* A form that should not run the full width of a console page. Written
   as a class rather than an inline style because the CSP here is
   style-src 'self', which forbids style ATTRIBUTES too — an inline width
   is silently dropped and the form quietly renders full-bleed. */
.form--narrow {
  max-inline-size: 44rem;
}


/* ==========================================================================
   AN OPTIONAL FIELD SAYS SO
   ==========================================================================
   Marking what is optional rather than what is required. Most fields on
   this site are required, so an asterisk on nine of ten labels carries no
   information — the exception is what the reader needs pointed out.
   ========================================================================== */

.field__optional {
  margin-inline-start: var(--space-2);
  font-size: var(--step--2);
  font-weight: var(--weight-regular);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--ink-faint);
}


/* ==========================================================================
   THE PICTURE ON AN ACCOUNT
   ==========================================================================
   The current photograph beside the control that changes it, so somebody
   can see what they are replacing. Stacks on a phone, where a 96px
   circle and a file input side by side leaves the input too narrow to
   read its own filename.
   ========================================================================== */

.photoform {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: clamp(var(--space-5), 4vw, var(--space-7));
}

.photoform__side {
  flex: 1 1 16rem;
  min-inline-size: 0;
}

.avatar--xl {
  inline-size: 96px;
  block-size: 96px;
  font-size: var(--step-3);
}


/* ==========================================================================
   A PASSWORD YOU CAN CHECK
   ==========================================================================
   The toggle sits INSIDE the field rather than as a checkbox underneath.
   A checkbox labelled "show password" is a second thing to read and a
   second thing to reach; the eye is where the eye goes.

   The button is hidden until password.js adds `.has-toggle`, because a
   reveal control that does nothing is worse than no control at all —
   somebody presses it, nothing happens, and they conclude the page is
   broken rather than that a script failed.
   ========================================================================== */

.passwrap {
  position: relative;
  display: flex;
}

.passwrap__input {
  /* Room for the button, plus the gutter it sits in. Padding rather
     than a narrower box, so the focus ring still traces the whole
     field — a ring that stops short of the eye looks like two
     controls. */
  padding-inline-end: 3rem;
  inline-size: 100%;
}

.passwrap__toggle {
  display: none;
  position: absolute;
  inset-block: 1px;
  inset-inline-end: 1px;
  /* 44px of touch target inside a field that is often 48px tall. */
  inline-size: 2.75rem;
  align-items: center;
  justify-content: center;
  border: 0;
  border-start-end-radius: inherit;
  border-end-end-radius: inherit;
  background: none;
  color: var(--ink-faint);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out);
}

.has-toggle .passwrap__toggle { display: flex; }

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

.passwrap__toggle:focus-visible {
  outline: 2px solid var(--action);
  outline-offset: -2px;
}

.passwrap__icon {
  inline-size: 1.15rem;
  block-size: 1.15rem;
}

/* One glyph at a time, and which one says the STATE rather than the
   action: an open eye means "it is visible now". A single icon that
   rotated would leave somebody guessing which way round it is. */
.passwrap__icon--hide { display: none; }
.is-shown .passwrap__icon--show { display: none; }
.is-shown .passwrap__icon--hide { display: block; }

.is-shown .passwrap__toggle { color: var(--action); }

/* Caps Lock. Accent rather than danger: nothing is wrong yet, and a red
   warning on a field somebody is still typing into cries wolf. */
.passwrap__caps {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--step--2);
  font-weight: var(--weight-semibold);
  color: var(--ink-accent);
}

.passwrap__caps::before {
  content: "";
  inline-size: 0.5rem;
  block-size: 0.5rem;
  border-radius: 50%;
  background: currentColor;
}

@media (forced-colors: active) {
  .passwrap__toggle { color: ButtonText; }
  .is-shown .passwrap__toggle { color: Highlight; }
}
