/* =============================================================================
   /forgot-password/ — page-scoped stylesheet
   -----------------------------------------------------------------------------
   A 1:1 port of /signin/css/signin.css (itself ported from the reference design
   intelio-login-mockup.html) so the two pages sit side by side with identical
   type, colour, spacing, field, button, border, radius, shadow, focus and
   message treatment. Every rule is namespaced .fp-* so nothing here can leak
   into the shared header/footer (which keep using /css/styles.css). Loaded
   AFTER /css/styles.css on purpose.

   Only the namespace token changed (si- -> fp-); the design tokens, values and
   breakpoints are unchanged. Page-specific additions:
     .fp-step                       — "01 / Forgot password" step indicator
     .fp-field--code input          — letter-spaced one-time-code field
     .fp-errors / .fp-alert         — server error + success banner region
     .fp-note                       — neutral "if an account exists" notice
     .fp-field-errors               — per-field error text (future-proofing)
     input[aria-invalid="true"]     — invalid field state
     .fp-btn[aria-busy] / spinner   — submit loading + disabled states
   ============================================================================= */

.fp-page {
  --fp-surface: #ffffff;
  --fp-dark: #111921;
  --fp-red: #c92f33;
  --fp-red-dark: #b02529;
  --fp-red-active: #9c2124;
  --fp-red-disabled: #c98d8f;
  --fp-red-soft: #f9eaea;
  --fp-red-light: #e07070;
  --fp-ink: #1b1b1b;
  --fp-muted: #5a6572;
  --fp-line: #dfe4ea;
  --fp-placeholder: #9aa5b1;
  --fp-sans: "Inter", "Helvetica Neue", Arial, sans-serif;
  --fp-mono: "JetBrains Mono", ui-monospace, monospace;

  display: grid;
  grid-template-columns: 1fr 1fr;
  /* 81px = the shared site header height (kept intact above this block). */
  min-height: calc(100vh - 81px);
  background: #f1f4f7;
  color: var(--fp-ink);
  font-family: var(--fp-sans);
  line-height: 1.6;
  text-align: left;
}

.fp-page *,
.fp-page *::before,
.fp-page *::after {
  box-sizing: border-box;
}

/* --------------------------------------------------------------- form side */
.fp-formside {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 64px;
  background: var(--fp-surface);
}

.fp-formside h1 {
  margin: 0 0 8px;
  padding: 0;
  font-family: var(--fp-sans);
  font-size: 30px;
  /* line-height intentionally not set: the reference inherits 1.6 (=48px). */
  color: var(--fp-ink);
}

.fp-sub {
  margin: 0 0 32px;
  padding: 0;
  color: var(--fp-muted);
  font-size: 15px;
  line-height: 1.6;
}

/* Emphasised inline value inside the sub-copy (e.g. the email a code went to). */
.fp-sub .fp-strong {
  color: var(--fp-ink);
  font-weight: 600;
}

/* ------------------------------------------------------- server error banner */
.fp-errors {
  margin: 0 0 22px;
}

.fp-errors:empty {
  display: none;
}

.fp-errors:focus-visible {
  outline: 2px solid var(--fp-red);
  outline-offset: 2px;
}

/* Normalises whatever markup the controller emits into one styled alert. */
.fp-errors > *,
.fp-page .fp-alert {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--fp-red-light);
  border-left: 3px solid var(--fp-red);
  border-radius: 2px;
  background: var(--fp-red-soft);
  color: #8f2124;
  font-family: var(--fp-sans);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
}

/* Same treatment, success semantics (e.g. "your password has been reset"). */
.fp-page .fp-alert--success {
  border-color: #a8d5b5;
  border-left-color: #1e7e34;
  background: #edf9ef;
  color: #1e7e34;
}

.fp-errors > * + * {
  margin-top: 10px;
}

