/* OppyWorks · Explore the Worlds — immersive WebGL diorama shell */
:root {
  color-scheme: dark;
  --bg: #101216;
  --panel: #1b1f25;
  --panel-soft: rgba(20, 23, 28, .86);
  --line: #343941;
  --text: #edf0f3;
  --muted: #aab1ba;
  --accent: #b3a2d4;
  --accent-hover: #c7b9e2;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --foot: 30px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body {
  font: 400 16px/1.55 Manrope, system-ui, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}
h1, h2 { font-family: 'Space Grotesk', Manrope, sans-serif; font-weight: 600; letter-spacing: -.02em; margin: 0; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--accent-hover); outline-offset: 3px; }
.no-ring:focus-visible { outline: none; }   /* programmatic focus on arrival by mouse; returns on first key */

.xp-skip { position: fixed; left: 12px; top: -60px; z-index: 50; padding: 10px 14px; background: var(--panel); border-radius: 4px; }
.xp-skip:focus { top: 12px; }

/* Stage */
.xp-stage { position: fixed; inset: 0; touch-action: none; cursor: grab; }
.xp-stage.is-dragging { cursor: grabbing; }
.xp-stage.is-over { cursor: pointer; }
/* Scrim under the world list and legal links, so they never sit on busy art; deeper while a world is open. */
.xp-stage::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: calc(150px + var(--foot) + var(--safe-b)); pointer-events: none;
  background: linear-gradient(rgba(16, 18, 22, 0), rgba(16, 18, 22, .5) 60%, rgba(16, 18, 22, .78)); opacity: .55; transition: opacity .8s var(--ease);
}
.xp.is-intro .xp-stage::after { opacity: 0; }
.xp.is-portal .xp-stage::after { opacity: 1; }
#xp-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 1.2s var(--ease); }
.xp.is-ready #xp-canvas { opacity: 1; }
.xp-fallback-art { display: none; }
.xp.no-gl .xp-fallback-art { display: block; position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 62% 50%; opacity: .55; }

/* Top bar */
.xp-bar {
  position: fixed; inset: 0 0 auto; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: max(14px, env(safe-area-inset-top)) clamp(16px, 3vw, 36px) 14px;
  background: linear-gradient(rgba(16, 18, 22, .78), rgba(16, 18, 22, 0)); pointer-events: none;
}
.xp-bar > * { pointer-events: auto; }
.xp-logo img { display: block; width: clamp(164px, 17vw, 232px); height: auto; }
.xp-bar-actions { display: flex; align-items: center; gap: 10px; }
.xp-icon {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--line); background: var(--panel-soft); color: var(--text); cursor: pointer;
  transition: border-color .2s, background .2s;
}
.xp-icon:hover { border-color: var(--accent); }
.xp-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.xp-icon svg path:first-child { fill: currentColor; stroke: none; }
.xp-icon .xp-wave { display: none; }
.xp-icon[aria-pressed="true"] .xp-wave { display: inline; }
.xp-icon[aria-pressed="true"] .xp-x { display: none; }
.xp-icon[aria-pressed="true"] { border-color: var(--accent); color: var(--accent-hover); }

/* Site menu: native <details>, so it works without JS */
.xp-menu { position: relative; }
.xp-menu summary { list-style: none; }
.xp-menu summary::-webkit-details-marker { display: none; }
.xp-icon svg path.xp-line { fill: none; stroke: currentColor; }
.xp-menu[open] summary { border-color: var(--accent); color: var(--accent-hover); }
.xp-menu-list {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 210px; padding: 6px; display: flex; flex-direction: column;
  background: rgba(19, 22, 27, .96); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 20px 50px rgba(0, 0, 0, .45);
}
.xp-menu-list a {
  display: flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 4px;
  font-size: 15px; text-decoration: none; color: var(--text);
}
.xp-menu-list a:hover { background: rgba(179, 162, 212, .12); }
.xp-menu-list a[lang="de"] { font-size: 13px; color: var(--muted); min-height: 38px; }
.xp-menu-sep { height: 1px; margin: 6px 8px; background: var(--line); }

