/*!
 * MagicWorksHost — WHMCS header & footer stylesheet
 * Source: magicworkshost_homepage_template_v1_2.html (Brand system v1.3 Final)
 *
 * HOW THIS FILE IS BUILT
 * - Every value (hex, px, radius, shadow, timing) is copied 1:1 from the
 *   template's <style> block. DO NOT change the hex values.
 * - Class names carry an "mwh-" prefix and the brand tokens are scoped to
 *   .mwh-scope, so nothing here leaks into WHMCS pages and Bootstrap 4
 *   (.btn, .btn-primary, .container, .dropdown-menu, .card ...) cannot
 *   override the header/footer.
 * - Element-level rules use :where(.mwh-scope) so they keep the SAME
 *   specificity as the template's plain element rules (a, p, ul, svg),
 *   which means the cascade behaves exactly like the reference file.
 */

/* ============================================================================
   BRAND TOKENS — v1.3 Final (DO NOT change hex values)
   ============================================================================ */
.mwh-scope,
.mwh-account-bar {
  /* Primary palette */
  --royal-purple: #3D2566;
  --brand-violet: #5B3FBE;
  --horizon-blue: #8EC5E8;
  --horizon-blue-deep: #5A9BD4;
  --saffron-marigold: #F39C12;
  --saffron-deep: #D97E00;

  /* Neutrals */
  --ivory: #F7F3EA;
  --ivory-warm: #FDFAF2;
  --graphite: #1A1A22;
  --graphite-soft: #4A4A55;

  /* Semantic */
  --page-bg: var(--ivory-warm);
  --surface: var(--ivory-warm);
  --surface-alt: var(--ivory);
  --text: var(--graphite);
  --text-soft: var(--graphite-soft);
  --border: rgba(26, 26, 34, 0.08);
  --border-emphasis: rgba(26, 26, 34, 0.16);

  /* Typography */
  --serif: Georgia, "Times New Roman", serif;
  --sans: "Helvetica Neue", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Courier New", monospace;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --radius-xl: 12px;

  /* Shadow */
  --shadow-sm: 0 1px 2px rgba(26,26,34,0.04);
  --shadow-md: 0 10px 30px rgba(61,37,102,0.08);
  --shadow-lg: 0 20px 60px rgba(61,37,102,0.12);
  --shadow-cta: 0 12px 32px rgba(26,26,34,0.12);
}

/* ============================================================================
   WHMCS COMPATIBILITY
   Twenty-One sets "html, body { height: 100% }", which caps <body> at one
   viewport and stops the sticky primary nav after the first screen.
   ============================================================================ */
html { scroll-behavior: smooth; }
html body { height: auto; min-height: 100%; }
html.mwh-drawer-lock,
html.mwh-drawer-lock body { overflow: hidden; }

/* ============================================================================
   RESET & BASE (scoped equivalent of the template's body/a/ul/p/svg rules)
   ============================================================================ */
