/* ============================================================================
   csf_login.css — Central Square Foundation login-page branding.

   Styles for the `mgrant_csf/www/login.html` template override (replaces the
   earlier CSS-only skin of Frappe's stock `.page-card` login layout — that
   approach couldn't reach the split cover/spine layout the design contract
   requires without a template override). Build target is the signed design
   contract's #s-login screen: `media/login-wireframe/csf-mis-wireframe.html`
   (.lg-* classes) — this sheet's `.csf-lg-*` classes are that screen's CSS
   ported 1:1 onto the login.html markup, generic navy/yellow tokens swapped
   for this site's derived CSF palette vars (below).

   Layout: full-bleed cover photograph (light navy duotone: multiply-blend
   tint at .55 opacity + grayscale(.85) filter) on the left, fixed 460px
   white spine on the right carrying the sign-in form. DM Sans headline type
   with a yellow starburst SVG full-stop. Mono (JetBrains Mono) slide index
   under the rotating headline (numeric only — no fill/progress indicator,
   per PM feedback that a filling bar read as a loading state). SDG-4 badge
   top-left of the cover. Underline-style form inputs (no boxed fields). Navy button,
   yellow HOVER ONLY — hard rule: yellow never carries white text, so hover
   swaps to navy text on the yellow fill. mGrant logo (image, not text) + a
   copyright line in the spine footer.

   Palette vars are the same derived ramp as csf_brand.css (see that file's
   header for the full derivation/contrast-gate notes) — repeated here as a
   flat set so this sheet has no load-order dependency on csf_brand.css.
   Self-hosted DM Sans @font-face also repeated for the same reason (see
   csf_brand.css header for the licensing/selection evidence trail). */

:root {
  --csf-navy-600:   #00316B !important;  /* primary seed */
  --csf-navy-700:   #012C60 !important;
  --csf-navy-800:   #001A47 !important;
  --csf-navy-900:   #000B33 !important;
  --csf-yellow-500: #FED304 !important;  /* seed — starburst + progress rule only */
  --csf-sky-600:    #00669D !important;  /* link color, AA-checked in csf_brand.css */
  --csf-sky-700:    #004F7D !important;
  --csf-font-heading: "CSF Heading", "DM Sans", "Inter", sans-serif;
}

@font-face {
  font-family: "CSF Heading";
  src: url("/assets/mgrant_csf/fonts/dm-sans-variable-latin.woff2") format("woff2-variations"),
       url("/assets/mgrant_csf/fonts/dm-sans-variable-latin.woff2") format("woff2");
  font-weight: 500 700;
  font-style: normal;
  font-display: swap;
}

/* 0 ─ Page shell. templates/web.html still wraps block page_content in its
       own page-content-wrapper/container/breadcrumb chrome (untouched) — the
       login screen owns the full viewport per the contract rather than
       sitting in a centered container, so that chrome is collapsed here. */
body.login-page,
.page_content {
  background: #F5F7FA !important;
  padding: 0 !important;
  margin: 0 !important;
}
#page-login .page-breadcrumbs,
#page-login .page-header-wrapper {
  display: none !important;
}
#page-login .page-content-wrapper,
#page-login main,
#page-login .page_content {
  padding: 0 !important;
  margin: 0 !important;
  max-width: none !important;
}
#page-login .container {
  padding: 0 !important;
  max-width: none !important;
  width: 100% !important;
}

.csf-lg {
  display: flex;
  min-height: 100vh;
  width: 100%;
  font-family: "Inter", -apple-system, sans-serif;
  color: #12203A;
}

/* 1 ─ Cover panel — full-bleed carousel photograph, light navy duotone. */
.csf-lg-cover {
  position: relative;
  flex: 1;
  overflow: hidden;
  background: var(--csf-navy-900);
  min-height: 100vh;
}
.csf-lg-ph {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: grayscale(.85) contrast(1.05) brightness(1);
  opacity: 0;
  transition: opacity 1.4s cubic-bezier(.2, 0, 0, 1);
}
.csf-lg-ph.active { opacity: 1; }
.csf-lg-tint {
  position: absolute;
  inset: 0;
  background: var(--csf-navy-600);
  mix-blend-mode: multiply;
  opacity: .55;
}
.csf-lg-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 11, 51, .85), rgba(0, 11, 51, .12) 46%, rgba(0, 11, 51, .22));
}
.csf-lg-inner {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 38px 46px 42px;
}

/* SDG-4 badge, top-left of the cover. */
.csf-sdg {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  width: fit-content;
  color: #fff;
  font-family: var(--csf-font-heading);
}
.csf-sdg-chip {
  background: #C5192D;
  border-radius: 4px;
  padding: 6px 9px;
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
}
.csf-sdg-t {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  line-height: 1.3;
  opacity: .9;
}