/* About & contact: shown when targeted (#about / #contact), JS or not */
.xp-about {
  display: none; position: fixed; z-index: 34; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 140px); overflow-y: auto; padding: 28px 30px 24px;
  background: rgba(19, 22, 27, .95); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
}
.xp-about:target, .xp-about:has(:target) { display: block; animation: xp-about-in .5s var(--ease) both; }
@keyframes xp-about-in { from { opacity: 0; transform: translate(-50%, calc(-50% + 16px)); } }
.xp-about h2 { font-size: clamp(28px, 3vw, 36px); line-height: 1.05; outline: none; }
.xp-about p:not(.xp-eyebrow) { color: #d4d8de; margin: 16px 0 0; }
.xp-about a:not(.xp-btn) { color: var(--accent-hover); }
.xp-about-close { margin-top: 22px; min-height: 44px; }

/* In-world details (the facts from the retired project pages).
   With WebGL the portal opens them (.is-open); without JS or WebGL, #<world> shows them via :target. */
.xp-world {
  display: none; position: fixed; z-index: 35; left: 50%; top: calc(50% - var(--foot) / 2); transform: translate(-50%, -50%);
  width: min(680px, calc(100vw - 32px)); max-height: calc(100vh - 150px - var(--foot)); overflow-y: auto; overscroll-behavior: contain;
  padding: 28px 30px 22px; background: #13161b; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55);
}
.xp-world.is-open, html:not(.js) .xp-world:target, .xp.no-gl .xp-world:target { display: block; animation: xp-details-in .45s var(--ease) both; }
@keyframes xp-details-in { from { opacity: 0; } }
/* Beside an open portal (desktop), dock left so the portal panel stays readable on the right. */
.xp.is-portal .xp-world.is-open { left: clamp(16px, 3vw, 40px); transform: translateY(-50%); width: min(620px, calc(100vw - min(400px, 36vw) - 3 * clamp(16px, 3vw, 40px))); }
.xp-world h2 { font-size: clamp(30px, 3.4vw, 42px); line-height: 1; outline: none; }
.xp-world .xp-eyebrow { margin-bottom: 10px; }
.xp-w-status { display: inline-block; margin: 12px 0 0; padding: 4px 10px; border-radius: 999px; font-size: 12px; letter-spacing: .05em; border: 1px solid var(--line); color: var(--muted); }
.xp-w-lede { font-size: 17px; color: var(--text); margin: 16px 0 0; }
.xp-world p, .xp-world li, .xp-world dd { color: #d4d8de; }
.xp-world p { margin: 14px 0 0; }
.xp-world figure { margin: 18px 0 4px; }
.xp-world figure img { display: block; width: 100%; height: auto; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); }
.xp-world figure.is-portrait img { width: auto; max-width: 100%; max-height: 360px; margin: 0 auto; }
.xp-world figcaption { margin-top: 8px; font-size: 12px; color: var(--muted); }
.xp-world ul { margin: 14px 0 0; padding-left: 1.1em; }
.xp-world li { margin: 4px 0; }
.xp-world dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--line); font-size: 14px; }
.xp-world dt { color: var(--muted); }
.xp-world dd { margin: 0; }
.xp-w-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 22px; }
.xp-w-close { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); font-size: 14px; text-decoration: none; }
.xp-w-close:hover { color: var(--text); }
.xp-w-note { font-size: 12px; color: var(--muted) !important; display: flex; align-items: center; gap: 10px; }
.xp-w-note img { border-radius: 50%; flex: none; }

/* No JS: the intro cannot be entered, so keep the world list usable under it. */
html:not(.js) .xp-intro-actions { display: none; }
html:not(.js) .xp.is-intro .xp-rail { opacity: 1; transform: translateX(-50%); pointer-events: auto; z-index: 31; }

