/* RS Labs – publik startsida. Mörkt rymdlabb, allt i 3D ritas i main.js. */
:root {
  --bg: #03040a;
  --fg: #eef6ff;
  --cyan: #4ff2ff;
  --violet: #8b5cff;
  --dim: rgba(238, 246, 255, .72);
  --line: rgba(79, 242, 255, .35);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%;
  background: var(--bg); color: var(--fg);
  overflow: hidden;
  font-family: "Syncopate", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  user-select: none; -webkit-user-select: none;
}
body { background: radial-gradient(120% 80% at 50% 60%, #0b0e24 0%, var(--bg) 60%); }

#gl {
  position: fixed; inset: 0; width: 100%; height: 100%;
  display: block; cursor: crosshair;
}
.noise {
  position: fixed; inset: -50%; pointer-events: none; z-index: 2;
  opacity: .035; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.hero {
  position: fixed; inset: 0; z-index: 3;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  pointer-events: none; text-align: center;
  padding: 0 16px;
  padding-top: env(safe-area-inset-top);
}
.hero::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 70vmin; height: 40vmin; z-index: -1;
  transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(3, 4, 10, .55), rgba(3, 4, 10, 0));
}
@media (max-width: 600px), (pointer: coarse) and (orientation: portrait) {
  .hero { justify-content: flex-start; padding-top: calc(env(safe-area-inset-top) + 18vh); }
  .hero::before { top: 50%; width: 100vw; height: 46vmin; }
}
.title {
  margin: 0;
  font-weight: 700;
  font-size: clamp(2.6rem, 11vw, 9rem);
  line-height: .95;
  letter-spacing: .18em;
  text-indent: .18em;
  display: flex; flex-direction: column; align-items: center; gap: .05em;
  color: #fff;
  text-shadow:
    0 0 .04em rgba(255,255,255,.9),
    0 0 .35em rgba(79, 242, 255, .55),
    0 0 1.2em rgba(139, 92, 255, .45);
}
.title .w { display: block; white-space: nowrap; }
.title .w span {
  display: inline-block;
  opacity: 0; transform: translateY(.35em) scale(.9); filter: blur(12px);
  animation: in 1.4s cubic-bezier(.16, 1, .3, 1) forwards;
}
.title .w:first-child span { font-size: .72em; vertical-align: .14em; color: var(--cyan); text-shadow: 0 0 .5em rgba(79,242,255,.9), 0 0 1.5em rgba(79,242,255,.5); }
.title .w:nth-child(1) span:nth-child(1) { animation-delay: .25s; }
.title .w:nth-child(1) span:nth-child(2) { animation-delay: .33s; }
.title .w:nth-child(2) span:nth-child(1) { animation-delay: .55s; }
.title .w:nth-child(2) span:nth-child(2) { animation-delay: .63s; }
.title .w:nth-child(2) span:nth-child(3) { animation-delay: .71s; }
.title .w:nth-child(2) span:nth-child(4) { animation-delay: .79s; }
@keyframes in { to { opacity: 1; transform: none; filter: blur(0); } }

.tag {
  margin: clamp(1.2rem, 3vh, 2.2rem) 0 0;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: clamp(.64rem, 1.4vw, .85rem);
  letter-spacing: .32em; text-indent: .32em; text-transform: uppercase;
  color: var(--dim);
  opacity: 0; animation: fade 1.6s ease 1.4s forwards;
}
.tag .dot {
  display: inline-block; width: .45em; height: .45em; border-radius: 50%;
  margin-right: 1em; vertical-align: .08em;
  background: var(--cyan);
  box-shadow: 0 0 .6em var(--cyan), 0 0 1.4em var(--cyan);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes fade { to { opacity: 1; } }
@keyframes pulse { 0%, 100% { opacity: .55; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.1); } }