.mwh-scope {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 400;
  line-height: normal;
  color: var(--text);
  text-align: left;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.mwh-scope,
:where(.mwh-scope) *,
:where(.mwh-scope) *::before,
:where(.mwh-scope) *::after { box-sizing: border-box; }

:where(.mwh-scope) a { color: var(--royal-purple); text-decoration: none; transition: color 0.12s ease; }
:where(.mwh-scope) a:hover,
:where(.mwh-scope) a:focus { color: var(--brand-violet); text-decoration: none; }
:where(.mwh-scope) img,
:where(.mwh-scope) svg { display: block; max-width: 100%; }
:where(.mwh-scope) ul { list-style: none; margin: 0; padding: 0; }
:where(.mwh-scope) p { color: var(--text-soft); line-height: 1.6; margin: 0; }

/* ============================================================================
   UTILITIES
   ============================================================================ */
.mwh-container {
  max-width: 1240px;
  margin: 0 auto;
  padding-inline: 32px;
  width: 100%;
}
.mwh-serif { font-family: var(--serif); }
.mwh-mono { font-family: var(--mono); }

/* Signal Rule: signature gradient divider */
.mwh-signal-rule {
  height: 2px;
  background: linear-gradient(
    90deg,
    var(--royal-purple) 0%,
    var(--brand-violet) 25%,
    var(--horizon-blue-deep) 55%,
    var(--saffron-marigold) 100%
  );
  border: 0;
  margin: 0;
  opacity: 1;
  box-sizing: border-box;
  overflow: hidden;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */
.mwh-btn {
  cursor: pointer;
  font-family: inherit;
  border: 0;
  border-radius: var(--radius-md);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 24px;
  font-size: 15px;
  transition: transform 0.08s ease, box-shadow 0.15s ease, background 0.15s ease, color 0.15s ease;
  text-decoration: none;
}
.mwh-btn-primary {
  background: var(--saffron-marigold);
  color: var(--graphite);
  box-shadow: 0 1px 0 var(--saffron-deep);
}
.mwh-btn-primary:hover { background: var(--saffron-deep); color: var(--ivory-warm); }
/* Keep the brand button colours inside the dark utility bar / drawer
   (the generic ".utility-bar a" link colour must not repaint the button). */
.mwh-utility-bar a.mwh-btn-primary,
.mwh-drawer-utility a.mwh-btn-primary { color: var(--graphite); }
.mwh-utility-bar a.mwh-btn-primary:hover,
.mwh-drawer-utility a.mwh-btn-primary:hover { color: var(--ivory-warm); }

/* ============================================================================
   TWO-ROW HEADER: UTILITY BAR + PRIMARY NAV WITH 10 MEGA-MENU ITEMS
   ============================================================================ */
.mwh-utility-bar {
  background: var(--graphite);
  color: rgba(253, 250, 242, 0.75);
  font-size: 13px;
}
.mwh-utility-bar .mwh-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
  gap: 24px;
}
.mwh-utility-bar a { color: rgba(253, 250, 242, 0.75); }
.mwh-utility-bar a:hover { color: var(--saffron-marigold); }
.mwh-utility-left, .mwh-utility-right {
  display: flex;
  align-items: center;
  gap: 20px;
}
.mwh-utility-left svg, .mwh-utility-right svg {
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}
.mwh-utility-inline-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.mwh-utility-divider {
  width: 1px;
  height: 16px;
  background: rgba(253, 250, 242, 0.15);
}

.mwh-primary-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.mwh-primary-nav .mwh-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  gap: 24px;
  max-width: 1360px;
}

.mwh-mega-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}
.mwh-mega-nav > li { position: relative; }
/* Invisible 4px hover bridge over the dropdown's margin-top gap so the
   panel doesn't flicker shut while the pointer travels into it. */
.mwh-mega-nav > li::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 6px;
}
.mwh-mega-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 10px 12px;
  font-weight: 600;
  font-size: 14px;
  color: var(--graphite);
  border-radius: var(--radius-md);
  white-space: nowrap;
  cursor: pointer;
  background: transparent;
  border: 0;
  font-family: inherit;
  min-height: auto;
}
.mwh-mega-trigger:hover,
.mwh-mega-nav > li:hover .mwh-mega-trigger,
.mwh-mega-nav > li:focus-within .mwh-mega-trigger {
  color: var(--royal-purple);
  background: var(--surface-alt);
}
.mwh-mega-trigger .mwh-chev {
  transition: transform 0.15s ease;
}
.mwh-mega-nav > li:hover .mwh-chev,
.mwh-mega-nav > li:focus-within .mwh-chev {
  transform: rotate(180deg);
}

