rx-header.css

I’ll build this as a production-ready rx-header.css for RX Theme: variables, sticky/header states, logo, nav, mega menu, mobile drawer, search, buttons, accessibility, RTL, responsive, print, dark mode, and performance-safe patterns.

Below is a strong advanced assets/css/rx-header.css file for your RX Theme. It is written to support a professional WordPress medical website header: sticky header, top bar, logo, nav menu, dropdown, mega menu, mobile drawer, search box, CTA button, accessibility focus, dark mode, RTL, responsive design, print mode, and future dynamic class support.

Create or replace:

rx-theme/assets/css/rx-header.css
/*!
 * RX Theme Header Styles
 * File: assets/css/rx-header.css
 * Theme: RX Theme
 * Author: RxHarun
 * Purpose: Advanced responsive header, navigation, mega menu, mobile drawer, search, CTA, accessibility
 */

/* =========================================================
   01. HEADER DESIGN TOKENS
   ========================================================= */

:root {
  --rx-header-height: 76px;
  --rx-header-height-compact: 62px;
  --rx-topbar-height: 38px;

  --rx-header-bg: #ffffff;
  --rx-header-bg-rgb: 255, 255, 255;
  --rx-header-text: #102033;
  --rx-header-muted: #5f6f83;
  --rx-header-border: rgba(16, 32, 51, 0.1);
  --rx-header-shadow: 0 10px 30px rgba(16, 32, 51, 0.08);

  --rx-header-primary: #0066cc;
  --rx-header-primary-dark: #004f9e;
  --rx-header-primary-soft: rgba(0, 102, 204, 0.1);

  --rx-header-danger: #d62828;
  --rx-header-success: #198754;
  --rx-header-warning: #f4a261;

  --rx-header-radius-xs: 4px;
  --rx-header-radius-sm: 8px;
  --rx-header-radius-md: 14px;
  --rx-header-radius-lg: 22px;
  --rx-header-radius-pill: 999px;

  --rx-header-gap-xs: 0.35rem;
  --rx-header-gap-sm: 0.65rem;
  --rx-header-gap-md: 1rem;
  --rx-header-gap-lg: 1.5rem;
  --rx-header-gap-xl: 2rem;

  --rx-header-font-size-xs: 0.75rem;
  --rx-header-font-size-sm: 0.875rem;
  --rx-header-font-size-md: 1rem;
  --rx-header-font-size-lg: 1.125rem;

  --rx-header-z: 900;
  --rx-header-dropdown-z: 950;
  --rx-header-mobile-z: 1000;
  --rx-header-overlay-z: 990;

  --rx-header-transition-fast: 160ms ease;
  --rx-header-transition-normal: 260ms ease;
  --rx-header-transition-slow: 420ms ease;

  --rx-header-container-max: 1240px;
  --rx-header-container-padding: clamp(1rem, 3vw, 2rem);
}

/* =========================================================
   02. DARK MODE TOKENS
   ========================================================= */

@media (prefers-color-scheme: dark) {
  :root {
    --rx-header-bg: #0f1724;
    --rx-header-bg-rgb: 15, 23, 36;
    --rx-header-text: #edf4ff;
    --rx-header-muted: #a6b6c8;
    --rx-header-border: rgba(255, 255, 255, 0.12);
    --rx-header-shadow: 0 14px 34px rgba(0, 0, 0, 0.38);
    --rx-header-primary-soft: rgba(79, 163, 255, 0.16);
  }
}

html[data-theme="dark"],
body.rx-dark-mode {
  --rx-header-bg: #0f1724;
  --rx-header-bg-rgb: 15, 23, 36;
  --rx-header-text: #edf4ff;
  --rx-header-muted: #a6b6c8;
  --rx-header-border: rgba(255, 255, 255, 0.12);
  --rx-header-shadow: 0 14px 34px rgba(0, 0, 0, 0.38);
  --rx-header-primary-soft: rgba(79, 163, 255, 0.16);
}

/* =========================================================
   03. HEADER BASE WRAPPER
   ========================================================= */

.rx-site-header {
  position: relative;
  z-index: var(--rx-header-z);
  width: 100%;
  color: var(--rx-header-text);
  background: var(--rx-header-bg);
  border-bottom: 1px solid var(--rx-header-border);
  isolation: isolate;
}

