/* Language picker, per-script type and right-to-left layout. Loaded after style.css. */

/* Hide the page for the instant between first paint and the language being applied. */
html.pending main,
html.pending footer {
  opacity: 0;
}
main,
footer {
  transition: opacity 0.25s;
}

/* The old EN/TR switch is gone; the old data-lang rules are not used any more. */

/* ── picker ─────────────────────────────────────────────────── */
.lang-picker {
  position: relative;
}
.lang-toggle {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.75rem;
  padding: 0 0.95rem;
  border: 1px solid var(--line-strong);
  background: rgb(255 255 255 / 0.04);
  backdrop-filter: blur(8px);
  color: var(--fg);
  font: 500 0.74rem/1 "Geist Mono", ui-monospace, monospace;
  letter-spacing: 0.16em;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
}
.lang-toggle:hover,
.lang-toggle[aria-expanded="true"] {
  border-color: var(--lilac);
  background: rgb(255 255 255 / 0.08);
}
.lang-toggle svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: var(--lilac);
}
.lang-toggle .caret {
  width: 0.6rem;
  height: 0.4rem;
  fill: none;
  color: var(--dim);
  transition: transform 0.2s;
}
.lang-toggle[aria-expanded="true"] .caret {
  transform: rotate(180deg);
}

.lang-menu {
  position: absolute;
  inset-block-start: calc(100% + 0.5rem);
  inset-inline-end: 0;
  z-index: 30;
  min-width: 13rem;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  border: 1px solid var(--line-strong);
  background: rgb(22 22 30 / 0.96);
  box-shadow: 0 24px 60px -20px rgb(0 0 0 / 0.8), inset 0 1px 0 rgb(255 255 255 / 0.06);
  backdrop-filter: blur(16px);
}
.lang-menu[hidden] {
  display: none;
}
.lang-menu button {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 0;
  background: transparent;
  color: var(--dim);
  font: 500 1rem/1.2 "Geist", "Noto Sans KR", "Noto Sans JP", "Noto Sans Arabic", system-ui, sans-serif;
  text-align: start;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.lang-menu button:hover,
.lang-menu button:focus-visible {
  background: rgb(255 255 255 / 0.07);
  color: var(--fg);
}
.lang-menu button[aria-checked="true"] {
  background: rgb(109 40 217 / 0.35);
  color: #fff;
}
.lang-menu .code {
  inline-size: 1.8rem;
  color: var(--lilac);
  font: 500 0.68rem/1 "Geist Mono", ui-monospace, monospace;
  letter-spacing: 0.14em;
}

/* ── per-script type ────────────────────────────────────────── */
html[lang="ko"] body {
  font-family: "Noto Sans KR", "Geist", system-ui, sans-serif;
  word-break: keep-all;
}
html[lang="ja"] body {
  font-family: "Noto Sans JP", "Geist", system-ui, sans-serif;
  line-break: strict;
}
html[lang="ar"] body {
  font-family: "Noto Sans Arabic", "Geist", system-ui, sans-serif;
}

/* Display and mono faces have no CJK / Arabic glyphs: use the script face, drop the tracking
   (letter-spacing breaks Arabic joining) and the forced capitals. */
html[lang="ko"] :is(.tagline, .status, .btn, .label, .socials .name),
html[lang="ja"] :is(.tagline, .status, .btn, .label, .socials .name),
html[lang="ar"] :is(.tagline, .status, .btn, .label, .socials .name) {
  font-family: inherit;
  font-stretch: 100%;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: none;
}
html[lang="ar"] :is(.tagline, .status, .btn, .label, .socials .name) {
  letter-spacing: 0;
}
html[lang="ko"] .tagline,
html[lang="ja"] .tagline,
html[lang="ar"] .tagline {
  font-size: clamp(1.15rem, 1.9vw, 1.55rem);
  line-height: 1.35;
}
html[lang="ko"] .status,
html[lang="ja"] .status,
html[lang="ar"] .status,
html[lang="ko"] .btn,
html[lang="ja"] .btn,
html[lang="ar"] .btn {
  font-size: 0.9rem;
}
html[lang="ar"] .copy p {
  line-height: 1.95;
}

/* The wordmark, logo lockup and social handles are Latin brand text in every language. */
.wordmark,
.lockup,
.socials {
  direction: ltr;
}

/* ── right to left ──────────────────────────────────────────── */
html[dir="rtl"] .plate {
  inset: 0 auto 0 0;
}
html[dir="rtl"] .plate-fade {
  background:
    linear-gradient(270deg, var(--bg) 2%, rgb(11 11 16 / 0.78) 26%, rgb(11 11 16 / 0.15) 62%, transparent),
    linear-gradient(0deg, var(--bg) 4%, transparent 50%),
    linear-gradient(180deg, var(--bg), transparent 7rem);
}
html[dir="rtl"] .plate-glow {
  background:
    radial-gradient(40rem 28rem at 10% 88%, rgb(139 92 246 / 0.45), transparent 70%),
    radial-gradient(30rem 22rem at 22% 8%, rgb(232 121 249 / 0.16), transparent 70%);
}
html[dir="rtl"] .plate-mark {
  right: auto;
  left: 5%;
}
html[dir="rtl"] .plate-slash {
  transform: skewX(18deg);
}
html[dir="rtl"] .plate-slash--a {
  right: auto;
  left: 7%;
}
html[dir="rtl"] .plate-slash--b {
  right: auto;
  left: 2%;
}
html[dir="rtl"] .plate > img:first-child {
  transform: scaleX(-1);
}
html[dir="rtl"] .btn {
  clip-path: polygon(0 0, 100% 0, calc(100% - 0.9rem) 100%, 0 100%, 0 0);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 0.9rem), calc(100% - 0.9rem) 100%, 0 100%);
}
html[dir="rtl"] .btn::before {
  left: auto;
  right: 0;
}
html[dir="rtl"] .btn .arrow {
  transform: scaleX(-1);
}
html[dir="rtl"] .btn:hover .arrow {
  transform: scaleX(-1) translateX(4px);
}

@media (max-width: 63.99rem) {
  html[dir="rtl"] .plate {
    inset: 0;
  }
}
