/* Foundation School restyle for Moodle's login pagelayout.
   Loaded only on body.pagelayout-login via hook injection. */

html, body { overflow-x: hidden; }

body.pagelayout-login {
  --fs-bg:        #F4EFE3;
  --fs-bg-2:      #FBF7EF;
  --fs-surface:   #FFFFFF;
  --fs-border:    #E6DDCC;
  --fs-ink:       #2F2250;
  --fs-ink-2:     #3A2F58;
  --fs-muted:     #7A6F86;
  --fs-navy:      #4C2A92;
  --fs-navy-d:    #3A1F75;
  --fs-navy-l:    #6D49C2;
  --fs-navy-ghost: rgba(76, 42, 146, 0.08);
  --fs-navy-ring:  rgba(76, 42, 146, 0.16);
  --fs-gold:      #F4BE41;
  --fs-gold-d:    #C47E0A;
  --fs-r-md:      14px;
  --fs-r-lg:      20px;
  --fs-r-pill:    999px;
  --fs-sh-sm:     0 2px 8px rgba(28,22,16,.06);
  --fs-sh-md:     0 14px 36px rgba(28,22,16,.10);
  --fs-sh-pop:    0 22px 60px rgba(28,22,16,.15);
  --fs-font-head: 'League Spartan', system-ui, sans-serif;
  --fs-font-body: 'Nunito', system-ui, sans-serif;
  --fs-topbar-h:  93px;

  font-family: var(--fs-font-body) !important;
  /* Graduation photo is the page background — fixed so it stays put on scroll.
     On desktop the right-half white form panel covers the photo's right side. */
  background: url('../pix/login-photo.jpg') center/cover no-repeat fixed !important;
  color: var(--fs-ink);
  min-height: 100dvh;
  position: relative;

  /* Subtle, brand-tinted scrollbar */
  scrollbar-color: var(--fs-navy-ring) transparent;
  scrollbar-width: thin;
}
body.pagelayout-login::-webkit-scrollbar { width: 10px; height: 10px; }
body.pagelayout-login::-webkit-scrollbar-track { background: transparent; }
body.pagelayout-login::-webkit-scrollbar-thumb {
  background: var(--fs-navy-ring);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
body.pagelayout-login::-webkit-scrollbar-thumb:hover {
  background-color: var(--fs-navy);
  background-clip: content-box;
}

/* Replace RemUI's "Rock Solid: Foundation School" sitename text inside the login card with the logo image. */
body.pagelayout-login .logo-area {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin-bottom: 14px !important;
}
body.pagelayout-login .logo-area .iconsitename {
  font-size: 0 !important;
  color: transparent !important;
  display: inline-block;
  width: 100%;
}
body.pagelayout-login .logo-area .iconsitename i { display: none !important; }
body.pagelayout-login .logo-area .iconsitename::before {
  content: '';
  display: block;
  width: 100%;
  max-width: 260px;
  height: 84px;
  margin: 0 auto;
  background: url('../pix/logo.png') center/contain no-repeat;
}

/* (Parchment grain removed — body background is now the photo. The dark overlay
   on .fs-login-aside replaces the parchment effect.) */

/* Hide RemUI chrome on the login page only */
body.pagelayout-login #page-header,
body.pagelayout-login .navbar,
body.pagelayout-login #page-footer,
body.pagelayout-login footer.footer,
body.pagelayout-login #page-navbar,
body.pagelayout-login .breadcrumb-nav,
body.pagelayout-login .navbar-light,
body.pagelayout-login .edw-navbar,
body.pagelayout-login .secondary-navigation { display: none !important; }

body.pagelayout-login #page,
body.pagelayout-login #page-wrapper,
body.pagelayout-login #page-content,
body.pagelayout-login .main-inner {
  background: transparent !important;
}

/* Mobile-default layout: aside becomes the full-page background photo,
   the form is a contained card centered over it. Desktop overrides at >= 960px
   re-split the layout into two columns. */
body.pagelayout-login .login-wrapper {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: calc(100dvh - var(--fs-topbar-h)) !important;
  padding: clamp(20px, 5vw, 40px) !important;
  position: relative;
  z-index: 5;
  background: transparent !important;
}
body.pagelayout-login .login-container {
  position: relative !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  width: 100% !important;
  max-width: 460px !important;
  height: auto !important;
  max-height: none !important;
  min-height: auto !important;
  overflow: visible !important;
  background: var(--fs-surface) !important;
  border: 1px solid var(--fs-border) !important;
  border-radius: var(--fs-r-lg) !important;
  box-shadow: var(--fs-sh-pop) !important;
  padding: clamp(28px, 6vw, 40px) !important;
  margin: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  animation: none !important;
  z-index: 5 !important;
}
/* Kill the gold gradient overlay that was part of the rounded-card look. */
body.pagelayout-login .login-container::before { display: none !important; }

/* Hold the form content at a readable max-width inside the wide panel. */
body.pagelayout-login .login-container .logo-area,
body.pagelayout-login .login-container > [role="main"],
body.pagelayout-login .login-container > div[role="main"] {
  width: 100% !important;
  max-width: 420px !important;
}

/* Heading area */
body.pagelayout-login .login-welcome-wrapper,
body.pagelayout-login .login-heading-wrapper {
  text-align: center !important;
  margin-bottom: 22px !important;
}
body.pagelayout-login .login-welcome-wrapper h1,
body.pagelayout-login .login-welcome-wrapper h2,
body.pagelayout-login .login-heading,
body.pagelayout-login h1.login-heading,
body.pagelayout-login .loginform h1 {
  font-family: var(--fs-font-head) !important;
  font-weight: 800 !important;
  font-size: 28px !important;
  letter-spacing: -0.01em !important;
  color: var(--fs-ink) !important;
  margin-bottom: 6px !important;
}
body.pagelayout-login .login-welcome-wrapper p,
body.pagelayout-login .login-heading-wrapper p {
  color: var(--fs-muted) !important;
  font-size: 14.5px !important;
}

/* Form labels — applies to ALL forms inside login pagelayout (login + forgot pw + set pw, etc.) */
body.pagelayout-login label,
body.pagelayout-login .col-form-label,
body.pagelayout-login .edw-form-label {
  font-family: var(--fs-font-head) !important;
  font-weight: 700 !important;
  font-size: 12px !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  color: var(--fs-ink-2) !important;
  margin-bottom: 6px !important;
}

/* Inputs (text/email/password/search) on any login-pagelayout form */
body.pagelayout-login .form-control,
body.pagelayout-login input[type="text"],
body.pagelayout-login input[type="email"],
body.pagelayout-login input[type="password"],
body.pagelayout-login input[type="search"] {
  border-radius: var(--fs-r-md) !important;
  border: 1.5px solid var(--fs-border) !important;
  background: var(--fs-bg-2) !important;
  padding: 14px 16px !important;
  height: auto !important;
  font-size: 15px !important;
  font-family: var(--fs-font-body) !important;
  color: var(--fs-ink) !important;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
  width: 100% !important;
}
body.pagelayout-login .form-control::placeholder { color: var(--fs-muted); }
body.pagelayout-login .form-control:focus,
body.pagelayout-login input:focus {
  border-color: var(--fs-navy) !important;
  background: var(--fs-surface) !important;
  box-shadow: 0 0 0 4px var(--fs-navy-ring) !important;
  outline: none !important;
}
body.pagelayout-login .form-group,
body.pagelayout-login .fitem { margin-bottom: 16px !important; }

/* Moodle's mform layout uses a 3/9 column split — collapse so labels stack above
   inputs (the wide-screen split looks weird in our narrow card column). */
body.pagelayout-login .mform .fitem.row {
  display: block !important;
  margin: 0 0 16px 0 !important;
}
body.pagelayout-login .mform .fitem .col-lg-3,
body.pagelayout-login .mform .fitem .col-md-4,
body.pagelayout-login .mform .fitem .col-lg-9,
body.pagelayout-login .mform .fitem .col-md-8 {
  flex: 0 0 100% !important;
  max-width: 100% !important;
  padding: 0 !important;
}
body.pagelayout-login .mform .fitem .form-inline {
  display: block !important;
}

/* Forgot password link */
body.pagelayout-login .login-form-forgotpassword a,
body.pagelayout-login .login-form-forgotpassword small a {
  color: var(--fs-navy) !important;
  font-weight: 700 !important;
  font-size: 13px !important;
  text-decoration: none;
}
body.pagelayout-login .login-form-forgotpassword a:hover { color: var(--fs-navy-d) !important; text-decoration: underline; }

/* Primary buttons — applies to all login-pagelayout forms incl. mform's input[type=submit] */
body.pagelayout-login .btn-primary,
body.pagelayout-login input[type="submit"].btn-primary,
body.pagelayout-login #loginbtn {
  background: var(--fs-navy) !important;
  border: 0 !important;
  border-radius: var(--fs-r-pill) !important;
  padding: 14px 22px !important;
  color: #fff !important;
  font-family: var(--fs-font-head) !important;
  font-weight: 700 !important;
  font-size: 14px !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
  box-shadow: var(--fs-sh-sm) !important;
  transition: transform .15s ease, box-shadow .2s ease, background .15s ease !important;
  margin-top: 4px;
  cursor: pointer;
}
body.pagelayout-login .btn-primary:hover,
body.pagelayout-login input[type="submit"].btn-primary:hover,
body.pagelayout-login #loginbtn:hover {
  background: var(--fs-navy-d) !important;
  transform: translateY(-1px);
  box-shadow: var(--fs-sh-md) !important;
  color: #fff !important;
}
body.pagelayout-login .btn-primary:active { transform: translateY(0); }