.rx-site-header *,
.rx-site-header *::before,
.rx-site-header *::after {
  box-sizing: border-box;
}

.rx-site-header a {
  color: inherit;
  text-decoration: none;
}

.rx-site-header button,
.rx-site-header input,
.rx-site-header select {
  font: inherit;
}

.rx-site-header img,
.rx-site-header svg {
  display: block;
  max-width: 100%;
}

.rx-header-inner,
.rx-header-container {
  width: min(100%, var(--rx-header-container-max));
  margin-inline: auto;
  padding-inline: var(--rx-header-container-padding);
}

/* =========================================================
   04. HEADER TYPES
   ========================================================= */

.rx-header-default {
  background: var(--rx-header-bg);
}

.rx-header-transparent {
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0;
  background: transparent;
  border-bottom-color: transparent;
}

.rx-header-glass {
  background: rgba(var(--rx-header-bg-rgb), 0.78);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
}

.rx-header-boxed .rx-header-main {
  margin-block: 0.75rem;
  border: 1px solid var(--rx-header-border);
  border-radius: var(--rx-header-radius-lg);
  box-shadow: var(--rx-header-shadow);
}

.rx-header-borderless {
  border-bottom: 0;
}

.rx-header-shadow {
  box-shadow: var(--rx-header-shadow);
}

/* =========================================================
   05. STICKY HEADER
   ========================================================= */

.rx-header-sticky {
  position: sticky;
  top: 0;
  z-index: var(--rx-header-z);
}

.admin-bar .rx-header-sticky {
  top: 32px;
}

.rx-header-fixed {
  position: fixed;
  top: 0;
  inset-inline: 0;
  z-index: var(--rx-header-z);
}

.admin-bar .rx-header-fixed {
  top: 32px;
}

.rx-header-is-scrolled {
  box-shadow: var(--rx-header-shadow);
  background: rgba(var(--rx-header-bg-rgb), 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.rx-header-is-compact .rx-header-main {
  min-height: var(--rx-header-height-compact);
}

.rx-header-is-hidden {
  transform: translateY(-100%);
}

.rx-site-header {
  transition:
    transform var(--rx-header-transition-normal),
    background-color var(--rx-header-transition-normal),
    box-shadow var(--rx-header-transition-normal),
    border-color var(--rx-header-transition-normal);
}

/* =========================================================
   06. TOP BAR
   ========================================================= */

.rx-header-topbar {
  min-height: var(--rx-topbar-height);
  font-size: var(--rx-header-font-size-sm);
  color: var(--rx-header-muted);
  background: linear-gradient(
    90deg,
    var(--rx-header-primary-soft),
    transparent
  );
  border-bottom: 1px solid var(--rx-header-border);
}

.rx-header-topbar-inner {
  min-height: var(--rx-topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--rx-header-gap-md);
}

.rx-header-topbar-left,
.rx-header-topbar-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--rx-header-gap-md);
}

.rx-header-contact-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  line-height: 1.4;
}

.rx-header-contact-item svg {
  width: 1em;
  height: 1em;
  color: var(--rx-header-primary);
}

.rx-header-topbar a:hover {
  color: var(--rx-header-primary);
}

/* =========================================================
   07. MAIN HEADER LAYOUT
   ========================================================= */

.rx-header-main {
  min-height: var(--rx-header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--rx-header-gap-lg);
  transition: min-height var(--rx-header-transition-normal);
}

.rx-header-left,
.rx-header-center,
.rx-header-right {
  display: flex;
  align-items: center;
  gap: var(--rx-header-gap-md);
}

.rx-header-left {
  flex: 0 0 auto;
}

.rx-header-center {
  flex: 1 1 auto;
  justify-content: center;
  min-width: 0;
}

.rx-header-right {
  flex: 0 0 auto;
  justify-content: flex-end;
}

.rx-header-layout-left .rx-header-center {
  justify-content: flex-start;
}

.rx-header-layout-center .rx-header-left,
.rx-header-layout-center .rx-header-right {
  flex: 1 1 0;
}

.rx-header-layout-center .rx-header-left {
  justify-content: flex-start;
}

.rx-header-layout-center .rx-header-right {
  justify-content: flex-end;
}

/* =========================================================
   08. LOGO / BRAND
   ========================================================= */

.rx-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  color: var(--rx-header-text);
}

.rx-brand:hover {
  color: var(--rx-header-primary);
}

