critical-home.css

I’ll build this as a strong critical homepage CSS file: above-the-fold layout, header/nav, hero, typography, buttons, cards, responsive rules, accessibility, dark mode support, print-safe basics, and performance-focused CSS variables.

Dear friend, for assets/static/static-css/critical/critical-home.css, this file should contain only above-the-fold critical CSS for the homepage. It should make your homepage load fast before the full CSS loads.

Use this as an advanced starter:

/*!
 * RX Theme - Critical Home CSS
 * Path: assets/static/static-css/critical/critical-home.css
 * Purpose: Above-the-fold homepage styles for fastest first paint
 * Author: RxHarun
 */

/* =========================================================
   01. ROOT DESIGN TOKENS
   ========================================================= */

:root {
  /* Brand Colors */
  --rx-color-primary: #0877d9;
  --rx-color-primary-dark: #065ead;
  --rx-color-primary-soft: #e8f4ff;

  --rx-color-secondary: #00a884;
  --rx-color-secondary-dark: #007f64;
  --rx-color-secondary-soft: #e6fff8;

  --rx-color-danger: #d93025;
  --rx-color-warning: #f9ab00;
  --rx-color-success: #188038;
  --rx-color-info: #1a73e8;

  /* Text Colors */
  --rx-color-text: #172033;
  --rx-color-text-soft: #4b5a70;
  --rx-color-text-muted: #6b7280;
  --rx-color-heading: #0f172a;

  /* Background Colors */
  --rx-color-bg: #ffffff;
  --rx-color-bg-soft: #f8fafc;
  --rx-color-bg-muted: #f1f5f9;
  --rx-color-surface: #ffffff;
  --rx-color-border: #e2e8f0;

  /* Medical Brand Gradient */
  --rx-gradient-primary: linear-gradient(135deg, #0877d9 0%, #00a884 100%);
  --rx-gradient-soft: linear-gradient(135deg, #f0f8ff 0%, #eefcf8 100%);
  --rx-gradient-hero: radial-gradient(circle at top left, rgba(8, 119, 217, 0.14), transparent 34%),
                      radial-gradient(circle at top right, rgba(0, 168, 132, 0.12), transparent 32%),
                      linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);

  /* Typography */
  --rx-font-system: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --rx-font-heading: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --rx-text-xs: clamp(0.75rem, 0.72rem + 0.12vw, 0.8125rem);
  --rx-text-sm: clamp(0.875rem, 0.84rem + 0.16vw, 0.9375rem);
  --rx-text-base: clamp(1rem, 0.96rem + 0.22vw, 1.0625rem);
  --rx-text-md: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);
  --rx-text-lg: clamp(1.25rem, 1.1rem + 0.7vw, 1.625rem);
  --rx-text-xl: clamp(1.5rem, 1.22rem + 1.2vw, 2.125rem);
  --rx-text-2xl: clamp(2rem, 1.45rem + 2.4vw, 3.5rem);

  /* Layout */
  --rx-container: 1200px;
  --rx-container-wide: 1320px;
  --rx-content: 760px;

  --rx-space-1: 0.25rem;
  --rx-space-2: 0.5rem;
  --rx-space-3: 0.75rem;
  --rx-space-4: 1rem;
  --rx-space-5: 1.25rem;
  --rx-space-6: 1.5rem;
  --rx-space-8: 2rem;
  --rx-space-10: 2.5rem;
  --rx-space-12: 3rem;
  --rx-space-16: 4rem;
  --rx-space-20: 5rem;

  /* Radius */
  --rx-radius-xs: 0.35rem;
  --rx-radius-sm: 0.5rem;
  --rx-radius-md: 0.75rem;
  --rx-radius-lg: 1rem;
  --rx-radius-xl: 1.25rem;
  --rx-radius-2xl: 1.75rem;
  --rx-radius-pill: 999px;

  /* Shadow */
  --rx-shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.06);
  --rx-shadow-sm: 0 4px 14px rgba(15, 23, 42, 0.08);
  --rx-shadow-md: 0 12px 30px rgba(15, 23, 42, 0.10);
  --rx-shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.14);

  /* Motion */
  --rx-transition-fast: 150ms ease;
  --rx-transition-normal: 220ms ease;
  --rx-transition-slow: 320ms ease;

  /* Header */
  --rx-header-height: 74px;
  --rx-admin-bar-height: 0px;

  /* Z Index */
  --rx-z-header: 1000;
  --rx-z-overlay: 1100;
  --rx-z-modal: 1200;
}


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

