/*!
 * Brandschutz Gimpl — Theme-Layer
 * Basiert auf Start Bootstrap "Grayscale" v7.0.6 (MIT), modernisiert.
 * Laedt nach bootstrap.css. Alle projekteigenen Regeln stehen ausschliesslich hier.
 */

/* ==========================================================================
   1. Design-Tokens
   ========================================================================== */

:root {
  /* Akzent (Petrol) — hier zentral tauschbar */
  --bg-accent: #64a19d;
  --bg-accent-strong: #4d8884;
  --bg-accent-deep: #35635f;
  --bg-accent-soft: rgba(100, 161, 157, 0.14);

  /* Flaechen */
  --bg-ink: #101112;
  --bg-ink-soft: #1b1d1f;
  --bg-paper: #f6f7f7;
  --bg-card: #fff;

  /* Text */
  --bg-text: #1b1d1f;
  --bg-text-muted: #5c6366;
  --bg-text-on-dark: rgba(255, 255, 255, 0.94);
  /* .text-white-50 (50%) ist auf Schwarz grenzwertig — hier auf 72% angehoben */
  --bg-text-on-dark-muted: rgba(255, 255, 255, 0.72);

  /* Typo */
  --bg-font-display: "Varela Round", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Form */
  --bg-radius: 14px;
  --bg-radius-lg: 20px;
  --bg-shadow-sm: 0 1px 2px rgba(16, 17, 18, 0.06), 0 2px 8px rgba(16, 17, 18, 0.05);
  --bg-shadow-md: 0 4px 12px rgba(16, 17, 18, 0.07), 0 12px 32px rgba(16, 17, 18, 0.08);
  --bg-shadow-lg: 0 8px 24px rgba(16, 17, 18, 0.1), 0 24px 56px rgba(16, 17, 18, 0.12);

  /* Layout */
  --bg-nav-h: 4.25rem;
  --bg-section-y: clamp(4rem, 9vw, 8.5rem);

  --bg-ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   2. Basis
   ========================================================================== */

html {
  scroll-behavior: smooth;
  /* Ankerziele nicht mehr unter der fixierten Navbar verstecken */
  scroll-padding-top: calc(var(--bg-nav-h) + 1rem);
  -webkit-text-size-adjust: 100%;
  /* Sicherheitsnetz gegen horizontales Scrollen.
     Bewusst "clip" statt "hidden" und bewusst auf html statt auf body:
     "hidden" auf body macht den Body zum Scroll-Container, wodurch
     window.scrollY auf 0 stehen bleibt und Navbar/Scrollspy nicht mehr
     reagieren. */
  overflow-x: clip;
}

body {
  letter-spacing: 0.01em; /* war 0.0625em — auf Fliesstext zu luftig */
  color: var(--bg-text);
  background-color: var(--bg-ink);
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  font-family: var(--bg-font-display);
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

img {
  max-width: 100%;
  height: auto;
}

/* Sichtbarer, einheitlicher Fokusring — ersetzt die frueheren outline:none */
:focus-visible {
  outline: 3px solid var(--bg-accent);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection {
  background: var(--bg-accent);
  color: #fff;
}

/* Sprunglink — nur bei Tastaturfokus sichtbar */
.skip-link:focus {
  position: fixed;
  top: 0.75rem;
  left: 50%;
  z-index: 2000;
  translate: -50% 0;
  padding: 0.75rem 1.25rem;
  font-family: var(--bg-font-display);
  font-size: 0.9rem;
  color: #fff;
  background-color: var(--bg-accent-deep);
  border-radius: 999px;
  box-shadow: var(--bg-shadow-md);
  text-decoration: none;
}

/* ==========================================================================
   3. Navigation
   ========================================================================== */

#mainNav {
  min-height: var(--bg-nav-h);
  background-color: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  box-shadow: 0 1px 0 rgba(16, 17, 18, 0.08);
  transition: background-color 0.3s var(--bg-ease), box-shadow 0.3s var(--bg-ease);
}

#mainNav .navbar-brand {
  display: flex;
  align-items: center;
  padding: 0.65rem 0;
}

#mainNav .logo {
  display: block;
  width: 130px;
  height: 59px; /* explizite Masse gegen Layout-Shift */
  max-width: 42vw;
  object-fit: contain;
  transition: filter 0.3s var(--bg-ease);
}

