/* ===== Variables ===== */
:root {
  /* Colors */
  --primary: #2C5E45;
  --secondary: #484848;
  --accent: #5a89c1;
  --bg: #f7f9fc;
  --white: #fff;
  --text: #1c2e40;
  --light-gray: #D4D4D4;
  --border-light: #e6eef7;

  /* Transparent Colors */
  --white-15: rgba(255, 255, 255, 0.15);
  --black-30: rgba(0, 0, 0, 0.3);

  /* Shadows */
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  --shadow-menu: -2px 0 10px rgba(0, 0, 0, 0.3);

  /* Layout */
  --radius: 14px;
  --transition: 0.3s cubic-bezier(.39, .58, .57, 1);
  --max-width: 980px;
  --header-height: 75px;
}

/* ===== Base Styles ===== */
html {
  scroll-padding-top: 80px;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Open Sans', Arial, sans-serif;
  overflow-x: hidden;
  position: relative;
  /* Ensure stacking context */
}



.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: 400;
  font-size: 1.5rem;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* ===== Header & Navigation ===== */
header {
  background: var(--primary);
  color: var(--text);
  box-shadow: var(--shadow);
  position: fixed;
  /* Fixed position to stay at top */
  width: 100%;
  /* Ensure full width */
  top: 0;
  z-index: 100;
  height: var(--header-height);
}

.header-container {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
}

.logo {
  display: flex;
  align-items: center;
  height: 100%;
}

.logo-link {
  text-decoration: none;
  display: flex;
  align-items: center;
}

.logo-text {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--light-gray);
  letter-spacing: 0.01em;
  padding: 0.8rem 1.2rem;
  margin-left: 1.5rem;
  display: flex;
  align-items: center;
  border-radius: 8px;
}

.logo-image {
  height: 2.4rem;
  width: auto;
}

.logo-fallback {
  display: inline;
}

nav {
  display: flex;
  align-items: center;
  font-size: 1.1rem;
  padding: 1rem 1.5rem 1rem 0;
  height: 100%;
}

/* ===== Menu Button ===== */
.menu-toggle {
  display: flex;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.8rem;
  z-index: 100;
  flex-direction: column;
  gap: 4px;
  width: 46px;
  height: 46px;
  justify-content: center;
  align-items: center;
  border-radius: 8px;
  transition: opacity var(--transition);
}

.menu-toggle:hover {
  background: var(--primary);
}

/* removed #menuToggle.active display:none to allow X transformation visibility */

.menu-close {
  display: none;
  margin-left: auto;
  margin-right: 1.5rem;
}

.menu-close.active {
  display: flex;
}

#menuToggle {
  align-items: flex-end;
}

#menuToggle.active {
  align-items: center;
}

.hamburger {
  width: 25px;
  height: 2.5px;
  background: var(--light-gray);
  border-radius: 2.5px;
  transition: all 0.3s ease;
}

.hamburger:nth-child(1) {
  width: 12px;
}

.hamburger:nth-child(2) {
  width: 18px;
}

.hamburger:nth-child(3) {
  width: 25px;
}

/* Open State: Perfect X */
.menu-toggle.active .hamburger {
  width: 25px;
}

.menu-toggle.active .hamburger:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.menu-toggle.active .hamburger:nth-child(2) {
  opacity: 0;
  transform: translateX(-20px);
}

.menu-toggle.active .hamburger:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.menu-icon {
  width: 32px;
  height: 32px;
  transition: transform 0.4s ease;
}

.menu-toggle:hover .menu-icon,
.menu-toggle.focus .menu-icon,
.menu-toggle.active .menu-icon {
  transform: rotate(360deg);
}

/* ===== Mobile Menu ===== */
.nav-links {
  position: fixed;
  top: var(--header-height);
  left: 100%;
  /* Start off-screen to the right */
  width: 100%;
  height: calc(100vh - var(--header-height));
  background: var(--bg);
  display: flex;
  flex-direction: column;
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
  /* Shadow on left side */
  transition: left 0.3s ease;
  overflow-y: auto;
  z-index: 99;
}

.nav-links.active {
  left: 0;
}

.nav-logo {
  display: none;
}

