/* behindx — global ui layer (homepage)
   constraints: palette-only, gabarito, rounded geometry, subtle motion */

/* reset */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
}

:root {
  /* palette (strict) */
  --bx-mint: #00dba8;
  --bx-blue: #77e3e5;
  --bx-yellow: #dbd200;
  --bx-red: #db3700; /* sparing emphasis only */

  --bx-text-black: #000000;
  --bx-text-white: #ffffff;
  --bx-text-gray: #323333;

  --bx-bg-white: #ffffff;
  --bx-bg-green: #2e5c37;
  --bx-bg-red: #86432d;

  /* type */
  --bx-font: "Gabarito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bx-font-weight: 700;
  --bx-font-weight-strong: 800;

  /* spacing + shape */
  --bx-radius-sm: 12px;
  --bx-radius-md: 18px;
  --bx-radius-lg: 28px;
  --bx-radius-pill: 999px;

  /* motion */
  --bx-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --bx-dur-1: 140ms;
  --bx-dur-2: 220ms;
  --bx-dur-3: 420ms;

  /* surfaces */
  --bx-page-bg: var(--bx-bg-green);
  --bx-page-fg: var(--bx-text-white);
  --bx-surface: rgba(255, 255, 255, 0.06);
  --bx-surface-strong: rgba(255, 255, 255, 0.12);
  --bx-stroke: rgba(255, 255, 255, 0.18);
  --bx-stroke-strong: rgba(0, 219, 168, 0.6);
  --bx-shadow: 0 18px 38px rgba(0, 0, 0, 0.35);

  /* Content frame aspect ratio (overridden by render variant). */
  --bx-frame-aspect: 16 / 9;
}

body {
  font-family: var(--bx-font);
  font-weight: var(--bx-font-weight);
  background: var(--bx-page-bg);
  color: var(--bx-page-fg);
  line-height: 1.55;
  overflow-x: hidden;
  overflow-y: hidden;
  text-transform: lowercase;
}

/* Variant markers (set by JS ContentLoader). */
body.bx-variant-mobile {
  --bx-frame-aspect: 9 / 16;
}

body.bx-variant-desktop {
  --bx-frame-aspect: 16 / 9;
}

/* keep user-entered data readable */
input,
textarea,
select,
option {
  text-transform: none;
  font-family: inherit;
  font-weight: inherit;
}

/* subtle vignette + abstract geometry (no blur, no sharp edges) */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: -20vh -20vw;
  pointer-events: none;
  z-index: -1;
  opacity: 0.9;
}

body::before {
  /* large soft blocks (solid fills only) */
  background:
    radial-gradient(circle at 20% 15%, rgba(0, 219, 168, 0.18) 0 22%, transparent 23%),
    radial-gradient(circle at 80% 25%, rgba(119, 227, 229, 0.14) 0 18%, transparent 19%),
    radial-gradient(circle at 70% 80%, rgba(219, 210, 0, 0.12) 0 16%, transparent 17%),
    radial-gradient(circle at 15% 85%, rgba(255, 255, 255, 0.06) 0 20%, transparent 21%);
  animation: bx-bg-drift-1 22s linear infinite;
}

body::after {
  /* vignette via inset shadow (black only) */
  background: transparent;
  box-shadow: inset 0 0 140px rgba(0, 0, 0, 0.45);
}

@media (prefers-reduced-motion: reduce) {
  body::before {
    animation: none;
  }
}

@keyframes bx-bg-drift-1 {
  0% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(2vw, -1.5vh, 0);
  }
  100% {
    transform: translate3d(0, 0, 0);
  }
}

/* focus */
:focus-visible {
  outline: 2px solid var(--bx-mint);
  outline-offset: 3px;
}

/* links */
a {
  color: inherit;
  text-decoration-color: rgba(0, 219, 168, 0.8);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 2px;
  transition: text-decoration-color var(--bx-dur-2) var(--bx-ease);
}

a:hover {
  text-decoration-color: var(--bx-mint);
}

em,
i {
  font-style: normal;
  text-decoration: underline;
  text-decoration-color: rgba(0, 219, 168, 0.95);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.18em;
}

