:root {
  --paper: #ffffff;
  --grid: #d6e5f5;
  --grid-strong: #c2d7ee;
  --ink: #1b2430;
  --ink-soft: #56697e;
  --muted: #8295a8;
  --blue: #2748c8;
  --blue-bright: #3b66f5;
  --blue-bg: #eaf0fe;
  --red: #e03e45;
  --red-dark: #c42a31;
  --sans: "Manrope", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.fortland-public-shell {
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 26px 26px;
  color: var(--ink);
  font-family: var(--sans);
}

.main-site-header,
body.fortland-public-shell .site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: block;
  min-height: 0;
  border-bottom: 1px solid rgba(146, 183, 226, 0.55);
  padding: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(240, 247, 255, 0.94));
  box-shadow: 0 18px 44px -36px rgba(31, 72, 145, 0.38);
  backdrop-filter: blur(16px);
}

.main-site-header::before,
body.fortland-public-shell .site-header::before {
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--blue), var(--blue-bright) 60%, var(--red));
  content: "";
  pointer-events: none;
}

.main-site-header .nav-inner,
body.fortland-public-shell .site-header-inner {
  width: 100%;
  max-width: 1140px;
  height: 86px;
  min-height: 86px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  margin: 0 auto;
  padding: 0 24px;
}

.main-site-header .logo,
body.fortland-public-shell .brand-modern {
  width: auto;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-size: 22px;
  font-weight: 900;
}

.main-site-header .logo .mark,
body.fortland-public-shell .brand-mark {
  width: 46px;
  height: 50px;
  flex: 0 0 46px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 12px;
  background: transparent;
  box-shadow: 0 10px 24px -12px rgba(39, 72, 200, 0.68);
}

.main-site-header .logo .mark img,
body.fortland-public-shell .brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.main-site-header .logo-text,
body.fortland-public-shell .brand-copy {
  display: grid;
  line-height: 1.08;
}

.main-site-header .logo-text small,
body.fortland-public-shell .brand-copy small {
  margin-top: 3px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.main-site-header .nav-links,
body.fortland-public-shell .site-header .main-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 38px;
  font-size: 22px;
  font-weight: 900;
}

.main-site-header .nav-links a,
body.fortland-public-shell .site-header .nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  border: 0;
  border-radius: 0;
  padding: 10px 0;
  background: transparent;
  color: var(--ink);
  line-height: 1;
  white-space: nowrap;
}

.main-site-header .nav-links a::after,
body.fortland-public-shell .site-header .nav-link::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  border-radius: 3px;
  background: var(--blue);
  content: "";
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.22s ease;
}

.main-site-header .nav-links a:hover,
.main-site-header .nav-links a.active,
body.fortland-public-shell .site-header .nav-link:hover,
body.fortland-public-shell .site-header .nav-link.is-active {
  color: var(--blue);
}

.main-site-header .nav-links a:hover::after,
.main-site-header .nav-links a.active::after,
body.fortland-public-shell .site-header .nav-link:hover::after,
body.fortland-public-shell .site-header .nav-link.is-active::after {
  transform: scaleX(1);
}

.main-site-header .nav-right,
body.fortland-public-shell .site-header .header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.main-site-header .nav-msgr,
body.fortland-public-shell .site-header .messenger-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.main-site-header .msgr,
body.fortland-public-shell .site-header .messenger-action {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  box-shadow: 0 14px 28px -16px rgba(27, 36, 48, 0.52);
}

