/* kacheln.css – .kachel, Hover, Wichtig, Antippen (Einrasten). Siehe DESIGN-REGELN.md
   Fallback-Werte in var(...) machen die Seite auch ohne tokens.css lesbar.
   Hilfsklassen: .kachel__label, .kachel__titel, .kachel__text, .kachel__link.
   Vom JS gesetzt: .is-tipp an der verlinkten Kachel (nur auf Touch-Geräten). */

.kachel {
  position: relative;
  isolation: isolate;
  box-sizing: border-box;
  padding: var(--s-6, 32px);
  background: var(--surface, #262c35);
  color: var(--text, #fff);
  font-family: var(--font-body, var(--font-text, "Adwaita Sans", system-ui, sans-serif));
  font-size: var(--fs-body, 17px);
  line-height: var(--lh-body, 1.6);
  border: 1px solid var(--border, #363e4a);
  border-radius: var(--radius, 16px);
  transition: border-color 200ms ease, background-color 200ms ease;
}

.kachel__label {
  display: block;
  margin: 0 0 var(--s-3, 12px);
  font-family: var(--font-display, "JetBrainsMono Nerd Font", "JetBrains Mono", ui-monospace, monospace);
  font-size: var(--fs-sm, 14px);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--lila-text, #b996f2);
}
.kachel__titel {
  margin: 0 0 var(--s-3, 12px);
  font-family: var(--font-head, var(--font-display, "JetBrainsMono Nerd Font", "JetBrains Mono", ui-monospace, monospace));
  font-size: var(--fs-h4, 21px);
  line-height: var(--lh-head, 1.15);
  font-weight: 700;
  letter-spacing: var(--head-ls, -0.02em);
  color: var(--text, #fff);
}
.kachel__text {
  margin: 0;
  color: var(--text-muted, rgba(255, 255, 255, .72));
}

/* Verlinkte Kachel */
a.kachel {
  display: block;
  text-decoration: none;
  color: var(--text, #fff);
}
.kachel--link .kachel__link:not(.btn) {
  color: inherit;
  text-decoration: none;
}
.kachel--link .kachel__link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}
a.kachel:focus-visible,
.kachel--link:has(.kachel__link:focus-visible) {
  outline: 2px solid var(--gelb, #f7ee6f);
  outline-offset: 3px;
}
.kachel--link .kachel__link:focus-visible { outline: none; }

/* Hover: ruhiger gelber Rahmen, Fläche minimal heller (nicht bei .kachel--ruhig) */
.kachel:not(.kachel--ruhig):is(:hover, :focus-within) {
  border-color: color-mix(in srgb, var(--gelb, #f7ee6f) 55%, transparent);
  background: color-mix(in srgb, var(--surface, #262c35) 65%, var(--surface-2, #2e3540));
}

/* ---------- Wichtig: 2px gelber Rahmen ohne Layout-Sprung ----------
   1px border plus 1px inset-Schatten in derselben Farbe. Ruhe 60 %, Hover/Fokus 100 %. */
.kachel--wichtig {
  border-color: color-mix(in srgb, var(--gelb, #f7ee6f) 60%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--gelb, #f7ee6f) 60%, transparent);
}
.kachel--wichtig:not(.kachel--ruhig):is(:hover, :focus-within) {
  border-color: var(--gelb, #f7ee6f);
  box-shadow: inset 0 0 0 1px var(--gelb, #f7ee6f);
}

/* ---------- Antippen: Einrasten (JS setzt .is-tipp, nur auf Touch) ---------- */

.kachel { transition: border-color 200ms ease, background-color 200ms ease, box-shadow 200ms ease; }
.kachel.is-tipp {
  transition: none;
  border-color: var(--gelb, #f7ee6f);
  background: color-mix(in srgb, var(--surface, #262c35) 65%, var(--surface-2, #2e3540));
  animation: kachel-einrasten 250ms cubic-bezier(.3, 1.6, .5, 1) both;
}
@keyframes kachel-einrasten {
  0%   { transform: scale(1); }
  40%  { transform: scale(.97); }
  100% { transform: scale(1); }
}

/* Weniger Bewegung: nur gelber Rahmen, keine Animation */
@media (prefers-reduced-motion: reduce) {
  .kachel { transition: none; }
  .kachel.is-tipp { animation: none !important; }
}
