.language-switcher {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  margin-inline-start: 0;
}

.language-control {
  position: relative;
  display: inline-grid;
  width: 50px;
  min-width: 44px;
  min-height: 44px;
  place-items: center;
  border: 1px solid var(--rule, #c9c2b7);
  border-radius: 2px;
  color: var(--ink, #171714);
  font: 600 11px/1.2 var(--sans, system-ui, sans-serif);
}

.language-current {
  grid-area: 1 / 1;
  pointer-events: none;
  user-select: none;
}

.language-control::after {
  grid-area: 1 / 1;
  justify-self: end;
  margin-inline-end: 6px;
  content: "⌄";
  font-size: 13px;
  pointer-events: none;
}

.language-select {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  min-width: 0;
  /* WebKit can expose the widest option as overflow beyond this hit target. */
  overflow-x: clip;
  height: 100%;
  margin: 0;
  /* The custom label and arrow replace native select chrome. */
  appearance: none;
  -webkit-appearance: none;
  opacity: 0;
  cursor: pointer;
}

.language-control:focus-within {
  outline: 2px solid var(--terracotta, #b64e31);
  outline-offset: 3px;
}

.language-select:focus-visible {
  outline: 0;
}

.language-submit {
  display: inline-flex;
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--rule, #c9c2b7);
  border-radius: 2px;
  background: transparent;
  color: inherit;
  font: inherit;
}

.language-switcher[data-enhanced="true"] .language-submit {
  display: none;
}

.language-submit:hover {
  border-color: currentColor;
}

.language-submit:focus-visible {
  outline: 2px solid var(--terracotta, #b64e31);
  outline-offset: 3px;
}

/* Two deliberate header rows keep every control reachable on narrow screens. */
@media (max-width: 480px) {
  .header-inner {
    display: grid;
    grid-template-areas:
      "brand language"
      "nav nav";
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0 10px;
    padding-block: 3px;
  }

  .header-inner > .brand { grid-area: brand; justify-self: start; }
  .header-inner > .nav {
    grid-area: nav;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0 clamp(5px, 2vw, 9px);
    font-size: 12px;
  }

  .header-inner > .nav a { white-space: nowrap; }
  .header-inner > .language-switcher { grid-area: language; justify-self: end; }
}

/* Archivo is intentionally Latin only; system fonts supply other scripts. */
html[data-writing-system="complex"] {
  --sans: "Archivo", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-family: var(--sans);
}

html[data-writing-system="complex"] :is(h1, h2, h3, h4, p, label, button, summary, a, li, td, th),
html[data-writing-system="complex"] .automation-kicker {
  letter-spacing: normal !important;
}

/* The Latin studio wordmark remains identical in every language. */
html[data-writing-system="complex"] .brand { letter-spacing: -.045em !important; }
html[data-writing-system="complex"] .footer-wordmark { letter-spacing: -.047em !important; }
html[data-writing-system="complex"] .card-wordmark { letter-spacing: -.065em !important; }
html[data-writing-system="complex"] :is(h1, h2, h3) { line-height: 1.16; }

/* The client opts in only when enhancement is available. Native navigation
   without JavaScript stays immediate, including older transition engines. */
@view-transition { navigation: none; }
::view-transition-old(root) { animation-duration: 120ms; }
::view-transition-new(root) { animation-duration: 160ms; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) { animation: none !important; }
}

html[dir="rtl"] body { text-align: start; }

html[dir="rtl"] .skip-link {
  right: var(--gutter);
  left: auto;
}

html[dir="rtl"] .nav a::after { transform-origin: right; }

/* Brand artwork, captured interfaces, code, telephone numbers, and URLs keep their original direction. */
.site-intro,
.brand,
.footer-wordmark,
.case-media,
.site-preview,
.site-preview img,
.case-media video,
pre:not(.form-result pre),
code,
input[type="email"],
input[type="tel"],
input[type="url"],
#reply,
.signature-preview,
.signature-code {
  direction: ltr;
}

pre:not(.form-result pre),
code,
.signature-code { text-align: left; }

.form-result pre { text-align: start; }

/* Let the selected language break long words before they escape editorial columns. */
html[lang="ru"] :is(.policy-intro h1, .utility-intro h1),
html[lang="ru"] .automation-page :is(h2, h3),
html[lang="es"] .automation-page :is(h2, h3),
html[lang="de"] .studio-heading h2,
html[lang^="pt-"] .studio-heading h2 {
  hyphens: auto;
  overflow-wrap: anywhere;
  text-wrap: pretty;
}

@media (max-width: 760px) {
  html[lang="ru"] .studio-heading h2,
  html[lang="de"] .studio-heading h2,
  html[lang^="pt-"] .studio-heading h2 {
    max-width: 100%;
  }
}

@media (max-width: 420px) {
  html[lang="ru"] .automation-page :is(h2, h3),
  html[lang="es"] .automation-page :is(h2, h3) {
    hyphens: manual;
    overflow-wrap: normal;
    word-break: normal;
  }

  html[lang="ru"] .automation-proof-heading {
    grid-template-columns: 26px minmax(0, 1fr);
    gap: 2px;
  }

  html[lang="ru"] .automation-proof-heading h2 {
    max-width: none;
    font-size: clamp(24px, 7.5vw, 31px);
    text-wrap: pretty;
  }

  html[lang="ru"] .automation-lane-heading h3 {
    font-size: clamp(31px, 9vw, 36px);
    text-wrap: pretty;
  }

  html[lang="es"] .automation-proof-heading h2 {
    font-size: clamp(36px, 9vw, 38px);
    text-wrap: pretty;
  }

  html[lang="ru"] :is(.policy-intro h1, .utility-intro h1) {

    max-width: 100%;
    font-size: clamp(36px, 10.8vw, 44px);
    line-height: 1.05;
    letter-spacing: -.04em;
    hyphens: manual;
    overflow-wrap: normal;
    word-break: normal;
    text-wrap: pretty;
  }

  html[lang="ru"] .case-action {
    flex-wrap: wrap;
    row-gap: 4px;
    align-items: flex-start;
  }
}

/* Fit the back message to the fixed 85 × 55 mm face while keeping its offer size. */
.card-face--back .card-message {
  max-width: none;
  font-size: clamp(18px, 1.5vw, 22px);
  line-height: 1.08;
  hyphens: auto;
  overflow-wrap: anywhere;
}

.card-face--back .card-offer {
  hyphens: auto;
  overflow-wrap: anywhere;
}