.rx-brand-logo {
  width: auto;
  max-height: 52px;
  transition:
    max-height var(--rx-header-transition-normal),
    transform var(--rx-header-transition-normal);
}

.rx-header-is-compact .rx-brand-logo {
  max-height: 42px;
}

.rx-brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.15;
}

.rx-brand-title {
  font-size: clamp(1.25rem, 2vw, 1.65rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  color: var(--rx-header-text);
  white-space: nowrap;
}

.rx-brand-tagline {
  margin-top: 0.15rem;
  font-size: var(--rx-header-font-size-xs);
  font-weight: 500;
  color: var(--rx-header-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

.rx-brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  color: #ffffff;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.35), transparent 35%),
    linear-gradient(135deg, var(--rx-header-primary), var(--rx-header-primary-dark));
  box-shadow: 0 10px 22px rgba(0, 102, 204, 0.28);
}

/* =========================================================
   09. PRIMARY NAVIGATION
   ========================================================= */

.rx-primary-nav {
  display: flex;
  align-items: center;
  min-width: 0;
}

.rx-menu,
.rx-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.rx-menu {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.rx-menu > li {
  position: relative;
}

.rx-menu > li > a,
.rx-menu > li > button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 0.85rem;
  border: 0;
  border-radius: var(--rx-header-radius-pill);
  color: var(--rx-header-text);
  background: transparent;
  font-size: var(--rx-header-font-size-sm);
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition:
    color var(--rx-header-transition-fast),
    background-color var(--rx-header-transition-fast),
    box-shadow var(--rx-header-transition-fast);
}

.rx-menu > li > a:hover,
.rx-menu > li > button:hover,
.rx-menu > li:hover > a,
.rx-menu > li:hover > button,
.rx-menu > li.current-menu-item > a,
.rx-menu > li.current_page_item > a,
.rx-menu > li.current-menu-ancestor > a {
  color: var(--rx-header-primary);
  background: var(--rx-header-primary-soft);
}

.rx-menu > li > a[aria-current="page"] {
  color: var(--rx-header-primary);
  background: var(--rx-header-primary-soft);
}

.rx-menu .menu-item-has-children > a::after,
.rx-menu .page_item_has_children > a::after {
  content: "";
  width: 0.42em;
  height: 0.42em;
  margin-inline-start: 0.2rem;
  border-inline-end: 2px solid currentColor;
  border-block-end: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  opacity: 0.75;
  transition: transform var(--rx-header-transition-fast);
}

.rx-menu .menu-item-has-children:hover > a::after,
.rx-menu .page_item_has_children:hover > a::after {
  transform: rotate(225deg) translateY(-1px);
}

/* =========================================================
   10. DROPDOWN MENUS
   ========================================================= */

.rx-menu .sub-menu,
.rx-menu .children {
  position: absolute;
  inset-block-start: calc(100% + 0.65rem);
  inset-inline-start: 0;
  z-index: var(--rx-header-dropdown-z);
  min-width: 235px;
  padding: 0.55rem;
  border: 1px solid var(--rx-header-border);
  border-radius: var(--rx-header-radius-md);
  background: var(--rx-header-bg);
  box-shadow: var(--rx-header-shadow);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px) scale(0.98);
  transform-origin: top left;
  transition:
    opacity var(--rx-header-transition-fast),
    visibility var(--rx-header-transition-fast),
    transform var(--rx-header-transition-fast);
}

.rx-menu li:hover > .sub-menu,
.rx-menu li:hover > .children,
.rx-menu li:focus-within > .sub-menu,
.rx-menu li:focus-within > .children {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.rx-menu .sub-menu li,
.rx-menu .children li {
  position: relative;
}

.rx-menu .sub-menu a,
.rx-menu .children a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--rx-header-gap-sm);
  width: 100%;
  padding: 0.72rem 0.8rem;
  border-radius: var(--rx-header-radius-sm);
  color: var(--rx-header-text);
  font-size: var(--rx-header-font-size-sm);
  font-weight: 600;
  line-height: 1.35;
  transition:
    color var(--rx-header-transition-fast),
    background-color var(--rx-header-transition-fast),
    transform var(--rx-header-transition-fast);
}

.rx-menu .sub-menu a:hover,
.rx-menu .children a:hover,
.rx-menu .sub-menu .current-menu-item > a,
.rx-menu .children .current_page_item > a {
  color: var(--rx-header-primary);
  background: var(--rx-header-primary-soft);
  transform: translateX(3px);
}