.main-site-header .msgr-wa,
body.fortland-public-shell .site-header .messenger-action-whatsapp { background: #25d366; }
.main-site-header .msgr-tg,
body.fortland-public-shell .site-header .messenger-action-telegram { background: #2aabee; }
.main-site-header .msgr-max,
body.fortland-public-shell .site-header .messenger-action-max {
  background: linear-gradient(135deg, #31c7e8 0%, #3c6fe8 52%, #a13ce8 100%);
}

.main-site-header .msgr img,
body.fortland-public-shell .site-header .messenger-action img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.main-site-header .nav-login,
body.fortland-public-shell .site-header .lesson-action {
  min-height: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  padding: 16px 24px;
  background: linear-gradient(145deg, var(--red) 0%, var(--red-dark) 100%);
  box-shadow: 0 14px 30px -18px rgba(224, 62, 69, 0.78);
  color: #fff;
  font-size: 15.5px;
  font-weight: 800;
  white-space: nowrap;
}

.main-site-header .nav-cabinet-mobile span,
body.fortland-public-shell .site-header .mobile-cabinet span {
  display: none;
}

.main-site-header .nav-cabinet-mobile .bi-person,
body.fortland-public-shell .site-header .mobile-cabinet .bi-person {
  width: 26px;
  height: 26px;
  fill: currentColor;
  stroke: none;
}

body.login-home-header .login-shell {
  min-height: calc(100vh - 86px);
  background: transparent;
}

body.login-home-header .login-panel {
  width: min(560px, 100%);
  border: 2px solid var(--grid-strong);
  border-radius: 28px;
  padding: clamp(30px, 5vw, 48px);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 30px 70px -38px rgba(39, 72, 200, 0.48);
}

body.login-home-header .login-heading h1 {
  color: var(--ink);
  font-family: var(--sans);
  font-size: clamp(42px, 6vw, 58px);
  font-weight: 900;
}

body.login-home-header .login-form span {
  color: var(--ink-soft);
}

body.login-home-header .login-form input {
  min-height: 58px;
  border: 2px solid var(--grid-strong);
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
}

body.login-home-header .login-form input:focus {
  border-color: var(--blue-bright);
  outline: 3px solid rgba(59, 102, 245, 0.16);
}

body.login-home-header .login-form button {
  min-height: 56px;
  background: linear-gradient(145deg, var(--blue-bright), var(--blue));
  box-shadow: 0 16px 30px -18px rgba(39, 72, 200, 0.72);
}

.ftr-cols-compact,
body.fortland-public-shell .footer-nav-compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 980px) {
  .main-site-header .nav-links,
  .main-site-header .nav-login,
  body.fortland-public-shell .site-header .main-nav,
  body.fortland-public-shell .site-header .lesson-action {
    display: none;
  }

  .main-site-header .nav-cabinet-mobile,
  body.fortland-public-shell .site-header .mobile-cabinet {
    width: 50px;
    height: 50px;
    flex: 0 0 50px;
    display: grid;
    place-items: center;
    border: 2px solid var(--grid-strong);
    border-radius: 12px;
    background: #fff;
    color: var(--blue);
  }

  .main-site-header .nav-toggle,
  body.fortland-public-shell .site-header .nav-toggle {
    width: 50px;
    height: 50px;
    flex: 0 0 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    border: 2px solid var(--grid-strong);
    border-radius: 12px;
    background: #fff;
    color: var(--ink);
  }
}

@media (max-width: 620px) {
  body.fortland-public-shell { background-size: 22px 22px; }

  .main-site-header .nav-inner,
  body.fortland-public-shell .site-header-inner {
    height: auto;
    min-height: 142px;
    grid-template-areas:
      "logo cabinet toggle"
      "social social social";
    grid-template-columns: auto minmax(140px, 1fr) auto;
    grid-template-rows: 62px 62px;
    gap: 8px;
    padding: 8px 14px 10px;
  }

  .main-site-header .logo,
  body.fortland-public-shell .brand-modern {
    grid-area: logo;
    justify-self: start;
  }

  .main-site-header .nav-right,
  body.fortland-public-shell .site-header .header-actions,
  body.fortland-public-shell .site-header .mobile-actions {
    display: contents;
  }

  .main-site-header .nav-msgr,
  body.fortland-public-shell .site-header .messenger-actions {
    grid-area: social;
    justify-self: center;
  }

  .main-site-header .logo-text,
  body.fortland-public-shell .brand-copy { display: none; }

  .main-site-header .logo .mark,
  body.fortland-public-shell .brand-mark {
    width: 52px;
    height: 56px;
    flex-basis: 52px;
  }

  .main-site-header .nav-msgr,
  body.fortland-public-shell .site-header .messenger-actions { gap: 7px; }

  .main-site-header .msgr,
  body.fortland-public-shell .site-header .messenger-action {
    width: 56px;
    height: 56px;
  }

  .main-site-header .msgr img,
  body.fortland-public-shell .site-header .messenger-action img {
    width: 34px;
    height: 34px;
  }

  .main-site-header .nav-cabinet-mobile,
  body.fortland-public-shell .site-header .mobile-cabinet {
    grid-area: cabinet;
    width: 56px;
    min-width: 56px;
    height: 56px;
    display: grid;
    flex-basis: 56px;
    justify-self: center;
    border-radius: 14px;
    padding: 0;
  }

  .main-site-header .nav-toggle,
  body.fortland-public-shell .site-header .nav-toggle {
    grid-area: toggle;
    width: 56px;
    height: 56px;
    flex-basis: 56px;
    justify-self: end;
    border-radius: 14px;
  }

  body.fortland-public-shell .mobile-menu {
    top: 150px;
  }

  body.login-home-header .login-shell {
    align-items: start;
    padding: 28px 16px 44px;
  }

  body.login-home-header .login-panel {
    border-radius: 22px;
    padding: 28px 20px;
  }

  .ftr-cols-compact,
  body.fortland-public-shell .footer-nav-compact {
    grid-template-columns: 1fr;
  }
}

/* Mobile header: one row — logo, messengers, account, menu. */
@media (max-width: 620px) {
  .main-site-header .nav-inner,
  body.fortland-public-shell .site-header-inner {
    height: 82px;
    min-height: 82px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 8px;
  }

  .main-site-header .logo,
  body.fortland-public-shell .brand-modern {
    flex: 0 0 auto;
  }

  .main-site-header .nav-right {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
  }

  body.fortland-public-shell .site-header .header-actions {
    display: flex;
    align-items: center;
    margin-left: auto;
  }

  body.fortland-public-shell .site-header .mobile-actions {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .main-site-header .nav-msgr,
  body.fortland-public-shell .site-header .messenger-actions {
    display: flex;
    gap: 6px;
  }

  .main-site-header .logo .mark,
  body.fortland-public-shell .brand-mark {
    width: 48px;
    height: 52px;
    flex-basis: 48px;
  }

  .main-site-header .msgr,
  body.fortland-public-shell .site-header .messenger-action,
  .main-site-header .nav-cabinet-mobile,
  .main-site-header .nav-toggle,
  body.fortland-public-shell .site-header .mobile-cabinet,
  body.fortland-public-shell .site-header .nav-toggle {
    width: 48px;
    min-width: 48px;
    height: 48px;
    flex: 0 0 48px;
    border-radius: 13px;
    padding: 0;
  }

  .main-site-header .msgr,
  body.fortland-public-shell .site-header .messenger-action {
    border-radius: 50%;
  }

  .main-site-header .msgr img,
  body.fortland-public-shell .site-header .messenger-action img {
    width: 38px;
    height: 38px;
  }

  body.fortland-public-shell .mobile-menu {
    top: 90px;
  }
}

@media (max-width: 360px) {
  .main-site-header .nav-inner,
  body.fortland-public-shell .site-header-inner {
    gap: 4px;
    padding-right: 4px;
    padding-left: 4px;
  }

  .main-site-header .nav-right,
  .main-site-header .nav-msgr,
  body.fortland-public-shell .site-header .header-actions,
  body.fortland-public-shell .site-header .mobile-actions,
  body.fortland-public-shell .site-header .messenger-actions {
    gap: 4px;
  }

  .main-site-header .logo .mark,
  body.fortland-public-shell .brand-mark,
  .main-site-header .msgr,
  body.fortland-public-shell .site-header .messenger-action,
  .main-site-header .nav-cabinet-mobile,
  .main-site-header .nav-toggle,
  body.fortland-public-shell .site-header .mobile-cabinet,
  body.fortland-public-shell .site-header .nav-toggle {
    width: 44px;
    min-width: 44px;
    height: 44px;
    flex-basis: 44px;
  }

  .main-site-header .msgr img,
  body.fortland-public-shell .site-header .messenger-action img {
    width: 36px;
    height: 36px;
  }
}