@media (prefers-color-scheme: dark) {
  :root {
    --rx-color-text: #e5eefc;
    --rx-color-text-soft: #b9c5d6;
    --rx-color-text-muted: #94a3b8;
    --rx-color-heading: #ffffff;

    --rx-color-bg: #07111f;
    --rx-color-bg-soft: #0f1b2d;
    --rx-color-bg-muted: #132238;
    --rx-color-surface: #0d1728;
    --rx-color-border: rgba(226, 232, 240, 0.14);

    --rx-color-primary-soft: rgba(8, 119, 217, 0.16);
    --rx-color-secondary-soft: rgba(0, 168, 132, 0.16);

    --rx-gradient-soft: linear-gradient(135deg, #0b1728 0%, #0e211f 100%);
    --rx-gradient-hero: radial-gradient(circle at top left, rgba(8, 119, 217, 0.20), transparent 34%),
                        radial-gradient(circle at top right, rgba(0, 168, 132, 0.16), transparent 32%),
                        linear-gradient(180deg, #07111f 0%, #0b1627 100%);

    --rx-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.25);
    --rx-shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.28);
    --rx-shadow-md: 0 12px 30px rgba(0, 0, 0, 0.34);
    --rx-shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.42);
  }
}


/* =========================================================
   03. RESET + BASE
   ========================================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  font-size: 100%;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--rx-color-text);
  background: var(--rx-color-bg);
  font-family: var(--rx-font-system);
  font-size: var(--rx-text-base);
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.admin-bar {
  --rx-admin-bar-height: 32px;
}

img,
picture,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

img {
  border-style: none;
}

a {
  color: var(--rx-color-primary);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
  transition: color var(--rx-transition-fast);
}

a:hover {
  color: var(--rx-color-primary-dark);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

p {
  margin: 0 0 var(--rx-space-4);
}

p:last-child {
  margin-bottom: 0;
}

ul,
ol {
  margin-top: 0;
}

strong,
b {
  font-weight: 700;
}

small {
  font-size: var(--rx-text-sm);
}

hr {
  border: 0;
  border-top: 1px solid var(--rx-color-border);
  margin: var(--rx-space-8) 0;
}

::selection {
  color: #ffffff;
  background: var(--rx-color-primary);
}


/* =========================================================
   04. ACCESSIBILITY
   ========================================================= */

:focus {
  outline: none;
}

:focus-visible {
  outline: 3px solid rgba(8, 119, 217, 0.45);
  outline-offset: 3px;
}

.rx-skip-link,
.skip-link {
  position: absolute;
  top: -999px;
  left: var(--rx-space-4);
  z-index: 99999;
  padding: var(--rx-space-3) var(--rx-space-4);
  color: #ffffff;
  background: var(--rx-color-primary);
  border-radius: var(--rx-radius-md);
  box-shadow: var(--rx-shadow-md);
}

.rx-skip-link:focus,
.skip-link:focus {
  top: var(--rx-space-4);
}

.screen-reader-text,
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
  border: 0;
}


/* =========================================================
   05. LAYOUT HELPERS
   ========================================================= */

.rx-container,
.container {
  width: min(100% - 32px, var(--rx-container));
  margin-inline: auto;
}