.rx-menu .sub-menu .sub-menu,
.rx-menu .children .children {
  inset-block-start: -0.55rem;
  inset-inline-start: calc(100% + 0.6rem);
}

/* Dropdown edge alignment helper */
.rx-menu > li.rx-dropdown-right > .sub-menu,
.rx-menu > li.rx-dropdown-right > .children {
  inset-inline-start: auto;
  inset-inline-end: 0;
  transform-origin: top right;
}

/* =========================================================
   11. MEGA MENU
   ========================================================= */

.rx-menu > li.rx-mega-menu {
  position: static;
}

.rx-menu > li.rx-mega-menu > .sub-menu {
  inset-inline: var(--rx-header-container-padding);
  inset-block-start: calc(100% + 0.75rem);
  width: auto;
  max-width: var(--rx-header-container-max);
  margin-inline: auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--rx-header-gap-md);
  padding: 1.2rem;
}

.rx-menu > li.rx-mega-menu > .sub-menu > li > a {
  font-size: var(--rx-header-font-size-sm);
  font-weight: 800;
  color: var(--rx-header-primary);
  background: transparent;
  pointer-events: none;
}

.rx-menu > li.rx-mega-menu > .sub-menu > li > .sub-menu {
  position: static;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.rx-mega-card {
  padding: 1rem;
  border: 1px solid var(--rx-header-border);
  border-radius: var(--rx-header-radius-md);
  background: linear-gradient(
    180deg,
    var(--rx-header-primary-soft),
    transparent
  );
}

.rx-mega-card-title {
  margin: 0 0 0.35rem;
  font-weight: 800;
  color: var(--rx-header-text);
}

.rx-mega-card-desc {
  margin: 0;
  font-size: var(--rx-header-font-size-sm);
  line-height: 1.55;
  color: var(--rx-header-muted);
}

/* =========================================================
   12. HEADER ACTION BUTTONS
   ========================================================= */

.rx-header-actions {
  display: inline-flex;
  align-items: center;
  gap: var(--rx-header-gap-sm);
}

.rx-header-icon-btn,
.rx-mobile-toggle,
.rx-search-toggle,
.rx-theme-toggle {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--rx-header-border);
  border-radius: 50%;
  color: var(--rx-header-text);
  background: var(--rx-header-bg);
  cursor: pointer;
  transition:
    color var(--rx-header-transition-fast),
    background-color var(--rx-header-transition-fast),
    border-color var(--rx-header-transition-fast),
    transform var(--rx-header-transition-fast),
    box-shadow var(--rx-header-transition-fast);
}

.rx-header-icon-btn:hover,
.rx-mobile-toggle:hover,
.rx-search-toggle:hover,
.rx-theme-toggle:hover {
  color: var(--rx-header-primary);
  border-color: rgba(0, 102, 204, 0.35);
  background: var(--rx-header-primary-soft);
  transform: translateY(-1px);
}

.rx-header-icon-btn svg,
.rx-mobile-toggle svg,
.rx-search-toggle svg,
.rx-theme-toggle svg {
  width: 20px;
  height: 20px;
}

.rx-header-cta {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.1rem;
  border: 1px solid transparent;
  border-radius: var(--rx-header-radius-pill);
  color: #ffffff;
  background: linear-gradient(
    135deg,
    var(--rx-header-primary),
    var(--rx-header-primary-dark)
  );
  font-size: var(--rx-header-font-size-sm);
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 10px 22px rgba(0, 102, 204, 0.22);
  transition:
    transform var(--rx-header-transition-fast),
    box-shadow var(--rx-header-transition-fast),
    filter var(--rx-header-transition-fast);
}

.rx-header-cta:hover {
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(0, 102, 204, 0.3);
  filter: saturate(1.08);
}

.rx-header-cta-outline {
  color: var(--rx-header-primary);
  background: transparent;
  border-color: rgba(0, 102, 204, 0.35);
  box-shadow: none;
}

.rx-header-cta-outline:hover {
  color: #ffffff;
  background: var(--rx-header-primary);
}

/* =========================================================
   13. HAMBURGER ICON
   ========================================================= */

.rx-mobile-toggle {
  display: none;
  position: relative;
}

