/*
 * Druckpunkt – ein Button-System für Website und Lern-App (Überarbeitung 10.11.2026).
 * Werte aus shared/design/tokens.ts (cssVariables); tests/unit/druckpunkt-tokens.test.ts prüft, dass sie übereinstimmen.
 *
 * Physischer Spielbutton: Oberseite (::before) mit Unterkante (Schatten ohne Unschärfe). Beim Drücken sinkt die Oberseite
 * um die Kantenstärke und die Kante wird flach – das Element selbst bleibt stehen, Lage im Layout und Trefferfläche ändern
 * sich nicht (die Kante ist als Innenabstand unten eingeplant, die Schrift rutscht über den Innenabstand mit).
 * Kein Leuchten, kein Glanz, kein Anheben unter der Maus: Tiefe kommt allein von Kante und Druckzustand.
 */
:root {
  --nx-accent: #26d07c;
  --nx-accent-edge: #159a57;
  --nx-on-accent: #0b1410;
  --nx-sec-face: #151a1e;
  --nx-sec-edge: #2f3840;
  --nx-sec-ink: #e2e8f0;
  --nx-sec-face-light: #ffffff;
  --nx-sec-edge-light: #cbddeb;
  --nx-sec-ink-light: #0e5a6e;
  --nx-disabled-face: #1d2328;
  --nx-disabled-ink: #8e99a4;
  --nx-focus: #2e8f63;
  --nx-focus-light: #159a57;
  --nx-edge: 4px;
  --nx-edge-sm: 3px;
  --nx-radius: 15px;
  --nx-radius-sm: 12px;
  --nx-btn-h: 52px;
  --nx-btn-h-sm: 44px;
  --nx-target: 44px;
  --nx-press-down: 60ms;
  --nx-press-up: 160ms;
  --nx-ease-down: cubic-bezier(0.2, 0, 0.2, 1);
  --nx-ease-up: cubic-bezier(0.3, 1.35, 0.55, 1);
  --nx-focus-w: 3px;
  --nx-focus-offset: 3px;
  --nx-label-spacing: 0.8px;
}
html:root {
  --nx-sec-face: #151a1e;
  --nx-sec-edge: #2f3840;
  --nx-disabled-face: #1a2024;
}

html body .btn {
  --face: var(--nx-accent);
  --edge-color: var(--nx-accent-edge);
  --line: transparent;
  --e: var(--nx-edge);
  --sink: 0px;
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-sizing: border-box;
  min-width: var(--nx-target);
  min-height: calc(var(--nx-btn-h) + var(--e));
  margin: 0;
  padding: var(--sink) 24px calc(var(--e) - var(--sink));
  border: 0 !important;
  border-radius: var(--nx-radius);
  background: transparent !important;
  box-shadow: none !important;
  color: var(--nx-on-accent) !important;
  font: 700 16px/1.2 var(--body, 'Lexend', system-ui, sans-serif);
  letter-spacing: var(--nx-label-spacing);
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transform: none !important;
  filter: none;
  overflow: visible;
  -webkit-tap-highlight-color: transparent;
  transition: padding var(--nx-press-up) var(--nx-ease-up);
}
html body .btn::before {
  content: '' !important;
  display: block !important;
  position: absolute;
  z-index: -1;
  inset: 0 0 var(--e) 0;
  border-radius: inherit;
  background: var(--face) !important;
  border: 2px solid var(--line);
  box-shadow: 0 var(--e) 0 0 var(--edge-color);
  transform: translateY(var(--sink));
  transition:
    transform var(--nx-press-up) var(--nx-ease-up),
    box-shadow var(--nx-press-up) var(--nx-ease-up),
    filter 120ms ease-out;
}
html body .btn::after {
  display: none !important;
}
@media (hover: hover) and (pointer: fine) {
  html body .btn:hover::before {
    filter: brightness(1.06);
  }
}
html body .btn:active {
  --sink: var(--e);
  transition-duration: var(--nx-press-down);
  transition-timing-function: var(--nx-ease-down);
}
html body .btn:active::before {
  box-shadow: 0 0 0 0 var(--edge-color);
  transition-duration: var(--nx-press-down);
  transition-timing-function: var(--nx-ease-down);
}
html body .btn:focus-visible {
  outline: var(--nx-focus-w) solid var(--nx-focus);
  outline-offset: var(--nx-focus-offset);
}
html body .btn svg {
  width: 20px;
  height: 20px;
  flex: none;
}

/* Nebenaktion: ruhig, mit 2-px-Rand und flacher Kante */
html body .btn.ghost,
html body .btn.secondary {
  --face: var(--nx-sec-face);
  --edge-color: var(--nx-sec-edge);
  --line: var(--nx-sec-edge);
  color: var(--nx-sec-ink) !important;
}
:root[data-theme='light'] .btn.ghost,
:root[data-theme='light'] .btn.secondary {
  --face: var(--nx-sec-face-light);
  --edge-color: var(--nx-sec-edge-light);
  --line: var(--nx-sec-edge-light);
  color: var(--nx-sec-ink-light) !important;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) .btn.ghost,
  :root:not([data-theme='dark']) .btn.secondary {
    --face: var(--nx-sec-face-light);
    --edge-color: var(--nx-sec-edge-light);
    --line: var(--nx-sec-edge-light);
    color: var(--nx-sec-ink-light) !important;
  }
}

/* Klein (z. B. in der Navigation) – bleibt mindestens 44 px hoch */
html body .btn.small {
  --e: var(--nx-edge-sm);
  min-height: calc(var(--nx-btn-h-sm) + var(--e));
  padding-inline: 16px;
  border-radius: var(--nx-radius-sm);
  font-size: 14px;
}

/* Gesperrt / lädt: flach, nicht drückbar */
html body .btn[aria-disabled='true'],
html body .btn:disabled {
  --face: var(--nx-disabled-face);
  --edge-color: var(--nx-disabled-face);
  --line: transparent;
  color: var(--nx-disabled-ink) !important;
  cursor: default;
  pointer-events: none;
}
html body .btn[aria-busy='true'] {
  pointer-events: none;
}

/* Weniger Bewegung: Druckzustand ohne Übergang */
@media (prefers-reduced-motion: reduce) {
  html body .btn,
  html body .btn::before {
    transition: none !important;
  }
}
:root[data-motion='reduce'] .btn,
:root[data-motion='reduce'] .btn::before {
  transition: none !important;
}
