/* MathPro Tutors - Math Guru inspired public menu + homepage newsletter v5 */

:root {
  --mgt-blue: #2b279b;
  --mgt-blue-dark: #211d7f;
  --mgt-pink: #ff5abb;
  --mgt-pink-dark: #e948a7;
  --mgt-ink: #171522;
}

/* Announcement strip */
body.mathguru-theme .mgt-announcement {
  position: relative;
  z-index: 90;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 58px 10px 24px;
  background: #fff;
  color: var(--mgt-blue);
  border-bottom: 1px solid rgba(43, 39, 155, .10);
  font-size: clamp(.92rem, 1.4vw, 1.18rem);
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
}
body.mathguru-theme .mgt-announcement-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 10px;
}
body.mathguru-theme .mgt-announcement a {
  color: var(--mgt-blue);
  text-decoration: underline;
  text-underline-offset: 3px;
}
body.mathguru-theme .mgt-announcement-dismiss {
  position: absolute;
  top: 50%;
  right: 20px;
  width: 32px;
  height: 32px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--mgt-blue);
  font-size: 1.55rem;
  line-height: 1;
  cursor: pointer;
}
body.mathguru-theme .mgt-announcement-dismiss:hover,
body.mathguru-theme .mgt-announcement-dismiss:focus-visible {
  background: rgba(43, 39, 155, .08);
}
body.mathguru-theme .mgt-announcement.is-dismissed { display: none; }

/* Public header modeled on the reference navigation */
body.mathguru-theme .mgt-reference-header {
  position: relative;
  z-index: 80;
  margin: 0;
  background: var(--mgt-blue-dark);
  border: 0;
  box-shadow: none;
}
body.mathguru-theme.mp-homepage .mgt-reference-header {
  position: absolute;
  top: 56px;
  left: 0;
  right: 0;
  background: linear-gradient(180deg, rgba(4, 4, 9, .72), rgba(4, 4, 9, .18));
}
body.mathguru-theme.mp-homepage .mgt-announcement.is-dismissed + .mgt-reference-header { top: 0; }
body.mathguru-theme .mgt-header-inner {
  min-height: 112px;
  display: flex;
  align-items: center;
  gap: 34px;
}
body.mathguru-theme .mgt-reference-header .pro-brand {
  flex: 0 0 auto;
  color: #fff;
  text-decoration: none;
}
body.mathguru-theme .mgt-reference-header .brand-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
}
body.mathguru-theme .mgt-reference-header .brand-mark {
  width: 60px;
  height: 60px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--mgt-pink);
  font-weight: 900;
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
}
body.mathguru-theme .mgt-reference-header .pro-brand-copy strong,
body.mathguru-theme .mgt-reference-header .pro-brand-copy small { color: #fff; }
body.mathguru-theme .mgt-reference-header .pro-brand-copy small { opacity: .82; }

body.mathguru-theme .mgt-reference-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 27px;
  min-width: 0;
}
body.mathguru-theme .mgt-reference-nav > a,
body.mathguru-theme .mgt-nav-parent {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 52px;
  color: #fff !important;
  text-decoration: none;
  font-size: 1.02rem;
  font-weight: 800;
  white-space: nowrap;
}
body.mathguru-theme .mgt-reference-nav > a::after,
body.mathguru-theme .mgt-nav-parent::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: 5px;
  height: 3px;
  background: var(--mgt-pink);
  transition: right .18s ease;
}
body.mathguru-theme .mgt-reference-nav > a:hover::after,
body.mathguru-theme .mgt-reference-nav > a:focus-visible::after,
body.mathguru-theme .mgt-reference-nav > a.is-current::after,
body.mathguru-theme .mgt-nav-dropdown:hover .mgt-nav-parent::after,
body.mathguru-theme .mgt-nav-dropdown:focus-within .mgt-nav-parent::after { right: 0; }

body.mathguru-theme .mgt-nav-dropdown {
  position: relative;
  display: flex;
  align-items: center;
}
body.mathguru-theme .mgt-nav-parent::before {
  content: "▾";
  order: 2;
  margin-left: 6px;
  font-size: .75em;
  opacity: .9;
}
body.mathguru-theme .mgt-dropdown-menu {
  position: absolute;
  top: calc(100% - 3px);
  left: 50%;
  width: 270px;
  transform: translate(-50%, 10px);
  padding: 10px 0;
  background: var(--mgt-blue);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 24px 50px rgba(0,0,0,.28);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease, visibility .16s ease;
}
body.mathguru-theme .mgt-nav-dropdown:hover .mgt-dropdown-menu,
body.mathguru-theme .mgt-nav-dropdown:focus-within .mgt-dropdown-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, 0);
}
body.mathguru-theme .mgt-dropdown-menu a {
  display: block;
  padding: 10px 20px;
  color: #fff !important;
  text-align: center;
  text-decoration: none;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.2;
}
body.mathguru-theme .mgt-dropdown-menu a:hover,
body.mathguru-theme .mgt-dropdown-menu a:focus-visible {
  background: rgba(255,255,255,.12);
}