.rx-mobile-toggle-bars {
  position: relative;
  width: 20px;
  height: 14px;
}

.rx-mobile-toggle-bars::before,
.rx-mobile-toggle-bars::after,
.rx-mobile-toggle-bars span {
  content: "";
  position: absolute;
  inset-inline: 0;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transition:
    transform var(--rx-header-transition-normal),
    opacity var(--rx-header-transition-normal),
    top var(--rx-header-transition-normal);
}

.rx-mobile-toggle-bars::before {
  top: 0;
}

.rx-mobile-toggle-bars span {
  top: 6px;
}

.rx-mobile-toggle-bars::after {
  top: 12px;
}

.rx-mobile-open .rx-mobile-toggle-bars::before {
  top: 6px;
  transform: rotate(45deg);
}

.rx-mobile-open .rx-mobile-toggle-bars span {
  opacity: 0;
}

.rx-mobile-open .rx-mobile-toggle-bars::after {
  top: 6px;
  transform: rotate(-45deg);
}

/* =========================================================
   14. HEADER SEARCH
   ========================================================= */

.rx-header-search {
  position: relative;
  max-width: 360px;
  width: 100%;
}

.rx-header-search-form {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.rx-header-search-field {
  width: 100%;
  min-height: 44px;
  padding: 0.75rem 2.9rem 0.75rem 1rem;
  border: 1px solid var(--rx-header-border);
  border-radius: var(--rx-header-radius-pill);
  color: var(--rx-header-text);
  background: var(--rx-header-bg);
  outline: 0;
  transition:
    border-color var(--rx-header-transition-fast),
    box-shadow var(--rx-header-transition-fast),
    background-color var(--rx-header-transition-fast);
}

.rx-header-search-field::placeholder {
  color: var(--rx-header-muted);
}

.rx-header-search-field:focus {
  border-color: rgba(0, 102, 204, 0.45);
  box-shadow: 0 0 0 4px var(--rx-header-primary-soft);
}

.rx-header-search-submit {
  position: absolute;
  inset-inline-end: 4px;
  top: 50%;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #ffffff;
  background: var(--rx-header-primary);
  transform: translateY(-50%);
  cursor: pointer;
}

.rx-header-search-submit:hover {
  background: var(--rx-header-primary-dark);
}

.rx-header-search-panel {
  position: absolute;
  inset-block-start: calc(100% + 0.75rem);
  inset-inline-end: 0;
  z-index: var(--rx-header-dropdown-z);
  width: min(92vw, 430px);
  padding: 1rem;
  border: 1px solid var(--rx-header-border);
  border-radius: var(--rx-header-radius-md);
  background: var(--rx-header-bg);
  box-shadow: var(--rx-header-shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition:
    opacity var(--rx-header-transition-fast),
    visibility var(--rx-header-transition-fast),
    transform var(--rx-header-transition-fast);
}

.rx-search-open .rx-header-search-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* =========================================================
   15. MOBILE DRAWER
   ========================================================= */

.rx-mobile-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--rx-header-overlay-z);
  background: rgba(0, 0, 0, 0.48);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity var(--rx-header-transition-normal),
    visibility var(--rx-header-transition-normal);
}

.rx-mobile-open .rx-mobile-overlay {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.rx-mobile-drawer {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  z-index: var(--rx-header-mobile-z);
  width: min(88vw, 390px);
  display: flex;
  flex-direction: column;
  color: var(--rx-header-text);
  background: var(--rx-header-bg);
  box-shadow: var(--rx-header-shadow);
  transform: translateX(-105%);
  transition: transform var(--rx-header-transition-normal);
}

.rx-mobile-open .rx-mobile-drawer {
  transform: translateX(0);
}

.rx-mobile-drawer-header {
  min-height: var(--rx-header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--rx-header-gap-md);
  padding: 1rem;
  border-bottom: 1px solid var(--rx-header-border);
}

.rx-mobile-close {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--rx-header-border);
  border-radius: 50%;
  color: var(--rx-header-text);
  background: transparent;
  cursor: pointer;
}

.rx-mobile-close:hover {
  color: var(--rx-header-primary);
  background: var(--rx-header-primary-soft);
}

.rx-mobile-drawer-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1rem;
}

.rx-mobile-drawer-footer {
  padding: 1rem;
  border-top: 1px solid var(--rx-header-border);
}

