/* GoldenAppX language list (in the header, all pages) and right-to-left / Arabic support. Loaded after style.css and free-tools.css.
   Language-list rules are scoped to .lang-switch; everything else to html[dir="rtl"] / html[lang="ar"], so English layout is otherwise unchanged. */

/* ---------- Language dropdown in the header, right after the logo (native <details>; works without JavaScript) ---------- */
.lang-switch { flex: 0 0 auto; position: relative; display: flex; align-items: center; }
.lang-menu { position: relative; }
.lang-menu summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; min-width: 60px; padding: 0 12px;
  color: var(--cream); font-weight: 700; font-size: .95rem; letter-spacing: .04em; border: 1px solid var(--line-strong); border-radius: 10px; background: rgba(255,255,255,.03); user-select: none;
}
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu summary::after { content: ""; width: 7px; height: 7px; border-inline-end: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform .15s; }
.lang-menu[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.lang-menu summary:hover, .lang-menu[open] summary { color: var(--gold-hi); border-color: var(--gold); background: rgba(229,165,42,.1); }
.lang-menu ul {
  list-style: none; margin: 6px 0 0; padding: 6px; position: absolute; inset-inline-start: 0; top: 100%; min-width: 170px; z-index: 60;
  background: #121216; border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: 0 14px 40px rgba(0,0,0,.6);
}
.lang-menu li a {
  display: flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 8px; color: var(--cream); font-weight: 600; font-size: 1rem; text-decoration: none; border: 1px solid transparent;
}
.lang-menu li a:hover { color: var(--gold-hi); background: var(--panel); }
.lang-menu li a[aria-current="true"] { color: var(--on-gold, #1a1204); background: var(--gold); border-color: var(--gold-hi); }
/* On narrow screens the button sits near a screen edge: open the list towards the middle of the screen so it never runs off it */
@media (max-width: 760px) { .lang-menu ul { inset-inline-start: auto; inset-inline-end: 0; } }
@media (max-width: 520px) { .lang-menu summary { min-width: 56px; padding: 0 10px; } }

/* ---------- Arabic typography ---------- */
html[lang="ar"] {
  --font-body: "Segoe UI", Tahoma, "Noto Sans Arabic", "Noto Naskh Arabic", "Arabic Typesetting", Arial, sans-serif;
  --font-head: "Segoe UI", Tahoma, "Noto Sans Arabic", "Noto Naskh Arabic", Arial, sans-serif;
}
html[lang="ar"] body { line-height: 1.75; }
html[lang="ar"] h1, html[lang="ar"] h2, html[lang="ar"] h3, html[lang="ar"] .tagline { line-height: 1.4; }
/* letter-spacing and forced capitals would break Arabic letter joining */
html[lang="ar"] * { letter-spacing: 0 !important; text-transform: none !important; }
html[lang="ar"] .wordmark, html[lang="ar"] .wordmark * { direction: ltr; unicode-bidi: isolate; }
html[lang="ar"] .nav a { white-space: nowrap; }
/* Latin-script values inside Arabic text keep their own direction */
html[lang="ar"] input[type="text"], html[lang="ar"] select { text-align: start; }
html[lang="ar"] .ltr, html[lang="ar"] [dir="ltr"] { unicode-bidi: isolate; }

/* ---------- Right-to-left mirroring of existing physical-direction rules ---------- */
html[dir="rtl"] .skip-link { left: auto; right: 8px; }
html[dir="rtl"] .ticks li { padding-left: 0; padding-right: 32px; }
html[dir="rtl"] .ticks li::before { left: auto; right: 0; }
html[dir="rtl"] .ticks li::after { left: auto; right: 7px; }
html[dir="rtl"] .ticks.crosses li::after { left: auto; right: 0; }
html[dir="rtl"] .panel.not .ticks li::before { left: auto; right: 0; }
html[dir="rtl"] .steps li { padding: 20px 72px 20px 20px; }
html[dir="rtl"] .steps li .ico { left: auto; right: 18px; }
html[dir="rtl"] .steps li::before { right: auto; left: 16px; }
@media (min-width: 640px) {
  html[dir="rtl"] .steps li { padding: 78px 20px 22px; }
  html[dir="rtl"] .steps li .ico { left: auto; right: 20px; }
  html[dir="rtl"] .steps li::before { right: auto; left: 18px; }
}
html[dir="rtl"] .faq summary { padding: 16px 18px 16px 48px; }
html[dir="rtl"] .faq summary::after { right: auto; left: 14px; }
html[dir="rtl"] .page ul, html[dir="rtl"] .error-summary ul, html[dir="rtl"] .tool-notes ul, html[dir="rtl"] .assumptions { padding-left: 0; padding-right: 22px; }
html[dir="rtl"] .breadcrumb li + li::before { margin-right: 0; margin-left: 6px; }
html[dir="rtl"] .tool-forecast { border-left: 0; border-right: 3px solid var(--gold); padding: 4px 12px 4px 0; }
/* tables: text columns start at the right, number columns end at the left */
html[dir="rtl"] .sched-table th, html[dir="rtl"] .sched-table td { text-align: left; }
html[dir="rtl"] .sched-table tbody th, html[dir="rtl"] .sched-table th:first-child { text-align: right; }
html[dir="rtl"] .sched-table td:last-child, html[dir="rtl"] .sched-table th:last-child { text-align: right; }
html[dir="rtl"] .sched-table.num-last td:last-child, html[dir="rtl"] .sched-table.num-last th:last-child { text-align: left; }
html[dir="rtl"] .week-table caption, html[dir="rtl"] .week-table th, html[dir="rtl"] .week-table td { text-align: right; }
/* numbers, currency amounts and times always read left to right, as one unit */
html[dir="rtl"] .sched-table td, html[dir="rtl"] .week-table td.calc, html[dir="rtl"] .price { unicode-bidi: plaintext; }
/* result values stay right-aligned like their labels; amounts are already isolated left-to-right units */
html[dir="rtl"] .result-list dd { text-align: right; }
html[dir="rtl"] .sched-table td:not(:last-child), html[dir="rtl"] .week-table td.calc { direction: ltr; }
html[dir="rtl"] .week-table td.calc { text-align: right; }
@media (max-width: 759px) {
  html[dir="rtl"] .week-table td.calc { direction: rtl; }
  html[dir="rtl"] .week-table td.calc::before { text-align: right; }
}
/* the chart axis, plot and slider stay left to right (time never reverses); text blocks around them follow the page direction */
html[dir="rtl"] .tool-chart-plot, html[dir="rtl"] .tool-chart-slider { direction: ltr; }
html[dir="rtl"] .tool-chart-readout, html[dir="rtl"] .tool-chart-legend { direction: rtl; }
html[dir="rtl"] .tool-chart-readout .tool-chart-value, html[dir="rtl"] .tool-chart-readout .tool-chart-reference { unicode-bidi: isolate; }
/* email addresses and URLs inside RTL paragraphs */
html[dir="rtl"] a[href^="mailto:"], html[dir="rtl"] .mail { direction: ltr; unicode-bidi: isolate; display: inline-block; }

/* Arabic: keep the four debt inputs on one baseline even when a label wraps to two lines */
@media (min-width: 1000px) { html[dir="rtl"] .debt-grid .field > label { min-height: 3.5em; } }

/* ---------- Social account links in the footer ---------- */
.site-footer .foot-brand .social-links { display: flex; flex-wrap: wrap; gap: 0 18px; margin: 10px 0 0; padding: 0; list-style: none; }
.site-footer .foot-brand .social-links a { display: inline-flex; align-items: center; min-height: 44px; padding: 0; }
