/* ============================================================
   LEANS DESIGN SYSTEM — Bauteile & Bewegung
   Setzt tokens/leans.css voraus.
   Bewegung laeuft, wo moeglich, ueber native scroll-driven
   animations (animation-timeline) — kein JS, kein Framework.
   ============================================================ */

/* ------------------------------------------------------------
   RASTER — Haarlinien statt Schatten
   ------------------------------------------------------------ */
.huelle {
  width: 100%;
  max-width: var(--breite);
  margin-inline: auto;
  padding-inline: var(--bund);
}

.gitter {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--s-6);
}
@media (max-width: 60rem) { .gitter { grid-template-columns: repeat(6, 1fr); } }
@media (max-width: 36rem) { .gitter { grid-template-columns: repeat(2, 1fr); } }

/* Millimeterpapier — der Grund einer technischen Zeichnung */
.raster {
  background-image:
    linear-gradient(to right,  var(--line) var(--hair), transparent var(--hair)),
    linear-gradient(to bottom, var(--line) var(--hair), transparent var(--hair));
  background-size: 4.5rem 4.5rem;
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 20%, transparent 78%);
          mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 20%, transparent 78%);
}

/* ------------------------------------------------------------
   FLANSCH — unsere Karte. Eckmarkierungen statt Rundung.
   ------------------------------------------------------------ */
.flansch {
  position: relative;
  background: var(--surface);
  border: var(--hair) solid var(--line);
  border-radius: var(--r);
  padding: var(--s-8);
  transition:
    border-color var(--d-2) var(--e-out),
    transform    var(--d-2) var(--e-out);
}
.flansch::before,
.flansch::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 9px;
  border: var(--hair) solid var(--accent);
  opacity: 0;
  transition:
    opacity var(--d-2) var(--e-out),
    inset   var(--d-3) var(--e-out);
}
.flansch::before { inset: 6px auto auto 6px; border-right: 0; border-bottom: 0; }
.flansch::after  { inset: auto 6px 6px auto; border-left: 0;  border-top: 0;    }
.flansch:hover,
.flansch:focus-within {
  border-color: var(--line-2);
  transform: translateY(-2px);
}
.flansch:hover::before,
.flansch:focus-within::before { opacity: 1; inset: -1px auto auto -1px; }
.flansch:hover::after,
.flansch:focus-within::after  { opacity: 1; inset: auto -1px -1px auto; }

/* ------------------------------------------------------------
   BEMASSUNG — unser Signatur-Auftritt.
   Erst faehrt die Masslinie aus (wie im Plan), dann kommt der
   Inhalt. Kein fade-up wie bei allen anderen.
   ------------------------------------------------------------ */
.mass {
  position: relative;
  padding-left: var(--s-8);
}
.mass::before {                     /* die Masslinie */
  content: "";
  position: absolute;
  left: 0; top: 0.15em; bottom: 0.15em;
  width: var(--hair);
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: top;
  animation: mass-linie var(--d-3) var(--e-mech) both;
  animation-timeline: view();
  animation-range: entry 4% cover 26%;
}
.mass::after {                      /* die beiden Endstriche */
  content: "";
  position: absolute;
  left: -4px; top: 0.15em; bottom: 0.15em;
  width: 9px;
  background:
    linear-gradient(var(--accent), var(--accent)) top    left / 9px var(--hair) no-repeat,
    linear-gradient(var(--accent), var(--accent)) bottom left / 9px var(--hair) no-repeat;
  opacity: 0;
  animation: mass-strich var(--d-2) var(--e-out) both;
  animation-timeline: view();
  animation-range: entry 16% cover 30%;
}
.mass > * {
  animation: mass-inhalt var(--d-4) var(--e-out) both;
  animation-timeline: view();
  animation-range: entry 10% cover 34%;
}
@keyframes mass-linie  { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes mass-strich { from { opacity: 0; }          to { opacity: 1; } }
@keyframes mass-inhalt {
  from { opacity: 0; transform: translate3d(-0.8rem, 0, 0); filter: blur(2px); }
  to   { opacity: 1; transform: none;                       filter: none; }
}

/* ------------------------------------------------------------
   WISCH — clip-path statt Deckkraft. Praezise Kante, kein Nebel.
   ------------------------------------------------------------ */
.wisch {
  animation: wisch var(--d-4) var(--e-mech) both;
  animation-timeline: view();
  animation-range: entry 2% cover 28%;
}
@keyframes wisch {
  from { clip-path: inset(0 100% 0 0); opacity: 0.001; }
  to   { clip-path: inset(0 0    0 0); opacity: 1; }
}

.wisch-hoch {
  animation: wisch-hoch var(--d-4) var(--e-out) both;
  animation-timeline: view();
  animation-range: entry 2% cover 30%;
}
@keyframes wisch-hoch {
  from { clip-path: inset(100% 0 0 0); transform: translate3d(0, 1.2rem, 0); }
  to   { clip-path: inset(0    0 0 0); transform: none; }
}

/* Wortweiser Auftritt, nach Zeilen gestaffelt (JS setzt --i je Wort).
   Wrapper schneidet ab, Innenteil klappt hoch. padding/margin verhindern,
   dass Unterlaengen (g, y, ue) beschnitten werden. */
.wort {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding-bottom: 0.14em;
  margin-bottom: -0.14em;
}
.wort > span {
  display: inline-block;
  animation: zeile-auf var(--d-4) var(--e-out) both;
  animation-delay: calc(var(--i, 0) * 68ms);
}
@keyframes zeile-auf {
  from { transform: translate3d(0, 105%, 0) rotate(1.4deg); }
  to   { transform: none; }
}

/* ------------------------------------------------------------
   BAUTEILE
   ------------------------------------------------------------ */
.knopf {
  --k-bg: var(--accent);
  --k-fg: var(--l-ink);
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-6);
  font-family: var(--f-tech);
  font-size: var(--t-sm);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  background: var(--k-bg);
  color: var(--k-fg);
  border: var(--hair) solid var(--k-bg);
  border-radius: var(--r);
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  transition: color var(--d-2) var(--e-out);
}
.knopf::before {                    /* Fuellung wischt von unten herein */
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--l-ink);
  transform: translateY(101%);
  transition: transform var(--d-2) var(--e-mech);
}
.knopf:hover { color: var(--accent); }
.knopf:hover::before { transform: translateY(0); }