/* =========================================================
   16. MOBILE MENU
   ========================================================= */

.rx-mobile-menu,
.rx-mobile-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.rx-mobile-menu {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.rx-mobile-menu li {
  position: relative;
}

.rx-mobile-menu a,
.rx-mobile-menu button {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--rx-header-gap-sm);
  padding: 0.75rem 0.85rem;
  border: 0;
  border-radius: var(--rx-header-radius-sm);
  color: var(--rx-header-text);
  background: transparent;
  font-weight: 700;
  text-align: start;
  cursor: pointer;
}

.rx-mobile-menu a:hover,
.rx-mobile-menu button:hover,
.rx-mobile-menu .current-menu-item > a,
.rx-mobile-menu .current_page_item > a {
  color: var(--rx-header-primary);
  background: var(--rx-header-primary-soft);
}

.rx-mobile-menu .sub-menu,
.rx-mobile-menu .children {
  display: none;
  margin-inline-start: 0.75rem;
  padding-inline-start: 0.75rem;
  border-inline-start: 1px solid var(--rx-header-border);
}

.rx-mobile-menu li.rx-submenu-open > .sub-menu,
.rx-mobile-menu li.rx-submenu-open > .children {
  display: block;
}

.rx-mobile-submenu-toggle {
  width: 36px;
  height: 36px;
  min-height: 36px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.rx-mobile-submenu-toggle::before {
  content: "+";
  font-weight: 900;
}

.rx-submenu-open > .rx-mobile-submenu-toggle::before {
  content: "−";
}

/* =========================================================
   17. NOTIFICATION / BADGE / CART STYLE
   ========================================================= */

.rx-header-badge-wrap {
  position: relative;
}

.rx-header-badge {
  position: absolute;
  inset-block-start: -4px;
  inset-inline-end: -4px;
  min-width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  padding-inline: 4px;
  border: 2px solid var(--rx-header-bg);
  border-radius: 999px;
  color: #ffffff;
  background: var(--rx-header-danger);
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 1;
}

.rx-header-dot {
  position: absolute;
  inset-block-start: 8px;
  inset-inline-end: 8px;
  width: 9px;
  height: 9px;
  border: 2px solid var(--rx-header-bg);
  border-radius: 50%;
  background: var(--rx-header-success);
}

/* =========================================================
   18. LANGUAGE / SOCIAL / UTILITY LINKS
   ========================================================= */

.rx-header-social {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.rx-header-social a {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--rx-header-border);
  border-radius: 50%;
  color: var(--rx-header-muted);
  transition:
    color var(--rx-header-transition-fast),
    background-color var(--rx-header-transition-fast),
    border-color var(--rx-header-transition-fast);
}

.rx-header-social a:hover {
  color: var(--rx-header-primary);
  border-color: rgba(0, 102, 204, 0.35);
  background: var(--rx-header-primary-soft);
}

.rx-header-language {
  position: relative;
}

.rx-header-language-current {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--rx-header-border);
  border-radius: var(--rx-header-radius-pill);
  background: transparent;
  color: var(--rx-header-text);
  cursor: pointer;
}

/* =========================================================
   19. BREADCRUMB INSIDE HEADER
   ========================================================= */

.rx-header-breadcrumb {
  padding-block: 0.7rem;
  border-top: 1px solid var(--rx-header-border);
  font-size: var(--rx-header-font-size-sm);
  color: var(--rx-header-muted);
}

.rx-header-breadcrumb a {
  color: var(--rx-header-muted);
}

.rx-header-breadcrumb a:hover {
  color: var(--rx-header-primary);
}

/* =========================================================
   20. ACCESSIBILITY
   ========================================================= */

.rx-site-header :focus {
  outline: none;
}

.rx-site-header :focus-visible {
  outline: 3px solid rgba(0, 102, 204, 0.45);
  outline-offset: 3px;
}

.rx-skip-link {
  position: absolute;
  inset-block-start: -100px;
  inset-inline-start: 1rem;
  z-index: 9999;
  padding: 0.75rem 1rem;
  border-radius: var(--rx-header-radius-sm);
  color: #ffffff;
  background: var(--rx-header-primary);
  font-weight: 800;
  transition: inset-block-start var(--rx-header-transition-fast);
}

.rx-skip-link:focus {
  inset-block-start: 1rem;
}

.rx-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  white-space: nowrap !important;
  clip-path: inset(50%) !important;
}