/* Mono slide index. */
.csf-lg-idx {
  font: 500 12px "JetBrains Mono", monospace;
  letter-spacing: .1em;
  color: rgba(255, 255, 255, .65);
  margin-bottom: 13px;
}
.csf-lg-idx b { color: var(--csf-yellow-500); font-weight: 500; }

/* Rotating headline, DM Sans, yellow starburst full-stop. */
.csf-lg-headline {
  position: relative;
  height: 3.4em;
  font-family: var(--csf-font-heading);
  font-weight: 800;
  font-size: clamp(30px, 3.2vw, 48px);
  line-height: 1.14;
  letter-spacing: -.015em;
  color: #fff;
}
.csf-lg-line {
  position: absolute;
  bottom: 0;
  left: 0;
  max-width: 16ch;
  opacity: 0;
  transform: translateY(34px);
  transition: opacity .35s cubic-bezier(.2, 0, 0, 1), transform 0s linear .35s;
}
.csf-lg-line.active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity .9s cubic-bezier(.2, 0, 0, 1) .45s, transform .9s cubic-bezier(.2, 0, 0, 1) .45s;
}
.csf-star {
  display: inline-block;
  width: .5em;
  height: .5em;
  margin-left: .14em;
}
.csf-star svg { width: 100%; height: 100%; display: block; }

/* prefers-reduced-motion: freeze the carousel on the first slide, no
   crossfade transitions. The login.html carousel script itself also skips
   the slide-advance interval under this media query — this is the paired
   CSS half of that contract. */
@media (prefers-reduced-motion: reduce) {
  .csf-lg-ph,
  .csf-lg-line {
    transition: none !important;
  }
}

/* 2 ─ Spine — fixed-width white panel carrying the sign-in form. */
.csf-lg-spine {
  position: relative;
  z-index: 4;
  flex: 0 0 460px;
  width: 460px;
  background: #FFFFFF;
  display: flex;
  flex-direction: column;
  padding: 48px 44px 36px;
  box-shadow: -18px 0 50px rgba(0, 11, 51, .35);
}
.csf-lg-logo {
  width: 224px;
  margin-bottom: auto;
}
.csf-lg-logo img { width: 100%; display: block; }

.csf-lg-form-wrap { width: 100%; }

.csf-lg-eyebrow {
  font: 600 11px "Inter", sans-serif;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #8494AB;
  margin-bottom: 9px;
}
.csf-lg-spine h1 {
  font: 800 28px var(--csf-font-heading);
  letter-spacing: -.01em;
  color: var(--csf-navy-800);
  margin: 0;
}
.csf-lg-rule {
  width: 46px;
  height: 3px;
  background: var(--csf-yellow-500);
  margin-top: 11px;
  margin-bottom: 30px;
}

.csf-lg-forgot-eyebrow { margin-top: 0; }

/* Underline-style inputs — no boxed field, bottom border only. Min-height
   40px on the input keeps the tap target comfortable per the accessibility
   pass even though the visible underline is thin. */
.csf-lfield {
  margin-top: 24px;
  position: relative;
}
.csf-lfield:first-child { margin-top: 0; }
.csf-lfield label.form-label {
  display: block;
  font: 600 11px "Inter", sans-serif;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--csf-navy-700);
  margin-bottom: 6px;
}
.csf-lfield input.form-control {
  width: 100%;
  padding: 9px 2px 10px;
  font: 400 15px "Inter", sans-serif;
  color: var(--csf-navy-900);
  border: none;
  border-bottom: 1.5px solid #DCE3EC;
  background: transparent;
  outline: none;
  border-radius: 0;
  box-shadow: none !important;
  transition: border-color .25s;
  min-height: 40px;
}
.csf-lfield input.form-control:focus {
  border-bottom-color: var(--csf-navy-600);
  box-shadow: none !important;
}

/* Password show/hide toggle — sits inside the same underline field, right-
   aligned, so the field keeps its single-row layout. Icon-only button (eye /
   eye-slash), swapped via the `hidden` attribute rather than a class so no
   extra state lives in CSS. 32px hit area keeps it inside the 40px input's
   row without widening the field; -8px right margin optically aligns the
   icon glyph with the field's right edge. */