/* Mega-menu dropdown panel */
.mwh-mega-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
  margin-top: 4px;
  box-shadow: var(--shadow-cta);
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 200;
}
.mwh-mega-nav > li:hover .mwh-mega-dropdown,
.mwh-mega-nav > li:focus-within .mwh-mega-dropdown {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.mwh-mega-dropdown.mwh-wide {
  min-width: 460px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 20px;
}
.mwh-mega-dropdown.mwh-right-align {
  left: auto;
  right: 0;
}
.mwh-mega-dropdown a {
  display: block;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
}
.mwh-mega-dropdown a:hover {
  background: var(--surface-alt);
  color: var(--royal-purple);
}
.mwh-mega-dropdown a .mwh-sub,
.mwh-drawer-links a .mwh-sub {
  display: block;
  font-size: 11px;
  color: var(--text-soft);
  font-weight: 400;
  margin-top: 2px;
}

/* Mobile hamburger (shown via media query) */
.mwh-hamburger {
  display: none;
  background: transparent;
  border: 0;
  padding: 8px;
  cursor: pointer;
  color: var(--graphite);
  min-height: auto;
  border-radius: var(--radius-md);
  font-family: inherit;
}
.mwh-hamburger:hover { background: var(--surface-alt); }

/* ============================================================================
   MOBILE DRAWER (template spec: full-height drawer, aria-expanded on the
   hamburger, focus trap inside). Built only from brand tokens.
   ============================================================================ */
.mwh-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 34, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0s linear 0.2s;
  z-index: 1040;
}
.mwh-drawer-overlay.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.2s ease;
}
.mwh-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(400px, 90vw);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.2s ease, visibility 0s linear 0.2s;
  z-index: 1041;
}
.mwh-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
  transition: transform 0.2s ease;
}
.mwh-drawer .mwh-drawer-close { display: inline-flex; }
.mwh-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.mwh-drawer-nav { padding: 12px; flex: 1 0 auto; }
.mwh-drawer-group { border-bottom: 1px solid var(--border); }
.mwh-drawer-group:last-child { border-bottom: 0; }
.mwh-drawer-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 12px;
  font-weight: 600;
  font-size: 15px;
  color: var(--graphite);
  border-radius: var(--radius-md);
  cursor: pointer;
  list-style: none;
}
.mwh-drawer-trigger::-webkit-details-marker { display: none; }
.mwh-drawer-trigger::marker { content: ""; }
.mwh-drawer-trigger:hover,
.mwh-drawer-group[open] > .mwh-drawer-trigger {
  color: var(--royal-purple);
  background: var(--surface-alt);
}
.mwh-drawer-trigger .mwh-chev { transition: transform 0.15s ease; }
.mwh-drawer-group[open] > .mwh-drawer-trigger .mwh-chev { transform: rotate(180deg); }
.mwh-drawer-links { padding: 4px 0 12px 8px; }
.mwh-drawer-links a {
  display: block;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
}
.mwh-drawer-links a:hover {
  background: var(--surface-alt);
  color: var(--royal-purple);
}
.mwh-drawer-utility {
  background: var(--graphite);
  color: rgba(253, 250, 242, 0.75);
  font-size: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex-shrink: 0;
}
.mwh-drawer-utility a { color: rgba(253, 250, 242, 0.75); }
.mwh-drawer-utility a:hover { color: var(--saffron-marigold); }
.mwh-drawer-utility svg { display: inline-block; vertical-align: middle; }
.mwh-drawer-utility .mwh-btn { width: 100%; margin-top: 6px; }

/* ============================================================================
   CLIENT-AREA ACCOUNT BAR (logged-in clients). WHMCS menus re-skinned
   with brand tokens; Bootstrap's dropdown/collapse behaviour is untouched.
   ============================================================================ */
