/* Wyprawa „Efekt Motyla”: drzwi, korytarz, wybór sceny (efektmotyla/wyprawa.js).
   Ten arkusz działa i na stronie głównej (drzwi w pasie strony, potem wyprawa na cały ekran),
   i na samodzielnej stronie /efektmotyla/. Dlatego nie zakłada żadnych stylów strony:
   wszystko jest pod klasami .wy i .gate--live. Kolory wyłącznie z logo. */

:root {
  --wy-css: 1; /* znacznik wersji: brama.js uruchamia drzwi tylko wtedy, gdy odczyta tę liczbę */
}

/* wyprawa zakrywa stronę: strona pod spodem się nie przewija */
html.wy-open,
html.wy-open body {
  overflow: hidden;
}

/* ---------- drzwi w pasie strony głównej (po uruchomieniu skryptu) ---------- */

.gate-view {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s;
}

.gate--live .gate-view {
  opacity: 1;
}

/* drzwi i szyld rysuje teraz płótno, dokładnie w tym samym miejscu; link zostaje jako pole do pukania */
.gate--live .gate-sign,
.gate--live .gate-leaf,
.gate--live .gate-door::before {
  opacity: 0;
}

.gate--live .gate-door {
  border-color: transparent;
  background: none;
  box-shadow: none;
}

.gate .wy-sound {
  position: absolute;
  right: 0.75rem;
  top: 1rem;
  z-index: 2;
}

/* ---------- wyłącznik dźwięku ---------- */

.wy-sound {
  padding: 0.5rem 0.7rem;
  border: 1.5px solid rgba(123, 15, 249, 0.6);
  border-radius: 999px;
  background: rgba(18, 0, 32, 0.88);
  color: rgba(243, 236, 255, 0.74);
  font: 500 0.68rem/1.2 "IBM Plex Mono", ui-monospace, monospace;
  cursor: pointer;
  touch-action: manipulation;
}

/* ---------- pełny ekran ---------- */

.wy {
  position: fixed;
  inset: 0;
  z-index: 200;
  overflow: hidden;
  background: #000;
  color: #f3ecff;
  font: 400 1rem/1.4 "Space Grotesk", system-ui, sans-serif;
  touch-action: none;
  overscroll-behavior: contain;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  --top: max(0.75rem, env(safe-area-inset-top));
  --bottom: max(0.9rem, env(safe-area-inset-bottom));
}

.wy,
.wy *,
.wy *::before,
.wy *::after {
  box-sizing: border-box;
}

.wy:focus {
  outline: none;
}

.wy :focus-visible {
  outline: 2px solid #06bfeb;
  outline-offset: 3px;
}

/* na stronie głównej wyprawa wyłania się z pasa z drzwiami */
.wy--over {
  opacity: 0;
  transition: opacity 0.2s;
}

.wy--over.wy--in {
  opacity: 1;
}

.wy h1,
.wy p {
  margin: 0;
}

.wy-view {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
}

.wy-top {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  z-index: 8;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
  padding: var(--top) 0.75rem 0;
  pointer-events: none;
}

.wy-top > * {
  pointer-events: auto;
}

.wy-x {
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1.5px solid rgba(123, 15, 249, 0.6);
  border-radius: 50%;
  background: rgba(18, 0, 32, 0.88);
  color: #f3ecff;
  font: 400 1.5rem/1 "Space Grotesk", system-ui, sans-serif;
  cursor: pointer;
  touch-action: manipulation;
}

.wy-home {
  padding: 0.5rem 0.8rem;
  border: 1.5px solid #7b0ff9;
  border-radius: 999px;
  background: rgba(18, 0, 32, 0.88);
  color: #f3ecff;
  font: 500 0.7rem/1.2 "IBM Plex Mono", ui-monospace, monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
}

.wy-home span {
  color: #c912f7;
}

