/* ==========================================================================
   Rehab Global — Base / shared styles
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--rg-font);
  font-size: var(--rg-fs-body);
  line-height: var(--rg-lh-body);
  font-weight: var(--rg-fw-regular);
  color: var(--rg-green-deep);          /* body text = #1D3A32 */
  background: var(--rg-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 {
  margin: 0 0 .4em;
  font-weight: var(--rg-fw-semibold);   /* headings = 600, confirmed */
  line-height: var(--rg-lh-heading);    /* ~1.2 (66/55) */
  color: var(--rg-green);               /* headings = #215749, confirmed */
}
h1 { font-size: var(--rg-fs-display); }
h2 { font-size: var(--rg-fs-h2); }
h3 { font-size: var(--rg-fs-h3); }
h4 { font-size: var(--rg-fs-h4); }
p  { margin: 0 0 1em; }

/* ---- Layout helpers ---- */
.rg-container {
  width: 100%;
  max-width: calc(var(--rg-container) + var(--rg-gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--rg-gutter);
}
.rg-section { padding-block: var(--rg-section-y); }

/* ---- Badge / eyebrow (• RECOVERY ADVISORY SERVICE) ---- */
/* Unified eyebrow badge: muted, subtle (doesn't grab attention) but AA-readable */
.rg-badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 13px;
  border: 1px solid var(--rg-line);
  border-radius: var(--rg-radius-pill);
  font-size: 11px;
  font-weight: var(--rg-fw-medium);        /* 500 — not bold */
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--rg-eyebrow);                          /* muted sage-green, contrast ~5.2:1 on white (passes WCAG AA) */
  background: var(--rg-white);
}
.rg-badge::before {
  content: ""; width: 5px; height: 5px;    /* small dot */
  border-radius: 50%; background: var(--rg-green);   /* subtle green accent */
}
/* A badge that introduces a heading always gets the same air beneath it.
   This single rule owns that spacing — it outranks the per-block __title
   margins (class+element beats class), so blocks don't set it themselves. */
.rg-badge + h1,
.rg-badge + h2,
.rg-badge + h3 { margin-top: 16px; }

/* Badge system: the ::before dot always marks the START of a badge (one, left);
   a thin rule separates meaning-parts inside it. Two dots would read as two
   badges stuck together at 11px. Spacing comes from .rg-badge's gap. */
.rg-badge__sep {
  width: 1px;
  height: 10px;
  background: var(--rg-line);
  display: inline-block;
  flex: 0 0 auto;
}
.rg-badge__part { white-space: nowrap; }   /* a part never breaks inside itself */
/* Phones: a two-part badge keeps its first part only (the heading right below says the rest),
   so it stays one clean line instead of two squeezed columns. */
@media (max-width: 560px) {
  .rg-badge__sep, .rg-badge__sep ~ .rg-badge__part { display: none; }
}

/* Section-closing CTA (conversion points at the end of a section) */
/* Left-aligned like every other section element — the page has no centred column. */
.rg-section-cta { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin-top: 40px; }
.rg-section-cta__note { margin: 0; font-size: var(--rg-fs-small); color: var(--rg-muted); }

/* ---- Buttons (all CTAs: gold, white text, radius 30px, 16px) ---- */
.rg-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px;
  padding: 0 32px;
  border-radius: var(--rg-radius-btn);
  font-family: var(--rg-font);
  font-size: var(--rg-fs-body);
  font-weight: var(--rg-fw-semibold);
  line-height: 1;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background .2s, color .2s, border-color .2s, transform .15s;
}
.rg-btn:hover { transform: translateY(-1px); }

.rg-btn--primary { background: var(--rg-beige); color: var(--rg-white); }     /* gold */
.rg-btn--primary:hover { background: var(--rg-beige-dark); }

.rg-btn--ghost {                                                              /* white outline "Learn more →" */
  background: var(--rg-white); color: var(--rg-green-deep); border-color: var(--rg-line);
}
.rg-btn--ghost:hover { border-color: var(--rg-sage); }

.rg-btn--green { background: var(--rg-green); color: var(--rg-white); }

/* ---- Cards ---- */
.rg-card {
  background: var(--rg-white);
  border-radius: var(--rg-radius-card);
  box-shadow: var(--rg-shadow-card);
}
.rg-card--green {                          /* dark green stat / VIP / CTA card */
  background: var(--rg-card-green);
  color: var(--rg-white);
}
.rg-card--green h1, .rg-card--green h2,
.rg-card--green h3, .rg-card--green h4 { color: var(--rg-white); }