.rx-container-wide {
  width: min(100% - 32px, var(--rx-container-wide));
  margin-inline: auto;
}

.rx-content-width {
  width: min(100% - 32px, var(--rx-content));
  margin-inline: auto;
}

.rx-section {
  padding-block: clamp(2.5rem, 5vw, 5rem);
}

.rx-section-sm {
  padding-block: clamp(1.75rem, 3vw, 3rem);
}

.rx-grid {
  display: grid;
  gap: var(--rx-space-6);
}

.rx-flex {
  display: flex;
  gap: var(--rx-space-4);
}

.rx-center {
  display: grid;
  place-items: center;
}

.rx-hidden {
  display: none !important;
}


/* =========================================================
   06. TYPOGRAPHY
   ========================================================= */

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0 0 var(--rx-space-4);
  color: var(--rx-color-heading);
  font-family: var(--rx-font-heading);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

h1 {
  font-size: var(--rx-text-2xl);
}

h2 {
  font-size: var(--rx-text-xl);
}

h3 {
  font-size: var(--rx-text-lg);
}

h4 {
  font-size: var(--rx-text-md);
}

.rx-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--rx-space-2);
  margin-bottom: var(--rx-space-4);
  padding: 0.45rem 0.8rem;
  color: var(--rx-color-primary-dark);
  background: var(--rx-color-primary-soft);
  border: 1px solid rgba(8, 119, 217, 0.16);
  border-radius: var(--rx-radius-pill);
  font-size: var(--rx-text-sm);
  font-weight: 700;
  line-height: 1.2;
}

.rx-title-gradient {
  background: var(--rx-gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.rx-lead {
  max-width: 68ch;
  color: var(--rx-color-text-soft);
  font-size: var(--rx-text-md);
  line-height: 1.75;
}

.rx-muted {
  color: var(--rx-color-text-muted);
}


/* =========================================================
   07. BUTTONS
   ========================================================= */

.rx-btn,
.button,
.wp-block-button__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--rx-space-2);
  min-height: 44px;
  padding: 0.78rem 1.15rem;
  color: #ffffff;
  background: var(--rx-color-primary);
  border: 1px solid transparent;
  border-radius: var(--rx-radius-pill);
  box-shadow: var(--rx-shadow-xs);
  font-size: var(--rx-text-sm);
  font-weight: 800;
  line-height: 1.2;
  text-decoration: none;
  transition:
    transform var(--rx-transition-fast),
    box-shadow var(--rx-transition-fast),
    background-color var(--rx-transition-fast),
    border-color var(--rx-transition-fast),
    color var(--rx-transition-fast);
}

.rx-btn:hover,
.button:hover,
.wp-block-button__link:hover {
  color: #ffffff;
  background: var(--rx-color-primary-dark);
  box-shadow: var(--rx-shadow-sm);
  transform: translateY(-1px);
}

.rx-btn:active,
.button:active,
.wp-block-button__link:active {
  transform: translateY(0);
}

.rx-btn-secondary {
  color: #ffffff;
  background: var(--rx-color-secondary);
}

.rx-btn-secondary:hover {
  color: #ffffff;
  background: var(--rx-color-secondary-dark);
}

.rx-btn-outline {
  color: var(--rx-color-primary);
  background: transparent;
  border-color: rgba(8, 119, 217, 0.35);
  box-shadow: none;
}

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

.rx-btn-ghost {
  color: var(--rx-color-text);
  background: var(--rx-color-bg-soft);
  border-color: var(--rx-color-border);
  box-shadow: none;
}

.rx-btn-ghost:hover {
  color: var(--rx-color-primary);
  background: var(--rx-color-primary-soft);
}


/* =========================================================
   08. HEADER CRITICAL
   ========================================================= */