/* Intro */
.xp-intro {
  position: fixed; z-index: 30; left: clamp(20px, 6vw, 96px); top: 50%; transform: translateY(-50%);
  max-width: 520px; transition: opacity .9s var(--ease), transform 1.1s var(--ease);
}
.xp-intro::before {
  content: ""; position: absolute; inset: -40vh -40vw -40vh -30vw; z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse at 30% 50%, rgba(16, 18, 22, .9), rgba(16, 18, 22, .55) 45%, rgba(16, 18, 22, 0) 70%);
}
.xp:not(.is-intro) .xp-intro { opacity: 0; transform: translate(-30px, -50%); pointer-events: none; visibility: hidden; transition: opacity .7s var(--ease), transform .9s var(--ease), visibility 0s .9s; }
.xp-eyebrow, .xp-p-eyebrow { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); margin: 0 0 14px; }
.xp-intro h1 { font-size: clamp(44px, 6.4vw, 84px); line-height: .98; }
.xp-lede { color: #d4d8de; font-size: clamp(16px, 1.4vw, 19px); margin: 22px 0 30px; max-width: 30em; }
.xp-small { color: var(--muted); font-size: 13px; margin: 22px 0 0; }
.xp-intro-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.xp-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px;
  padding: 0 24px; border-radius: 4px; border: 1px solid var(--line); font: 600 16px/1 Manrope, sans-serif;
  text-decoration: none; cursor: pointer; overflow: hidden; transition: background .2s, border-color .2s, transform .2s var(--ease);
}
.xp-btn:disabled { cursor: progress; }
.xp-btn-primary { background: var(--accent); border-color: var(--accent); color: #15121c; }
.xp-btn-primary:not(:disabled):hover { background: var(--accent-hover); transform: translateY(-1px); }
.xp-btn-quiet { background: var(--panel-soft); color: var(--text); }
.xp-btn-quiet:not(:disabled):hover { border-color: var(--accent); }
.xp-btn:disabled.xp-btn-quiet { opacity: .5; }
.xp-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(21, 18, 28, .2); }
.xp-progress i { display: block; height: 100%; width: 0; background: #15121c; transition: width .3s; }
.xp-btn:not(:disabled) .xp-progress { display: none; }

/* Hint + tooltip */
.xp-hint {
  position: fixed; z-index: 15; left: 50%; bottom: calc(96px + var(--foot) + var(--safe-b)); transform: translateX(-50%);
  margin: 0; padding: 8px 16px; border-radius: 999px; background: var(--panel-soft); border: 1px solid var(--line);
  color: var(--muted); font-size: 13px; white-space: nowrap; opacity: 0; transition: opacity .6s; pointer-events: none;
}
.xp.show-hint .xp-hint { opacity: 1; }
.xp-tip {
  position: absolute; z-index: 5; left: 0; top: 0; pointer-events: none; padding: 9px 14px 10px; border-radius: 6px;
  background: rgba(16, 18, 22, .9); border: 1px solid var(--line); opacity: 0; transform: translate(-50%, -100%);
  transition: opacity .18s; white-space: nowrap;
}
.xp-tip.is-on { opacity: 1; }
.xp-tip strong { display: block; font: 600 17px/1.2 'Space Grotesk', sans-serif; }
.xp-tip span { font-size: 12px; color: var(--accent-hover); letter-spacing: .04em; }

/* World rail */
.xp-rail {
  position: fixed; z-index: 15; left: 50%; bottom: calc(10px + var(--foot) + var(--safe-b)); transform: translateX(-50%);
  max-width: calc(100vw - 24px); transition: opacity .6s var(--ease), transform .6s var(--ease);
}
.xp.is-intro .xp-rail { opacity: 0; transform: translate(-50%, 20px); pointer-events: none; }
.xp-rail ul {
  list-style: none; margin: 0; padding: 6px; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
  background: var(--panel-soft); border: 1px solid var(--line); border-radius: 10px; scroll-snap-type: x proximity;
}
.xp-rail ul::-webkit-scrollbar { display: none; }
.xp-rail a {
  display: flex; flex-direction: column; justify-content: center; min-height: 48px; padding: 6px 14px; border-radius: 6px;
  text-decoration: none; font: 600 14px/1.2 'Space Grotesk', sans-serif; white-space: nowrap; scroll-snap-align: center;
  border: 1px solid transparent; transition: background .2s, border-color .2s;
}
.xp-rail small { font: 500 11px/1.3 Manrope, sans-serif; color: var(--muted); letter-spacing: .03em; }
.xp-rail a:hover, .xp-rail a.is-hot { background: rgba(179, 162, 212, .12); }
.xp-rail a[aria-current="true"] { border-color: var(--accent); background: rgba(179, 162, 212, .16); }
/* With a world open, the list steps back so the art and the panel lead; it returns on hover or focus. */
.xp.is-portal .xp-rail { opacity: .5; }
.xp.is-portal .xp-rail:hover, .xp.is-portal .xp-rail:focus-within { opacity: 1; }

/* Portal panel */
.xp-portal {
  position: fixed; z-index: 25; top: 50%; right: clamp(16px, 3vw, 40px); width: min(400px, 36vw);
  transform: translateY(-50%); padding: 26px 28px 22px; border-radius: 10px;
  background: rgba(19, 22, 27, .9); border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
  animation: xp-panel-in .7s var(--ease) both;
}
.xp-portal[hidden] { display: none; }
@keyframes xp-panel-in { from { opacity: 0; transform: translate(24px, -50%); } }
.xp-back { background: none; border: 0; color: var(--muted); font: 500 14px Manrope, sans-serif; padding: 8px 0; margin: -8px 0 14px; cursor: pointer; }
.xp-back:hover { color: var(--text); }
.xp-portal h2 { font-size: clamp(32px, 3.2vw, 44px); line-height: 1; outline: none; }
.xp-p-status { display: inline-block; margin: 14px 0 0; padding: 4px 10px; border-radius: 999px; font-size: 12px; letter-spacing: .05em; border: 1px solid var(--line); color: var(--muted); }
.xp-p-status[data-live="true"] { border-color: rgba(179, 162, 212, .6); color: var(--accent-hover); }
.xp-p-desc { color: #d4d8de; margin: 16px 0 22px; }
.xp-p-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.xp-p-actions .xp-btn { min-width: 170px; }
.xp-p-more { color: var(--muted); font-size: 14px; text-decoration: none; padding: 10px 0; }
.xp-p-more:hover { color: var(--text); }
.xp-p-toy { margin: 20px 0 0; font-size: 13px; color: var(--accent-hover); min-height: 1em; }
.xp-p-toy:empty { display: none; }
.xp-p-nav { display: flex; align-items: center; justify-content: space-between; margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.xp-icon-btn { width: 44px; height: 40px; border-radius: 4px; border: 1px solid var(--line); background: transparent; color: var(--text); font-size: 22px; line-height: 1; cursor: pointer; }
.xp-icon-btn:hover { border-color: var(--accent); }

.xp-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.xp-noscript { position: fixed; inset: calc(76px + env(safe-area-inset-top, 0px)) 16px auto; z-index: 21; font-size: 14px; padding: 16px; background: var(--panel); border-radius: 6px; }

/* Legal links: one tap away in every state, above the intro scrim and portal sheet */
.xp-foot {
  position: fixed; z-index: 32; left: 0; right: 0; bottom: 0; display: flex; justify-content: center;
  padding: 0 16px var(--safe-b); pointer-events: none;
  background: linear-gradient(rgba(16, 18, 22, 0), rgba(16, 18, 22, .72));
}
.xp-foot nav { display: flex; gap: 4px; pointer-events: auto; }
.xp-foot a {
  display: inline-flex; align-items: center; min-height: var(--foot); padding: 0 10px; border-radius: 4px;
  color: var(--muted); font-size: 12px; letter-spacing: .02em; text-decoration: none;
}
.xp-foot a:hover { color: var(--text); text-decoration: underline; }

/* No WebGL: still a usable, honest page */
.xp.no-gl .xp-hint, .xp.no-gl #xp-enter-quiet { display: none; }

/* Phone / portrait: bottom sheet */
@media (max-width: 760px) {
  .xp-intro { left: 20px; right: 20px; top: auto; bottom: calc(12px + var(--foot) + var(--safe-b)); transform: none; max-width: none; }
  .xp:not(.is-intro) .xp-intro { transform: translateY(30px); }
  .xp-intro::before { inset: -30vh -20px -40px; background: linear-gradient(rgba(16, 18, 22, 0), rgba(16, 18, 22, .88) 40%); }
  .xp-intro h1 { font-size: clamp(40px, 12vw, 56px); }
  .xp-lede { margin: 14px 0 20px; font-size: 16px; }
  .xp-intro-actions .xp-btn { flex: 1 1 100%; }
  .xp-hint { bottom: calc(80px + var(--foot) + var(--safe-b)); font-size: 12px; }
  .xp-portal {
    top: auto; bottom: 0; left: 0; right: 0; width: auto; transform: none; border-radius: 16px 16px 0 0;
    padding: 18px 20px calc(12px + var(--foot) + var(--safe-b)); max-height: 52vh; overflow-y: auto;
    animation-name: xp-sheet-in;
  }
  @keyframes xp-sheet-in { from { opacity: 0; transform: translateY(40px); } }
  .xp-portal h2 { font-size: 32px; }
  .xp-p-desc { margin: 12px 0 16px; font-size: 15px; }
  .xp-p-toy { margin-top: 12px; }
  .xp-p-nav { margin-top: 12px; padding-top: 10px; }
  .xp.is-portal .xp-rail { opacity: 0; pointer-events: none; }
  .xp-world {
    left: 0; right: 0; top: auto; bottom: calc(var(--foot) + var(--safe-b)); transform: none; width: auto;
    max-height: calc(86vh - var(--foot)); padding: 20px 20px 18px; border-radius: 16px 16px 0 0;
  }
  .xp.is-portal .xp-world.is-open { left: 0; transform: none; width: auto;
  }
  .xp-world figure.is-portrait img { max-height: 280px; }
  html:not(.js) .xp-intro { bottom: calc(84px + var(--foot) + var(--safe-b)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .15s !important; }
}

/* ?debug only: why the 3D view did not start */
.xp-debug { margin: 10px 0 0; font-size: .78rem; color: var(--silver, #AAB1BA); max-width: 36ch; }