.knopf--linie {
  --k-bg: transparent;
  --k-fg: var(--text);
  border-color: var(--line-2);
}
.knopf--linie:hover { color: var(--l-ink); }
.knopf--linie::before { background: var(--accent); }

/* Typenschild — Marke/Status */
.schild {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-1) var(--s-3);
  font-family: var(--f-tech);
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  border: var(--hair) solid var(--line-2);
  border-radius: var(--r);
}
.schild::before {
  content: "";
  width: 5px;
  height: 5px;
  background: var(--accent);
  animation: puls 2.4s var(--e-mech) infinite;
}
@keyframes puls { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

/* Kennwert — kW, m3/h, DN gross und in Mono */
.kennwert { display: flex; flex-direction: column; gap: var(--s-1); }
.kennwert dt {
  order: 2;
  font-family: var(--f-tech);
  font-size: var(--t-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-2);
}
.kennwert dd {
  order: 1;
  margin: 0;
  font-family: var(--f-tech);
  font-weight: 500;
  font-variant-numeric: tabular-nums slashed-zero;
  font-size: var(--t-lg);
  letter-spacing: -0.02em;
  color: var(--text);
}

/* Achse — Trennlinie mit Endpunkten, wie im Plan */
.achse {
  position: relative;
  height: var(--hair);
  background: var(--line-2);
  border: 0;
  margin: var(--s-16) 0;
}
.achse::before,
.achse::after {
  content: "";
  position: absolute;
  top: -3px;
  width: var(--hair);
  height: 7px;
  background: var(--line-2);
}
.achse::before { left: 0; }
.achse::after  { right: 0; }

/* ------------------------------------------------------------
   RUECKFALL: Browser ohne scroll-driven animations (Firefox).
   Dort sind Inhalte sichtbar — nie unsichtbar haengen lassen.
   JS-Ersatz siehe motion/leans-motion.js
   ------------------------------------------------------------ */
@supports not (animation-timeline: view()) {
  .mass::before { transform: scaleY(1); animation: none; }
  .mass::after  { opacity: 1; animation: none; }
  .mass > *,
  .wisch,
  .wisch-hoch {
    animation: none;
    opacity: 1;
    clip-path: none;
    transform: none;
    filter: none;
  }
  .js-beobachtet .mass > *,
  .js-beobachtet .wisch,
  .js-beobachtet .wisch-hoch {
    opacity: 0;
    transform: translate3d(0, 1rem, 0);
    transition:
      opacity   var(--d-4) var(--e-out),
      transform var(--d-4) var(--e-out);
  }
  .js-beobachtet .sichtbar,
  .js-beobachtet .sichtbar > * {
    opacity: 1;
    transform: none;
  }
}

/* ------------------------------------------------------------
   BARRIEREFREIHEIT — Pflicht, nicht optional
   ------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
  .mass > *,
  .wisch,
  .wisch-hoch {
    opacity: 1 !important;
    clip-path: none !important;
    transform: none !important;
    filter: none !important;
  }
}
