/*
Theme Name: RefreshBalance
Theme URI: https://refreshbalance.com
Author: Antigravity
Author URI: https://refreshbalance.com
Description: A high-performance, medical-grade block theme for RefreshBalance. Built with Vanilla CSS, Interactivity API, and optimized for Core Web Vitals.
Version: 1.0.1
Requires at least: 6.4
Requires PHP: 8.0
License: Proprietary
Text Domain: refreshbalance
*/


/* 
 * CRITICAL PATH CSS

 */

/* ─── Accessibility: Skip to content ────────────────────────── */
.rb-skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 9999;
  background: #7c3aed;
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 0 0 8px 8px;
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  transition: top 0.2s;
}
.rb-skip-link:focus { top: 0; }

/* ─── Design Tokens ─────────────────────────────────────────── */
:root {
    --rb-hue: 0deg;

    --rb-bg: #f8f9fc;
    --rb-white: #ffffff;
    --rb-dark: #0d0f1a;
    --rb-mid: #4a5168;
    --rb-violet: #7c3aed;
    --rb-teal: #0d9488;
    --rb-rose: #e11d48;
    --rb-amber: #d97706;
    --rb-indigo: #4f46e5;
    --rb-shadow-card: 0 4px 24px -6px rgba(13, 15, 26, 0.08);
    --rb-shadow-lift: 0 16px 48px -12px rgba(124, 58, 237, 0.18);
    --rb-radius-card: 22px;
    --rb-transition: 0.42s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-family: 'Noto Sans Sinhala', 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--rb-dark);
    background: var(--rb-bg);
    line-height: 1.75;
}

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

/* SVG reset — scoped to content only, not nav/UI elements */
.entry-content svg,
.wp-block-image svg,
.rb-article-card svg {
    display: block;
    max-width: 100%;
    height: auto;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
    overflow-wrap: break-word;
}

/* Base Table Styles */
.entry-content table, 
table.wp-block-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}

.entry-content table th, 
.entry-content table td,
table.wp-block-table th,
table.wp-block-table td {
    border: 1px solid #e2e8f0;
    padding: 0.75rem 1rem;
    text-align: left;
}

.entry-content table th,
table.wp-block-table th {
    background-color: #f8fafc;
    font-weight: 600;
}

/* ─── Common Utilities ─────────────────────────────────────── */
.rb-container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 2rem;
}

.rb-grad {
    background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 50%, #0d9488 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.rb-post-meta { display: none !important; }

/* ─── Layout Wrappers ───────────────────────────────────────── */
.rb-site-wrap,
.wp-site-blocks {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1 0 auto;
}

/* ─── Dark Footer ───────────────────────────────────────────── */
.rb-footer {
    background: #080c14;
    position: relative;
    overflow: hidden;
    color: #94a3b8;
    font-family: 'Inter', 'Plus Jakarta Sans', sans-serif;
    margin-top: 0;
}

.rb-footer-orb {
    position: absolute;
    top: -120px;
    right: -80px;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.08), transparent 65%);
    pointer-events: none;
    filter: blur(40px);
}

.rb-footer-inner {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 4rem;
    max-width: 1240px;
    margin: 0 auto;
    padding: 4.5rem 2rem 3rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* Brand */
.rb-footer-brand {}

.rb-footer-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    text-decoration: none;
    margin-bottom: 1.25rem;
}

/* Fix: prevent global svg reset from breaking footer logo */
.rb-footer-logo svg {
    display: inline-block !important;
    width: 34px !important;
    height: 34px !important;
    max-width: none !important;
    flex-shrink: 0;
}

.rb-footer-logo-text {
    font-size: 1.2rem;
    font-weight: 500;
    color: #e2e8f0;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.rb-footer-logo-text strong {
    font-weight: 800;
    color: #fff;
}

.rb-footer-desc {
    font-size: 0.875rem;
    line-height: 1.7;
    color: #64748b;
    max-width: 32ch;
    margin-bottom: 1.5rem;
}

.rb-footer-socials {
    display: flex;
    gap: 0.6rem;
}

.rb-social-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: #64748b;
    text-decoration: none;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.rb-social-icon:hover {
    background: rgba(124, 58, 237, 0.2);
    border-color: rgba(124, 58, 237, 0.3);
    color: #a78bfa;
}

/* Nav group */
.rb-footer-nav-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.rb-footer-col-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    color: #e2e8f0;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 0 0 1rem;
}

.rb-footer-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.rb-footer-links a {
    font-size: 0.88rem;
    color: #64748b;
    text-decoration: none;
    transition: color 0.2s;
}

.rb-footer-links a:hover {
    color: #e2e8f0;
}

/* Trust badges */
.rb-footer-trust {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.rb-footer-trust-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 1.25rem 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
}

.rb-footer-trust-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.73rem;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.rb-footer-trust-badge svg {
    color: #7c3aed;
    flex-shrink: 0;
}