.fp-errors a {
  color: #8f2124;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* --------------------------------------------------------------- step label */
/* "01 / Forgot password" — the reference kicker treatment, on the light form
   side, so it keeps sign-in's mono/uppercase/tracked rhythm. */
.fp-step {
  margin: 0 0 8px;
  padding: 0;
  font-family: var(--fp-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--fp-red);
}

/* ------------------------------------------------------------------- fields */
.fp-field {
  margin-bottom: 18px;
}

/* One-time code field — wider tracking so the 6 digits read as a group. */
.fp-field--code input {
  letter-spacing: 0.4em;
}

.fp-field label {
  display: block;
  margin: 0 0 7px;
  font-family: var(--fp-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fp-muted);
}

.fp-field input {
  width: 100%;
  margin: 0;
  font-family: var(--fp-sans);
  font-size: 15px;
  /* "normal" matches the reference exactly (Chrome's UA value, not inherited
     1.6 from the page) — keeps the field at the reference height. */
  line-height: normal;
  padding: 13px 14px;
  border: 1px solid var(--fp-line);
  border-radius: 2px;
  outline: none;
  color: var(--fp-ink);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Focus ring per the reference: border turns Intelio red. */
.fp-field input:focus {
  border-color: var(--fp-red);
  box-shadow: 0 0 0 3px rgba(201, 47, 51, 0.1);
}

.fp-field input::placeholder {
  color: var(--fp-placeholder);
}

/* Invalid (server-rejected) field state. */
.fp-field input[aria-invalid="true"] {
  border-color: var(--fp-red);
  background: #fffafa;
}

/* Per-field error text (fragment emitted by the controller). */
.fp-field-errors:empty {
  display: none;
}

.fp-field-errors {
  margin-top: 7px;
}

.fp-field-errors > *,
.fp-page .fp-field-error,
.fp-field > p {
  margin: 0;
  padding: 0;
  font-family: var(--fp-mono);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--fp-red);
}

/* ------------------------------------------------------- password + toggle */
.fp-passwrap {
  position: relative;
}

.fp-passwrap input {
  padding-right: 46px;
}

.fp-passtoggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: #8b95a1;
  border-radius: 2px;
}

.fp-passtoggle svg {
  width: 16px;
  height: 16px;
}

.fp-passtoggle:hover {
  color: var(--fp-red);
}

.fp-passtoggle:focus-visible {
  outline: 2px solid var(--fp-red);
  outline-offset: 2px;
}

/* Icon swap driven by the existing page script (toggles .is-visible). */
.fp-passtoggle .fp-eye-closed {
  display: none;
}

.fp-passtoggle.is-visible .fp-eye-open {
  display: none;
}

.fp-passtoggle.is-visible .fp-eye-closed {
  display: block;
}

/* ------------------------------------------------------------------ button */
.fp-btn {
  display: block;
  width: 100%;
  padding: 15px;
  background: var(--fp-red);
  color: #fff;
  border: none;
  font-family: var(--fp-sans);
  font-size: 13px;
  font-weight: 700;
  line-height: normal;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 2px;
  margin: 0;
  transition: background 0.15s ease;
}

.fp-btn:hover:not(:disabled) {
  background: var(--fp-red-dark);
}

.fp-btn:active:not(:disabled) {
  background: var(--fp-red-active);
}

.fp-btn:focus-visible {
  outline: 2px solid var(--fp-ink);
  outline-offset: 2px;
}

/* Disabled / loading state. */
.fp-btn:disabled,
.fp-btn[aria-busy="true"] {
  background: var(--fp-red-disabled);
  cursor: progress;
}

.fp-btn-label {
  display: inline;
}

.fp-btn-loading {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  white-space: nowrap;
}

.fp-btn[aria-busy="true"] .fp-btn-label {
  display: none;
}

.fp-btn[aria-busy="true"] .fp-btn-loading {
  display: inline-flex;
}

.fp-spinner {
  width: 14px;
  height: 14px;
  flex: none;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: fp-spin 0.7s linear infinite;
}

