/* ==========================================================
   WiFTech Mechatronik – Stylesheet
   ========================================================== */

:root {
  color-scheme: light;

  --bg: #ffffff;
  --bg-2: #f5f5f7;
  --karte: #ffffff;
  --band: #000000;

  --text: #1d1d1f;
  --text-2: #6e6e73;
  --linie: #d2d2d7;

  --nav-bg: rgba(255, 255, 255, 0.8);
  --nav-linie: rgba(0, 0, 0, 0.08);

  --rot: #c4161c;
  --rot-dunkel: #a01217;
  --rot-hell: #ff5a5f;
  --link: #c4161c;
  --auf-rot: #ffffff;
  --strom-rot: #d0161c;

  --zeichnung: #86868b;
  --zeichnung-dunkel: #8e8e93;
  --dunkel-karte: #1d1d1f;
  --flaeche: #f5f5f7;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
          Roboto, "Helvetica Neue", Arial, sans-serif;

  --nav-h: 48px;
  --breite: 980px;
}

/* ---------- Basis ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-padding-top: var(--nav-h);
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.47;
  letter-spacing: -0.022em;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
svg {
  display: block;
  max-width: 100%;
}

h1, h2, h3, p, ul, ol, dl, dd {
  margin: 0;
}

h1,
h2,
h3 {
  text-wrap: balance;
  -webkit-hyphens: auto;
  hyphens: auto;
  overflow-wrap: break-word;
}

.hero__lead,
.sub-hero__lead,
.kachel__text,
.statement__text,
.cta__text {
  text-wrap: balance;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
  border-radius: 4px;
}

.container {
  width: 100%;
  max-width: var(--breite);
  margin-inline: auto;
  padding-inline: 22px;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--text);
  color: var(--bg);
  border-radius: 8px;
}

.skip-link:focus {
  top: 8px;
}

/* ---------- Navigation ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  border-bottom: 1px solid var(--nav-linie);
}

/* Unschärfe als eigene Ebene: backdrop-filter direkt auf .nav würde das
   Vollbild-Menü am Handy an die Leiste binden statt an den Bildschirm */
.nav::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}

.nav__inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 100%;
  max-width: var(--breite);
  margin-inline: auto;
  padding-inline: 22px;
}

.nav__logo img {
  height: 32px;
  width: auto;
}

.nav__menu {
  margin-left: auto;
}

.nav__menu ul {
  display: flex;
  gap: 28px;
}

.nav__menu a {
  font-size: 14px;
  color: var(--text);
  opacity: 0.8;
  transition: opacity 0.2s;
}

.nav__menu a:hover,
.nav__menu a[aria-current="page"] {
  opacity: 1;
}

.nav__menu a[aria-current="page"] {
  font-weight: 600;
}

.nav__call,
.nav__toggle {
  display: none;
}

@media (max-width: 767px) {
  .nav__menu {
    position: fixed;
    inset: var(--nav-h) 0 0 0;
    margin: 0;
    padding: 24px 32px;
    background: var(--bg);
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.25s, visibility 0.25s;
  }

  .nav-open .nav__menu {
    visibility: visible;
    opacity: 1;
  }

  .nav-open {
    overflow: hidden;
  }

  .nav__menu ul {
    flex-direction: column;
    gap: 4px;
  }

  .nav__menu a {
    display: block;
    padding: 8px 0;
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.01em;
    opacity: 1;
  }

  .nav__call {
    display: inline-block;
    margin-left: auto;
    padding: 6px 14px;
    font-size: 14px;
    color: var(--auf-rot);
    background: var(--rot);
    border-radius: 980px;
  }

  .nav__toggle {
    display: grid;
    place-content: center;
    gap: 6px;
    width: 40px;
    height: 40px;
    margin-right: -10px;
    padding: 0;
    background: none;
    border: 0;
    cursor: pointer;
  }

  .nav__toggle span {
    display: block;
    width: 18px;
    height: 1.5px;
    background: var(--text);
    transition: transform 0.25s;
  }

  .nav-open .nav__toggle span:first-child {
    transform: translateY(3.75px) rotate(45deg);
  }

  .nav-open .nav__toggle span:last-child {
    transform: translateY(-3.75px) rotate(-45deg);
  }

  .hat-anrufleiste .nav__call {
    display: none;
  }

  .hat-anrufleiste .nav__toggle {
    margin-left: auto;
  }
}

/* ---------- Buttons & Links ---------- */

.btn {
  display: inline-block;
  padding: 12px 24px;
  font-size: 17px;
  border-radius: 980px;
  transition: background-color 0.2s;
}

.btn--primary {
  color: var(--auf-rot);
  background: var(--rot);
}

.btn--primary:hover {
  background: var(--rot-dunkel);
}

.link-more {
  font-size: 19px;
  color: var(--link);
}

