/* ==========================================================================
   BUMASS.STORE — i18n.css
   Language switcher, takeover modes (it / ru / fr) and the Chinese ad plague.
   Loaded on every page; costs almost nothing until a language is picked.
   ========================================================================== */

/* Non-default languages hide the body until the dictionary lands, so nobody
   sees Dutch flash into English. The inline head script clears this after
   1500ms as a failsafe in case the module never runs. */
html[data-lang-pending] body { visibility: hidden; }

/* ==========================================================================
   Top bar + language selector
   ========================================================================== */

.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 4px 6px;
  background: var(--face);
  box-shadow: var(--bevel-out);
  margin-bottom: var(--gap-sm);
}

.topbar__brand {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .06em;
  padding: 2px 6px;
  box-shadow: var(--bevel-thin-in);
  white-space: nowrap;
}

.topbar__spacer { flex: 1 1 auto; }

.langsel {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.langsel__label {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Custom listbox because Windows' native select does not render country-flag
   emoji. This keeps the flags visible instead of degrading them into letters. */
.langsel__control { position: relative; display: inline-block; min-width: 210px; }
.langsel__button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-width: 168px;
  min-height: 24px;
  padding: 3px 28px 3px 7px;
  border: 0;
  border-radius: 0;
  background: var(--well);
  box-shadow: var(--bevel-well);
  font-family: var(--ui);
  font-size: var(--fs-sm);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.langsel__button:focus-visible,
.langsel__option:focus-visible { outline: 2px dotted var(--focus); outline-offset: -3px; }
.langsel__value { flex: 1 1 auto; }

.langsel__arrow {
  position: absolute;
  top: 2px;
  right: 2px;
  bottom: 2px;
  width: 20px;
  display: grid;
  place-items: center;
  background: var(--face);
  box-shadow: var(--bevel-out);
  pointer-events: none;
  font-size: 8px;
  line-height: 1;
}

.langsel__menu {
  position: absolute;
  z-index: 920;
  top: calc(100% + 2px);
  left: 0;
  width: 100%;
  min-width: 210px;
  padding: 3px;
  background: var(--face);
  box-shadow: var(--bevel-out), 3px 3px 10px rgba(0, 0, 0, .35);
}
.langsel__menu[hidden] { display: none; }
.langsel__option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 26px;
  padding: 4px 7px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--ui);
  font-size: var(--fs-sm);
  text-align: left;
  cursor: pointer;
}
.langsel__option:hover,
.langsel__option:focus,
.langsel__option[aria-selected="true"] {
  background: var(--sel);
  color: var(--sel-ink);
}