.rx-site-header,
.site-header {
  position: sticky;
  top: var(--rx-admin-bar-height);
  z-index: var(--rx-z-header);
  min-height: var(--rx-header-height);
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid var(--rx-color-border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

@media (prefers-color-scheme: dark) {
  .rx-site-header,
  .site-header {
    background: rgba(7, 17, 31, 0.88);
  }
}

.rx-header-inner,
.site-header-inner {
  width: min(100% - 32px, var(--rx-container-wide));
  min-height: var(--rx-header-height);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--rx-space-5);
}

.rx-site-branding,
.site-branding {
  display: flex;
  align-items: center;
  gap: var(--rx-space-3);
  min-width: 0;
}

.rx-logo,
.custom-logo-link {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  text-decoration: none;
}

.rx-logo img,
.custom-logo {
  max-height: 48px;
  width: auto;
}

.rx-site-title,
.site-title {
  margin: 0;
  color: var(--rx-color-heading);
  font-size: clamp(1.15rem, 1rem + 0.5vw, 1.5rem);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

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

.rx-site-description,
.site-description {
  margin: 0;
  color: var(--rx-color-text-muted);
  font-size: var(--rx-text-xs);
  font-weight: 600;
  line-height: 1.3;
}

.rx-main-navigation,
.main-navigation {
  display: flex;
  align-items: center;
  gap: var(--rx-space-4);
}

.rx-menu,
.main-navigation ul {
  display: flex;
  align-items: center;
  gap: clamp(0.25rem, 1vw, 0.8rem);
  margin: 0;
  padding: 0;
  list-style: none;
}

.rx-menu a,
.main-navigation a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0.55rem 0.7rem;
  color: var(--rx-color-text);
  border-radius: var(--rx-radius-pill);
  font-size: var(--rx-text-sm);
  font-weight: 750;
  line-height: 1.2;
  text-decoration: none;
  transition:
    color var(--rx-transition-fast),
    background-color var(--rx-transition-fast);
}

.rx-menu a:hover,
.main-navigation a:hover,
.rx-menu .current-menu-item > a,
.main-navigation .current-menu-item > a {
  color: var(--rx-color-primary);
  background: var(--rx-color-primary-soft);
}

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

.rx-menu-toggle,
.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--rx-color-text);
  background: var(--rx-color-bg-soft);
  border: 1px solid var(--rx-color-border);
  border-radius: var(--rx-radius-pill);
}


/* =========================================================
   09. HOMEPAGE HERO CRITICAL
   ========================================================= */

.rx-home-hero,
.home-hero,
.hero-section {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--rx-gradient-hero);
  border-bottom: 1px solid var(--rx-color-border);
}

.rx-home-hero::before,
.home-hero::before,
.hero-section::before {
  content: "";
  position: absolute;
  inset: auto -10% -30% -10%;
  z-index: -1;
  height: 260px;
  background: radial-gradient(circle, rgba(8, 119, 217, 0.12), transparent 60%);
  pointer-events: none;
}

.rx-hero-inner,
.hero-inner {
  width: min(100% - 32px, var(--rx-container-wide));
  min-height: clamp(520px, 72vh, 760px);
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  align-items: center;
  gap: clamp(2rem, 6vw, 5rem);
  padding-block: clamp(3rem, 7vw, 6rem);
}

.rx-hero-content,
.hero-content {
  max-width: 720px;
}

.rx-hero-title,
.hero-title {
  margin-bottom: var(--rx-space-5);
  font-size: clamp(2.35rem, 5.8vw, 5.5rem);
  line-height: 0.98;
  letter-spacing: -0.06em;
}

.rx-hero-subtitle,
.hero-subtitle {
  max-width: 66ch;
  margin-bottom: var(--rx-space-6);
  color: var(--rx-color-text-soft);
  font-size: clamp(1.06rem, 1.1vw + 0.9rem, 1.35rem);
  line-height: 1.75;
}

.rx-hero-actions,
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--rx-space-3);
  margin-top: var(--rx-space-6);
}