/* Bottom bar */
.rb-footer-bottom {
    max-width: 1240px;
    margin: 0 auto;
    padding: 1.25rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.rb-footer-copy,
.rb-footer-made {
    font-size: 0.78rem;
    color: #334155;
    margin: 0;
}

.rb-footer-made {
    color: #475569;
}

/* Responsive */
@media (max-width: 900px) {
    .rb-footer-inner {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }

    .rb-footer-nav-group {
        grid-template-columns: repeat(2, 1fr);
    }

    .rb-footer-desc {
        max-width: 100%;
    }
}

@media (max-width: 600px) {
    .rb-footer-nav-group {
        grid-template-columns: repeat(2, 1fr);
    }

    .rb-footer-bottom {
        flex-direction: column;
        text-align: center;
    }

    .rb-footer-trust-inner {
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .rb-footer {
        display: none !important;
    }
}

/* ─── Minimal Mobile Footer ────────────────────────────────── */
/* Shown only on mobile where the desktop footer is hidden */
.rb-mobile-footer {
    display: none;
    background: #080c14;
    padding: 1.25rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255,255,255,0.06);
    font-family: 'Inter', 'Plus Jakarta Sans', sans-serif;
}

.rb-mobile-footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem 1.25rem;
    margin-bottom: 0.85rem;
}

.rb-mobile-footer-links a {
    font-size: 0.78rem;
    color: #64748b;
    text-decoration: none;
    transition: color 0.2s;
}

.rb-mobile-footer-links a:hover {
    color: #e2e8f0;
}

.rb-mobile-footer-copy {
    text-align: center;
    font-size: 0.72rem;
    color: #334155;
    margin: 0;
}

@media (max-width: 768px) {
    .rb-mobile-footer {
        display: block;
    }
}

/* ─── Mobile Container Padding ─────────────────────────────── */
/* Standard 1rem gutter — keeps all content aligned at the same left edge */
@media (max-width: 767px) {
    .rb-container {
        padding: 0 1rem;
    }
}


/* ─── Modern RTL Support for Farsi (Persian), Arabic & Urdu ─────────── */
[dir="rtl"] {
  text-align: right;
  direction: rtl;
}

[dir="rtl"] body,
[dir="rtl"] h1,
[dir="rtl"] h2,
[dir="rtl"] h3,
[dir="rtl"] h4,
[dir="rtl"] h5,
[dir="rtl"] h6,
[dir="rtl"] p,
[dir="rtl"] .entry-content,
[dir="rtl"] .rb-article-content {
  text-align: right;
  direction: rtl;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Tahoma, 'Vazirmatn', Arial, sans-serif;
}

[dir="rtl"] .rb-article-content th,
[dir="rtl"] .rb-article-content td,
[dir="rtl"] .entry-content table th,
[dir="rtl"] .entry-content table td,
[dir="rtl"] table.wp-block-table th,
[dir="rtl"] table.wp-block-table td {
  text-align: right;
}

[dir="rtl"] .rb-article-content ul,
[dir="rtl"] .rb-article-content ol {
  padding-left: 0;
  padding-right: 1.5rem;
}

/* Callout borders flip to the right side (where Persian reading starts) */
[dir="rtl"] .rb-doctors-note-card {
  border-left: 1.5px solid #99f6e4 !important;
  border-right: 5px solid #0d9488 !important;
}

[dir="rtl"] .rb-references-section {
  border-left: 1px solid #e2e8f0 !important;
  border-right: 4px solid #64748b !important;
}

[dir="rtl"] .key-takeaways {
  border-left: 1.5px solid #ddd6fe !important;
  border-right: 4px solid #7c3aed !important;
}

[dir="rtl"] .medical-disclaimer {
  border-left: none !important;
  border-right: 4px solid #d97706 !important;
}

[dir="rtl"] blockquote {
  border-left: none !important;
  border-right: 4px solid #7c3aed !important;
  padding-left: 0 !important;
  padding-right: 1.25rem !important;
}

/* Dynamically adjust inline border-left callout boxes generated for Persian */
[dir="rtl"] div[style*="border-left: 5px solid #16a34a"],
[dir="rtl"] div[style*="border-left:5px solid #16a34a"],
[dir="rtl"] div[style*="border-left: 4px solid #16a34a"] {
  border-left: none !important;
  border-right: 5px solid #16a34a !important;
}

[dir="rtl"] div[style*="border-left: 5px solid #dc2626"],
[dir="rtl"] div[style*="border-left:5px solid #dc2626"],
[dir="rtl"] div[style*="border-left: 4px solid #dc2626"] {
  border-left: none !important;
  border-right: 5px solid #dc2626 !important;
}

[dir="rtl"] div[style*="border-left: 5px solid #2563eb"],
[dir="rtl"] div[style*="border-left:5px solid #2563eb"],
[dir="rtl"] div[style*="border-left: 4px solid #2563eb"] {
  border-left: none !important;
  border-right: 5px solid #2563eb !important;
}
