/* Languages (trilingual stage 1, 2026-11-16): the language button, the fonts
   and right-to-left layout for the Arabic and Russian twins built by
   backend/pipeline/pages/i18n.py. Loaded only by pages that have twins.

   Header widths at 1280px were measured on the live About page with each
   language's labels and this button (55px): English needs 1,141px of the
   1,188px row once links sit 12px apart; Arabic needs about 1,152px in a
   system Arabic font, and its own font may run wider; Russian needs 1,340px,
   more than the row can ever hold at its 1,320px cap. So Arabic keeps the
   menu below 1440px, Russian below 1600px, and Russian may use a wider row
   above that. header.js checks all three. */

/* ---- the language button ---------------------------------------------- */
.lang-switch { position: relative; flex: 0 0 auto; }
.lang-switch > summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 8px; border: 1px solid var(--line-dark); border-radius: 8px;
  color: var(--on-dark); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; line-height: 1.2;
}
.lang-switch > summary::-webkit-details-marker { display: none; }
.lang-switch > summary:hover, .lang-switch[open] > summary, .lang-switch > summary:focus-visible { border-color: var(--gold-bright); color: var(--gold-bright); }
.lang-menu {
  position: absolute; inset-inline-end: 0; top: calc(100% + 6px); z-index: 60;
  display: flex; flex-direction: column; min-width: 150px; padding: 6px;
  background: var(--kemet); border: 1px solid var(--line-dark); border-radius: 10px;
}
.lang-menu a { color: var(--on-dark); text-decoration: none; padding: 10px 12px; border-radius: 6px; font-size: var(--fs-sm); }
.lang-menu a:hover, .lang-menu a:focus-visible { background: rgba(255, 255, 255, 0.08); }
.lang-menu a[aria-current] { color: var(--gold-bright); }
/* On phones the button gives way to plain links in the menu (LANG-LINKS). */
@media (max-width: 430px) { .lang-switch { display: none; } }
@media (min-width: 1280px) { .nav-links { gap: 12px; } }