.rx-hero-trust,
.hero-trust {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--rx-space-3);
  margin-top: var(--rx-space-6);
  color: var(--rx-color-text-muted);
  font-size: var(--rx-text-sm);
  font-weight: 650;
}

.rx-hero-trust-item {
  display: inline-flex;
  align-items: center;
  gap: var(--rx-space-2);
}

.rx-hero-trust-icon {
  width: 1.15rem;
  height: 1.15rem;
  color: var(--rx-color-success);
}

.rx-hero-media,
.hero-media {
  position: relative;
  display: grid;
  place-items: center;
}

.rx-hero-card {
  position: relative;
  width: min(100%, 520px);
  padding: clamp(1.2rem, 2vw, 2rem);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(226, 232, 240, 0.85);
  border-radius: var(--rx-radius-2xl);
  box-shadow: var(--rx-shadow-lg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

@media (prefers-color-scheme: dark) {
  .rx-hero-card {
    background: rgba(13, 23, 40, 0.78);
    border-color: rgba(226, 232, 240, 0.14);
  }
}

.rx-hero-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: -1;
  background: var(--rx-gradient-primary);
  border-radius: inherit;
  opacity: 0.18;
}

.rx-health-search {
  display: flex;
  align-items: center;
  gap: var(--rx-space-2);
  width: 100%;
  min-height: 58px;
  padding: var(--rx-space-2);
  background: var(--rx-color-bg);
  border: 1px solid var(--rx-color-border);
  border-radius: var(--rx-radius-pill);
  box-shadow: var(--rx-shadow-sm);
}

.rx-health-search input,
.rx-health-search-field {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 var(--rx-space-4);
  color: var(--rx-color-text);
  background: transparent;
  border: 0;
  outline: 0;
}

.rx-health-search button,
.rx-health-search-submit {
  flex: 0 0 auto;
  min-height: 42px;
  padding-inline: var(--rx-space-5);
  color: #ffffff;
  background: var(--rx-color-primary);
  border: 0;
  border-radius: var(--rx-radius-pill);
  font-weight: 800;
}

.rx-hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--rx-space-3);
  margin-top: var(--rx-space-5);
}

.rx-hero-stat {
  padding: var(--rx-space-4);
  background: var(--rx-color-bg-soft);
  border: 1px solid var(--rx-color-border);
  border-radius: var(--rx-radius-lg);
}

.rx-hero-stat-number {
  display: block;
  color: var(--rx-color-heading);
  font-size: clamp(1.2rem, 1.2vw, 1.6rem);
  font-weight: 900;
  line-height: 1.1;
}

.rx-hero-stat-label {
  display: block;
  margin-top: var(--rx-space-1);
  color: var(--rx-color-text-muted);
  font-size: var(--rx-text-xs);
  font-weight: 650;
}


/* =========================================================
   10. MEDICAL CATEGORY SECTION ABOVE FOLD
   ========================================================= */

.rx-home-categories,
.home-categories {
  background: var(--rx-color-bg);
}

.rx-section-header {
  max-width: 760px;
  margin: 0 auto var(--rx-space-8);
  text-align: center;
}

.rx-section-title {
  margin-bottom: var(--rx-space-3);
}

.rx-section-description {
  color: var(--rx-color-text-soft);
  font-size: var(--rx-text-md);
}

.rx-category-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--rx-space-4);
}

.rx-category-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--rx-space-3);
  min-height: 150px;
  padding: var(--rx-space-5);
  color: var(--rx-color-text);
  background: var(--rx-color-surface);
  border: 1px solid var(--rx-color-border);
  border-radius: var(--rx-radius-xl);
  box-shadow: var(--rx-shadow-xs);
  text-decoration: none;
  transition:
    transform var(--rx-transition-normal),
    box-shadow var(--rx-transition-normal),
    border-color var(--rx-transition-normal),
    background-color var(--rx-transition-normal);
}