/* Secondary / outline buttons (e.g. "Cancel" on the already-logged-in confirm page) */
body.pagelayout-login .btn-secondary,
body.pagelayout-login .btn:not(.btn-primary):not(.btn-floating):not(.fs-register-cta) {
  background: transparent !important;
  border: 1.5px solid var(--fs-navy-ghost) !important;
  border-radius: var(--fs-r-pill) !important;
  padding: 12px 22px !important;
  color: var(--fs-navy) !important;
  font-family: var(--fs-font-head) !important;
  font-weight: 700 !important;
  font-size: 14px !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
  cursor: pointer;
}
body.pagelayout-login .btn-secondary:hover,
body.pagelayout-login .btn:not(.btn-primary):not(.btn-floating):not(.fs-register-cta):hover {
  border-color: var(--fs-navy-ring) !important;
  background: var(--fs-navy-ghost) !important;
  color: var(--fs-navy-d) !important;
}

/* OAuth2 / identity provider buttons */
body.pagelayout-login .login-identityproviders {
  margin-top: 24px !important;
  padding-top: 24px;
  border-top: 1px solid var(--fs-border);
  display: flex; flex-direction: column; gap: 10px;
}
body.pagelayout-login .login-identityproviders .btn,
body.pagelayout-login .login-divider + * a.btn {
  background: var(--fs-surface) !important;
  color: var(--fs-ink) !important;
  border: 1.5px solid var(--fs-border) !important;
  border-radius: var(--fs-r-pill) !important;
  padding: 12px 20px !important;
  font-family: var(--fs-font-head) !important;
  font-weight: 700 !important;
  font-size: 13.5px !important;
  letter-spacing: 0.02em !important;
  text-transform: none !important;
  display: inline-flex !important; align-items: center !important; justify-content: center !important; gap: 10px;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
body.pagelayout-login .login-identityproviders .btn:hover {
  border-color: var(--fs-navy-ring) !important;
  background: var(--fs-navy-ghost) !important;
  color: var(--fs-navy) !important;
  transform: translateY(-1px);
}
body.pagelayout-login .login-divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--fs-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin: 20px 0 0;
}
body.pagelayout-login .login-divider::before,
body.pagelayout-login .login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--fs-border);
}