/* layout */
.page-container {
  width: 100%;
  height: 100dvh;
  min-height: 100vh;
  margin: 0;
  padding: clamp(0.75rem, 2vw, 1.25rem);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow: hidden;
  min-height: 0;
}

.top-nav {
  flex: 0 0 auto;
}

.nav-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding: 0.65rem 0.9rem;
  border-radius: var(--bx-radius-pill);
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--bx-stroke);
  box-shadow: var(--bx-shadow);
  gap: 1rem;
}

.nav-left {
  min-width: 0;
}

.content-links {
  list-style: none;
  display: flex;
  gap: 0.55rem;
  padding: 0;
  margin: 0;
  overflow: hidden;
}

.content-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.8rem;
  border-radius: var(--bx-radius-pill);
  font-size: 0.9rem;
  font-weight: var(--bx-font-weight-strong);
  text-decoration: none;
  color: rgba(255, 255, 255, 0.86);
  transition:
    transform var(--bx-dur-2) var(--bx-ease),
    background-color var(--bx-dur-2) var(--bx-ease),
    color var(--bx-dur-2) var(--bx-ease),
    box-shadow var(--bx-dur-2) var(--bx-ease);
}

.content-link:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.08);
  color: var(--bx-text-white);
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.25);
}

/* language panel */
.language-panel-header {
  font-size: 0.85rem;
  opacity: 0.85;
  margin-bottom: 0.65rem;
}

.language-panel-body {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.language-panel-tools {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.a11y-tool {
  width: 38px;
  height: 38px;
  border-radius: var(--bx-radius-pill);
  border: 1px solid var(--bx-stroke);
  background: rgba(0, 0, 0, 0.22);
  color: rgba(255, 255, 255, 0.9);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    transform var(--bx-dur-2) var(--bx-ease),
    background-color var(--bx-dur-2) var(--bx-ease),
    border-color var(--bx-dur-2) var(--bx-ease);
}

.a11y-tool:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.08);
}

.a11y-tool.is-active {
  border-color: var(--bx-stroke-strong);
  background: rgba(0, 219, 168, 0.16);
}

.a11y-tool svg {
  width: 18px;
  height: 18px;
}

.language-button {
  border: 1px solid var(--bx-stroke);
  background: rgba(0, 0, 0, 0.22);
  color: rgba(255, 255, 255, 0.9);
  border-radius: var(--bx-radius-pill);
  padding: 0.35rem 0.7rem;
  cursor: pointer;
  transition:
    transform var(--bx-dur-2) var(--bx-ease),
    background-color var(--bx-dur-2) var(--bx-ease),
    border-color var(--bx-dur-2) var(--bx-ease);
}

.language-button:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.08);
}

.language-button.is-active {
  border-color: var(--bx-stroke-strong);
  background: rgba(0, 219, 168, 0.16);
}

.language-panel-empty {
  opacity: 0.75;
}

.content-link.active {
  background: var(--bx-mint);
  color: var(--bx-text-black);
  box-shadow: 0 14px 24px rgba(0, 0, 0, 0.28);
}

.nav-right {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
}