.rx-category-card:hover {
  color: var(--rx-color-text);
  border-color: rgba(8, 119, 217, 0.34);
  box-shadow: var(--rx-shadow-md);
  transform: translateY(-3px);
}

.rx-category-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  color: var(--rx-color-primary);
  background: var(--rx-color-primary-soft);
  border-radius: var(--rx-radius-lg);
}

.rx-category-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 850;
  line-height: 1.25;
}

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


/* =========================================================
   11. HOMEPAGE FEATURED POSTS CRITICAL
   ========================================================= */

.rx-featured-posts,
.home-featured-posts {
  background: var(--rx-color-bg-soft);
}

.rx-post-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr;
  gap: var(--rx-space-5);
}

.rx-post-card {
  overflow: hidden;
  background: var(--rx-color-surface);
  border: 1px solid var(--rx-color-border);
  border-radius: var(--rx-radius-xl);
  box-shadow: var(--rx-shadow-xs);
  transition:
    transform var(--rx-transition-normal),
    box-shadow var(--rx-transition-normal),
    border-color var(--rx-transition-normal);
}

.rx-post-card:hover {
  border-color: rgba(8, 119, 217, 0.28);
  box-shadow: var(--rx-shadow-md);
  transform: translateY(-3px);
}

.rx-post-card-featured {
  grid-row: span 2;
}

.rx-post-thumbnail {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--rx-color-bg-muted);
}

.rx-post-card-featured .rx-post-thumbnail {
  aspect-ratio: 16 / 10;
}

.rx-post-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rx-post-content {
  padding: var(--rx-space-5);
}

.rx-post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--rx-space-2);
  margin-bottom: var(--rx-space-3);
  color: var(--rx-color-text-muted);
  font-size: var(--rx-text-xs);
  font-weight: 700;
}

.rx-post-category {
  color: var(--rx-color-primary);
}

.rx-post-title {
  margin: 0 0 var(--rx-space-3);
  font-size: clamp(1.05rem, 1vw + 0.85rem, 1.45rem);
  line-height: 1.25;
}

.rx-post-card-featured .rx-post-title {
  font-size: clamp(1.45rem, 1.5vw + 1rem, 2.2rem);
}

.rx-post-title a {
  color: var(--rx-color-heading);
  text-decoration: none;
}

.rx-post-title a:hover {
  color: var(--rx-color-primary);
}

.rx-post-excerpt {
  margin: 0;
  color: var(--rx-color-text-soft);
  font-size: var(--rx-text-sm);
  line-height: 1.65;
}


/* =========================================================
   12. MEDICAL DISCLAIMER BAR
   ========================================================= */

.rx-medical-notice,
.medical-notice {
  padding: var(--rx-space-4);
  color: var(--rx-color-text-soft);
  background: var(--rx-color-primary-soft);
  border: 1px solid rgba(8, 119, 217, 0.18);
  border-radius: var(--rx-radius-lg);
  font-size: var(--rx-text-sm);
  line-height: 1.65;
}

.rx-medical-notice strong,
.medical-notice strong {
  color: var(--rx-color-heading);
}


/* =========================================================
   13. BREADCRUMB CRITICAL
   ========================================================= */

.rx-breadcrumb,
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--rx-space-2);
  margin-bottom: var(--rx-space-5);
  color: var(--rx-color-text-muted);
  font-size: var(--rx-text-sm);
  font-weight: 600;
}

.rx-breadcrumb a,
.breadcrumb a {
  color: var(--rx-color-text-muted);
  text-decoration: none;
}

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


/* =========================================================
   14. ABOVE-FOLD SIDEBAR / WIDGET BASICS
   ========================================================= */

.rx-widget,
.widget {
  padding: var(--rx-space-5);
  background: var(--rx-color-surface);
  border: 1px solid var(--rx-color-border);
  border-radius: var(--rx-radius-xl);
  box-shadow: var(--rx-shadow-xs);
}