.mwh-account-bar {
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}
.mwh-account-bar .mwh-container { max-width: 1360px; }
.mwh-account-navbar.navbar {
  padding: 6px 0;
  flex-wrap: wrap;
  min-height: 52px;
}
.mwh-account-label {
  font-size: 12px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--brand-violet);
  font-weight: 700;
  margin-right: 16px;
  white-space: nowrap;
}
.mwh-account-tools {
  order: 2;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.mwh-account-navbar .navbar-collapse { order: 3; }
@media (min-width: 1200px) {
  .mwh-account-navbar .navbar-collapse { order: 2; }
  .mwh-account-tools { order: 3; margin-left: 12px; }
}
.mwh-account-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--graphite);
  background: transparent;
  border: 1px solid var(--border-emphasis);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  transition: color 0.12s ease, background 0.15s ease;
}
.mwh-account-btn:hover,
.mwh-account-btn:focus {
  color: var(--royal-purple);
  background: var(--surface);
  text-decoration: none;
}
.mwh-account-btn.mwh-account-admin {
  background: var(--saffron-marigold);
  border-color: var(--saffron-marigold);
  color: var(--graphite);
}
.mwh-account-btn.mwh-account-admin:hover { background: var(--saffron-deep); color: var(--ivory-warm); }
.mwh-account-navbar .navbar-nav > li > a {
  display: block;
  padding: 10px 12px !important;
  font-size: 14px;
  font-weight: 600;
  color: var(--graphite);
  border-radius: var(--radius-md);
  white-space: nowrap;
  text-decoration: none;
  transition: color 0.12s ease, background 0.15s ease;
}
.mwh-account-navbar .navbar-nav > li > a:hover,
.mwh-account-navbar .navbar-nav > li.show > a,
.mwh-account-navbar .navbar-nav > li.active > a {
  color: var(--royal-purple);
  background: var(--surface);
  text-decoration: none;
}
.mwh-account-navbar .navbar-nav .badge {
  background: var(--brand-violet);
  color: var(--ivory-warm);
  font-size: 11px;
}
.mwh-account-navbar .dropdown-menu {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
  margin-top: 4px;
  box-shadow: var(--shadow-cta);
  min-width: 240px;
}
.mwh-account-navbar .dropdown-menu > li.dropdown-item {
  padding: 0;
  background: transparent;
}
.mwh-account-navbar .dropdown-menu a.dropdown-item {
  display: block;
  padding: 9px 12px !important;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  background: transparent;
  white-space: nowrap;
}
.mwh-account-navbar .dropdown-menu a.dropdown-item:hover,
.mwh-account-navbar .dropdown-menu a.dropdown-item:focus {
  background: var(--surface-alt);
  color: var(--royal-purple);
}
.mwh-account-navbar .dropdown-divider { border-top-color: var(--border); margin: 6px 0; }
@media (max-width: 1199.98px) {
  .mwh-account-navbar .navbar-collapse { padding: 8px 0 4px; }
  .mwh-account-navbar .dropdown-menu { box-shadow: none; }
}

/* ============================================================================
   FOOTER helpers
   ============================================================================ */
.mwh-footer a:hover,
.mwh-footer a:focus { text-decoration: none; }
.mwh-locale-btn {
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  font-size: 12px;
  color: rgba(253, 250, 242, 0.55);
  cursor: pointer;
  min-height: auto;
}
.mwh-locale-btn:hover { color: rgba(253, 250, 242, 0.85); }

/* ============================================================================
   RESPONSIVE (same breakpoints as the template)
   ============================================================================ */
@media (max-width: 1200px) {
  .mwh-mega-nav { display: none; }
  .mwh-hamburger { display: inline-flex; }
  .mwh-utility-bar { display: none; }
}
@media (max-width: 1024px) {
  .mwh-footer-grid { grid-template-columns: 1fr 1fr !important; }
}
@media (max-width: 640px) {
  .mwh-container { padding-inline: 20px; }
  .mwh-footer-grid { grid-template-columns: 1fr !important; }
}
@media (prefers-reduced-motion: reduce) {
  .mwh-drawer, .mwh-drawer-overlay, .mwh-mega-dropdown { transition: none; }
}