/* The offer to read a page in the language the reader picked (lang.js). */
.lang-offer { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 8px 6vw; background: var(--papyrus, #F6EEDC); border-bottom: 1px solid rgba(0, 0, 0, 0.08); font-size: var(--fs-sm); }
.lang-offer a { color: var(--blue); font-weight: 600; }
.lang-offer button { background: none; border: 0; cursor: pointer; font-size: var(--fs-base); line-height: 1; padding: 4px 8px; color: inherit; }

/* The line under each translated page saying it awaits a native review. */
.i18n-note { margin: 14px 0 0; font-size: var(--fs-xs); opacity: 0.8; }

/* ---- fonts ------------------------------------------------------------- */
/* Arabic letters join: any letter-spacing breaks the words apart. */
:lang(ar) body, :lang(ar) .kicker, :lang(ar) .btn, :lang(ar) input, :lang(ar) button {
  font-family: 'Noto Sans Arabic', 'Inter', system-ui, sans-serif;
}
:lang(ar) * { letter-spacing: 0 !important; }
:lang(ar) .kicker { text-transform: none; }
:lang(ar) h1, :lang(ar) h2, :lang(ar) h3, :lang(ar) h4 { font-family: 'Amiri', 'Noto Sans Arabic', serif; line-height: 1.35; }
/* Cinzel has no Cyrillic letters. */
:lang(ru) h1, :lang(ru) h2, :lang(ru) h3, :lang(ru) h4 { font-family: 'Cormorant Garamond', Georgia, serif; letter-spacing: 0; }
/* The brand stays the brand in every language. */
.brand { font-family: 'Cinzel', Georgia, serif; }

/* ---- right to left ------------------------------------------------------ */
[dir="rtl"] .nav-links { justify-content: flex-start; }
@media (max-width: 1279px) {
  [dir="rtl"] .nav-actions { margin-left: 0; margin-right: auto; }
}

/* ---- per-language header breakpoints ------------------------------------
   Arabic and Russian labels need more room, so these languages keep the
   menu up to 1440px and 1600px. Each block is the menu block of egybi.css
   (max-width: 1279px) with every selector under html:lang(); the menu was
   rebuilt on 2026-11-23 (egybi.css says why), and test_nav_menu.py fails
   when a copy here differs from it. */
@media (min-width: 1280px) and (max-width: 1439px) {
  html:lang(ar) .nav-toggle { display: inline-block; order: 3; min-width: 44px; min-height: 44px; }
  html:lang(ar) .nav-actions { order: 2; margin-inline-start: auto; }
  html:lang(ar) .nav-links { order: 4; position: absolute; top: 100%; left: 0; right: 0; background: var(--kemet); padding: 10px 6vw 16px; border-bottom: 1px solid var(--line-dark); display: none; max-height: calc(100vh - 64px); max-height: calc(100dvh - var(--nav-top, 64px)); overflow-y: auto; overscroll-behavior: contain; }
  html:lang(ar) .nav-links.open { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); column-gap: 14px; row-gap: 4px; align-content: start; align-items: stretch; }
  html:lang(ar) .nav-links a { display: flex; align-items: center; min-height: 44px; padding: 8px 10px; border-inline-start: 3px solid transparent; border-radius: 4px; font-size: var(--fs-base); white-space: normal; opacity: 1; }
  html:lang(ar) .nav-links a:not(.cta)::after { display: none; }
  html:lang(ar) .nav-links a:hover { background: rgba(255, 255, 255, 0.06); }
  html:lang(ar) .nav-links a.active { border-inline-start-color: var(--gold-bright); background: rgba(231, 198, 76, 0.1); }
  html:lang(ar) .nav-links a:not(.nav-only-mobile) + .nav-only-mobile { grid-column-start: 1; }
  html:lang(ar) .nav-links a.nav-only-mobile { justify-content: center; text-align: center; margin-top: 8px; padding: 8px 14px; border: 1px solid var(--line-dark); border-radius: 999px; color: var(--on-dark); }
  html:lang(ar) .nav-links a.nav-only-mobile:hover { border-color: var(--gold-bright); }
  html:lang(ar) .nav-links a.nav-only-mobile[href$="ask.html"] { background: var(--gold); border-color: var(--gold); color: var(--kemet); font-weight: 700; }
  html:lang(ar) .nav-links a.nav-only-mobile.active { text-decoration: underline; text-underline-offset: 3px; }
  html:lang(ar).nav-open { overflow: hidden; }
  html:lang(ar) .site-header .bar { position: relative; flex-wrap: nowrap; }
}
@media (min-width: 1280px) and (max-width: 1599px) {
  html:lang(ru) .nav-toggle { display: inline-block; order: 3; min-width: 44px; min-height: 44px; }
  html:lang(ru) .nav-actions { order: 2; margin-inline-start: auto; }
  html:lang(ru) .nav-links { order: 4; position: absolute; top: 100%; left: 0; right: 0; background: var(--kemet); padding: 10px 6vw 16px; border-bottom: 1px solid var(--line-dark); display: none; max-height: calc(100vh - 64px); max-height: calc(100dvh - var(--nav-top, 64px)); overflow-y: auto; overscroll-behavior: contain; }
  html:lang(ru) .nav-links.open { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); column-gap: 14px; row-gap: 4px; align-content: start; align-items: stretch; }
  html:lang(ru) .nav-links a { display: flex; align-items: center; min-height: 44px; padding: 8px 10px; border-inline-start: 3px solid transparent; border-radius: 4px; font-size: var(--fs-base); white-space: normal; opacity: 1; }
  html:lang(ru) .nav-links a:not(.cta)::after { display: none; }
  html:lang(ru) .nav-links a:hover { background: rgba(255, 255, 255, 0.06); }
  html:lang(ru) .nav-links a.active { border-inline-start-color: var(--gold-bright); background: rgba(231, 198, 76, 0.1); }
  html:lang(ru) .nav-links a:not(.nav-only-mobile) + .nav-only-mobile { grid-column-start: 1; }
  html:lang(ru) .nav-links a.nav-only-mobile { justify-content: center; text-align: center; margin-top: 8px; padding: 8px 14px; border: 1px solid var(--line-dark); border-radius: 999px; color: var(--on-dark); }
  html:lang(ru) .nav-links a.nav-only-mobile:hover { border-color: var(--gold-bright); }
  html:lang(ru) .nav-links a.nav-only-mobile[href$="ask.html"] { background: var(--gold); border-color: var(--gold); color: var(--kemet); font-weight: 700; }
  html:lang(ru) .nav-links a.nav-only-mobile.active { text-decoration: underline; text-underline-offset: 3px; }
  html:lang(ru).nav-open { overflow: hidden; }
  html:lang(ru) .site-header .bar { position: relative; flex-wrap: nowrap; }
}
@media (min-width: 1600px) {
  html:lang(ru) .site-header .bar { max-width: 1500px; }
}