.csf-lfield-password input.form-control {
  padding-right: 34px;
}
.csf-pw-toggle {
  position: absolute;
  right: -8px;
  bottom: 3px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  color: #8494AB;
  cursor: pointer;
  border-radius: 4px;
  transition: color .15s ease;
}
.csf-pw-toggle:hover,
.csf-pw-toggle:focus-visible {
  color: var(--csf-navy-600);
}
.csf-pw-toggle:focus-visible {
  outline: 2px solid var(--csf-navy-600);
  outline-offset: 1px;
}
.csf-pw-icon {
  transition: opacity .1s ease;
}
@media (prefers-reduced-motion: reduce) {
  .csf-pw-toggle,
  .csf-pw-icon {
    transition: none !important;
  }
}

/* Invalid-state feedback — login.js adds `.invalid` to the nearest
   `.page-card-body` and `.invalid-login` to `.login-content.page-card` on a
   failed login/reset. Neither of those exact wrapper elements exists
   verbatim in this markup's outer shell, so `.page-card-body` (present,
   wraps the fields) carries the red underline, and the shake is retargeted
   at `.csf-lg-form` — same two trigger classes login.js already adds,
   no core JS behaviour reinterpreted. */
.page-card-body.invalid .csf-lfield input.form-control {
  border-bottom-color: #E23D28;
}
.csf-lg-form.invalid-login {
  animation: csf-lg-shake .4s;
}
@media (prefers-reduced-motion: reduce) {
  .csf-lg-form.invalid-login { animation: none; }
}
@keyframes csf-lg-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* Navy button, yellow HOVER ONLY — hard rule: yellow never carries white
   text, so hover swaps text to navy the moment the fill turns yellow.
   min-height 44px keeps the primary action well above the 40px tap-target
   floor. */
.csf-lg-btn.btn {
  width: 100%;
  margin-top: 34px;
  padding: 13px;
  min-height: 44px;
  border: none;
  border-radius: 6px;
  background: var(--csf-navy-600);
  color: #FFFFFF;
  font: 700 15px var(--csf-font-heading);
  cursor: pointer;
  transition: all .25s cubic-bezier(.2, 0, 0, 1);
}
.csf-lg-btn.btn:hover,
.csf-lg-btn.btn:focus {
  background: var(--csf-yellow-500);
  color: var(--csf-navy-800);
  box-shadow: 0 10px 26px rgba(0, 49, 107, .22);
}

/* Forgot-password / back-to-sign-in links — min-height 40px hit area even
   though the visible link text is small, per the tap-target pass. */
.csf-lg-aux {
  margin-top: 18px;
  text-align: left;
}
.csf-lg-aux a {
  font: 500 13px "Inter", sans-serif;
  color: var(--csf-sky-600);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
}
.csf-lg-aux a:hover { color: var(--csf-sky-700); }

/* Section toggling: login.js shows/hides `.for-login` / `.for-forgot` via
   jQuery .toggle(); default display below matches the .form-forgot `.hide`
   class already present on that form so there's no flash-of-both-sections
   before JS runs. */
.for-forgot { display: none; }

/* Social login (SSO) — rendered only when a Social Login Key is enabled;
   button markup and auth URL come from core context untouched. */
.csf-lg-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 14px;
  font: 500 11px "Inter", sans-serif;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #8494AB;
}
.csf-lg-divider::before,
.csf-lg-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--csf-gray-200, #E5EAF1);
}
.csf-lg-sso,
.btn.csf-lg-sso {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 44px;
  border: 1.5px solid var(--csf-gray-200, #E5EAF1);
  border-radius: 8px;
  background: #FFFFFF;
  color: var(--csf-navy-600, #00316B);
  font: 600 13.5px "Inter", sans-serif;
  text-decoration: none;
}
.csf-lg-sso:hover,
.btn.csf-lg-sso:hover {
  background: #F6F8FB;
  color: var(--csf-navy-600, #00316B);
  border-color: #C9D4E4;
}
.csf-lg-sso img {
  width: 18px;
  height: 18px;
  display: block;
}

.csf-lg-foot {
  margin-top: auto;
  padding-top: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
}
.csf-lg-foot img { height: 22px; opacity: .85; display: block; }
.csf-lg-foot span { font-size: 11px; color: #8494AB; line-height: 1.4; }

/* 3 ─ Narrow-viewport fallback — the contract is a fixed two-pane desktop
   layout with no documented mobile behaviour; stacking the spine under a
   shortened cover keeps the form reachable rather than clipping it
   off-screen below 900px. Not part of the signed contract — flagged as a
   deviation in the PR, not a silent judgment call. */
@media (max-width: 900px) {
  .csf-lg { flex-direction: column; min-height: auto; }
  .csf-lg-cover { min-height: 46vh; flex: none; }
  .csf-lg-spine { flex: none; width: 100%; box-shadow: none; }
}