.foot {
  position: fixed; inset: 0; z-index: 3; pointer-events: none;
  opacity: 0; animation: fade 2s ease 1.8s forwards;
}
.corner { position: absolute; width: 22px; height: 22px; border: 1px solid var(--line); }
.tl { top: max(18px, env(safe-area-inset-top)); left: 18px; border-right: 0; border-bottom: 0; }
.tr { top: max(18px, env(safe-area-inset-top)); right: 18px; border-left: 0; border-bottom: 0; }
.bl { bottom: max(18px, env(safe-area-inset-bottom)); left: 18px; border-right: 0; border-top: 0; }
.br { bottom: max(18px, env(safe-area-inset-bottom)); right: 18px; border-left: 0; border-top: 0; }
.copy {
  position: absolute; left: 0; right: 0; bottom: max(22px, calc(env(safe-area-inset-bottom) + 10px));
  text-align: center;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: .6rem; letter-spacing: .25em; text-indent: .25em;
  color: rgba(238, 246, 255, .3);
}
.nojs { position: fixed; inset: 0; display: grid; place-items: center; margin: 0; font-size: 3rem; letter-spacing: .2em; }

/* Utan WebGL: lugn gradient bakom texten i stället för 3D. */
html.nogl body { background: radial-gradient(60% 50% at 50% 50%, #1a1540 0%, #0a0c22 45%, var(--bg) 100%); }

@media (prefers-reduced-motion: reduce) {
  .title .w span, .tag, .foot { animation-duration: .01s; animation-delay: 0s; }
  .tag .dot { animation: none; opacity: 1; }
}

/* Gå in i labbet + ljud av/på */
.enter {
  pointer-events: auto; cursor: pointer;
  margin-top: clamp(1.6rem, 4vh, 2.8rem);
  padding: .9em 2.2em .8em;
  font: inherit; font-weight: 700; font-size: clamp(.6rem, 1.3vw, .78rem);
  letter-spacing: .3em; text-indent: .3em; text-transform: uppercase;
  color: var(--fg); background: rgba(79, 242, 255, .06);
  border: 1px solid var(--line); border-radius: 999px;
  box-shadow: 0 0 1.2em rgba(79, 242, 255, .18), inset 0 0 1.2em rgba(79, 242, 255, .06);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: background .3s, box-shadow .3s, transform .3s, opacity .6s;
  opacity: 0; animation: fade 1.2s ease 1.9s forwards;
}
.enter small {
  display: block; margin-top: .55em;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-weight: 400;
  font-size: .78em; letter-spacing: .18em; text-indent: .18em; text-transform: none; color: var(--dim);
}
.enter:hover, .enter:focus-visible { background: rgba(79, 242, 255, .14); box-shadow: 0 0 2em rgba(79, 242, 255, .35), inset 0 0 1.2em rgba(79, 242, 255, .1); transform: translateY(-1px); outline: none; }
body.entered .enter { opacity: 0; pointer-events: none; transform: scale(.9); animation: none; }

.sound {
  position: fixed; z-index: 4; cursor: pointer;
  right: 18px; bottom: max(18px, env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: .6em;
  padding: .55em .9em; margin: 0;
  font: inherit; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .6rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--dim); background: rgba(3, 4, 10, .45); border: 1px solid var(--line); border-radius: 999px;
  opacity: 0; pointer-events: none; transition: opacity .6s, color .3s, border-color .3s;
}
body.entered .sound { opacity: 1; pointer-events: auto; }
.sound svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.sound .spk { fill: currentColor; stroke: none; }
.sound .x { display: none; }
.sound[aria-pressed="false"] .w1, .sound[aria-pressed="false"] .w2 { display: none; }
.sound[aria-pressed="false"] .x { display: block; }
.sound[aria-pressed="true"] { color: var(--cyan); border-color: rgba(79, 242, 255, .6); }
.sound:hover, .sound:focus-visible { color: var(--fg); outline: none; }
.corner.br { display: none; }
@media (prefers-reduced-motion: reduce) { .enter { animation-duration: .01s; animation-delay: 0s; } }