.nav-logo-container {
  max-width: var(--max-width);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.nav-logo .logo-text {
  padding: 0.8rem 1.2rem;
  margin-left: 1.5rem;
  border-radius: 8px;
  color: var(--light-gray);
}

.nav-main-links {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.nav-main-links a {
  color: var(--text);
  background: var(--light-gray);
  text-decoration: none;
  padding: 1.2rem;
  text-align: center;
  transition: background var(--transition), color var(--transition);
  border-bottom: 1px solid var(--primary);
}

.nav-main-links a:hover,
.nav-main-links a:focus,
.nav-main-links a.active {
  color: var(--light-gray);
  background: var(--primary);
}

.nav-main-links a.active {
  font-weight: 600;
}

/* ===== Menu Footer Links ===== */
.nav-footer-links {
  border-top: 1px solid var(--primary);
  /* Restored border */
  background: transparent;
  color: var(--text);
  text-align: center;
  padding: 2rem 1rem 1.3rem;
  /* Keep padding for height */
  margin-top: auto;
  margin-bottom: 0;
  display: block;
}

/* Container for links inside nav-footer-links */
.nav-footer-links>div {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.nav-footer-links a {
  color: var(--text);
  text-decoration: none;
  padding: 0;
  font-size: inherit;
  transition: color var(--transition);
}

.nav-footer-links a:hover {
  color: var(--primary);
}

.nav-copyright {
  color: var(--text);
  font-size: 0.8rem;
  text-align: center;
  padding: 0;
  margin: 1em 0;
  /* Add vertical margin to match footer p */
}

/* ===== Main Content ===== */
main {
  max-width: var(--max-width);
  /* Added top margin to compensate for fixed header */
  margin: calc(var(--header-height) + 3rem) auto 4rem;
  padding: 0 1rem;
}

section {
  margin-bottom: 3.5rem;
  padding: 2rem 1.6rem 1.2rem;
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(40px);
  transition: opacity var(--transition), transform var(--transition);
}

section.visible {
  opacity: 1;
  transform: translateY(0);
}

h2 {
  font-family: 'Montserrat', sans-serif;
  color: var(--secondary);
  font-weight: 600;
  font-size: 2rem;
  margin: 0 0 1.1rem;
  border-left: 5px solid var(--secondary);
  padding-left: 0.7rem;
  letter-spacing: 0.01em;
}

ul {
  margin: 0.7rem 0;
  padding-left: 1em;
}

li {
  margin: 0.38em 0;
}

/* ===== Leistungen Cards ===== */
.leistungen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 1.8rem;
  margin-top: 1.5rem;
}

.leistung-card {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 1.6rem 1.3rem 1.2rem;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition), transform var(--transition);
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
}

.leistung-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-3px) scale(1.015);
}

.leistung-card h3 {
  font-size: 1.18rem;
  font-family: 'Montserrat', sans-serif;
  color: var(--text);
  margin: 0 0 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
}

.leistung-card ul {
  list-style: disc inside;
  padding: 0;
  margin: 0;
  font-size: 1.05rem;
  color: var(--text);
}

/* ===== Info Sections (Kontakt, Impressum, Datenschutz) ===== */
.kontakt,
.impressum,
.datenschutz {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 3.5rem;
  padding: 2rem 1.6rem 1rem;
  font-size: 1.05rem;
  color: var(--text);
}

.kontakt a {
  text-decoration: none;
  color: var(--secondary);
  border-bottom: 1px dashed var(--accent);
}

.kontakt a:hover {
  color: var(--accent);
}

/* ===== Footer ===== */
footer {
  background: var(--primary);
  color: var(--light-gray);
  text-align: center;
  padding: 2rem 1rem 1.3rem;
  font-size: 0.8rem;
  margin-top: 3rem;
  border-radius: var(--radius) var(--radius) 0 0;
}

.footer-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.footer-nav a {
  color: var(--light-gray);
  text-decoration: underline;
}

.footer-nav a:hover {
  color: var(--white);
}

/* ===== Scroll to Top Button ===== */
.scroll-btn-container {
  position: fixed;
  bottom: 3.5rem;
  left: 0;
  right: 0;
  max-width: var(--max-width);
  margin: 0 auto;
  pointer-events: none;
  z-index: 999;
  display: flex;
  justify-content: flex-end;
}

#scrollToTopBtn {
  margin-right: 1.5rem;
  width: 44px;
  height: 44px;
  background: var(--primary);
  border: 3px solid var(--light-gray);
  color: var(--light-gray);
  border-radius: 12px;
  font-size: 1.8rem;
  font-weight: bold;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

#scrollToTopBtn:hover {
  opacity: 0.7;
  transform: translateY(-3px);
}

#scrollToTopBtn.show {
  opacity: 1;
  visibility: visible;
}

/* Hide Scroll Button when Mobile Menu is Open */
body.menu-open #scrollToTopBtn {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none;
}

/* ===== Animations ===== */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-24px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Media Queries ===== */
@media (max-width: 768px) {
  .logo-text {
    font-size: 1.2rem;
  }
}

@media (max-width: 650px) {
  .leistungen-grid {
    grid-template-columns: 1fr;
  }

  main {
    padding: 0 1rem;
  }

  section,
  .kontakt,
  .impressum,
  .datenschutz {
    padding: 1.1rem 1rem;
  }

  .logo-text {
    font-size: 1rem;
  }
}