.rx-widget-title,
.widget-title {
  margin-bottom: var(--rx-space-4);
  font-size: 1.15rem;
}

.rx-widget ul,
.widget ul {
  padding-left: 1.15rem;
  margin-bottom: 0;
}

.rx-widget li,
.widget li {
  margin-bottom: var(--rx-space-2);
}

.rx-widget li:last-child,
.widget li:last-child {
  margin-bottom: 0;
}


/* =========================================================
   15. FORM CRITICAL
   ========================================================= */

.rx-form-row {
  display: grid;
  gap: var(--rx-space-2);
  margin-bottom: var(--rx-space-4);
}

label {
  color: var(--rx-color-heading);
  font-size: var(--rx-text-sm);
  font-weight: 750;
}

input[type="text"],
input[type="search"],
input[type="email"],
input[type="url"],
input[type="tel"],
textarea,
select {
  width: 100%;
  min-height: 46px;
  padding: 0.75rem 0.95rem;
  color: var(--rx-color-text);
  background: var(--rx-color-surface);
  border: 1px solid var(--rx-color-border);
  border-radius: var(--rx-radius-md);
  box-shadow: none;
  transition:
    border-color var(--rx-transition-fast),
    box-shadow var(--rx-transition-fast);
}

textarea {
  min-height: 130px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(8, 119, 217, 0.65);
  box-shadow: 0 0 0 4px rgba(8, 119, 217, 0.12);
}


/* =========================================================
   16. WORDPRESS BLOCK CRITICAL SUPPORT
   ========================================================= */

.wp-site-blocks {
  min-height: 100vh;
}

.alignwide {
  width: min(100% - 32px, var(--rx-container-wide));
  margin-inline: auto;
}

.alignfull {
  width: 100%;
  margin-inline: 0;
}

.wp-block-image {
  margin: 0 0 var(--rx-space-6);
}

.wp-block-image img {
  border-radius: var(--rx-radius-lg);
}

.wp-block-cover {
  min-height: 420px;
}

.wp-block-group {
  position: relative;
}

.wp-block-columns {
  gap: var(--rx-space-6);
}

.wp-block-button {
  margin-top: var(--rx-space-4);
}


/* =========================================================
   17. SKELETON / LAZY PLACEHOLDER
   ========================================================= */

.rx-skeleton {
  position: relative;
  overflow: hidden;
  background: var(--rx-color-bg-muted);
  border-radius: var(--rx-radius-md);
}

.rx-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.35),
    transparent
  );
  animation: rx-skeleton-loading 1.4s infinite;
}

@keyframes rx-skeleton-loading {
  100% {
    transform: translateX(100%);
  }
}


/* =========================================================
   18. MOBILE NAV CRITICAL
   ========================================================= */

@media (max-width: 991px) {
  :root {
    --rx-header-height: 68px;
  }

  .rx-menu-toggle,
  .menu-toggle {
    display: inline-flex;
  }

  .rx-main-navigation,
  .main-navigation {
    position: fixed;
    top: calc(var(--rx-header-height) + var(--rx-admin-bar-height));
    left: 16px;
    right: 16px;
    display: none;
    padding: var(--rx-space-4);
    background: var(--rx-color-surface);
    border: 1px solid var(--rx-color-border);
    border-radius: var(--rx-radius-xl);
    box-shadow: var(--rx-shadow-lg);
  }

  .rx-main-navigation.is-open,
  .main-navigation.toggled,
  .main-navigation.is-open {
    display: block;
  }

  .rx-menu,
  .main-navigation ul {
    display: grid;
    gap: var(--rx-space-1);
  }

  .rx-menu a,
  .main-navigation a {
    justify-content: space-between;
    width: 100%;
    border-radius: var(--rx-radius-md);
  }

  .rx-header-actions .rx-btn {
    display: none;
  }

  .rx-hero-inner,
  .hero-inner {
    grid-template-columns: 1fr;
    min-height: auto;
    padding-block: clamp(2.5rem, 8vw, 4.5rem);
  }

  .rx-hero-media,
  .hero-media {
    order: -1;
  }

  .rx-hero-card {
    width: min(100%, 620px);
  }

  .rx-category-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rx-post-grid {
    grid-template-columns: 1fr 1fr;
  }

  .rx-post-card-featured {
    grid-column: 1 / -1;
    grid-row: auto;
  }
}