#mainNav .navbar-toggler {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  font-size: 0.8rem;
  font-family: var(--bg-font-display);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--bg-accent-deep);
  border: 1px solid rgba(100, 161, 157, 0.5);
  border-radius: 999px;
  transition: color 0.2s var(--bg-ease), background-color 0.2s var(--bg-ease),
    border-color 0.2s var(--bg-ease);
}

#mainNav .navbar-toggler:hover {
  color: #fff;
  background-color: var(--bg-accent);
  border-color: var(--bg-accent);
}

#mainNav .navbar-nav {
  padding: 0.5rem 0;
}

/* Aufklappmenue ohne Bootstrap-JS.
   Bewusst als eingeblendetes Panel statt ueber eine Hoehenanimation: bei
   grid-template-rows/max-height setzen die Innenabstaende der Liste eine
   automatische Mindesthoehe, wodurch der geschlossene Zustand nicht sauber
   auf 0 geht. Das !important haengt Bootstraps
   .collapse:not(.show){display:none} ab. */
@media (max-width: 991.98px) {
  #navbarResponsive {
    display: block !important;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    padding: 0.25rem 1.5rem 1rem;
    background-color: rgba(255, 255, 255, 0.97);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    backdrop-filter: saturate(180%) blur(12px);
    border-radius: 0 0 var(--bg-radius) var(--bg-radius);
    box-shadow: var(--bg-shadow-md);
    opacity: 0;
    /* visibility haelt die Links im geschlossenen Zustand aus dem Fokus */
    visibility: hidden;
    transform: translateY(-0.5rem);
    transition: opacity 0.25s var(--bg-ease), transform 0.25s var(--bg-ease),
      visibility 0.25s;
  }

  #navbarResponsive.is-open {
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  /* Abstaende kommen vom Panel, nicht von der Liste */
  #mainNav .navbar-nav {
    padding: 0;
  }

  #mainNav .nav-link {
    padding: 0.7rem 0.75rem;
  }
}

#mainNav .nav-link {
  font-family: var(--bg-font-display);
  font-size: 0.95rem;
  color: var(--bg-text);
  border-radius: 8px;
  transition: color 0.2s var(--bg-ease), background-color 0.2s var(--bg-ease);
}

#mainNav .nav-link:hover,
#mainNav .nav-link:focus-visible {
  color: var(--bg-accent-deep);
  background-color: var(--bg-accent-soft);
}

#mainNav .nav-link.active {
  color: var(--bg-accent-deep);
}

@media (min-width: 992px) {
  #mainNav {
    padding-top: 0;
    padding-bottom: 0;
    background-color: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: none;
  }

  /* Muss explizit zurueckgesetzt werden: die Regeln oben adressieren den
     Toggler ueber #mainNav und schlagen damit Bootstraps
     .navbar-expand-lg .navbar-toggler { display: none } per ID-Spezifitaet. */
  #mainNav .navbar-toggler {
    display: none;
  }

  /* Ueber dem dunklen Hero: helles Logo + helle Links */
  #mainNav .logo {
    filter: invert(1) brightness(1.9);
  }

  #mainNav .nav-link {
    padding: 1.85rem 1.35rem;
    color: var(--bg-text-on-dark-muted);
    border-radius: 0;
  }

  #mainNav .nav-link:hover,
  #mainNav .nav-link:focus-visible {
    color: #fff;
    background-color: transparent;
  }

  /* Gescrollt: heller Balken, dunkles Logo, dunkle Links */
  #mainNav.navbar-shrink {
    background-color: rgba(255, 255, 255, 0.92);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    backdrop-filter: saturate(180%) blur(12px);
    box-shadow: var(--bg-shadow-sm);
  }

  #mainNav.navbar-shrink .logo {
    filter: none;
  }

  #mainNav.navbar-shrink .nav-link {
    position: relative;
    padding: 1.45rem 1.35rem;
    color: var(--bg-text);
  }

  #mainNav.navbar-shrink .nav-link:hover {
    color: var(--bg-accent-deep);
  }

  /* Aktiv-Unterstreichung als animiertes Pseudoelement statt border-bottom,
     dadurch kein Springen des Textes beim Wechsel */
  #mainNav.navbar-shrink .nav-link::after {
    content: "";
    position: absolute;
    left: 1.35rem;
    right: 1.35rem;
    bottom: 0.85rem;
    height: 3px;
    border-radius: 3px;
    background-color: var(--bg-accent);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.25s var(--bg-ease);
  }

  #mainNav.navbar-shrink .nav-link:hover::after,
  #mainNav.navbar-shrink .nav-link.active::after {
    transform: scaleX(1);
  }

  #mainNav.navbar-shrink .nav-link.active {
    color: var(--bg-accent-deep);
  }
}