.logo {
  height: 44px;
  width: auto;
  display: block;
  border-radius: var(--bx-radius-sm);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.main-layout {
  flex: 1 1 auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 0;
}

.shell-grid {
  width: 100%;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
  animation: bx-enter var(--bx-dur-3) var(--bx-ease) both;
  min-height: 0;
  height: 100%;
}

.side-rail {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  margin-inline: 1.35rem;
}

.side-panel {
  border-radius: var(--bx-radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--bx-shadow);
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
}

.side-panel::before {
  content: "";
  position: absolute;
  inset: -25%;
  border-radius: 40%;
  background: rgba(0, 219, 168, 0.12);
  transform: rotate(14deg);
  animation: bx-bg-drift-2 26s linear infinite;
  pointer-events: none;
}

.side-panel::after {
  content: "";
  position: absolute;
  inset: 10% 12%;
  border-radius: 24px;
  background: rgba(119, 227, 229, 0.1);
  clip-path: polygon(8% 20%, 78% 6%, 96% 48%, 62% 92%, 14% 78%);
  opacity: 0.9;
  pointer-events: none;
}

.side-panel > * {
  position: relative;
  z-index: 1;
}

.side-panel-top {
  flex: 1 1 auto;
  min-height: clamp(92px, 18vh, 220px);
  padding: 1rem 1.1rem;
}

.side-panel-bottom {
  flex: 0 0 auto;
  min-height: clamp(80px, 14vh, 180px);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 0.65rem;
  padding: 1rem 1.1rem;
}

.side-impressum {
  align-self: center;
  margin-top: 0;
  padding: 0.55rem 1.25rem;
  border-radius: var(--bx-radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.18);
  color: rgba(255, 255, 255, 0.9);
  font-weight: var(--bx-font-weight-strong);
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition:
    transform var(--bx-dur-2) var(--bx-ease),
    background-color var(--bx-dur-2) var(--bx-ease),
    border-color var(--bx-dur-2) var(--bx-ease);
}

.side-impressum:hover {
  transform: translateY(-1px);
  border-color: rgba(0, 219, 168, 0.7);
  background: rgba(0, 219, 168, 0.14);
}

@media (prefers-reduced-motion: reduce) {
  .shell-grid,
  .side-panel::before {
    animation: none;
  }
}

@keyframes bx-bg-drift-2 {
  0% {
    transform: translate3d(0, 0, 0) rotate(14deg);
  }
  50% {
    transform: translate3d(-2vw, 1.25vh, 0) rotate(14deg);
  }
  100% {
    transform: translate3d(0, 0, 0) rotate(14deg);
  }
}

@keyframes bx-enter {
  from {
    opacity: 0;
    transform: translateY(-14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .page-container {
    padding-inline: 0.9rem;
  }

  .shell-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .side-rail {
    margin-inline: 0;
    order: 2;
    flex-direction: row;
    align-items: stretch;
  }

  .side-panel-top,
  .side-panel-bottom {
    min-height: 110px;
    flex: 1;
  }
}

/* True mobile layout: content frame stays the hero (16:9), navbar floats over it,
   tools + impressum sit below, and the page can scroll. */
@media (max-width: 900px) {
  body {
    overflow-y: auto;
    overflow-x: hidden;
  }

  .page-container {
    height: auto;
    min-height: 100dvh;
    padding: 0.75rem;
    gap: 0.75rem;
  }

  /* Float the top navbar over the hero content (no layout compression). */
  .top-nav {
    position: fixed;
    top: 0.6rem;
    left: 0.6rem;
    right: 0.6rem;
    z-index: 30;
    pointer-events: none;
  }

  .nav-bar {
    pointer-events: auto;
    padding: 0.3rem 0.5rem;
    border-radius: var(--bx-radius-pill);
  }

  /* Stack content first, then tools area */
  .shell-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    height: auto;
    min-height: 0;
    animation: none;
  }

  .content-shell {
    order: 1;
    min-height: 0;
    height: auto;
    padding-top: 2.2rem; /* space so nav overlay doesn't cover taps */
  }

  .side-rail {
    order: 2;
    margin-inline: 0;
    gap: 0.75rem;
    position: static;
    padding-bottom: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .side-panel-bottom {
    display: flex;
    min-height: unset;
    padding: 0.85rem 0.95rem;
  }

  .side-panel-top {
    min-height: unset;
    padding: 0.9rem 0.95rem;
  }

  .side-impressum {
    display: inline-flex;
    align-self: stretch;
    justify-content: center;
  }

  /* Variant-specific mobile chrome:
     - Navbar sits on top (already fixed above)
     - Tools live inside navbar (toggle)
     - Content frame is not scrollable; gestures navigate */
  body.bx-variant-mobile {
    overflow-y: hidden;
  }

  body.bx-variant-mobile .page-container {
    height: 100dvh;
    min-height: 100dvh;
  }

  body.bx-variant-mobile .content-shell {
    /* keep taps clear of fixed navbar + toolbar */
    padding-top: 3.2rem;
    padding-bottom: 0.75rem;
  }

  /* Hide the old side-rail container on mobile; its panels are moved into the navbar host by JS. */
  body.bx-variant-mobile .side-rail {
    display: none;
  }
}

/* Legal page */
body.bx-legal {
  overflow-y: auto;
  overflow-x: hidden;
}

/* Mobile navbar sizing + truncation */
@media (max-width: 900px) {
  body.bx-variant-mobile .content-links {
    gap: 0.35rem;
  }

  body.bx-variant-mobile .content-link {
    font-size: 0.72rem;
    padding: 0.26rem 0.5rem;
    max-width: 10.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  body.bx-variant-mobile .logo {
    height: 26px;
    box-shadow: none;
  }

  body.bx-variant-mobile .nav-tools-toggle {
    width: 32px;
    height: 32px;
    border-radius: var(--bx-radius-pill);
    border: 1px solid var(--bx-stroke);
    background: rgba(0, 0, 0, 0.22);
    color: rgba(255, 255, 255, 0.92);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-right: 0.35rem;
  }

  body.bx-variant-mobile .nav-tools-toggle:focus-visible,
  body.bx-variant-mobile .nav-tools-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
  }

  /* Hide links that JS marked as overflow for mobile. */
  body.bx-variant-mobile .content-link.bx-nav-hidden {
    display: none;
  }

  /* Mobile tools dropdown (inside fixed header). */
  body.bx-variant-mobile .mobile-tools-host {
    margin-top: 0.45rem;
    padding: 0.75rem 0.8rem;
    border-radius: var(--bx-radius-lg);
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: var(--bx-shadow);
    pointer-events: auto;
  }

  body.bx-variant-mobile .mobile-tools-host[hidden] {
    display: none;
  }
}

/* Accessibility: high contrast + reduced motion */
body.bx-high-contrast {
  --bx-page-bg: #ffffff;
  --bx-page-fg: #000000;
  --bx-surface: rgba(0, 0, 0, 0.04);
  --bx-surface-strong: rgba(0, 0, 0, 0.08);
  --bx-stroke: rgba(0, 0, 0, 0.6);
  --bx-stroke-strong: rgba(0, 0, 0, 0.9);
  --bx-shadow: none;
  background: #ffffff;
  color: #000000;
}

body.bx-high-contrast::before,
body.bx-high-contrast::after {
  display: none;
}

body.bx-high-contrast .nav-bar,
body.bx-high-contrast .side-panel,
body.bx-high-contrast .content-frame {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.9);
  box-shadow: none;
}

body.bx-high-contrast .content-link,
body.bx-high-contrast .language-button,
body.bx-high-contrast .a11y-tool {
  background: #ffffff;
  color: #000000;
  border-color: rgba(0, 0, 0, 0.9);
}

body.bx-high-contrast .content-link.active {
  background: #000000;
  color: #ffffff;
}

body.bx-reduce-motion *,
body.bx-reduce-motion *::before,
body.bx-reduce-motion *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

/* (Removed) rotate-screen gate: mobile is now fully responsive. */

/* Splash / staged loading */
.bx-splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000000;
  display: grid;
  place-items: center;
}

.bx-splash-layer {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.bx-splash-gif {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bx-splash-loading-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Mobile: rotate only the loading screens (main_loading/end_loading) by 90deg so they
   present as portrait (9:16) without needing new assets. */
body.bx-variant-mobile .bx-splash-layer--loading .bx-splash-loading-video,
body.bx-variant-mobile .bx-splash-layer--loading .bx-splash-preload {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100vh;
  height: 100vw;
  transform: translate(-50%, -50%) rotate(90deg);
  transform-origin: center center;
}

.bx-splash-video-wrap {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  transform-origin: top left;
  will-change: transform, filter, opacity;
  backface-visibility: hidden;
  transform: translateZ(0);
}

.bx-splash-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  will-change: transform, filter, opacity;
  backface-visibility: hidden;
  transform: translateZ(0);
}

body.bx-splash-active .page-container {
  opacity: 0;
  pointer-events: none;
}

body.bx-splash-revealing .page-container {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 420ms var(--bx-ease);
}

/* While the cover video shrinks into the content frame, reveal the page behind it,
   but keep it non-interactive until the splash is removed. */
body.bx-splash-revealing .page-container {
  pointer-events: none;
}

body.bx-splash-revealing .bx-splash {
  background: transparent;
}