.link-more:hover {
  text-decoration: underline;
}

.link-more::after {
  content: " ›";
}

.kachel--dunkel .link-more,
.sub-hero--dunkel .link-more {
  color: var(--rot-hell);
}

/* ---------- Hero (Startseite) ---------- */

.hero {
  padding-top: clamp(64px, 10vw, 120px);
  text-align: center;
  overflow: hidden;
}

.hero__title {
  font-size: clamp(44px, 8vw, 96px);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.015em;
}

.hero__lead {
  max-width: 42ch;
  margin: 20px auto 0;
  font-size: clamp(21px, 2.6vw, 28px);
  line-height: 1.25;
  color: var(--text-2);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px 32px;
  margin-top: 36px;
}

.hero__art {
  margin-top: clamp(16px, 3vw, 32px);
}

@media (prefers-reduced-motion: no-preference) {
  .hero__title,
  .hero__lead,
  .hero__actions,
  .sub-hero__title,
  .sub-hero__lead {
    animation: aufsteigen 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }

  .hero__lead,
  .sub-hero__lead { animation-delay: 0.12s; }
  .hero__actions  { animation-delay: 0.24s; }
}

@keyframes aufsteigen {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Vertrauensleiste ---------- */

.nachweise {
  border-block: 1px solid var(--linie);
}

.nachweise__liste {
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-width: var(--breite);
  margin-inline: auto;
}

.nachweise__liste li {
  padding: 24px 16px;
  text-align: center;
}

.nachweise__titel {
  display: block;
  font-size: 21px;
  font-weight: 600;
  line-height: 1.2;
}

.nachweise__text {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  line-height: 1.35;
  color: var(--text-2);
}

@media (max-width: 767px) {
  .nachweise__liste li:nth-child(odd) {
    border-right: 1px solid var(--linie);
  }

  .nachweise__liste li:nth-child(-n + 2) {
    border-bottom: 1px solid var(--linie);
  }
}

@media (min-width: 768px) {
  .nachweise__liste {
    grid-template-columns: repeat(4, 1fr);
  }

  .nachweise__liste li {
    padding-block: 32px;
  }

  .nachweise__liste li + li {
    border-left: 1px solid var(--linie);
  }
}

/* ---------- Kacheln (Startseite) ---------- */

.kacheln {
  padding: 12px;
  background: var(--bg-2);
}

.kacheln__grid {
  display: grid;
  gap: 12px;
  max-width: 1440px;
  margin-inline: auto;
}

@media (min-width: 900px) {
  .kacheln__grid {
    grid-template-columns: 1fr 1fr;
  }

  .kachel--breit {
    grid-column: 1 / -1;
  }
}

.kachel {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(44px, 5vw, 64px) clamp(16px, 3vw, 40px) clamp(20px, 3vw, 36px);
  text-align: center;
  background: var(--karte);
  border-radius: 24px;
  overflow: hidden;
}

.kachel--dunkel {
  background: #000000;
  color: #f5f5f7;
}

.kachel__title {
  font-size: clamp(32px, 3.8vw, 44px);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.01em;
}

.kachel--breit .kachel__title {
  font-size: clamp(34px, 6vw, 64px);
}

.kachel__text {
  max-width: 38ch;
  margin-top: 12px;
  font-size: clamp(18px, 2vw, 21px);
  line-height: 1.33;
}

.kachel--breit .kachel__text {
  font-size: clamp(19px, 2.2vw, 24px);
}

.kachel__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 32px;
  margin-top: 20px;
}

.kachel__art {
  width: 100%;
  max-width: 640px;
  margin-top: auto;
  padding-top: clamp(28px, 4vw, 44px);
}

.kachel--breit .kachel__art {
  max-width: 860px;
}

/* ---------- Zeichnungen „unter Strom“ ---------- */

.zeichnung {
  --strom: var(--strom-rot);
  aspect-ratio: 720 / 300;
  color: var(--zeichnung);
}

.zeichnung svg {
  width: 100%;
  height: auto;
}

.zeichnung--pv {
  --strom: #f2a900;
}

.zeichnung--automation {
  --strom: #30d158;
}

.zeichnung.zeichnung--held {
  aspect-ratio: auto;
  height: clamp(220px, 24vw, 360px);
}

.zeichnung.zeichnung--held svg {
  height: 100%;
}

.kachel--dunkel .zeichnung,
.sub-hero--dunkel .zeichnung {
  color: var(--zeichnung-dunkel);
}

.zeichnung text {
  font-family: var(--font);
  font-size: 13px;
  letter-spacing: 0;
  fill: currentColor;
  stroke: none;
}

.zeichnung .symbol {
  font-size: 26px;
}

.zeichnung .strom {
  stroke: var(--strom);
  stroke-width: 3;
}

