/* =========================================================
   AVW Energiewende – Custom Styles
   Ergänzt Tailwind CSS (CDN). Reines CSS, kein Build-Schritt.
   ========================================================= */

:root {
  --emerald-700: #047857;
  --emerald-800: #065f46;
  --emerald-900: #064e3b;
  --emerald-950: #022c22;
  --lime-300: #bef264;
  --lime-400: #a3e635;
  --anthracite-900: #1a211f;
  --anthracite-700: #3f4a47;
  --header-h: 5rem;
}

/* ---------- Basis ---------- */
* {
  -webkit-tap-highlight-color: rgba(5, 150, 105, 0.15);
}

html {
  scroll-padding-top: calc(var(--header-h) + 1rem);
  /* Verhindert, dass iOS in der Querachse Schriftgrößen aufbläht */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-feature-settings: "kern", "liga", "calt";
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Platz für die sticky Action-Bar, damit der Footer nicht verdeckt wird */
@media (max-width: 639px) {
  body {
    padding-bottom: calc(4.5rem + env(safe-area-inset-bottom));
  }
}

/* Höhe des Headers auf kleinen Schirmen reduzieren (80px -> 64px) */
@media (max-width: 639px) {
  :root {
    --header-h: 4rem;
  }
}

section[id] {
  scroll-margin-top: calc(var(--header-h) + 1rem);
}

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid var(--lime-400);
  outline-offset: 2px;
  border-radius: 0.5rem;
}

/* =========================================================
   Header
   ========================================================= */
#site-header {
  background: transparent;
}

#site-header.is-scrolled {
  background: rgba(2, 44, 34, 0.9);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  box-shadow: 0 10px 30px -18px rgba(0, 0, 0, 0.6);
}

.nav-link {
  position: relative;
  border-radius: 0.75rem;
  padding: 0.65rem 0.9rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(236, 253, 245, 0.9);
  transition: color 0.2s ease, background-color 0.2s ease;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0.9rem;
  right: 0.9rem;
  bottom: 0.35rem;
  height: 2px;
  border-radius: 999px;
  background: var(--lime-400);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.nav-link:hover::after,
.nav-link:focus-visible::after,
.nav-link.is-active::after {
  transform: scaleX(1);
}

.nav-link.is-active {
  color: #fff;
}

.mobile-link {
  display: block;
  border-radius: 1rem;
  padding: 0.85rem 1rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: rgba(236, 253, 245, 0.95);
  transition: background-color 0.2s ease, color 0.2s ease, padding-left 0.2s ease;
}

.mobile-link:hover,
.mobile-link:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  padding-left: 1.35rem;
}

#mobile-menu.is-open {
  pointer-events: auto;
  max-height: 32rem;
  opacity: 1;
}

#mobile-menu:not(.is-open) {
  max-height: 0;
  opacity: 0;
}

body.nav-open {
  overflow: hidden;
}

/* =========================================================
   Hero
   ========================================================= */
.hero-grid {
  background-image:
    linear-gradient(to right, rgba(190, 242, 100, 0.07) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(190, 242, 100, 0.07) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
}

.chart-line {
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
  animation: draw 1.8s ease-out forwards;
}

@keyframes draw {
  to { stroke-dashoffset: 0; }
}

/* =========================================================
   Service Cards
   ========================================================= */
.service-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: 1.25rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  padding: 2rem 1.5rem;
  box-shadow: 0 10px 30px -20px rgba(6, 95, 70, 0.35);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  overflow: hidden;
}

.service-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(6, 95, 70, 0.05), transparent 55%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.service-card:hover,
.service-card:focus-visible {
  transform: translateY(-6px);
  border-color: var(--emerald-600);
  box-shadow: 0 18px 45px -20px rgba(6, 95, 70, 0.5);
}

.service-card:hover::before,
.service-card:focus-visible::before {
  opacity: 1;
}

.service-icon {
  display: flex;
  height: 3.5rem;
  width: 3.5rem;
  align-items: center;
  justify-content: center;
  border-radius: 1rem;
  background: #d1fae5;
  color: var(--emerald-800);
  transition: background-color 0.3s ease, color 0.3s ease, transform 0.3s ease;
}

.service-icon svg {
  height: 1.75rem;
  width: 1.75rem;
}

.service-card:hover .service-icon,
.service-card:focus-visible .service-icon {
  background: var(--emerald-700);
  color: #fff;
  transform: rotate(-6deg) scale(1.05);
}