/* =========================================================
   21. BODY STATE HELPERS
   ========================================================= */

body.rx-mobile-open,
body.rx-search-open {
  overflow: hidden;
}

body.rx-header-fixed-padding {
  padding-top: var(--rx-header-height);
}

body.admin-bar.rx-header-fixed-padding {
  padding-top: calc(var(--rx-header-height) + 32px);
}

/* =========================================================
   22. RESPONSIVE DESIGN
   ========================================================= */

@media (max-width: 1180px) {
  .rx-menu > li > a,
  .rx-menu > li > button {
    padding-inline: 0.68rem;
  }

  .rx-menu > li.rx-mega-menu > .sub-menu {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1024px) {
  .rx-primary-nav {
    display: none;
  }

  .rx-mobile-toggle {
    display: inline-grid;
  }

  .rx-header-center {
    justify-content: flex-end;
  }

  .rx-header-search {
    max-width: 300px;
  }

  .rx-menu > li.rx-mega-menu > .sub-menu {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 782px) {
  .admin-bar .rx-header-sticky,
  .admin-bar .rx-header-fixed {
    top: 46px;
  }

  body.admin-bar.rx-header-fixed-padding {
    padding-top: calc(var(--rx-header-height) + 46px);
  }
}

@media (max-width: 768px) {
  :root {
    --rx-header-height: 68px;
    --rx-header-container-padding: 1rem;
  }

  .rx-header-topbar {
    display: none;
  }

  .rx-header-main {
    gap: var(--rx-header-gap-sm);
  }

  .rx-header-center {
    display: none;
  }

  .rx-header-cta {
    display: none;
  }

  .rx-brand-tagline {
    max-width: 180px;
  }

  .rx-brand-logo {
    max-height: 44px;
  }
}

@media (max-width: 520px) {
  .rx-brand-title {
    font-size: 1.15rem;
  }

  .rx-brand-tagline {
    display: none;
  }

  .rx-header-actions {
    gap: 0.35rem;
  }

  .rx-header-icon-btn,
  .rx-mobile-toggle,
  .rx-search-toggle,
  .rx-theme-toggle {
    width: 40px;
    height: 40px;
  }

  .rx-mobile-drawer {
    width: min(92vw, 360px);
  }
}

/* =========================================================
   23. RTL SUPPORT
   ========================================================= */

[dir="rtl"] .rx-menu .sub-menu,
.rtl .rx-menu .sub-menu,
[dir="rtl"] .rx-menu .children,
.rtl .rx-menu .children {
  transform-origin: top right;
}

[dir="rtl"] .rx-menu .sub-menu .sub-menu,
.rtl .rx-menu .sub-menu .sub-menu,
[dir="rtl"] .rx-menu .children .children,
.rtl .rx-menu .children .children {
  inset-inline-start: auto;
  inset-inline-end: calc(100% + 0.6rem);
}

[dir="rtl"] .rx-menu .sub-menu a:hover,
.rtl .rx-menu .sub-menu a:hover,
[dir="rtl"] .rx-menu .children a:hover,
.rtl .rx-menu .children a:hover {
  transform: translateX(-3px);
}

[dir="rtl"] .rx-mobile-drawer,
.rtl .rx-mobile-drawer {
  inset-inline-start: auto;
  inset-inline-end: 0;
  transform: translateX(105%);
}

[dir="rtl"] .rx-mobile-open .rx-mobile-drawer,
.rtl .rx-mobile-open .rx-mobile-drawer {
  transform: translateX(0);
}

/* =========================================================
   24. REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  .rx-site-header,
  .rx-site-header *,
  .rx-site-header *::before,
  .rx-site-header *::after,
  .rx-mobile-overlay,
  .rx-mobile-drawer {
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

/* =========================================================
   25. HIGH CONTRAST SUPPORT
   ========================================================= */

@media (forced-colors: active) {
  .rx-site-header,
  .rx-header-topbar,
  .rx-menu .sub-menu,
  .rx-menu .children,
  .rx-mobile-drawer,
  .rx-header-search-panel {
    border: 1px solid CanvasText;
  }

  .rx-header-cta {
    border: 1px solid ButtonText;
  }
}

/* =========================================================
   26. PRINT
   ========================================================= */

@media print {
  .rx-site-header {
    position: static !important;
    box-shadow: none !important;
    border-bottom: 1px solid #000 !important;
    background: #fff !important;
    color: #000 !important;
  }

  .rx-primary-nav,
  .rx-header-actions,
  .rx-mobile-toggle,
  .rx-mobile-drawer,
  .rx-mobile-overlay,
  .rx-header-search,
  .rx-header-topbar {
    display: none !important;
  }

  .rx-header-main {
    min-height: auto !important;
    padding-block: 0.5rem !important;
  }
}

/* =========================================================
   27. HEADER VARIANTS FOR FUTURE RX THEME OPTIONS
   ========================================================= */

.rx-header-medical {
  --rx-header-primary: #0077b6;
  --rx-header-primary-dark: #023e8a;
  --rx-header-primary-soft: rgba(0, 119, 182, 0.12);
}

.rx-header-green {
  --rx-header-primary: #198754;
  --rx-header-primary-dark: #0f5132;
  --rx-header-primary-soft: rgba(25, 135, 84, 0.12);
}

.rx-header-red {
  --rx-header-primary: #d62828;
  --rx-header-primary-dark: #9d0208;
  --rx-header-primary-soft: rgba(214, 40, 40, 0.12);
}

.rx-header-purple {
  --rx-header-primary: #6f42c1;
  --rx-header-primary-dark: #4c2889;
  --rx-header-primary-soft: rgba(111, 66, 193, 0.12);
}

/* =========================================================
   28. WORDPRESS COMPATIBILITY
   ========================================================= */

.rx-site-header .screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}

.rx-site-header .menu-item-description {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--rx-header-muted);
}