/* Cookie/remember-me etc. */
body.pagelayout-login .form-check-label,
body.pagelayout-login .rememberusername {
  font-size: 13.5px;
  color: var(--fs-ink-2);
}

/* Errors */
body.pagelayout-login .loginerrors,
body.pagelayout-login .login-error,
body.pagelayout-login .alert-danger,
body.pagelayout-login .errormessage {
  background: rgba(217, 89, 65, 0.10) !important;
  border: 1px solid rgba(217, 89, 65, 0.32) !important;
  color: #8B2A18 !important;
  border-radius: var(--fs-r-md) !important;
  padding: 12px 14px !important;
  font-size: 14px !important;
  margin-bottom: 14px !important;
}

/* Maintenance / info notices */
body.pagelayout-login .alert-info,
body.pagelayout-login .alert-warning {
  border-radius: var(--fs-r-md) !important;
}

/* ============================================================
   Photo overlay + side tagline.
   The photo itself is on body's background-image (defined above).
   This <aside> is now just a darkening overlay + the desktop tagline copy —
   it has NO photo of its own, so there's no stacking-context fight with the form.
   ============================================================ */
.fs-login-aside {
  display: block;
  position: fixed;
  top: var(--fs-topbar-h);
  left: 0; right: 0; bottom: 0;
  pointer-events: none; /* don't intercept clicks; lets the form receive them */
  overflow: hidden;
  z-index: 0; /* sits over the body bg-image but under all flow content */
  background:
    linear-gradient(180deg,
      rgba(20, 10, 50, 0.45) 0%,
      rgba(40, 20, 90, 0.55) 45%,
      rgba(58, 31, 117, 0.78) 78%,
      rgba(30, 14, 70, 0.92) 100%);
}
/* On mobile the tagline is hidden — the form card carries the heading instead. */
.fs-login-aside .fs-aside-copy { display: none; }