/* ---- Header (Figma 40:36 — 70px bar, 40px row) + sticky ---- */
.rg-header {
  position: sticky; top: 0; z-index: 100;
  padding-block: 15px;                       /* 70px bar = 40 row + 15*2 */
  background: rgba(var(--rg-line-rgb), 0.82);     /* frosted page bg so content scrolls under */
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(var(--rg-green-deep-rgb), 0.08);   /* separator line like Tilda */
}
.rg-header__inner { display: flex; align-items: center; gap: 32px; min-height: 40px; }
.rg-header__logo { display: inline-flex; align-items: center; flex-shrink: 0; }
.rg-header__logo img { height: 30px; width: auto; display: block; }   /* Figma logo 124x29 */
.rg-header__nav { flex: 1; }
.rg-menu { display: flex; gap: 30px; list-style: none; margin: 0; padding: 0; }   /* Figma itemSpacing 30 */
.rg-menu a { font-size: var(--rg-fs-body); font-weight: var(--rg-fw-medium); color: var(--rg-green-deep); }  /* 16/500 */
.rg-menu > li > a, .rg-header__cta { white-space: nowrap; }   /* longer labels (RU) must not wrap */
html:lang(ru) body { overflow-wrap: break-word; }
/* Long Russian words: hyphenate on phones and in narrow cards only, never in headings. */
@media (max-width: 760px) { html:lang(ru) body { hyphens: auto; } }
html:lang(ru) :is(.rg-clinics__card, .rg-clinic-receive__list li, .rg-stats__label, .rg-care__item-text) { hyphens: auto; }
html:lang(ru) :is(h1, h2, h3) { hyphens: manual; }
@media (min-width: 1101px) { html:lang(ru) .rg-menu { gap: 22px; } }   /* Russian labels are longer */
@media (min-width: 1101px) and (max-width: 1180px) {   /* narrow desktop: keep the header on one line */
  .rg-header__inner { gap: 16px; }
  .rg-menu, html:lang(ru) .rg-menu { gap: 16px; }
  .rg-header__cta { padding-inline: 16px; }
  .rg-header .rg-header__icon { display: none; }   /* WhatsApp and e-mail stay in the chat widget and the footer */
}
.rg-menu a:hover { color: var(--rg-green); }
.rg-menu > li { position: relative; }
.rg-menu .sub-menu { display: none; position: absolute; z-index: 120; top: 100%; left: -14px; min-width: 200px; margin: 0; padding: 8px; list-style: none; border-top: 10px solid transparent; background: var(--rg-white); background-clip: padding-box; border-radius: var(--rg-radius-md); box-shadow: var(--rg-shadow-card); }
.rg-menu li:hover > .sub-menu, .rg-menu li:focus-within > .sub-menu { display: block; }
.rg-menu .sub-menu a { display: block; padding: 7px 10px; }
.rg-header__burger { display: none; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border: 0; background: none; color: var(--rg-green-deep); cursor: pointer; }
.rg-header__actions { display: flex; align-items: center; gap: 12px; }
.rg-header__cta { min-height: 40px; padding-inline: 22px; font-size: var(--rg-fs-body); }   /* Figma pill 40px */

/* WhatsApp / email circular icons */
.rg-header__icon {
  width: 40px; height: 40px;
  display: inline-grid; place-items: center;
  border-radius: 50%;
  background: var(--rg-sage);              /* light green — unified with footer & original */
  color: var(--rg-white);
  transition: background .2s, transform .15s;
}
.rg-header__icon svg { width: 20px; height: 20px; }
.rg-header__icon .material-symbols-rounded { font-size: 22px; }
.rg-header__icon:hover { background: var(--rg-green); transform: translateY(-1px); }

/* Custom language switcher (on-brand pill + dropdown) */
.rg-lang { position: relative; }
.rg-lang__btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 14px;
  font-family: var(--rg-font); font-size: var(--rg-fs-small); font-weight: var(--rg-fw-semibold);
  color: var(--rg-green-deep);
  background: var(--rg-white);
  border: 1px solid var(--rg-line); border-radius: var(--rg-radius-pill);
  cursor: pointer;
  transition: border-color .2s, color .2s;
}
.rg-lang__btn:hover { border-color: var(--rg-sage); color: var(--rg-green); }
.rg-lang__chev { transition: transform .2s; opacity: .7; }
.rg-lang:hover .rg-lang__chev, .rg-lang:focus-within .rg-lang__chev { transform: rotate(180deg); }