/* warstwa napisów nad sceną: nie łapie dotyku poza przyciskami */
.wy-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(var(--top) + 3.4rem) 1.1rem calc(var(--bottom) + 0.6rem);
  text-align: center;
  text-shadow: 0 0 0.5rem #000, 0 0 0.2rem #000;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s, visibility 0s 0.5s;
}

.wy-layer.on {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s;
}

.wy-layer a,
.wy-layer button {
  pointer-events: auto;
  touch-action: manipulation;
}

.wy-spacer {
  flex: 1;
}

.wy-ask {
  font: 700 clamp(4.4rem, 22vw, 7.5rem) / 0.9 "Amatic SC", "Space Grotesk", sans-serif;
  text-shadow: 0 0 1rem rgba(201, 18, 247, 0.9), 0 0 2.8rem rgba(123, 15, 249, 0.8);
}

.wy-cap {
  min-height: 1.5rem;
  margin-top: 0.5rem;
  font-size: 1.1rem;
  font-weight: 500;
}

.wy-facts {
  margin-top: 0.6rem;
  color: #06bfeb;
  font: 500 0.8rem/1.6 "IBM Plex Mono", ui-monospace, monospace;
}

.wy-note {
  max-width: 22rem;
  margin: 0.4rem 0 0.3rem;
  color: rgba(243, 236, 255, 0.74);
  font-size: 0.86rem;
}

.wy-tip {
  max-width: 22rem;
  margin-bottom: 0.7rem;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.35;
}

/* przycisk na drzwiach: dla klawiatury i czytników; dotyk i mysz obsługuje cała scena */
.wy-knock {
  position: absolute;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.wy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.9rem;
  padding: 0.6rem 1.25rem;
  border: 1.5px solid #7b0ff9;
  border-radius: 999px;
  background: rgba(18, 0, 32, 0.82);
  color: #f3ecff;
  font: 500 0.8rem/1.2 "IBM Plex Mono", ui-monospace, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
}

/* ---------- rozwidlenie: przyciski leżą dokładnie na przejściach narysowanych na płótnie ---------- */

.wy-portal {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.35rem;
  padding: 0 0.2rem 0.7rem; /* górny odstęp ustawia skrypt, zależnie od szerokości łuku */
  border: 0;
  border-radius: 999px 999px 0 0;
  background: none;
  color: #f3ecff;
  font: inherit;
  text-shadow: 0 0 0.5rem #000, 0 0 0.2rem #000;
  cursor: pointer;
}

.wy-portal:focus-visible {
  outline-offset: 5px;
}

.wy-portal-name {
  font: 700 clamp(1.7rem, 8vw, 2.6rem) / 0.9 "Amatic SC", "Space Grotesk", sans-serif;
}

.wy-portal[data-kind="cma"] .wy-portal-name {
  text-shadow: 0 0 0.7rem #7b0ff9, 0 0 0.2rem #000;
}

.wy-portal[data-kind="motyl"] .wy-portal-name {
  color: #06bfeb;
  text-shadow: 0 0 0.7rem #06bfeb, 0 0 0.2rem #000;
}

.wy-portal-list {
  font: 400 0.72rem/1.7 "IBM Plex Mono", ui-monospace, monospace;
}

.wy-portal-go {
  margin-top: auto;
  padding: 0.2rem 0.55rem;
  border: 1px solid #f3ecff;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.66);
  font: 500 0.66rem/1.3 "IBM Plex Mono", ui-monospace, monospace;
  letter-spacing: 0.04em;
  text-shadow: none;
}

/* ---------- gdy coś pójdzie nie tak: dwa zwykłe linki ---------- */

.wy-fail {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0.8rem;
  padding: 1.5rem;
  text-align: center;
  touch-action: auto;
}

.wy-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
}

@media (max-height: 30rem) {
  .wy-ask { font-size: 3rem; }
  .wy-note { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .wy,
  .wy *,
  .gate-view {
    animation: none !important;
    transition: none !important;
  }
}