.zeichnung .aus {
  opacity: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .zeichnung.bereit .strom {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
  }

  .zeichnung.bereit .leuchtet {
    opacity: 0;
  }

  .zeichnung.bereit .aus {
    opacity: 1;
  }

  .zeichnung.bereit.an .strom {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset var(--t, 1s) cubic-bezier(0.45, 0, 0.55, 1) var(--d, 0s);
  }

  .zeichnung.bereit.an .leuchtet {
    opacity: 1;
    transition: opacity 0.6s ease var(--d, 1s);
  }

  .zeichnung.bereit.an .aus {
    opacity: 0;
    transition: opacity 0.15s ease 0.25s;
  }
}

/* ---------- Interaktive Schaltpläne ---------- */

.zeichnung .z1,
.zeichnung .z2 {
  transition: opacity 0.35s ease;
}

.zeichnung .z2 {
  opacity: 0;
}

.zeichnung.zustand-2 .z1 {
  opacity: 0;
}

.zeichnung.zustand-2 .z2 {
  opacity: 1;
}

/* Strompfade, die erst im zweiten Zustand fließen */
.zeichnung .strom2 {
  stroke: var(--strom);
  stroke-width: 3;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset var(--t2, 0.6s) ease var(--d2, 0s);
}

.zeichnung.zustand-2 .strom2 {
  stroke-dashoffset: 0;
}

.zeichnung .hk-wert {
  font-size: 15px;
  font-weight: 600;
  fill: var(--strom);
}

.schaltbar {
  cursor: pointer;
  border-radius: 12px;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

.schaltbar:focus-visible {
  outline-offset: 6px;
}

.zeichnung__hinweis {
  margin-top: 10px;
  font-size: 13px;
  letter-spacing: 0;
  text-align: center;
  color: var(--text-2);
  transition: opacity 0.4s;
}

.zeichnung__hinweis.benutzt {
  opacity: 0.55;
}

.kachel--dunkel .zeichnung__hinweis,
.sub-hero--dunkel .zeichnung__hinweis {
  color: #8e8e93;
}

@media (prefers-reduced-motion: reduce) {
  .zeichnung .z1,
  .zeichnung .z2,
  .zeichnung .strom2 {
    transition: none;
  }
}

/* Funke an der Unterbrechung (404) */
@media (prefers-reduced-motion: no-preference) {
  .zeichnung.an .funke {
    animation: funke 2.4s steps(1) 1.8s infinite;
  }
}

@keyframes funke {
  0%   { opacity: 1; }
  8%   { opacity: 0.15; }
  12%  { opacity: 1; }
  55%  { opacity: 1; }
  60%  { opacity: 0; }
  64%  { opacity: 1; }
}

/* ---------- Seitenübergänge ---------- */

@view-transition {
  navigation: auto;
}

.nav {
  view-transition-name: hauptnavigation;
}

.anrufleiste {
  view-transition-name: anrufleiste;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.35s;
}

@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }
}

/* ---------- So läuft es ab ---------- */

.ablauf {
  padding-block: clamp(80px, 11vw, 128px);
}

.ablauf__liste {
  position: relative;
  display: grid;
  gap: 36px;
  margin-top: 48px;
}

.ablauf__liste::before {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 6px;
  width: 2px;
  background: var(--linie);
}

.ablauf__liste li {
  position: relative;
  padding-left: 40px;
}

.ablauf__liste li::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 14px;
  height: 14px;
  background: var(--strom-rot);
  border: 3px solid var(--bg);
  border-radius: 50%;
  box-shadow: 0 0 0 1.5px var(--strom-rot);
}

.ablauf__nr {
  display: block;
  font-size: 14px;
  color: var(--text-2);
}

.ablauf__liste h3 {
  margin-top: 2px;
  font-size: 21px;
  font-weight: 600;
  line-height: 1.3;
}

.ablauf__liste p {
  margin-top: 6px;
  color: var(--text-2);
}

@media (min-width: 768px) {
  .ablauf__liste {
    grid-template-columns: repeat(4, 1fr);
    gap: 32px;
  }

  .ablauf__liste::before {
    bottom: auto;
    right: 0;
    width: auto;
    height: 2px;
  }

  .ablauf__liste li {
    padding-left: 0;
    padding-top: 36px;
  }
}

/* ---------- Über uns (Startseite) ---------- */

.grund {
  padding-bottom: clamp(80px, 11vw, 128px);
}

.grund__inner {
  padding-top: clamp(64px, 9vw, 96px);
  border-top: 1px solid var(--linie);
}