.rg-lang__menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 100%; width: max-content; margin: 0; padding: 6px; list-style: none;
  background: var(--rg-white);
  border: 1px solid var(--rg-line); border-radius: 14px;
  box-shadow: 0 12px 32px rgba(var(--rg-green-deep-rgb), .12);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .18s, transform .18s, visibility .18s;
  z-index: 50;
}
.rg-lang:hover .rg-lang__menu, .rg-lang:focus-within .rg-lang__menu {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.rg-lang__item {
  display: block; padding: 10px 14px; border-radius: 9px;
  font-size: var(--rg-fs-small); font-weight: var(--rg-fw-medium); color: var(--rg-green-deep);
}
.rg-lang__item:hover { background: var(--rg-bg-soft); color: var(--rg-green); }
.rg-lang__item.is-active { color: var(--rg-green); font-weight: var(--rg-fw-semibold); }

/* ---- Footer (Figma 40:1477 + live Tilda copy) ---- */
.rg-footer { padding-block: 48px; }
.rg-footer__grid {
  display: grid;
  grid-template-columns: minmax(320px, 400px) 1fr;
  gap: 40px 80px;
}
/* Left: logo -> divider -> (nav + contacts) */
.rg-footer__brand { display: flex; flex-direction: column; gap: 18px; }
.rg-footer__logo { display: inline-block; line-height: 0; }
.rg-footer__logo img { width: 196px; height: auto; }
.rg-footer__divider {
  width: 294px; max-width: 100%;
  margin: 0; border: 0;
  border-top: 1px solid rgba(var(--rg-green-deep-rgb), 0.15);   /* Figma Vector 294px divider */
}
.rg-footer__links { display: flex; gap: 60px; }
.rg-footer__nav { display: flex; flex-direction: column; gap: 12px; }
.rg-footer__contact { display: flex; flex-direction: column; gap: 12px; }
.rg-footer__nav a, .rg-footer__link {
  font-size: var(--rg-fs-body); font-weight: var(--rg-fw-medium);
  color: var(--rg-green-deep); text-decoration: none;
}
.rg-footer__nav a:hover { color: var(--rg-green); }
.rg-footer__social { display: flex; gap: 10px; }
.rg-footer__soc {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 50%;                      /* circular — unified with header icons */
  background: var(--rg-sage); color: var(--rg-white);
  transition: background .15s;
}
.rg-footer__soc:hover { background: var(--rg-green); }
.rg-footer__soc .material-symbols-rounded { font-size: 18px; }
/* Right: Medical Disclaimer */
.rg-footer__disclaimer { display: flex; flex-direction: column; gap: 16px; }
.rg-footer__legal { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: var(--rg-fs-small); }
.rg-footer__legal a { color: var(--rg-green-deep); text-decoration: underline; text-underline-offset: 2px; }
/* Title parallels the logo; +margin drops the body text to the divider line (its visual top boundary). */
.rg-footer__title { margin: 0 0 26px; font-size: var(--rg-fs-card); font-weight: var(--rg-fw-semibold); line-height: var(--rg-lh-heading); color: var(--rg-green-deep); }
.rg-footer__text { margin: 0; font-size: var(--rg-fs-body); line-height: var(--rg-lh-body); color: var(--rg-green-deep); max-width: 620px; }

@media (max-width: 860px) {
  .rg-footer__grid { grid-template-columns: 1fr; gap: 32px; }
}
@media (max-width: 460px) {
  .rg-footer__links { gap: 40px; }
}

@media (max-width: 1100px) {   /* below this the menu, CTA and language switcher no longer fit one line (RU) */
  .rg-header__nav, .rg-header__cta { display: none; }
  .rg-header__burger { display: inline-flex; }
  .rg-header__actions { margin-left: auto; }
  .rg-header.is-open .rg-header__nav { display: block; position: absolute; top: 100%; left: 0; right: 0; max-height: calc(100dvh - 80px); overflow-y: auto; padding: 8px 20px 18px; background: var(--rg-bg); box-shadow: var(--rg-shadow-card); }
  .rg-menu { flex-direction: column; gap: 0; }
  .rg-menu a { display: block; padding: 10px 0; }
  .rg-menu .sub-menu { display: block; position: static; min-width: 0; padding: 0 0 0 14px; border: 0; background: none; box-shadow: none; }
  .rg-menu .sub-menu a { padding: 7px 0; }
}
@media (max-width: 560px) {   /* phone: logo + language + menu; WhatsApp is the floating widget, e-mail is in the footer */
  .rg-header .rg-header__icon { display: none; }
}

/* Breadcrumbs (articles, clinic pages) — rg_breadcrumbs() */
.rg-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 22px; font-size: var(--rg-fs-small); color: var(--rg-muted); }
.rg-crumbs__link { color: var(--rg-green); }
.rg-crumbs__link:hover { color: var(--rg-green-deep); }
.rg-crumbs__current { color: var(--rg-muted); }