body.mathguru-theme .mgt-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin-left: 4px;
}
body.mathguru-theme .mgt-header-actions .mgt-sign-in {
  color: #fff !important;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}
body.mathguru-theme .mgt-contact-cta,
body.mathguru-theme .mgt-portal-cta {
  min-width: 150px;
  min-height: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 24px;
  color: #fff !important;
  background: var(--mgt-pink);
  border: 2px solid var(--mgt-pink);
  border-radius: 0;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(255,90,187,.18);
}
body.mathguru-theme .mgt-contact-cta:hover,
body.mathguru-theme .mgt-contact-cta:focus-visible,
body.mathguru-theme .mgt-portal-cta:hover,
body.mathguru-theme .mgt-portal-cta:focus-visible {
  background: var(--mgt-pink-dark);
  border-color: var(--mgt-pink-dark);
}
body.mathguru-theme .mgt-sign-out {
  border: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

/* Homepage newsletter: the supplied image is the actual background */
body.mathguru-theme .pro-home-hero.pro-home-hero-newsletter {
  position: relative;
  min-height: 760px;
  padding: 190px 0 82px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #fff;
  background-image:
    linear-gradient(180deg, rgba(62, 45, 53, .38), rgba(62, 45, 53, .34)),
    url('../img/homepage-newsletter-background-v5.png') !important;
  background-size: cover !important;
  background-position: center center !important;
  background-repeat: no-repeat !important;
  border: 0;
}
body.mathguru-theme .pro-home-hero-newsletter .pro-home-hero-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0,0,0,.18) 0%, rgba(0,0,0,.06) 33%, rgba(0,0,0,.12) 100%);
  pointer-events: none;
}
body.mathguru-theme .pro-home-hero-newsletter-inner {
  position: relative;
  z-index: 2;
  width: min(100% - 40px, 1050px);
  margin-inline: auto;
  text-align: center;
}
body.mathguru-theme .pro-home-hero-newsletter .pro-home-hero-copy-centered {
  max-width: 920px;
  margin: 0 auto 42px;
  text-align: center;
}
body.mathguru-theme .pro-home-hero-newsletter .pro-home-hero-copy-centered h1 {
  margin: 0 0 24px;
  color: #fff;
  font-size: clamp(2.4rem, 4.2vw, 4.2rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -.03em;
  text-shadow: 0 3px 20px rgba(0,0,0,.22);
}
body.mathguru-theme .pro-home-hero-newsletter .pro-home-hero-copy-centered p {
  max-width: 880px;
  margin: 0 auto;
  color: #fff;
  font-size: clamp(1.15rem, 2.1vw, 1.75rem);
  font-weight: 700;
  line-height: 1.45;
  text-shadow: 0 2px 16px rgba(0,0,0,.20);
}
body.mathguru-theme .pro-newsletter-form {
  width: min(100%, 900px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}
body.mathguru-theme .pro-newsletter-name-row {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
body.mathguru-theme .pro-newsletter-field {
  display: block;
  width: 100%;
  margin: 0;
}
body.mathguru-theme .pro-newsletter-field input {
  width: 100%;
  min-height: 84px;
  padding: 18px 30px;
  border: 1px solid rgba(255,255,255,.95);
  border-radius: 0;
  outline: none;
  background: #fff;
  color: #30303a;
  box-shadow: 0 6px 22px rgba(0,0,0,.08);
  font-size: clamp(1.05rem, 1.6vw, 1.45rem);
  font-weight: 500;
}
body.mathguru-theme .pro-newsletter-field input::placeholder { color: #a9a9b0; opacity: 1; }
body.mathguru-theme .pro-newsletter-field input:focus {
  border-color: var(--mgt-pink);
  box-shadow: 0 0 0 4px rgba(255,90,187,.20), 0 8px 28px rgba(0,0,0,.10);
}
body.mathguru-theme .pro-newsletter-email { width: 52%; min-width: 430px; }
body.mathguru-theme .pro-newsletter-cta {
  min-width: 180px;
  min-height: 80px;
  padding: 18px 34px !important;
  border-radius: 0 !important;
  background: var(--mgt-pink) !important;
  border-color: var(--mgt-pink) !important;
  color: #fff !important;
  font-size: 1.22rem !important;
  font-weight: 900 !important;
  box-shadow: 0 10px 28px rgba(255,90,187,.24);
}
body.mathguru-theme .pro-newsletter-cta:hover,
body.mathguru-theme .pro-newsletter-cta:focus-visible {
  background: var(--mgt-pink-dark) !important;
  border-color: var(--mgt-pink-dark) !important;
}
body.mathguru-theme .pro-newsletter-message {
  width: min(100%, 900px);
  margin: -18px auto 22px;
  padding: 14px 18px;
  background: rgba(255,255,255,.94);
  color: #272431;
  font-weight: 800;
  box-shadow: 0 10px 30px rgba(0,0,0,.12);
}
body.mathguru-theme .pro-newsletter-message.is-success { border-left: 5px solid #2a9d67; }
body.mathguru-theme .pro-newsletter-message.is-error { border-left: 5px solid #c23a51; }
body.mathguru-theme .pro-newsletter-honeypot {
  position: absolute !important;
  left: -10000px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
}

/* Ensure the old homepage hero styles cannot suppress this section. */
body.mathguru-theme.mp-homepage main > #newsletter {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}

@media (max-width: 1180px) {
  body.mathguru-theme .mgt-header-inner { gap: 22px; }
  body.mathguru-theme .mgt-reference-nav { gap: 18px; }
  body.mathguru-theme .mgt-reference-nav > a,
  body.mathguru-theme .mgt-nav-parent { font-size: .94rem; }
  body.mathguru-theme .mgt-contact-cta,
  body.mathguru-theme .mgt-portal-cta { min-width: 132px; padding-inline: 18px; }
}

@media (max-width: 1040px) {
  body.mathguru-theme .mgt-announcement { min-height: 50px; padding: 9px 50px 9px 18px; }
  body.mathguru-theme.mp-homepage .mgt-reference-header { top: 50px; }
  body.mathguru-theme.mp-homepage .mgt-announcement.is-dismissed + .mgt-reference-header { top: 0; }
  body.mathguru-theme .mgt-reference-header .mpt-nav-toggle {
    margin-left: auto;
    display: inline-flex;
    border-color: rgba(255,255,255,.45);
    background: rgba(0,0,0,.20);
  }
  body.mathguru-theme .mgt-reference-header .mpt-nav-toggle span { background: #fff; }
  body.mathguru-theme .mgt-reference-nav {
    position: absolute;
    top: 100%;
    left: 16px;
    right: 16px;
    margin: 0;
    padding: 18px;
    display: none;
    align-items: stretch;
    gap: 4px;
    background: rgba(24, 21, 87, .98);
    box-shadow: 0 22px 54px rgba(0,0,0,.30);
    max-height: calc(100vh - 150px);
    overflow-y: auto;
  }
  body.mathguru-theme .mgt-reference-nav.is-open { display: flex; }
  body.mathguru-theme .mgt-reference-nav > a,
  body.mathguru-theme .mgt-nav-parent { min-height: 46px; padding: 0 8px; }
  body.mathguru-theme .mgt-nav-dropdown { display: block; }
  body.mathguru-theme .mgt-dropdown-menu {
    position: static;
    width: auto;
    transform: none;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    display: grid;
    padding: 0 0 8px 14px;
    background: transparent;
    border: 0;
    box-shadow: none;
  }
  body.mathguru-theme .mgt-dropdown-menu a { padding: 8px 10px; text-align: left; font-size: .92rem; }
  body.mathguru-theme .mgt-header-actions { margin: 8px 0 0; flex-wrap: wrap; }
  body.mathguru-theme .mgt-contact-cta,
  body.mathguru-theme .mgt-portal-cta { min-width: 155px; }
  body.mathguru-theme .pro-home-hero.pro-home-hero-newsletter { padding-top: 175px; }
}

@media (max-width: 720px) {
  body.mathguru-theme .mgt-announcement { font-size: .85rem; }
  body.mathguru-theme .mgt-announcement-dismiss { right: 10px; }
  body.mathguru-theme .mgt-header-inner { min-height: 88px; }
  body.mathguru-theme .mgt-reference-header .brand-logo { width: 50px; height: 50px; }
  body.mathguru-theme .mgt-reference-header .brand-mark { width: 48px; height: 48px; }
  body.mathguru-theme .mgt-reference-header .pro-brand-copy small { display: none; }
  body.mathguru-theme .pro-home-hero.pro-home-hero-newsletter {
    min-height: 700px;
    padding: 160px 0 64px;
    background-position: 48% center !important;
  }
  body.mathguru-theme .pro-home-hero-newsletter-inner { width: min(100% - 28px, 680px); }
  body.mathguru-theme .pro-home-hero-newsletter .pro-home-hero-copy-centered { margin-bottom: 30px; }
  body.mathguru-theme .pro-newsletter-name-row { grid-template-columns: 1fr; gap: 14px; }
  body.mathguru-theme .pro-newsletter-form { gap: 14px; }
  body.mathguru-theme .pro-newsletter-field input { min-height: 66px; padding: 14px 20px; }
  body.mathguru-theme .pro-newsletter-email { width: 100%; min-width: 0; }
  body.mathguru-theme .pro-newsletter-cta { min-height: 64px; min-width: 155px; }
}

/* V6: keep the original hero at the top; newsletter is a separate end-of-homepage section. */
body.mathguru-theme .pro-newsletter-section {
  position: relative;
  min-height: 720px;
  padding: 92px 0 86px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #fff;
  background-image:
    linear-gradient(180deg, rgba(73,52,59,.26), rgba(73,52,59,.30)),
    url('../img/homepage-newsletter-background-v5.png');
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  border-top: 54px solid var(--mgt-blue);
  border-bottom: 0;
}
body.mathguru-theme .pro-newsletter-section-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0,0,0,.10), rgba(0,0,0,.04) 45%, rgba(0,0,0,.10));
}
body.mathguru-theme .pro-newsletter-section-inner {
  position: relative;
  z-index: 2;
  width: min(100% - 40px, 1050px);
  margin-inline: auto;
  text-align: center;
}
body.mathguru-theme .pro-newsletter-copy {
  max-width: 920px;
  margin: 0 auto 42px;
}
body.mathguru-theme .pro-newsletter-copy h2 {
  margin: 0 0 24px;
  color: #fff;
  font-size: clamp(2.5rem, 4.3vw, 4rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -.03em;
  text-shadow: 0 3px 20px rgba(0,0,0,.20);
}
body.mathguru-theme .pro-newsletter-copy p {
  max-width: 880px;
  margin: 0 auto;
  color: #fff;
  font-size: clamp(1.15rem, 2vw, 1.65rem);
  font-weight: 700;
  line-height: 1.45;
  text-shadow: 0 2px 16px rgba(0,0,0,.18);
}
body.mathguru-theme.mp-homepage main > #newsletter {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}
@media (max-width: 1040px) {
  body.mathguru-theme .pro-newsletter-section { min-height: 660px; padding: 78px 0 72px; }
}
@media (max-width: 720px) {
  body.mathguru-theme .pro-newsletter-section {
    min-height: 700px;
    padding: 68px 0 60px;
    border-top-width: 32px;
    background-position: 46% center;
  }
  body.mathguru-theme .pro-newsletter-section-inner { width: min(100% - 28px, 680px); }
  body.mathguru-theme .pro-newsletter-copy { margin-bottom: 30px; }
  body.mathguru-theme .pro-newsletter-copy h2 { font-size: clamp(2.15rem, 10vw, 3rem); margin-bottom: 16px; }
  body.mathguru-theme .pro-newsletter-copy p { font-size: 1.06rem; }
}

/* V7 stability/UI correction: prevent the reference-style header from colliding
   with the logo/brand on login, error and portal-adjacent public pages. */
body.mathguru-theme .mgt-reference-header .pro-brand,
body.mathguru-theme .mgt-reference-header .brand {
  flex: 0 0 240px;
  max-width: 240px;
  min-width: 220px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}
body.mathguru-theme .mgt-reference-header .pro-brand-copy {
  min-width: 0;
  display: grid;
  line-height: 1.08;
}
body.mathguru-theme .mgt-reference-header .pro-brand-copy strong,
body.mathguru-theme .mgt-reference-header .pro-brand-copy small {
  display: block;
  max-width: 165px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body.mathguru-theme .mgt-reference-nav { flex: 1 1 auto; }
body.mathguru-theme .mgt-reference-nav > a,
body.mathguru-theme .mgt-nav-parent { z-index: 1; }
@media (max-width: 1180px) {
  body.mathguru-theme .mgt-reference-header .pro-brand,
  body.mathguru-theme .mgt-reference-header .brand { flex-basis: 218px; min-width: 200px; }
  body.mathguru-theme .mgt-reference-header .pro-brand-copy strong,
  body.mathguru-theme .mgt-reference-header .pro-brand-copy small { max-width: 142px; }
  body.mathguru-theme .mgt-reference-nav { gap: 14px; }
}
@media (max-width: 1040px) {
  body.mathguru-theme .mgt-reference-header .pro-brand,
  body.mathguru-theme .mgt-reference-header .brand { flex: 0 1 auto; max-width: calc(100% - 78px); min-width: 0; }
  body.mathguru-theme .mgt-reference-header .pro-brand-copy strong,
  body.mathguru-theme .mgt-reference-header .pro-brand-copy small { max-width: 220px; }
}

/* Keep the error page readable when an incident page is shown. */
body.mathguru-theme .error-page {
  padding: clamp(72px, 8vw, 120px) 0;
  background: linear-gradient(135deg, #fff7fb 0%, #f1f0ff 100%);
}
body.mathguru-theme .error-page .narrow {
  width: min(760px, calc(100% - 32px));
  margin-inline: auto;
  text-align: center;
}
body.mathguru-theme .error-page .request-id {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
}