/* =========================================================
   19. SMALL MOBILE
   ========================================================= */

@media (max-width: 640px) {
  .rx-container,
  .container,
  .rx-container-wide,
  .rx-content-width,
  .rx-header-inner,
  .site-header-inner,
  .rx-hero-inner,
  .hero-inner {
    width: min(100% - 24px, var(--rx-container));
  }

  body.admin-bar {
    --rx-admin-bar-height: 46px;
  }

  .rx-site-title,
  .site-title {
    font-size: 1.1rem;
  }

  .rx-site-description,
  .site-description {
    display: none;
  }

  .rx-hero-title,
  .hero-title {
    font-size: clamp(2.1rem, 12vw, 3.4rem);
  }

  .rx-hero-actions,
  .hero-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .rx-hero-actions .rx-btn,
  .hero-actions .rx-btn {
    width: 100%;
  }

  .rx-health-search {
    align-items: stretch;
    flex-direction: column;
    padding: var(--rx-space-3);
    border-radius: var(--rx-radius-xl);
  }

  .rx-health-search button,
  .rx-health-search-submit {
    width: 100%;
  }

  .rx-hero-stats {
    grid-template-columns: 1fr;
  }

  .rx-category-grid,
  .rx-post-grid {
    grid-template-columns: 1fr;
  }

  .rx-category-card {
    min-height: auto;
  }
}


/* =========================================================
   20. REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .rx-btn:hover,
  .button:hover,
  .wp-block-button__link:hover,
  .rx-category-card:hover,
  .rx-post-card:hover {
    transform: none;
  }
}


/* =========================================================
   21. HIGH CONTRAST SUPPORT
   ========================================================= */

@media (prefers-contrast: more) {
  :root {
    --rx-color-border: #64748b;
  }

  .rx-btn,
  .button,
  .wp-block-button__link {
    border-color: currentColor;
  }

  .rx-category-card,
  .rx-post-card,
  .rx-widget,
  .widget,
  .rx-hero-card {
    border-width: 2px;
  }
}


/* =========================================================
   22. PRINT BASIC
   ========================================================= */

@media print {
  *,
  *::before,
  *::after {
    color: #000000 !important;
    background: transparent !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  body {
    font-size: 12pt;
    line-height: 1.5;
  }

  a {
    color: #000000 !important;
    text-decoration: underline;
  }

  .rx-site-header,
  .site-header,
  .rx-main-navigation,
  .main-navigation,
  .rx-hero-actions,
  .hero-actions,
  .rx-menu-toggle,
  .menu-toggle {
    display: none !important;
  }

  .rx-home-hero,
  .home-hero,
  .hero-section {
    border: 0;
  }

  .rx-hero-inner,
  .hero-inner {
    display: block;
    min-height: auto;
    padding: 0;
  }
}

For best performance, load this file early in header.php like this:

<link rel="preload" href="<?php echo esc_url( get_template_directory_uri() . '/assets/static/static-css/critical/critical-home.css' ); ?>" as="style">
<link rel="stylesheet" href="<?php echo esc_url( get_template_directory_uri() . '/assets/static/static-css/critical/critical-home.css' ); ?>">

Best practice for RX Theme:

critical-home.css = only homepage first visible screen
home.css          = full homepage design
main.css          = global full theme design
dynamic.css       = PHP-generated user/customizer CSS

Do not put every full website style inside critical-home.css. It should stay small enough for fast loading. This version is already advanced, but still focused on homepage critical rendering.

Leave a Reply

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