@keyframes fp-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .fp-spinner {
    animation-duration: 1.6s;
  }
}

/* ------------------------------------------------- neutral info note */
/* Same treatment as the sign-in page's info note, left-aligned so it reads as
   a page-level notice above the form. */
.fp-note {
  margin: 0 0 22px;
  padding: 12px 14px;
  border: 1px solid var(--fp-line);
  border-radius: 2px;
  background: #f7f9fb;
  color: var(--fp-muted);
  font-family: var(--fp-sans);
  font-size: 13px;
  line-height: 1.5;
}

.fp-note:empty {
  display: none;
}

/* --------------------------------------------------- secondary text links */
/* "Back to sign in" / "Request a new code" footers under each step — the
   sign-in page's centred aux-link treatment. */
.fp-signup {
  margin: 26px 0 0;
  padding: 0;
  text-align: center;
  font-size: 14px;
  color: var(--fp-muted);
}

.fp-signup a {
  color: var(--fp-red);
  font-weight: 600;
  text-decoration: none;
}

.fp-signup a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* -------------------------------------------------------------- benefits side */
.fp-benefits {
  background: var(--fp-dark);
  color: #fff;
  padding: 48px 64px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.fp-benefits .kicker {
  font-family: var(--fp-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--fp-red-light);
  margin-bottom: 14px;
}

.fp-benefits h2 {
  margin: 0 0 14px;
  padding: 0;
  font-family: var(--fp-sans);
  font-size: 26px;
  line-height: 1.25;
  color: #fff;
}

.fp-benefits > p {
  color: var(--fp-placeholder);
  font-size: 15px;
  margin: 0 0 34px;
  padding: 0;
  max-width: 420px;
}

.fp-perk {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid #232c38;
}

.fp-perk:first-of-type {
  border-top: none;
}

.fp-perk-icon {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  background: #0c1219;
  border: 1px solid #232c38;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fp-perk-icon svg {
  width: 18px;
  height: 18px;
  stroke: var(--fp-red-light);
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fp-perk b {
  display: block;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 2px;
}

.fp-perk span {
  font-size: 13px;
  line-height: 1.6;
  color: var(--fp-placeholder);
}

/* ------------------------------------------------------------- breakpoints */
/* Tablet + mobile: single column, benefits panel hidden (reference behaviour). */
@media (max-width: 900px) {
  .fp-page {
    grid-template-columns: 1fr;
    min-height: calc(100vh - 65px);
  }

  .fp-benefits {
    display: none;
  }

  .fp-formside {
    padding: 36px 22px;
    justify-content: flex-start;
  }

  .fp-formside h1 {
    font-size: 24px;
    line-height: 1.25;
    margin-bottom: 6px;
  }

  .fp-sub {
    font-size: 14px;
    margin-bottom: 26px;
  }
}

/* Small phones — keep the reference rhythm, just tighten the gutters. */
@media (max-width: 480px) {
  .fp-formside {
    padding: 30px 18px;
  }

  .fp-page {
    min-height: calc(100vh - 61px);
  }

  .fp-step {
    letter-spacing: 0.16em;
  }
}

/* ==========================================================================
   Heading typography override — MUST stay inside @layer base.
   --------------------------------------------------------------------------
   /css/styles.css (Tailwind v4) contains:
       @layer base { h1, h2, h3, h4, h5, h6 {
           font-family: var(--font-sans) !important;
           letter-spacing: -0.02em !important;
           font-weight: 600 !important; } }
   For !important author declarations the cascade REVERSES layer order, so a
   layered !important beats an unlayered !important no matter the specificity.
   Living in the same `base` layer means our higher-specificity selector wins
   deterministically and the headings render at the reference weights.
   ========================================================================== */
@layer base {
  .fp-page .fp-formside h1,
  .fp-page .fp-benefits h2 {
    font-family: var(--fp-sans) !important;
    font-weight: 700 !important;
    letter-spacing: -0.01em !important;
  }
}