/* Tiny locally-rendered flags: no emoji-font lottery and no external assets. */
.langflag {
  position: relative;
  display: inline-block;
  flex: 0 0 22px;
  width: 22px;
  height: 14px;
  border: 1px solid rgba(0, 0, 0, .35);
  box-shadow: 1px 1px 0 rgba(255,255,255,.45);
  overflow: hidden;
}
.langflag--nl { background: linear-gradient(#ae1c28 0 33.33%, #fff 33.33% 66.66%, #21468b 66.66%); }
.langflag--it { background: linear-gradient(90deg, #009246 0 33.33%, #fff 33.33% 66.66%, #ce2b37 66.66%); }
.langflag--ru { background: linear-gradient(#fff 0 33.33%, #0039a6 33.33% 66.66%, #d52b1e 66.66%); }
.langflag--cn { background: #de2910; }
.langflag--cn::after {
  content: "★";
  position: absolute;
  top: -2px;
  left: 2px;
  color: #ffde00;
  font-size: 10px;
  line-height: 1;
}
.langflag--gb {
  background:
    linear-gradient(33deg, transparent 43%, #fff 43% 57%, transparent 57%),
    linear-gradient(-33deg, transparent 43%, #fff 43% 57%, transparent 57%),
    linear-gradient(33deg, transparent 48%, #c8102e 48% 52%, transparent 52%),
    linear-gradient(-33deg, transparent 48%, #c8102e 48% 52%, transparent 52%),
    linear-gradient(#fff 0 35%, #c8102e 35% 65%, #fff 65%),
    linear-gradient(90deg, transparent 0 35%, #fff 35% 43%, #c8102e 43% 57%, #fff 57% 65%, transparent 65%),
    #012169;
}
.langflag--white { overflow: visible; margin-left: 2px; flex-basis: 20px; width: 18px; height: 12px; background: #fff; }
.langflag--white::before {
  content: "";
  position: absolute;
  top: -2px;
  left: -4px;
  width: 2px;
  height: 17px;
  background: #777;
}

@media (pointer: coarse) {
  .langsel__button, .langsel__option { min-height: 40px; font-size: var(--fs-md); }
  .langsel__arrow { width: 26px; }
}

@media (max-width: 519px) {
  .topbar__brand { display: none; }
  .langsel { flex: 1 1 100%; }
  .langsel__control { flex: 1 1 auto; min-width: 0; }
  .langsel__button, .langsel__menu { width: 100%; min-width: 0; }
}

/* ==========================================================================
   Takeover modes — it / ru / fr
   The header, nav and language selector always survive, so the visitor is
   never trapped in a joke they cannot leave.
   ========================================================================== */

html[data-lang-mode="takeover"] .marquee,
html[data-lang-mode="takeover"] main,
html[data-lang-mode="takeover"] .colophon,
html[data-lang-mode="takeover"] .taskbar__tasks { display: none !important; }

#takeover { display: none; }
html[data-lang-mode="takeover"] #takeover { display: block; }

.tk {
  position: relative;
  margin-top: var(--gap-sm);
  background: var(--face);
  box-shadow: var(--bevel-out);
  padding: 3px;
}
.tk__body { position: relative; }

/* Escape hatch pinned inside every takeover, in case the top bar scrolled. */
.tk__exit {
  position: absolute;
  z-index: 6;
  top: 8px;
  right: 8px;
}

/* --- Italy --------------------------------------------------------------- */

.tk--it .tk__body {
  min-height: 60vh;
  background: #000;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.tk--it img {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(100vh - 120px);
  object-fit: contain;
  image-rendering: auto;
}
/* Deep-fried already, but a little extra never hurt anyone. */
html[data-fx="off"] .tk--it img { filter: none; }
.tk--it img { filter: saturate(1.35) contrast(1.12); }

.tk--it .tk__missing {
  padding: 40px 20px;
  text-align: center;
  font-family: var(--mono);
  font-size: var(--fs-sm);
  color: #ffd400;
  background-color: #1a1a1a;
  background-image: repeating-linear-gradient(45deg, rgba(255,212,0,.08) 0 12px, transparent 12px 24px);
}
.tk--it .tk__missing code {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 8px;
  background: #000;
  color: #2bff2b;
  font-size: var(--fs-sm);
  word-break: break-all;
}

/* Tricolore edge, because subtlety is not on the menu. */
.tk--it { border-left: 8px solid #009246; border-right: 8px solid #ce2b37; }

/* --- Audio controls (Italy) ---------------------------------------------- */

.tk__audio {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: var(--face);
}
.tk__audio p {
  flex: 1 1 220px;
  font-size: var(--fs-xs);
  color: var(--ink-soft);
  min-width: 0;
}
/* The player itself is audio-only scenery: 1px is enough for the API, but a
   zero-size iframe gets throttled, so keep it small and out of the way. */
.tk__player {
  position: absolute;
  left: -9999px;
  width: 320px;
  height: 180px;
  border: 0;
}

/* --- Russia -------------------------------------------------------------- */

.tk--ru .tk__body {
  display: grid;
  place-items: center;
  min-height: min(72vh, 620px);
  padding: 8vh 4vw;
  background: #0f0f0f;
  text-align: center;
}
.tk--ru p {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2.6rem, 13vw, 11rem);
  line-height: .92;
  letter-spacing: -.01em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 4px 4px 0 #b32c2c, 8px 8px 0 rgba(0, 0, 0, .6);
  overflow-wrap: break-word;
}

/* --- France -------------------------------------------------------------- */

.tk--fr .tk__body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: min(70vh, 600px);
  background: #fff;
}
.tk--fr .tk__blank { flex: 1 1 auto; }
.tk--fr .tk__punchline {
  padding: 18px 16px;
  text-align: center;
  font-size: clamp(13px, 3vw, 18px);
  font-weight: 700;
  color: #111;
  border-top: 2px dotted #cfcfcf;
}

/* ==========================================================================
   Chinese mode — fake ads, fake popups, one cursor parasite
   Rules: never cover the top bar or the nav, always dismissible, never
   blocking, and capped so the page stays usable.
   ========================================================================== */

.ad-layer {
  position: fixed;
  inset: 0;
  z-index: 760;          /* under the taskbar (800) and start menu (850) */
  pointer-events: none;
}
.ad-layer > * { pointer-events: auto; }

.fakead {
  position: absolute;
  width: min(240px, calc(100vw - 24px));
  background: var(--face);
  box-shadow: var(--bevel-out), 3px 3px 10px rgba(0, 0, 0, .4);
  padding: 3px;
  font-size: var(--fs-xs);
}
.fakead__bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 2px 2px 5px;
  background: linear-gradient(90deg, #a80000, #e04a00);
  color: #fff;
}
.fakead__bar strong {
  flex: 1 1 auto;
  min-width: 0;
  font-size: var(--fs-xs);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fakead__body {
  padding: 8px;
  text-align: center;
  line-height: 1.4;
}
.fakead__body .big {
  display: block;
  font-family: var(--display);
  font-size: 19px;
  letter-spacing: .02em;
  color: #a80000;
  margin-bottom: 3px;
}
.fakead__body .blink { color: #a80000; font-weight: 700; }
.fakead--gaudy .fakead__body {
  background: linear-gradient(90deg, #fff2b0, #ffd400, #fff2b0);
  background-size: 220% 100%;
  animation: ad-shift 7s linear infinite;
}

/* Cursor parasite. Follows, never intercepts anything but its own click. */
.parasite {
  position: fixed;
  z-index: 770;
  width: 176px;
  padding: 3px;
  background: var(--face);
  box-shadow: var(--bevel-out), 2px 2px 8px rgba(0, 0, 0, .45);
  /* Centre the button on the pointer so the moving ad remains clickable. */
  transform: translate(-50%, -50%);
  will-change: left, top;
}
.parasite__inner {
  display: block;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  background: linear-gradient(135deg, #d40000, #ff8a00);
  color: #fff;
  font-family: var(--ui);
  font-size: var(--fs-xs);
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  cursor: pointer;
}
.parasite__inner b { display: block; font-size: 15px; }
.parasite__close {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 18px;
  height: 16px;
  padding: 0;
  border: 0;
  background: var(--face);
  box-shadow: var(--bevel-thin-out);
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1;
  cursor: pointer;
}
/* Touch has no cursor to chase — it parks itself above the taskbar instead. */
.parasite--parked {
  left: auto !important;
  right: 8px;
  top: auto !important;
  bottom: calc(var(--taskbar-h) + env(safe-area-inset-bottom, 0px) + 8px);
  transform: none;
}
@media (prefers-reduced-motion: reduce) { .parasite { transition: none; } }

/* Video window opened by the parasite. */
.tubewin {
  position: fixed;
  z-index: 870;
  width: min(560px, calc(100vw - 20px));
  background: var(--face);
  box-shadow: var(--bevel-out), 4px 4px 16px rgba(0, 0, 0, .5);
  padding: 3px;
}
.tubewin__frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  box-shadow: var(--bevel-well);
}
.tubewin__frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* A "close all of this" button, always reachable in the tray. */
.tray__panic {
  min-height: 20px;
  padding: 2px 7px;
  border: 0;
  background: #ffd400;
  box-shadow: var(--bevel-thin-out);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  color: #000;
  cursor: pointer;
}
@media (pointer: coarse) { .tray__panic { min-height: 32px; padding: 6px 10px; font-size: 11px; } }

/* Chinese text wants a different stack than Tahoma. */
html[lang^="zh"] {
  --ui: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Heiti SC",
        "Source Han Sans SC", "Noto Sans CJK SC", Tahoma, sans-serif;
  --display: "Microsoft YaHei", "PingFang SC", "Heiti SC", Impact, sans-serif;
}
/* CJK needs a touch more room to breathe than 11px Tahoma did. */
html[lang^="zh"] { --fs-xs: 12px; --fs-sm: 13px; --fs-md: 14px; }
html[lang^="zh"] .logo { letter-spacing: 0; }