.service-arrow {
  position: absolute;
  top: 1.75rem;
  right: 1.5rem;
  color: var(--emerald-600);
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.service-card:hover .service-arrow,
.service-card:focus-visible .service-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* =========================================================
   Vorteile / Advantage
   ========================================================= */
.advantage {
  display: flex;
  gap: 1rem;
  border-radius: 1.25rem;
  border: 1px solid #d1fae5;
  background: #fff;
  padding: 1.5rem;
  box-shadow: 0 8px 24px -18px rgba(6, 95, 70, 0.4);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.advantage:hover,
.advantage:focus-within {
  transform: translateX(6px);
  border-color: var(--emerald-600);
  box-shadow: 0 14px 34px -18px rgba(6, 95, 70, 0.5);
}

/* =========================================================
   Formular
   ========================================================= */
.form-label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--anthracite-900);
}

.form-input {
  display: block;
  width: 100%;
  border-radius: 0.9rem;
  border: 1px solid #cbd5e1;
  background: #fff;
  padding: 0.85rem 1rem;
  /* 16px ist Pflicht: darunter zoomt iOS Safari beim Fokussieren die Seite */
  font-size: 1rem;
  line-height: 1.5;
  color: var(--anthracite-900);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

/* Auf größeren Schirmen kompakter, ohne die 16px-Regel zu verletzen */
@media (min-width: 640px) {
  .form-input {
    padding: 0.8rem 1rem;
    font-size: 0.95rem;
  }
}

.form-input::placeholder {
  color: #94a3b8;
}

.form-input:hover {
  border-color: #94a3b8;
}

.form-input:focus {
  border-color: var(--emerald-600);
  box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.16);
  outline: none;
}

.form-input[aria-invalid="true"] {
  border-color: #dc2626;
  background: #fef2f2;
}

.form-error {
  margin-top: 0.4rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: #dc2626;
}

.form-error:not([hidden]) {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.form-error:not([hidden])::before {
  content: "!";
  display: inline-flex;
  height: 1rem;
  width: 1rem;
  flex: none;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
}

select.form-input {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%233f4a47' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 7.5 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 1.15rem;
  padding-right: 2.5rem;
}

/* Touch-Geräte: Formularfelder und Buttons dürfen nicht zu klein sein */
@media (pointer: coarse) {
  .form-input {
    min-height: 48px;
  }
}

/* =========================================================
   Sticky Action-Bar (nur Mobile)
   ========================================================= */
#mobile-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem calc(0.6rem + env(safe-area-inset-bottom));
  background: rgba(2, 44, 34, 0.94);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  box-shadow: 0 -8px 24px -14px rgba(0, 0, 0, 0.5);
  transform: translateY(110%);
  transition: transform 0.3s ease;
}

#mobile-bar.is-visible {
  transform: translateY(0);
}

@media (min-width: 640px) {
  #mobile-bar {
    display: none;
  }
}

/* Service-Cards: auf kleinen Schirmen etwas kompakter */
@media (max-width: 639px) {
  .service-card {
    padding: 1.5rem 1.25rem;
  }

  .advantage {
    padding: 1.25rem;
    gap: 0.85rem;
  }
}

/* Auf Touch-Geräten keine dauerhaften Hover-Zustände (z. B. nach Tap) */
@media (hover: none) {
  .service-card:hover,
  .service-card:focus-visible {
    transform: none;
  }

  .service-card:hover .service-icon,
  .service-card:focus-visible .service-icon {
    transform: none;
  }

  .service-arrow {
    opacity: 0;
    transform: none;
  }

  .advantage:hover {
    transform: none;
  }

  .nav-link:hover::after {
    transform: scaleX(0);
  }
}

#form-status.is-success p {
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
  color: #065f46;
}

#form-status.is-error p {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #991b1b;
}

/* =========================================================
   Scroll-Reveal
   ========================================================= */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}

[data-reveal].is-visible {
  opacity: 1;
  transform: none;
  will-change: auto;
}

/* Staggering innerhalb der Service-Grid */
#service-grid [data-reveal]:nth-child(1) { transition-delay: 0.00s; }
#service-grid [data-reveal]:nth-child(2) { transition-delay: 0.08s; }
#service-grid [data-reveal]:nth-child(3) { transition-delay: 0.16s; }
#service-grid [data-reveal]:nth-child(4) { transition-delay: 0.24s; }

/* =========================================================
   Accessibility / Motion
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  [data-reveal] {
    opacity: 1;
    transform: none;
  }

  .chart-line {
    stroke-dashoffset: 0;
  }
}

@media print {
  #site-header,
  #mobile-menu,
  [data-reveal] {
    display: none !important;
  }
}
