/* PRE locale controls: header language button + menu, footer region button, region dialog, legal notice.
   Reads the page's own tokens (--accent, --font-main) when present and falls back to the PRE palette. */
:root {
  --pre-l-accent: var(--accent, #9fd8ff);
  --pre-l-ink: #020304;
  --pre-l-text: #f4f4f4;
  --pre-l-body: rgba(255, 255, 255, 0.78);
  --pre-l-muted: rgba(255, 255, 255, 0.58);
  --pre-l-hairline: rgba(255, 255, 255, 0.12);
  --pre-l-hairline-strong: rgba(255, 255, 255, 0.32);
  --pre-l-accent-soft: rgba(159, 216, 255, 0.1);
  --pre-l-accent-line: rgba(159, 216, 255, 0.45);
  --pre-l-surface: #06090d; /* opaque: a translucent menu let page text show through */
  --pre-l-field: #101b1f;
  --pre-l-radius-sm: 6px;
  --pre-l-radius: 12px;
  --pre-l-radius-lg: 14px;
  --pre-l-font: var(--font-main, "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif);
  --pre-l-display: "Syne", "Manrope", system-ui, sans-serif;
  --pre-l-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --pre-l-fast: 150ms;
  --pre-l-normal: 280ms;
}

/* No flash of untranslated text or of the wrong currency (the inline head snippet sets these; locale.js clears them). */
html[data-i18n-pending] [data-i18n],
html[data-i18n-pending] [data-i18n-html],
html[data-i18n-pending] time[data-i18n-date],
html[data-i18n-pending] [data-pre-lang-code],
html[data-prices-pending] [data-price],
html[data-prices-pending] [data-pre-price] { visibility: hidden !important; }
html.pre-region-open { overflow: hidden; }

.pre-visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- header language button ---------- */
.pre-lang { position: relative; display: inline-flex; flex: none; }
/* Pages without a header (404): the button sits in the top-right corner of the page. */
.pre-lang.pre-lang-corner { position: absolute; top: 16px; right: 16px; z-index: 20; }
.pre-lang-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-width: 44px; min-height: 44px; margin: 0; padding: 0 0.85rem 0 0.7rem;
  border: 1px solid var(--pre-l-hairline); border-radius: var(--pre-lang-radius, 999px);
  background: rgba(8, 11, 16, 0.72); color: var(--pre-l-text);
  font: 700 0.72rem/1 var(--pre-l-font); letter-spacing: 0.1em; text-transform: uppercase;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: border-color var(--pre-l-fast) ease-out, background-color var(--pre-l-fast) ease-out, transform var(--pre-l-fast) ease-out;
}
.pre-lang-button svg { width: 16px; height: 16px; flex: none; color: var(--pre-l-accent); transition: transform var(--pre-l-normal) var(--pre-l-ease); }
.pre-lang-code { display: inline-block; min-width: 1.6em; text-align: center; }
.pre-lang-button:hover { border-color: var(--pre-l-accent-line); background-color: rgba(159, 216, 255, 0.08); }
.pre-lang-button:hover svg { transform: rotate(-20deg); }
.pre-lang-button:active { transform: scale(0.96); }
.pre-lang-button[aria-expanded="true"] { border-color: var(--pre-l-accent); background-color: var(--pre-l-accent-soft); }
.pre-lang-button[aria-expanded="true"] svg { transform: rotate(-20deg); }
.pre-lang-button:focus-visible { outline: 2px solid var(--pre-l-accent); outline-offset: 3px; }
/* Phones and tablets: a tighter button (about 52 px wide, still 44 px tall) leaves room for the header nav and CTA. */
@media (max-width: 900px) {
  .pre-lang-button { gap: 0.2rem; padding: 0 0.45rem; }
  .pre-lang-button svg { width: 14px; height: 14px; }
}
/* Very narrow phones: globe and code squeezed into the 44 px minimum target. */
@media (max-width: 359px) {
  .pre-lang-button { gap: 0.1rem; padding: 0 0.3rem; }
  .pre-lang-code { min-width: 0; }
}

/* Placement inside the existing headers. Guarded with :has() so nothing changes until a page adds the button. */
/* index, shop, faq (.header flex row): the button joins the CTA on the right; the nav or menu toggle stays centred in the gap. */
/* index (the only header with .header-shop) squares its header buttons with --radius; match them. */
.header:has(> .header-shop) > .pre-lang { --pre-lang-radius: var(--radius, 12px); }
@media (min-width: 768px) {
  .header:has(> .pre-lang) > .logo { margin-right: auto; }
  .header > .pre-lang { margin-left: auto; }
}
/* info and legal pages (.site-header .wrap): nav and button share the right side. Below 600 px the button joins the
   wordmark row and the nav takes a row of its own, so three nav links never push the header wider than the screen. */
.site-header .wrap:has(> .pre-lang) > .legal-nav { margin-left: auto; }
@media (max-width: 600px) {
  .site-header .wrap:has(> .pre-lang) { flex-flow: row wrap; align-items: center; row-gap: 0.6rem; }
  .site-header .wrap > .pre-lang { order: 1; margin-left: auto; }
  .site-header .wrap:has(> .pre-lang) > .legal-nav { order: 2; flex: 1 0 100%; margin-left: 0; }
}

/* ---------- language menu ---------- */
.pre-lang-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 140;
  box-sizing: border-box; width: max-content; min-width: 240px; max-width: calc(100vw - 32px);
  margin: 0; padding: 6px; overflow-y: auto; overscroll-behavior: contain;
  border: 1px solid var(--pre-l-hairline); border-radius: var(--pre-l-radius-lg);
  background: var(--pre-l-surface); color: var(--pre-l-text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 28px 64px -16px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(0, 0, 0, 0.35);
  font: 500 0.9rem/1.3 var(--pre-l-font); letter-spacing: normal; text-align: left; text-transform: none; white-space: normal;
  transform-origin: top right;
  animation: pre-l-pop var(--pre-l-normal) var(--pre-l-ease);
}
.pre-lang-menu[data-align="left"] { right: auto; left: 0; transform-origin: top left; }
.pre-lang-menu[hidden] { display: none; }
/* The menu can only rise as high as its header's stacking context (z-index 100 on index, shop and faq), and the home
   page's detail callouts sit above that (115 to 120): lift the header while its menu is open. */
.header:has(.pre-lang-menu:not([hidden])) { z-index: 130; }
.pre-lang-item {
  display: flex; align-items: center; gap: 0.75rem; box-sizing: border-box;
  width: 100%; min-height: 44px; margin: 0; padding: 0.5rem 0.7rem;
  border: 0; border-radius: 8px; background: transparent; color: var(--pre-l-body);
  font: inherit; letter-spacing: inherit; text-align: left; text-transform: none; cursor: pointer;
  transition: background-color var(--pre-l-fast) ease-out, color var(--pre-l-fast) ease-out;
}
.pre-lang-item-name { flex: 1; min-width: 0; }
.pre-lang-item-code { color: var(--pre-l-muted); font-size: 0.66rem; font-weight: 700; letter-spacing: 0.12em; }
.pre-lang-item-check { width: 16px; height: 16px; flex: none; color: var(--pre-l-accent); opacity: 0; }
.pre-lang-item[aria-checked="true"] { color: #ffffff; font-weight: 700; }
.pre-lang-item[aria-checked="true"] .pre-lang-item-check { opacity: 1; }
.pre-lang-item:hover, .pre-lang-item:focus { background-color: rgba(159, 216, 255, 0.1); color: #ffffff; outline: none; }
/* An outline, not a box-shadow: forced-colors mode (Windows High Contrast) drops shadows and would leave no ring. */
.pre-lang-item:focus-visible { outline: 2px solid var(--pre-l-accent); outline-offset: -2px; }
.pre-lang-item:active { background-color: rgba(159, 216, 255, 0.18); }
.pre-lang-sep { height: 1px; margin: 6px 6px; background: var(--pre-l-hairline); }
.pre-lang-region { color: var(--pre-l-muted); font-size: 0.8rem; font-weight: 600; line-height: 1.35; }
.pre-lang-region svg { width: 16px; height: 16px; flex: none; color: var(--pre-l-accent); }

/* ---------- footer region button ---------- */
.pre-region-button {
  display: inline-flex; align-items: center; gap: 0.45em;
  min-height: 44px; max-width: 100%; margin: 0; padding: 0.35rem 0;
  border: 0; background: none; color: inherit;
  font: inherit; letter-spacing: inherit; text-align: left;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.25em;
  cursor: pointer; overflow-wrap: anywhere;
  transition: color var(--pre-l-fast) ease-out, text-decoration-color var(--pre-l-fast) ease-out;
}
.pre-region-button svg { width: 1.15em; height: 1.15em; flex: none; color: var(--pre-l-accent); }
.pre-region-button:hover { color: #ffffff; text-decoration-color: var(--pre-l-accent); }
.pre-region-button:active { opacity: 0.75; }
.pre-region-button:focus-visible { outline: 2px solid var(--pre-l-accent); outline-offset: 3px; border-radius: 4px; }

/* ---------- legal pages: English-only notice ---------- */
.pre-legal-notice {
  display: flex; align-items: flex-start; gap: 0.75rem;
  margin: 1.25rem 0 0; padding: 0.85rem 1.15rem;
  border: 1px solid var(--pre-l-accent-line); border-radius: var(--pre-l-radius);
  background: var(--pre-l-accent-soft); color: rgba(255, 255, 255, 0.92);
  font-size: 0.95rem; line-height: 1.55;
}
.pre-legal-notice[hidden] { display: none; }
.pre-legal-notice svg { width: 1.2em; height: 1.2em; flex: none; margin-top: 0.15em; color: var(--pre-l-accent); }

/* ---------- region dialog ---------- */
.pre-region-dialog {
  box-sizing: border-box; width: min(468px, calc(100vw - 32px)); max-width: none;
  max-height: calc(100dvh - 32px); margin: auto; padding: 0; overflow: auto; overscroll-behavior: contain;
  border: 1px solid var(--pre-l-hairline); border-radius: var(--pre-l-radius-lg);
  background: radial-gradient(130% 70% at 50% -12%, #16425f 0%, #0a1824 46%, #05080c 100%);
  color: var(--pre-l-text); color-scheme: dark;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 48px 120px -24px rgba(0, 0, 0, 0.9);
  font: 400 1rem/1.55 var(--pre-l-font); letter-spacing: normal; text-align: left; text-transform: none;
}
.pre-region-dialog[open] { animation: pre-l-rise 360ms var(--pre-l-ease); }
.pre-region-dialog::backdrop { background: rgba(2, 3, 4, 0.74); }
.pre-region-dialog[open]::backdrop { animation: pre-l-fade 240ms ease-out; }
.pre-region-body { position: relative; padding: 28px 24px 20px; }
.pre-region-dialog [hidden] { display: none !important; }
.pre-region-mark {
  display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 18px;
  border: 1px solid var(--pre-l-accent-line); border-radius: 50%;
  background: radial-gradient(circle, rgba(159, 216, 255, 0.18), rgba(159, 216, 255, 0) 70%);
  color: var(--pre-l-accent);
}
.pre-region-mark svg { width: 22px; height: 22px; }
.pre-region-title {
  margin: 0 44px 10px 0; color: #ffffff;
  font: 500 clamp(1.5rem, 1.25rem + 1.1vw, 1.85rem)/1.08 var(--pre-l-display); letter-spacing: -0.02em;
  text-transform: none;
}
.pre-region-detected { margin: 0; color: var(--pre-l-body); font-size: 1rem; }
.pre-region-detected strong { color: #ffffff; font-weight: 700; }
.pre-region-close {
  position: absolute; top: 12px; right: 12px;
  display: grid; place-items: center; width: 44px; height: 44px; margin: 0; padding: 0;
  border: 1px solid transparent; border-radius: var(--pre-l-radius); background: transparent; color: var(--pre-l-muted);
  cursor: pointer; transition: background-color var(--pre-l-fast) ease-out, color var(--pre-l-fast) ease-out, border-color var(--pre-l-fast) ease-out;
}
.pre-region-close svg { width: 18px; height: 18px; }
.pre-region-close:hover { background-color: rgba(255, 255, 255, 0.07); color: #ffffff; }
.pre-region-close:active { transform: scale(0.94); }
.pre-region-close:focus-visible { outline: 2px solid var(--pre-l-accent); outline-offset: 2px; }
.pre-region-actions { display: grid; gap: 10px; margin-top: 22px; }
.pre-region-primary, .pre-region-secondary {
  display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box;
  width: 100%; min-height: 50px; margin: 0; padding: 0.7rem 1.2rem;
  border-radius: var(--pre-l-radius); font: 700 0.95rem/1.2 var(--pre-l-font); letter-spacing: 0.01em; text-transform: none;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: background-color var(--pre-l-fast) ease-out, border-color var(--pre-l-fast) ease-out, box-shadow var(--pre-l-normal) ease-out, transform var(--pre-l-fast) ease-out;
}
.pre-region-primary { border: 1px solid var(--pre-l-accent); background: var(--pre-l-accent); color: var(--pre-l-ink); }
.pre-region-primary:hover { background: #c6e9ff; box-shadow: 0 12px 32px -12px rgba(159, 216, 255, 0.7); }
.pre-region-secondary { border: 1px solid var(--pre-l-hairline-strong); background: transparent; color: #ffffff; }
.pre-region-secondary:hover { border-color: var(--pre-l-accent-line); background: rgba(255, 255, 255, 0.05); }
.pre-region-primary:active, .pre-region-secondary:active { transform: translateY(1px) scale(0.99); box-shadow: none; }
.pre-region-primary:focus-visible, .pre-region-secondary:focus-visible { outline: 2px solid var(--pre-l-accent); outline-offset: 3px; }
.pre-region-label {
  display: block; margin: 4px 0 8px; color: var(--pre-l-muted);
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase;
}
.pre-region-select-wrap { position: relative; }
.pre-region-select {
  box-sizing: border-box; width: 100%; min-height: 50px; margin: 0; padding: 0 44px 0 14px;
  border: 1px solid var(--pre-l-hairline-strong); border-radius: var(--pre-l-radius);
  background: var(--pre-l-field); color: #f5f5f5; color-scheme: dark;
  font: 500 1rem/1.2 var(--pre-l-font); /* 16px: no iOS zoom on focus */
  -webkit-appearance: none; appearance: none; cursor: pointer;
  transition: border-color var(--pre-l-fast) ease-out, box-shadow var(--pre-l-fast) ease-out;
}
.pre-region-select:hover { border-color: var(--pre-l-accent-line); }
.pre-region-select:focus-visible { outline: 2px solid var(--pre-l-accent); outline-offset: 2px; border-color: var(--pre-l-accent); }
.pre-region-select option, .pre-region-select optgroup { background: var(--pre-l-field); color: #f5f5f5; }
.pre-region-chevron { position: absolute; top: 50%; right: 14px; width: 18px; height: 18px; color: var(--pre-l-accent); pointer-events: none; transform: translateY(-50%); }
.pre-region-error { margin: 8px 0 0; color: #ffd0c2; font-size: 0.85rem; font-weight: 600; }
.pre-region-currency { display: flex; align-items: center; gap: 10px; margin: 14px 0 0; color: var(--pre-l-body); font-size: 0.9rem; line-height: 1.4; }
.pre-region-badge {
  flex: none; padding: 4px 8px; border: 1px solid var(--pre-l-accent-line); border-radius: var(--pre-l-radius-sm);
  background: var(--pre-l-accent-soft); color: var(--pre-l-accent);
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.12em; line-height: 1.2;
}
.pre-region-noship {
  margin: 12px 0 0; padding: 10px 12px; border-left: 2px solid var(--pre-l-accent-line);
  border-radius: 0 var(--pre-l-radius) var(--pre-l-radius) 0; background: rgba(255, 255, 255, 0.04);
  color: var(--pre-l-body); font-size: 0.86rem; line-height: 1.5;
}
.pre-region-lang { margin-top: 20px; padding-top: 6px; border-top: 1px solid var(--pre-l-hairline); }
.pre-region-lang-line { display: flex; flex-wrap: wrap; align-items: center; margin: 0; color: var(--pre-l-muted); font-size: 0.86rem; }
.pre-region-sep { margin: 0 0.45em; }
.pre-region-link {
  display: inline-flex; align-items: center; min-height: 44px; margin: 0; padding: 0 4px;
  border: 0; background: none; color: var(--pre-l-accent);
  font: 700 0.86rem/1 var(--pre-l-font); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.25em;
  cursor: pointer; transition: color var(--pre-l-fast) ease-out;
}
.pre-region-link:hover { color: #ffffff; }
.pre-region-link:focus-visible { outline: 2px solid var(--pre-l-accent); outline-offset: 2px; border-radius: 4px; }
.pre-region-langs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin: 4px 0 6px; padding: 0; border: 0; min-width: 0; }
.pre-region-chip { position: relative; display: block; min-width: 0; }
.pre-region-chip input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.pre-region-chip span {
  display: flex; align-items: center; box-sizing: border-box; min-height: 44px; padding: 0 12px;
  border: 1px solid var(--pre-l-hairline); border-radius: var(--pre-l-radius);
  color: var(--pre-l-body); font-size: 0.88rem; font-weight: 600; overflow-wrap: anywhere;
  transition: border-color var(--pre-l-fast) ease-out, background-color var(--pre-l-fast) ease-out, color var(--pre-l-fast) ease-out;
}
.pre-region-chip input:hover + span { border-color: var(--pre-l-accent-line); color: #ffffff; }
.pre-region-chip input:checked + span { border-color: var(--pre-l-accent); background: var(--pre-l-accent-soft); color: #ffffff; }
.pre-region-chip input:active + span { transform: scale(0.98); }
.pre-region-chip input:focus-visible + span { outline: 2px solid var(--pre-l-accent); outline-offset: 2px; }

@media (min-width: 420px) {
  .pre-region-langs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pre-region-body { padding: 32px 30px 22px; }
}
/* Phones: the dialog becomes a sheet near the thumb. */
@media (max-width: 480px) {
  .pre-region-dialog { margin: auto auto 16px; }
}

@keyframes pre-l-pop { from { opacity: 0; transform: translateY(-4px) scale(0.97); } }
@keyframes pre-l-rise { from { opacity: 0; transform: translateY(14px) scale(0.98); } }
@keyframes pre-l-fade { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .pre-lang-menu, .pre-region-dialog[open], .pre-region-dialog[open]::backdrop { animation: none; }
  .pre-lang-button, .pre-lang-button svg, .pre-region-primary, .pre-region-secondary { transition: none; }
  .pre-lang-button:hover svg, .pre-lang-button[aria-expanded="true"] svg { transform: none; }
}
body[data-motion="paused"] .pre-lang-menu,
body[data-motion="paused"] .pre-region-dialog[open],
body[data-motion="paused"] .pre-region-dialog[open]::backdrop { animation: none !important; transition: none !important; }
body[data-motion="paused"] .pre-lang-button,
body[data-motion="paused"] .pre-lang-button svg,
body[data-motion="paused"] .pre-region-primary,
body[data-motion="paused"] .pre-region-secondary { transition: none !important; }
body[data-motion="paused"] .pre-lang-button:hover svg,
body[data-motion="paused"] .pre-lang-button[aria-expanded="true"] svg { transform: none; }
/* Forced colors: outlines mean focus only. The current language keeps its check mark and bold name; a chosen
   language chip is filled with the system selection colours. */
@media (forced-colors: active) {
  .pre-lang-item:focus-visible { outline-color: Highlight; }
  .pre-region-chip input:checked + span { border-color: Highlight; background: Highlight; color: HighlightText; }
  .pre-lang-item-check { forced-color-adjust: auto; }
}
@media print {
  .pre-lang, .pre-region-button, .pre-region-dialog { display: none !important; }
}