/* ==========================================================================
   4. Buttons
   ========================================================================== */

.btn {
  padding: 1rem 2.25rem;
  font-family: var(--bg-font-display);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  border: 0;
  border-radius: 999px;
  box-shadow: var(--bg-shadow-sm);
  transition: transform 0.2s var(--bg-ease), box-shadow 0.2s var(--bg-ease),
    background-color 0.2s var(--bg-ease);
}

.btn-primary {
  background-color: var(--bg-accent);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background-color: var(--bg-accent-strong);
  transform: translateY(-2px);
  box-shadow: var(--bg-shadow-md);
}

.btn-primary:active {
  transform: translateY(0);
}

/* ==========================================================================
   5. Masthead / Hero
   ========================================================================== */

.masthead {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 100svh; /* svh: kein Springen durch die mobile Browserleiste */
  padding: calc(var(--bg-nav-h) + 3rem) 0 4rem;
  background-color: var(--bg-ink);
  background-image:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0.6) 60%, #000 100%),
    image-set(url("../assets/img/bg-masthead.webp") type("image/webp"),
              url("../assets/img/bg-masthead.jpg") type("image/jpeg"));
  background-image:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0.6) 60%, #000 100%),
    -webkit-image-set(url("../assets/img/bg-masthead.webp") type("image/webp"),
                      url("../assets/img/bg-masthead.jpg") type("image/jpeg"));
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.masthead h1,
.masthead .h1 {
  font-family: var(--bg-font-display);
  font-size: clamp(2rem, 9vw, 6.5rem);
  line-height: 1.05;
  letter-spacing: clamp(0.15rem, 1.2vw, 0.8rem);
  /* Letter-spacing haengt auch hinter dem letzten Zeichen und verschiebt die
     optische Mitte — hier wieder herausgerechnet */
  margin-right: calc(-1 * clamp(0.15rem, 1.2vw, 0.8rem));
  background-image: linear-gradient(180deg, #fff 15%, rgba(255, 255, 255, 0.55) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.masthead h2,
.masthead .h2 {
  max-width: 34rem;
  margin-inline: auto;
  font-family: inherit;
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  font-weight: 400;
  line-height: 1.65;
  color: var(--bg-text-on-dark-muted);
}

/* Dezenter Scroll-Hinweis */
.masthead .scroll-hint {
  position: absolute;
  left: 50%;
  bottom: 1.75rem;
  width: 1.5rem;
  height: 2.5rem;
  translate: -50% 0;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  pointer-events: none;
}

.masthead .scroll-hint::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 0.45rem;
  width: 3px;
  height: 0.5rem;
  translate: -50% 0;
  border-radius: 3px;
  background-color: rgba(255, 255, 255, 0.65);
  animation: bg-scroll-hint 1.9s var(--bg-ease) infinite;
}

@keyframes bg-scroll-hint {
  0%, 100% { transform: translateY(0); opacity: 1; }
  60%      { transform: translateY(0.85rem); opacity: 0; }
}

@media (max-width: 575.98px) {
  .masthead .scroll-hint { display: none; }
}

/* ==========================================================================
   6. Sektionen
   ========================================================================== */

.about-section {
  padding-top: var(--bg-section-y);
  padding-bottom: var(--bg-section-y);
  background: linear-gradient(to bottom, #000 0%, var(--bg-ink) 60%, var(--bg-ink-soft) 100%);
}

.about-section .lead-copy {
  max-width: 62ch;
  margin-inline: auto;
  margin-bottom: clamp(3rem, 6vw, 5rem);
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--bg-text-on-dark-muted);
}

.projects-section {
  padding-top: var(--bg-section-y);
  padding-bottom: var(--bg-section-y);
  background-color: var(--bg-paper) !important;
}

.contact-section {
  padding-top: var(--bg-section-y);
  padding-bottom: calc(var(--bg-section-y) * 0.6);
  background-color: var(--bg-ink) !important;
}

.footer {
  padding: 2.5rem 0 3rem;
  background-color: var(--bg-ink) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* Sektionsueberschrift mit Akzentstrich */
.section-heading {
  margin-bottom: 1.5rem;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  letter-spacing: 0.02em;
}

.section-heading::after {
  content: "";
  display: block;
  width: 3.5rem;
  height: 4px;
  margin: 1.1rem auto 0;
  border-radius: 4px;
  background-color: var(--bg-accent);
}

/* ==========================================================================
   7. Karten: Team & Leistungen
   ========================================================================== */

/* Gemeinsames Grundgeruest fuer die Bild/Text-Paare */
.media-card {
  overflow: hidden;
  border-radius: var(--bg-radius-lg);
  box-shadow: var(--bg-shadow-md);
  background-color: var(--bg-ink-soft);
}

/* Das Seitenverhaeltnis gibt die Kartenhoehe vor — nicht die Textlaenge.
   Waere es umgekehrt (Bild fuellt einfach die Texthoehe), wuerde eine kurze
   Beschreibung das Bild zu einem schmalen Streifen zusammendruecken und stark
   beschneiden. Die Textspalte zieht stattdessen mit; ist der Text laenger als
   das Bildformat, waechst die Karte und der Beschnitt bleibt gering. */
.media-card__figure {
  position: relative;
  overflow: hidden;
  background-color: rgba(0, 0, 0, 0.25);
  aspect-ratio: 4 / 3;
}

/* Leistungsbilder liegen im Quellformat 3:2 vor — exakt uebernommen,
   dadurch entsteht auf keiner Breite Beschnitt */
.projects-section .media-card__figure {
  aspect-ratio: 3 / 2;
}

/* Teamportraits sind hochformatig; quadratisch wirkt neben dem Text
   ausgewogener als das volle Hochformat */
.about-section .media-card__figure {
  aspect-ratio: 1 / 1;
}

/* Wrapper ist je nach Bild ein <picture> oder direkt das <img> */
.media-card__figure > picture,
.media-card__figure > img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.media-card__figure img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.5s var(--bg-ease);
}

/* Kopfbereich bleibt beim Beschnitt der Portraits erhalten */
.about-section .media-card__figure img {
  object-position: center 25%;
}

.media-card:hover .media-card__figure img {
  transform: scale(1.03);
}

.project-text {
  padding: clamp(1.75rem, 4vw, 3.25rem);
  font-size: 0.975rem;
  line-height: 1.7;
}

.project-text h3,
.project-text .h4 {
  margin-bottom: 0.9rem;
  font-size: clamp(1.2rem, 2.4vw, 1.5rem);
  letter-spacing: 0.02em;
}

.media-card .project-text p,
.media-card .project-text .service-list {
  color: var(--bg-text-on-dark-muted);
}

/* Kontaktzeilen in den Teamkarten */
.contactDetails {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.95rem;
  line-height: 2;
}

.contactDetails a {
  color: var(--bg-accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s var(--bg-ease), border-color 0.2s var(--bg-ease);
}

.contactDetails a:hover,
.contactDetails a:focus-visible {
  color: #fff;
  border-bottom-color: var(--bg-accent);
}

/* Hervorgehobene Leistung (Wartung) */
.featured-text {
  padding: clamp(1.5rem, 4vw, 2rem) 0 0;
}

@media (min-width: 992px) {
  .featured-text {
    padding: 0 0 0 2.5rem;
    border-left: 4px solid var(--bg-accent);
  }
}

.featured-text h3,
.featured-text .h4 {
  margin-bottom: 1rem;
  font-size: clamp(1.3rem, 2.6vw, 1.6rem);
}

.featured-text .service-list {
  color: var(--bg-text-muted);
}

.featured-media {
  overflow: hidden;
  border-radius: var(--bg-radius-lg);
  box-shadow: var(--bg-shadow-md);
}

.featured-media img {
  display: block;
  width: 100%;
  height: auto;
}

/* ==========================================================================
   8. Listen
   ========================================================================== */

.service-list {
  margin: 0;
  padding: 0;
  list-style: none;
  text-align: left;
}

.service-list li {
  position: relative;
  padding-left: 1.85rem;
  margin-bottom: 0.85rem;
  line-height: 1.65;
  /* Blocksatz erzeugte in schmalen Spalten grosse Luecken — jetzt linksbuendig */
  text-align: left;
}

.service-list li:last-child {
  margin-bottom: 0;
}

.service-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background-color: var(--bg-accent);
}

/* ==========================================================================
   9. Kontaktkarten & Social
   ========================================================================== */

.contact-section .card {
  border: 0;
  /* Akzent als Rahmen statt Pseudoelement — sitzt dadurch buendig an der
     Unterkante und nicht innerhalb des Card-Paddings */
  border-bottom: 4px solid var(--bg-accent);
  border-radius: var(--bg-radius);
  background-color: var(--bg-card);
  box-shadow: var(--bg-shadow-md);
  transition: transform 0.25s var(--bg-ease), box-shadow 0.25s var(--bg-ease);
}

.contact-section .card:hover {
  transform: translateY(-4px);
  box-shadow: var(--bg-shadow-lg);
}

.contact-section .card svg {
  color: var(--bg-accent);
}

.contact-section .card h3,
.contact-section .card .h4 {
  font-size: 0.85rem;
  font-family: var(--bg-font-display);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.contact-section .card hr {
  width: 3rem;
  opacity: 1;
  border: 0;
  border-top: 4px solid var(--bg-accent);
  border-radius: 4px;
}

.contact-section .card a {
  color: var(--bg-accent-deep);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s var(--bg-ease), border-color 0.2s var(--bg-ease);
}

.contact-section .card a:hover,
.contact-section .card a:focus-visible {
  color: var(--bg-accent-strong);
  border-bottom-color: currentColor;
}

.contact-section .social {
  margin-top: clamp(3rem, 6vw, 4.5rem);
}

.contact-section .social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 3rem;
  width: 3rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.65);
  transition: color 0.2s var(--bg-ease), background-color 0.2s var(--bg-ease),
    transform 0.2s var(--bg-ease);
}

.contact-section .social a:hover,
.contact-section .social a:focus-visible {
  color: #fff;
  background-color: var(--bg-accent);
  transform: translateY(-3px);
}

.footer a {
  color: var(--bg-text-on-dark-muted);
}

/* ==========================================================================
   10. Sanftes Einblenden beim Scrollen
   ========================================================================== */

/* Ausgangszustand nur setzen, wenn JS ihn auch wieder aufheben kann —
   ohne JS bleibt der Inhalt sichtbar */
.js .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s var(--bg-ease), transform 0.6s var(--bg-ease);
}

.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ==========================================================================
   11. Reduzierte Bewegung
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

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

  .js .reveal {
    opacity: 1;
    transform: none;
  }

  .media-card:hover .media-card__figure img {
    transform: none;
  }
}

/* ==========================================================================
   12. Druck
   ========================================================================== */

@media print {
  #mainNav,
  .masthead,
  .social,
  .scroll-hint {
    display: none !important;
  }

  .about-section,
  .contact-section,
  .footer,
  .projects-section {
    padding: 1rem 0 !important;
    background: #fff !important;
    color: #000 !important;
  }

  .about-section *,
  .contact-section *,
  .footer * {
    color: #000 !important;
  }
}