@media (min-width: 960px) {
  /* Shift the body's bg-photo so its center (the people) lands in the LEFT half
     instead of behind the right-half white form panel. Achieved by scaling the
     image to 150% width and right-aligning — the visible left 50vw shows the
     image's middle, where the subjects are. */
  body.pagelayout-login {
    background-size: 150% auto !important;
    background-position: 100% center !important;
  }
  .fs-login-aside {
    /* Only darken the left half on desktop; right half stays photo-clear before
       the white form panel covers it. */
    right: auto;
    width: 50vw;
    background:
      linear-gradient(180deg,
        rgba(20, 10, 50, 0.10) 0%,
        rgba(40, 20, 90, 0.30) 45%,
        rgba(58, 31, 117, 0.78) 78%,
        rgba(30, 14, 70, 0.92) 100%);
  }
  .fs-login-aside .fs-aside-copy {
    display: block;
    position: absolute;
    left: 9%; right: 9%;
    bottom: 8%;
    color: #fff;
    text-align: left;
    pointer-events: auto;
  }

  /* Reserve the left 50vw for the fixed aside; the .login-container then fills
     the remaining right half edge-to-edge (no card chrome on desktop). */
  body.pagelayout-login .login-wrapper {
    padding: 0 0 0 50vw !important;
  }
  body.pagelayout-login .login-container {
    max-width: none !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    min-height: calc(100dvh - var(--fs-topbar-h)) !important;
    padding: clamp(32px, 5vw, 72px) clamp(24px, 4vw, 56px) !important;
  }
  .fs-login-aside .fs-aside-eyebrow {
    display: inline-flex; align-items: center; gap: 8px;
    font-family: var(--fs-font-head);
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255,255,255,.78);
    background: rgba(255,255,255,.10);
    padding: 6px 12px;
    border-radius: 999px;
    margin-bottom: 14px;
  }
  .fs-login-aside .fs-aside-eyebrow::before {
    content: '';
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--fs-gold);
  }
  .fs-login-aside h2 {
    color: #fff !important;
    font-family: var(--fs-font-head) !important;
    font-weight: 800 !important;
    font-size: clamp(24px, 2.4vw, 32px) !important;
    letter-spacing: -0.01em !important;
    line-height: 1.15 !important;
    margin: 0 0 8px !important;
  }
  .fs-login-aside p {
    color: rgba(255,255,255,.85) !important;
    font-size: 14.5px !important;
    max-width: 38ch !important;
    margin: 0 !important;
  }

  /* RemUI's `.loginright` already pins .login-container to the right edge of the wrapper.
     We don't need to shift anything — the aside fills the empty left half. */
}

/* Custom topbar injected by hook — pinned at the top of the viewport */
.fs-brand-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px clamp(20px, 4vw, 40px);
  border-bottom: 1px solid var(--fs-border);
  background: rgba(251, 247, 239, 0.92);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
}

/* Push the rest of the page below the fixed brand bar */
body.pagelayout-login { padding-top: var(--fs-topbar-h) !important; }
.fs-brand-bar .fs-brand {
  display: flex; align-items: center; gap: 14px;
  text-decoration: none;
}
.fs-brand-bar .fs-brand img { height: 56px; width: auto; display: block; }
.fs-brand-bar .fs-brand-tag {
  font-family: var(--fs-font-head);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--fs-muted);
  text-transform: uppercase;
  padding-left: 14px;
  border-left: 1.5px solid var(--fs-border);
  line-height: 1.2;
  white-space: nowrap;
}
.fs-brand-bar .fs-register-cta {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 22px;
  background: var(--fs-navy);
  color: #fff;
  text-decoration: none;
  border-radius: var(--fs-r-pill);
  font-family: var(--fs-font-head);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: var(--fs-sh-sm);
  transition: background .15s ease, transform .15s ease, box-shadow .2s ease;
}
.fs-brand-bar .fs-register-cta:hover {
  background: var(--fs-navy-d);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--fs-sh-md);
}
@media (max-width: 640px) {
  .fs-brand-bar .fs-brand img { height: 44px; }
  .fs-brand-bar .fs-brand-tag { display: none; }
  .fs-brand-bar .fs-register-cta { padding: 9px 16px; font-size: 12px; }
}