.rx-site-header .custom-logo-link {
  display: inline-flex;
  align-items: center;
}

.rx-site-header .custom-logo {
  width: auto;
  max-height: 52px;
}

.rx-header-is-compact .custom-logo {
  max-height: 42px;
}

/* =========================================================
   29. SMALL ANIMATION HELPERS
   ========================================================= */

@keyframes rxHeaderFadeDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes rxHeaderPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 102, 204, 0.35);
  }

  70% {
    box-shadow: 0 0 0 12px rgba(0, 102, 204, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(0, 102, 204, 0);
  }
}

.rx-header-animate-in {
  animation: rxHeaderFadeDown 320ms ease both;
}

.rx-header-pulse {
  animation: rxHeaderPulse 1.8s infinite;
}

/* =========================================================
   30. SAFE FALLBACKS
   ========================================================= */

@supports not (backdrop-filter: blur(12px)) {
  .rx-header-glass,
  .rx-header-is-scrolled {
    background: var(--rx-header-bg);
  }
}

@supports not selector(:focus-visible) {
  .rx-site-header a:focus,
  .rx-site-header button:focus,
  .rx-site-header input:focus {
    outline: 3px solid rgba(0, 102, 204, 0.45);
    outline-offset: 3px;
  }
}

Add this file in functions.php enqueue:

wp_enqueue_style(
    'rx-header',
    get_template_directory_uri() . '/assets/css/rx-header.css',
    array(),
    wp_get_theme()->get('Version')
);

Best header class structure for your header.php:

<header class="rx-site-header rx-header-default rx-header-sticky rx-header-medical">
  <div class="rx-header-container">
    <div class="rx-header-main">

      <div class="rx-header-left">
        <a class="rx-brand" href="/">
          <span class="rx-brand-mark">RX</span>
          <span class="rx-brand-text">
            <span class="rx-brand-title">RX Harun</span>
            <span class="rx-brand-tagline">A global war against illness</span>
          </span>
        </a>
      </div>

      <div class="rx-header-center">
        <nav class="rx-primary-nav" aria-label="Primary Menu">
          <!-- WordPress menu here -->
        </nav>
      </div>

      <div class="rx-header-right">
        <div class="rx-header-actions">
          <button class="rx-search-toggle" type="button" aria-label="Open search"></button>
          <a class="rx-header-cta" href="/appointment/">Appointment</a>
          <button class="rx-mobile-toggle" type="button" aria-label="Open menu">
            <span class="rx-mobile-toggle-bars"><span></span></span>
          </button>
        </div>
      </div>

    </div>
  </div>
</header>

For RX Theme, this rx-header.css is a strong advanced base. Next best file after this is usually:

assets/css/rx-footer.css

Leave a Reply

Your email address will not be published. Required fields are marked *