/* Content tag: a plain list item (substance, therapy, specialty, location). Square-ish and
   tinted so it never reads as a section label (.rg-badge) or a clickable chip (.rg-chip). */
.rg-tag {
  display: inline-flex; align-items: center; padding: 5px 12px;
  border-radius: var(--rg-radius-sm); background: rgba(var(--rg-sage-rgb), .18);
  font-size: var(--rg-fs-small); font-weight: var(--rg-fw-medium); line-height: var(--rg-lh-snug); color: var(--rg-green-deep);
}

/* Country notice, added by assets/js/country-notice.js */
.rg-country-notice { padding: 14px 0; background: rgba(var(--rg-beige-rgb), .14); }
.rg-country-notice p { margin: 0; font-size: var(--rg-fs-small); line-height: var(--rg-lh-body); color: var(--rg-green-deep); }
.rg-country-notice a { color: var(--rg-green); text-decoration: underline; text-underline-offset: 2px; }

/* Anchor links stop below the sticky header */
html { scroll-padding-top: 90px; }

/* Cookie banner */
.rg-footer__cookies { padding: 0; border: 0; background: none; font: inherit; color: var(--rg-green-deep); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.rg-cookie { position: fixed; z-index: 990; left: 20px; bottom: 20px; width: min(440px, calc(100vw - 40px)); padding: 20px; border-radius: var(--rg-radius-card); background: var(--rg-white); box-shadow: var(--rg-shadow-card); }
.rg-cookie p { margin: 0 0 14px; font-size: var(--rg-fs-small); line-height: var(--rg-lh-body); color: var(--rg-green-deep); }
.rg-cookie a { color: var(--rg-green); text-decoration: underline; text-underline-offset: 2px; }
.rg-cookie__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rg-cookie__actions .rg-btn { min-height: 46px; padding-inline: 12px; font-size: var(--rg-fs-small); }
@media (max-width: 640px) { .rg-cookie { bottom: 92px; } } /* above the contact button */

/* Floating WhatsApp button (template-parts/whatsapp-button.php). Same size and place as the
   former messenger widget; brand green (decision 15.11), white WhatsApp mark. */
.rg-wa { position: fixed; z-index: 980; right: 24px; bottom: 24px; display: flex; align-items: center; gap: 12px; text-decoration: none; }
.rg-wa__btn { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 50%; background: var(--rg-green); color: var(--rg-white); box-shadow: 0 4px 16px rgba(0, 0, 0, .22); transition: transform .2s ease, box-shadow .2s ease; }
.rg-wa__label { padding: 9px 16px; border-radius: var(--rg-radius-pill); background: var(--rg-green); color: var(--rg-white); font-size: var(--rg-fs-small); font-weight: var(--rg-fw-semibold); line-height: 1.2; white-space: nowrap; box-shadow: 0 2px 8px rgba(0, 0, 0, .18); }
.rg-wa:hover .rg-wa__btn { transform: scale(1.06); box-shadow: 0 6px 20px rgba(0, 0, 0, .26); }
.rg-wa:focus-visible { outline: none; }
.rg-wa:focus-visible .rg-wa__btn { outline: 2px solid var(--rg-green); outline-offset: 3px; }
@media (max-width: 767px) {
  .rg-wa { right: 16px; }
  .rg-wa__btn { width: 56px; height: 56px; }
  .rg-wa__label { display: none; }   /* phone: the round button only */
}
@media print { .rg-wa { display: none; } }

/* Page not found (404.php) */
.rg-404 { min-height: 50vh; }
.rg-404__title { margin: 16px 0 12px; font-size: var(--rg-fs-h2-lg); line-height: var(--rg-lh-heading); color: var(--rg-green); }
.rg-404__text { max-width: var(--rg-heading-max); margin: 0; font-size: var(--rg-fs-lead); color: var(--rg-green-deep); }
.rg-404__actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 0; }
