/* EB Atelier — languages (lang.js): the menu-bar button and the once-only card. Loaded by every page, so each value
   falls back to the brand's own if a page has no token for it. */

/* menu-bar button: sits beside the dark-mode switch, same size and weight */
.lang { position: relative; flex: none; display: flex; }
.lang__btn { height: 40px; display: inline-flex; align-items: center; gap: 6px; padding: 0 8px; border: 0; border-radius: var(--radius-ctl, 3px);
  background: none; color: inherit; font: 500 12px/1 var(--f-label, -apple-system, sans-serif); letter-spacing: .06em; opacity: .78; cursor: pointer;
  transition: opacity .2s var(--ease, ease), background .2s var(--ease, ease); }
.lang__btn:hover, .lang__btn[aria-expanded="true"] { opacity: 1; background: rgba(var(--shade, 19, 34, 30), .06); }
.gnav.is-dark .lang__btn:hover, .gnav.is-dark .lang__btn[aria-expanded="true"] { background: rgba(244, 240, 230, .08); }
.lang__btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.4; }
.lang__btn:focus-visible { outline: 2px solid var(--fern, #9C5A2A); outline-offset: 2px; opacity: 1; }
.gnav.is-dark .lang__btn:focus-visible { outline-color: var(--mint, #D9935E); }
.lang__menu { position: absolute; z-index: 120; top: calc(100% + 8px); inset-inline-end: 0; min-width: 180px; margin: 0; padding: 6px; list-style: none;
  background: var(--paper, #FBF9F4); color: var(--ink, #13221E); border: 1px solid var(--rule, #E2DCCB); border-radius: var(--radius-card, 3px);
  box-shadow: 0 18px 40px -18px rgba(var(--shade, 19, 34, 30), .45); }
.lang__menu[hidden] { display: none; }
.lang__opt { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px; border-radius: var(--radius-ctl, 3px);
  color: inherit; font-size: 15px; text-decoration: none; }
.lang__opt::before { content: ""; flex: none; width: 6px; height: 6px; background: transparent; }
.lang__opt[aria-current]::before { background: var(--fern, #9C5A2A); }
.lang__opt[aria-current] { font-weight: 600; }
.lang__opt:hover { background: var(--line-hover, rgba(156, 90, 42, .08)); }
.lang__opt:focus-visible { outline: 2px solid var(--fern, #9C5A2A); outline-offset: -2px; }

/* footer: the languages as a quiet row of links, the current one marked */
.langlist { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--s-4, 1rem); font-size: .875rem; }
.langlist svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.4; opacity: .7; margin-inline-end: calc(-1 * var(--s-2, .5rem)); }
.langlist__opt { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; color: inherit; opacity: .78; text-decoration: none; }
.langlist__opt::before { content: ""; width: 5px; height: 5px; background: transparent; }
.langlist__opt[aria-current] { opacity: 1; font-weight: 600; }
.langlist__opt[aria-current]::before { background: var(--mint, #D9935E); }
.langlist__opt:hover { opacity: 1; text-decoration: underline; text-underline-offset: 3px; }
.langlist__opt:focus-visible { outline: 2px solid var(--mint, #D9935E); outline-offset: 2px; opacity: 1; }
.footer .langlist { color: var(--on-forest, #F4F0E6); }
.foot .langlist__opt[aria-current]::before { background: currentColor; }   /* Thing Control's footer is paper, not green */
.footer__inner > .footer__langs { grid-column: 2; justify-self: end; margin-top: calc(-1 * var(--s-4, 1rem)); }
.footer__inner > .footer__links { justify-self: end; }   /* the links and the languages end on the same edge */
@media (max-width: 760px) { .footer__inner > .footer__langs, .footer__inner > .footer__links { grid-column: 1; justify-self: start; margin-top: 0; } }

/* the card: a small Fez-green note in the corner, never over the middle of the page */
.langcard { position: fixed; z-index: 96; inset-inline-start: clamp(12px, 1.6vw, 26px); bottom: clamp(12px, 2vw, 26px);
  width: min(368px, calc(100vw - 24px)); padding: 20px 20px 18px; border-radius: var(--radius-tile, 6px);
  background: var(--forest, #0F3B33); color: var(--on-forest, #F4F0E6); font-family: var(--f, system-ui, sans-serif);
  box-shadow: 0 24px 60px -24px rgba(5, 20, 17, .6), 0 0 0 1px var(--forest-line, #2A5A50);
  opacity: 0; translate: 0 18px; transition: opacity .4s var(--ease, ease), translate .55s cubic-bezier(.16, 1, .3, 1); }
.langcard.is-on { opacity: 1; translate: 0 0; }
.langcard__title { margin: 0 44px 0 0; font-size: 17px; font-weight: 600; line-height: 1.3; }
.langcard[dir="rtl"] .langcard__title { margin: 0 0 0 44px; }
.langcard__title::after { content: ""; display: inline-block; width: .2em; height: .2em; margin-inline-start: .08em; background: var(--mint, #D9935E); }
.langcard__body { margin: 6px 0 16px; font-size: 14.5px; line-height: 1.5; color: var(--on-forest-2, #B4CBC2); }
/* the choice: their language as the one copper button; staying and the other languages are quiet text */
.langcard__acts { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; }
.langcard__go { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 18px; border: 0; border-radius: var(--radius-ctl, 3px);
  background: var(--mint, #D9935E); color: var(--forest, #0F3B33); font: 600 15px/1 var(--f, system-ui, sans-serif); text-decoration: none; cursor: pointer;
  transition: background .2s var(--ease, ease); }
.langcard__go::after { content: "\2192"; transition: translate .25s var(--ease, ease); }
.langcard[dir="rtl"] .langcard__go::after { content: "\2190"; }
.langcard__go:hover { background: #E6AE83; }
.langcard__go:hover::after { translate: 3px 0; }
.langcard[dir="rtl"] .langcard__go:hover::after { translate: -3px 0; }
.langcard__stay { min-height: 44px; padding: 0; border: 0; background: none; color: var(--on-forest-2, #B4CBC2); font: 14.5px/1.3 var(--f, system-ui, sans-serif);
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.langcard__stay:hover { color: var(--on-forest, #F4F0E6); }
.langcard__more { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 14px; margin: 14px 0 0; padding-top: 10px; border-top: 1px solid var(--forest-line, #2A5A50);
  font-size: 13.5px; color: var(--on-forest-2, #B4CBC2); }
.langcard__alt { display: inline-flex; align-items: center; min-height: 32px; color: var(--on-forest, #F4F0E6); text-decoration: underline; text-underline-offset: 3px; }
.langcard__go:focus-visible, .langcard__stay:focus-visible, .langcard__alt:focus-visible, .langcard__x:focus-visible { outline: 2px solid var(--mint, #D9935E); outline-offset: 2px; }
.langcard__x { position: absolute; top: 10px; inset-inline-end: 10px; width: 36px; height: 36px; display: grid; place-items: center; padding: 0;
  border: 0; border-radius: var(--radius-ctl, 3px); background: none; color: var(--on-forest-2, #B4CBC2); cursor: pointer; }
.langcard__x:hover { background: var(--forest-2, #14473E); color: var(--on-forest, #F4F0E6); }
.langcard__x svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; }
/* phones: the bar spreads its items apart; dark mode and language sit together at the right, beside the menu */
@media (max-width: 760px) { .gnav__inner > .gnav__theme { margin-inline: auto 0; } .gnav__inner > .lang { margin-inline-start: -18px; } }
@media (max-width: 760px) { .langcard { inset-inline: 12px; bottom: 12px; width: auto; } }
@media (prefers-reduced-motion: reduce) { .langcard { translate: none; transition: opacity .2s linear; } }

/* Arabic: Geist keeps the Latin (names, numbers); IBM Plex Sans Arabic sets the Arabic beside it */
:root:lang(ar) { --f: "Geist", "IBM Plex Sans Arabic", -apple-system, BlinkMacSystemFont, "Geeza Pro", Arial, sans-serif; }
:root:lang(ar) { --f-label: "IBM Plex Sans Arabic", "Geist", -apple-system, sans-serif; }   /* labels in Arabic script beside Geist's Latin */

/* ---------- right to left (Arabic) ----------
   The page mirrors on its own through flex, grid and logical properties. What stays left to right on purpose:
   things that move or turn sideways (rows that scroll, the poster rail and its arrows, the page-turning reader, the
   before/after slider, the image viewer, the live desk), because their scripts count from the left and the printed
   work they carry reads left to right. Their captions still read right to left. */
[dir="rtl"] :is(.gallery, .belt, .marquee, .paddles, .compare, .rd__stage, .rd__bottom, .lb__stage, .lb__strip, .thing__stage, .thing__keys) { direction: ltr; }
[dir="rtl"] :is(.gallery, .belt, .marquee, .thing__keys) :is(p, h3, h4, figcaption, .thing__label) { direction: rtl; }
/* arrows point the way the reader reads */
[dir="rtl"] .tile__case::after { content: "\2190"; }
[dir="rtl"] .case__arrow { display: inline-block; transform: scaleX(-1); }
[dir="rtl"] .case__next:hover .case__arrow, [dir="rtl"] .case__next:focus-visible .case__arrow { transform: scaleX(-1) translateX(.2em); }
[dir="rtl"] .chev { transform: scaleX(-1); }
[dir="rtl"] .link-cta:hover .chev { translate: -2px 0; }
/* Arabic letters join: tracking pulls them apart, so labels set in spaced capitals are set solid */
:root:lang(ar) body * { letter-spacing: normal !important; }
/* Arabic sits taller than Latin at the same size: headings get room for the dots and tails */
:root:lang(ar) :is(h1, h2, h3, .hero__title, .tile h3) { line-height: 1.3; }
/* Arabic script needs more size than Latin to read at label scale */
:root:lang(ar) { --t-label: .875rem; }

/* ---------- the copyright note (protect.js): shown by the pointer on a right-click, gone after a moment ---------- */
.copynote { position: fixed; z-index: 200; display: flex; gap: 12px; align-items: flex-start; max-width: min(320px, calc(100vw - 24px));
  padding: 12px 16px 13px 12px; border-radius: var(--radius-ctl, 3px); background: var(--forest, #0F3B33); color: var(--on-forest, #F4F0E6);
  font-family: var(--f, system-ui, sans-serif); box-shadow: 0 18px 40px -16px rgba(5, 20, 17, .6), 0 0 0 1px var(--forest-line, #2A5A50);
  pointer-events: none; opacity: 0; translate: 0 6px; transition: opacity .2s var(--ease, ease), translate .3s cubic-bezier(.16, 1, .3, 1); }
.copynote.is-on { opacity: 1; translate: 0 0; }
.copynote__mark { flex: none; width: 26px; height: 26px; display: grid; place-items: center; border-radius: var(--radius-ctl, 3px);
  background: var(--mint, #D9935E); color: var(--forest, #0F3B33); font-size: 15px; font-weight: 700; line-height: 1; }
.copynote p { margin: 0; font-size: 14px; line-height: 1.4; }
.copynote b { display: block; font-weight: 600; }
.copynote p span { color: var(--on-forest-2, #B4CBC2); }
@media (prefers-reduced-motion: reduce) { .copynote { translate: none; transition: opacity .15s linear; } }
img, video { -webkit-touch-callout: none; }   /* iPhone: no "Save image" sheet on a long press */