.grund__title {
  font-size: clamp(32px, 4.5vw, 48px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.005em;
}

.grund__text {
  display: grid;
  gap: 16px 48px;
  margin-top: 32px;
}

.grund__text p {
  color: var(--text-2);
}

.grund__text .grund__lead {
  font-size: 21px;
  line-height: 1.4;
  color: var(--text);
}

@media (min-width: 768px) {
  .grund__text {
    grid-template-columns: 1fr 1fr;
  }

  .grund__text .grund__lead {
    grid-column: 1 / -1;
    max-width: 44ch;
  }
}

/* ---------- Kontakt-Teaser (Startseite) ---------- */

.kontakt {
  padding-block: clamp(72px, 10vw, 112px);
  background: var(--flaeche);
}

.kontakt__title {
  font-size: clamp(32px, 4.5vw, 48px);
  font-weight: 600;
  line-height: 1.1;
}

.kontakt__lead {
  margin-top: 12px;
  font-size: 21px;
  color: var(--text-2);
}

.kontakt__daten {
  display: grid;
  gap: 32px;
  margin-top: 48px;
}

.kontakt__daten dt {
  font-size: 14px;
  color: var(--text-2);
}

.kontakt__daten dd {
  margin-top: 4px;
  font-size: 21px;
  line-height: 1.35;
}

.kontakt__daten a:hover {
  color: var(--link);
}

.kontakt__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 32px;
  margin-top: 48px;
}

@media (min-width: 768px) {
  .kontakt__daten {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ---------- Unterseiten: Kopfbereich ---------- */

.sub-hero {
  padding: clamp(64px, 10vw, 120px) 22px clamp(48px, 7vw, 80px);
  text-align: center;
}

.sub-hero--dunkel {
  background: #000000;
  color: #f5f5f7;
}

.sub-hero__title {
  font-size: clamp(32px, 9.4vw, 80px);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.015em;
}

.sub-hero__lead {
  max-width: 40ch;
  margin: 16px auto 0;
  font-size: clamp(21px, 2.6vw, 28px);
  line-height: 1.25;
  color: var(--text-2);
}

.sub-hero--dunkel .sub-hero__lead {
  color: #a1a1a6;
}

.sub-hero__art {
  max-width: var(--breite);
  margin: clamp(48px, 7vw, 72px) auto 0;
  padding: clamp(24px, 5vw, 56px);
  background: var(--flaeche);
  border-radius: 24px;
}

.sub-hero__art .zeichnung {
  max-width: 760px;
  margin-inline: auto;
}

.sub-hero--dunkel .sub-hero__art {
  background: var(--dunkel-karte);
}

/* ---------- Unterseiten: Leistungen ---------- */

.leistungen {
  padding-block: clamp(72px, 10vw, 112px);
  background: var(--bg-2);
}

.section-title {
  font-size: clamp(32px, 4.5vw, 48px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.005em;
}

.leistungen__liste {
  display: grid;
  gap: 12px;
  margin-top: 40px;
}

.leistungen__liste li {
  padding: 28px;
  background: var(--karte);
  border-radius: 18px;
}

.leistungen__liste h3 {
  font-size: 21px;
  font-weight: 600;
  line-height: 1.3;
}

.leistungen__liste p {
  margin-top: 6px;
  max-width: 46ch;
  color: var(--text-2);
}

@media (min-width: 768px) {
  .leistungen__liste {
    grid-template-columns: 1fr 1fr;
  }
}

/* ---------- Unterseiten: Kernaussage ---------- */

.statement {
  padding: clamp(80px, 11vw, 128px) 22px;
  text-align: center;
  background: var(--band);
  color: #f5f5f7;
}

.statement__title {
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.statement__text {
  max-width: 48ch;
  margin: 16px auto 0;
  font-size: clamp(19px, 2.2vw, 21px);
  line-height: 1.4;
  color: #a1a1a6;
}

/* ---------- Unterseiten: Abschluss ---------- */

.cta {
  padding: clamp(72px, 10vw, 112px) 22px;
  text-align: center;
}

.cta__text {
  max-width: 44ch;
  margin: 12px auto 0;
  font-size: 21px;
  line-height: 1.35;
  color: var(--text-2);
}

/* ---------- Footer ---------- */

.footer {
  padding-block: 24px 40px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-2);
  background: var(--bg-2);
  border-top: 1px solid var(--linie);
}

.footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 24px;
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}

.footer__links a:hover {
  color: var(--text);
  text-decoration: underline;
}

/* ---------- Anruf-Leiste (nur Handy) ---------- */

.anrufleiste {
  display: none;
}

@media (max-width: 767px) {
  .anrufleiste {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 90;
    display: flex;
    gap: 10px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--nav-bg);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid var(--nav-linie);
  }

  .anrufleiste a {
    flex: 1;
    padding: 12px 16px;
    font-size: 17px;
    text-align: center;
    border-radius: 980px;
  }

  .anrufleiste__link {
    color: var(--text);
    border: 1px solid var(--linie);
  }

  .hat-anrufleiste {
    padding-bottom: 72px;
  }
}