/* Herbs.Beauty: Arabic (right-to-left) edition. Loaded last on Arabic pages, after the mirrored copies of every
   stylesheet in assets/css/rtl/ (generated by _build/rtl-css.mjs). Only what mirroring cannot do lives here. */

/* Typefaces: the Latin face comes first, so Latin names, INCI names and numbers keep the site's look; Arabic
   letters fall through to a modern Arabic face with real bold weights (Noto Kufi Arabic for display, Tajawal for
   text; owner request, 24 Nov 2026). */
:root[dir="rtl"] {
  --display: 'Hedvig Letters Serif', 'Noto Kufi Arabic', 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
  --body: 'Rethink Sans', 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
  --ui: 'Rethink Sans', 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
  --latin: 'Newsreader', 'Tajawal', Georgia, serif;
}

/* Arabic needs more line height for its ascenders, descenders and dots, and no letter-spacing anywhere. */
[dir="rtl"] body { line-height: 1.85; }
[dir="rtl"] :is(h1, h2, h3, h4) { line-height: 1.35; letter-spacing: normal; }
[dir="rtl"] :is(.lede, .prose p, .prose li, .card-d) { line-height: 1.85; }
[dir="rtl"] * { letter-spacing: normal !important; }
[dir="rtl"] :is(.eyebrow, .micro, .kicker, .mh-kicker, .mainnav a, .btn, .chip) { text-transform: none; }

/* Latin names, INCI names and other Latin runs keep their own direction inside Arabic sentences. */
[dir="rtl"] :is(i, em, .latin, .inci, .mono, code, kbd, time, [lang="en"], [lang="la"]) { unicode-bidi: isolate; }
[dir="rtl"] :is(.latin, [lang="la"], .inci) { direction: ltr; }

/* Arabic has no true italic: emphasis is shown with weight instead. Latin names stay italic: an emphasized
   Latin-script run carries dir="ltr" (sciNames() in lib.mjs). */
[dir="rtl"] em:not([lang]):not([dir]) { font-style: normal; font-weight: 600; }
[dir="rtl"] em[dir="ltr"] { font-style: italic; }

/* Arrow icons drawn as SVG point the reading way. Logos, play buttons, checkmarks and charts are not mirrored. */
[dir="rtl"] :is(.link-arrow, .feature-link, .btn, .path-link, .nav-feat, .arrow, .pager, .sec-head > a) svg:not(.rosette):not(.no-flip) { transform: scaleX(-1); }

/* Form fields: user text aligns to its own language. */
[dir="rtl"] :is(input, textarea, select) { text-align: start; }
[dir="rtl"] :is(input[type="email"], input[type="url"], input[type="number"], input[type="tel"]) { direction: ltr; text-align: end; }

/* Tables of numbers keep Western digits readable right-aligned in the reading direction. */
[dir="rtl"] .num { text-align: left !important; }

/* In the opening bands Arabic keeps a slightly tighter line height, so the band still fits the first screen. */
[dir="rtl"] :is(.mono-band, .page-head, .apo-hero) :is(.hook, .binomial, .lede) { line-height: 1.6; }

/* Arrow images drawn in CSS (home path cards) point the reading way. */
[dir="rtl"] .path-links a::after { transform: scaleX(-1); }
[dir="rtl"] .path-links a:hover::after, [dir="rtl"] .path-links a:focus-visible::after { transform: scaleX(-1) translateX(3px); }

/* Latin binomials under Arabic titles follow the Arabic alignment, and their trailing punctuation stays with them. */
[dir="rtl"] :is(.latin, [lang="la"], .inci, .sheet-label i) { text-align: right; unicode-bidi: isolate; }
[dir="rtl"] :is(.page-head .eyebrow + h1, .sec-head h2)::after { -webkit-mask-position: right center; mask-position: right center; }

/* Arabic names in the "also called" lists use the page's Arabic text face, not the first edition's Naskh. */
[dir="rtl"] .names [lang="ar"] { font-family: var(--body); }

/* Menus: the drawn arrow sits at the left end, clear of the text (mirroring flips the padding, not the position). */
[dir="rtl"] select { background-position: 10px 55%, 5px 55%; }

/* The home ticker lists Latin binomials: always italic, as botanical names are written. */
[dir="rtl"] .ticker a { font-style: italic; }

/* Header and menu: Arabic letters at the small sizes set for spaced Latin capitals read too small, so the
   Arabic header, menu and menu panels are set larger (owner request, 24 Nov 2026). */
[dir="rtl"] :is(.nav-top, .mainnav-in > a) { font-size: .98rem; font-weight: 700; }
[dir="rtl"] .text-btn { font-size: .9rem; }
[dir="rtl"] .brand-sub { font-size: .8rem; }
[dir="rtl"] .nav-h { font-size: .84rem; }
[dir="rtl"] .nav-feat-k { font-size: .8rem; }
[dir="rtl"] .nav-mega a { font-size: 1.02rem; }
[dir="rtl"] .nav-mega .nav-d, [dir="rtl"] .nav-feat-d { font-size: .9rem; }
@media (max-width: 980px) { [dir="rtl"] :is(.nav-top, .mainnav-in > a) { font-size: 1.08rem; } }

/* A Latin name marked inside a line (sciMark(), sciNames()) is not isolated, so it stays in one left-to-right run
   with the Latin words around it: "Sideroxylon spinosum L." keeps its author on the right. */
[dir="rtl"] i[lang="la"] { unicode-bidi: normal; }

/* Short label lines (plate labels, credits, grade pills, tags) keep a compact line height: the 1.85 set for Arabic
   running text would make the enlarged labels push the openings past the first screen. */
[dir="rtl"] :is(.sheet-label > *, .sheet-credit, .grade, .grade-pill, .tag, .chip, .flag, .eyebrow, .crumbs) { line-height: 1.4; }
/* The larger Arabic breadcrumbs keep the strip at its usual height (--crumb-h), so openings still fit. */
@media (min-width: 761px) { [dir="rtl"] .crumbs { padding-top: 24px; } }
@media (max-width: 760px) { [dir="rtl"] .crumbs { padding-top: 10px; } }
/* The concern chips in an ingredient's facts row stay compact, so they keep sharing rows and the opening fits. */
[dir="rtl"] .mono-head .facts .chip { font-size: .78rem; line-height: 1.15; padding: 2px 8px; }
[dir="rtl"] .mono-head .binomial { line-height: 1.2; }
/* The safety and sun-sensitivity columns wrap instead of widening with their larger labels. */
@media (min-width: 1181px) { [dir="rtl"] .mono-head .facts { grid-template-columns: max-content fit-content(190px) fit-content(110px) minmax(0, 1fr); } }
