/* BEYONDV Portal - Grundlagen: Reset, Schrift, Hintergrund, Fokus, Hilfsklassen. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
:root[data-motion='off'] html { scroll-behavior: auto; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  /* ruhiger Farbschleier wie im Launcher: oben links ein Hauch Akzent, unten rechts warm */
  background:
    radial-gradient(70vmax 50vmax at 8% -10%, rgba(var(--a-rgb), 0.07), transparent 60%),
    radial-gradient(60vmax 45vmax at 105% 105%, rgba(242, 168, 60, 0.05), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: 0.01em;
  font-feature-settings: 'tnum' 0;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg, canvas, video { display: block; max-width: 100%; }
img { image-rendering: auto; }
.pixel, img.pixel { image-rendering: pixelated; image-rendering: crisp-edges; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--accent-bright); text-decoration: none; }
a:hover { color: var(--text); }
p { margin: 0 0 var(--s3); }
h1, h2, h3, h4 { margin: 0; font-weight: 500; line-height: 1.15; }
ul, ol { margin: 0; padding: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s5) 0; }
::selection { background: var(--accent-a40); color: var(--text); }
[hidden] { display: none !important; }

/* Fokus: nie unsichtbar. BeyondV-Eckklammern kommen pro Baustein dazu, hier die Grundlinie. */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }
:focus:not(:focus-visible) { outline: none; }

/* Scrollleisten duenn wie UiScrollArea */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--line-hover); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------------------- Hintergrund */
#globe {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: var(--z-globe);
  pointer-events: none;
  transition: opacity 900ms var(--ease);
}
body.globe-dim #globe { opacity: 0.38; }
/* Die Erde gibt es nur noch auf der Geschichte - sonst ist sie aus (Shell setzt den Modus) */
body.globe-off #globe { opacity: 0; }

/* Koernung und Vignette wie im Menue der Mod (UiDraw.grain / vignette) */
.bg-grain {
  position: fixed; inset: 0; pointer-events: none; z-index: var(--z-globe);
  background-image: url('/res/zsurvival/textures/gui/ui/grain.png');
  background-size: 128px 128px;
  opacity: 0.035;
  mix-blend-mode: overlay;
}
.bg-vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: var(--z-globe);
  background:
    radial-gradient(ellipse 90% 80% at 50% 40%, transparent 0%, rgba(8, 9, 10, 0.25) 70%, rgba(8, 9, 10, 0.7) 100%);
}
/* Lichtschein, der dem Mauszeiger folgt (sehr dezent) */
.bg-cursor {
  position: fixed; left: 0; top: 0; width: 640px; height: 640px; margin: -320px 0 0 -320px;
  pointer-events: none; z-index: var(--z-globe);
  background: radial-gradient(circle, rgba(255, 255, 255, 0.035) 0%, transparent 62%);
  transform: translate3d(var(--cx, -999px), var(--cy, -999px), 0);
  transition: opacity 600ms var(--ease);
}
:root[data-motion='off'] .bg-cursor { display: none; }
@media (hover: none) { .bg-cursor { display: none; } }

/* ---------------------------------------------------------------- Typografie */
.caps { text-transform: uppercase; letter-spacing: var(--track-caps); }
.kicker {
  display: inline-flex; align-items: center; gap: var(--s2);
  font-size: 12px; text-transform: uppercase; letter-spacing: var(--track-wide);
  color: var(--text-dim);
}
.kicker::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px rgba(var(--a-rgb), 0.6); }
.num { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; }
.dim { color: var(--text-dim); }
.muted { color: var(--text-muted); }
.accent { color: var(--accent); }
.good { color: var(--good); }
.warn { color: var(--warn); }
.bad { color: var(--danger-text); }
.small { font-size: 14px; }
.tiny { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 0.92em; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
/* "Zum Inhalt springen": erscheint, sobald man mit der Tab-Taste darauf kommt */
a.sr-only:focus, a.sr-only:focus-visible {
  position: fixed !important; left: var(--s4); top: var(--s3); z-index: 1000;
  width: auto; height: auto; margin: 0; padding: 10px 16px; clip: auto; overflow: visible;
  background: var(--panel-a-strong); color: var(--text); border: 1px solid var(--accent); outline: none; border-radius: var(--r-sm);
}
/* Windows-Kontrastdesign: Rahmen und Fokus bleiben sichtbar */
@media (forced-colors: active) {
  .btn, .card, .fs-step, .nav-item.active { border: 1px solid CanvasText; }
  :focus-visible { outline: 2px solid Highlight; }
}

/* ---------------------------------------------------------------- Layout-Helfer */
.row { display: flex; align-items: center; gap: var(--s3); }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.row.top { align-items: flex-start; }
.col { display: flex; flex-direction: column; gap: var(--s3); }
.grow { flex: 1 1 auto; min-width: 0; }
.stack > * + * { margin-top: var(--s4); }
.grid { display: grid; gap: var(--s4); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.gauto { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); } }

/* Einblenden beim ersten Zeichnen (Motion uebernimmt, das hier ist der CSS-Rueckfall) */
@keyframes bv-fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes bv-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes bv-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.45; transform: scale(0.82); } }
@keyframes bv-ring { from { transform: scale(0.6); opacity: 0.8; } to { transform: scale(2.4); opacity: 0; } }
@keyframes bv-spin { to { transform: rotate(360deg); } }
@keyframes bv-shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@keyframes bv-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes bv-sweep { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.fade-up { animation: bv-fade-up var(--slow) var(--ease) both; }
:root[data-motion='off'] .fade-up { animation: none; }
@media (prefers-reduced-motion: reduce) { .fade-up { animation: none; } }

/* Elemente mit [data-reveal] blendet app/lib/motion.js#reveal gestaffelt ein. Ohne JavaScript
   (keine Klasse .js) oder bei "Effekte aus" bleiben sie sichtbar. */
.js [data-reveal]:not([data-revealed]) { opacity: 0; }
:root[data-motion='off'] [data-reveal] { opacity: 1 !important; }

/* Ladebild in index.html (#app .boot), bis Preact die Seite zeichnet - erst nach 250 ms sichtbar */
.boot {
  position: fixed; inset: 0; z-index: 2;
  display: grid; place-content: center; justify-items: center; gap: 14px;
  font-size: 12px; letter-spacing: var(--track-wide); text-transform: uppercase; color: var(--text-dim);
  animation: bv-fade 600ms 250ms both;
}
.boot img { filter: drop-shadow(0 0 16px rgba(var(--a-rgb), 0.45)); animation: bv-pulse 1.6s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .boot img { animation: none; } }
