/* =========================================================================
   HOLZBAU PEIFER - NEUE WEBSITE STYLES
   ========================================================================= */

:root {
  --primary-color: #00824E; /* Green */
  --secondary-color: #663333; /* Brown/Red */
  --accent-color: #CC6633; /* Orange */
  --text-color: #333;
  --bg-color: #EFDFBE;
  --nav-bg: #00824E;
  --nav-hover: #00663E;
  --nav-text: #fff;
  --footer-bg: transparent; /* Changed to match image */
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Prevent any element from causing horizontal overflow */
html, body {
  overflow-x: hidden;
  max-width: 100%;
}

/* Images never exceed their container — overrides inline max-width styles */
img {
  max-width: 100% !important;
  height: auto;
}

body {
  font-family: Verdana, sans-serif;
  font-size: 0.8125rem; /* a bit smaller */
  color: var(--text-color);
  line-height: 1.6;
  background-color: var(--bg-color);
  /* The wood background as seen in the screenshot */
  background: url('../images/bg.jpg') top center; 
  background-attachment: fixed;
  background-size: cover;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Container */
.container {
  max-width: 1200px; /* matched screenshot */
  margin: 0 auto;
  /* Semi transparent beige overlay as seen in screenshot */
  background-color: rgba(239, 223, 190, 0.86);
  border-left: 1px solid rgba(255,255,255,0.4);
  border-right: 1px solid rgba(255,255,255,0.4);
}

.site-wrapper {
  flex: 1;
}

/* Header */
.header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 20px 20px;
}

.logo-section {
  display: flex;
  align-items: baseline;
}

.logo img {
  max-width: 200px;
  height: auto;
}

.slogan p {
  color: var(--primary-color);
  font-weight: bold;
  font-size: 0.95rem;
  margin-left: 10px;
}

.services-list ul {
  list-style: none;
  text-align: right;
  font-weight: bold;
  font-size: 0.95rem;
  color: #444;
}

.services-list li {
  margin-bottom: 5px;
}

/* Hero Section / Slider */
.hero {
  position: relative;
  width: 100%;
}

.hero img {
  width: 100%;
  height: 380px;
  object-fit: cover;
  object-position: center 25%; /* Shift focal point to show faces */
  display: block;
}

.hero-slider {
  position: relative;
  height: 380px;
  overflow: hidden;
}

.slide {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  opacity: 0;
  transition: opacity 1s ease-in-out;
}

.slide.active { opacity: 1; }

.slider-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  color: white;
  border: none;
  font-size: 30px;
  padding: 10px 20px;
  cursor: pointer;
}

.slider-btn.prev { left: 10px; }
.slider-btn.next { right: 10px; }

/* Navigation */
.main-nav {
  background-color: var(--nav-bg);
  position: relative;
  z-index: 1000;
  border-top: 2px solid white;
  display: flex;
  justify-content: center;
}

.nav-toggle {
  display: block;
  padding: 15px;
  color: var(--nav-text);
  background-color: var(--primary-color);
  cursor: pointer;
  text-align: center;
  font-weight: bold;
}

.menu {
  display: none;
  list-style: none;
  flex-direction: column;
  width: 100%;
}

.menu.active {
  display: flex;
}

.menu > li {
  position: relative;
  flex: 1;
  text-align: center;
}

.menu > li > a {
  display: block;
  padding: 10px 10px;
  color: var(--nav-text);
  text-decoration: none;
  font-weight: normal;
  font-size: 0.8125rem;
}

.menu > li > a:hover,
.menu > li > a.active {
  background-color: var(--nav-hover);
}

.submenu {
  display: none;
  list-style: none;
  background-color: var(--nav-hover);
}

.menu li:hover .submenu {
  display: flex;
  flex-direction: column;
}

.submenu a {
  display: block;
  padding: 10px 30px;
  color: white;
  text-decoration: none;
}
.submenu a:hover { background-color: var(--primary-color); }

/* Main Content Area */
.main-content {
  display: flex;
  flex-direction: column;
  padding: 30px 20px;
  gap: 30px;
}

/* Sidebar */
.sidebar {
  flex: 0 0 280px;
  padding: 0 10px;
}

.sidebar h4 {
  color: var(--primary-color);
  font-size: 1rem;
  margin-bottom: 2px;
}

.sidebar p.slogan-red {
  color: #FF0000;
  font-weight: bold;
  margin-bottom: 20px;
}

.sidebar p {
  margin-bottom: 15px;
  display: flex;
  align-items: flex-start;
}

.icon {
  width: 24px;
  margin-right: 10px;
}

.sidebar a {
  color: var(--primary-color);
  text-decoration: none;
}
.sidebar a:hover { text-decoration: underline; }

/* Content */
.content {
  flex: 1;
}

.content h1.green-title {
  color: var(--primary-color);
  font-size: 1.125rem;
  margin-bottom: 5px;
}

.content h2.brown-title {
  color: var(--secondary-color);
  font-size: 1.25rem;
  margin-bottom: 20px;
}

.content h4.bold-p {
  color: #000;
  margin-bottom: 20px;
  font-weight: normal;
}
.content h4.bold-p strong {
  font-weight: bold;
}

.content p {
  margin-bottom: 15px;
  color: #333;
  line-height: 1.8;
}

.content img {
  max-width: 100%;
  height: auto;
  border: 2px solid white;
}

/* Leistungen Section */
.leistungen-row {
  display: flex;
  justify-content: space-between;
  text-align: center;
  margin-top: 40px;
  padding-bottom: 40px;
  gap: 15px;
}

.leistung-item {
  flex: 1;
}

.leistung-item h3 {
  color: var(--secondary-color);
  margin-bottom: 10px;
  font-size: 0.95rem;
  font-weight: bold;
}

.leistung-item img {
  width: 100%;
  max-width: 220px;
  height: auto;
  border: 4px solid #fff;
}

dl dt {
  font-weight: bold;
  padding: 10px 35px 10px 10px;
  background-color: white;
  margin-top: 5px;
  cursor: pointer;
  border-bottom: 1px solid #ddd;
  position: relative;
  user-select: none;
}
dl dt::after {
  content: '+';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--primary-color);
  transition: transform 0.2s ease;
}
dl dt.open::after {
  content: '−';
}
dl dt:hover { background-color: #f9f9f9; }
dl dd {
  padding: 15px 10px;
  background-color: transparent;
  display: none;
}
dl dd.open {
  display: block;
  background-color: rgba(255, 255, 255, 0.6);
}
dl dd ul, dl dd ol {
  padding-left: 1.5em;
}
dl dd ul li, dl dd ol li {
  margin-bottom: 6px;
}

/* Container Image Layout */
.content-grid {
  display: flex;
  gap: 20px;
  margin-bottom: 30px;
}


.container_bild {
  position: relative;
  flex: 1;
  overflow: hidden;
  text-align: center;
}
.container_bild img { 
  width: 100%; 
  height: auto; 
  display: block; 
}
.container_bild .textbox {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 130, 78, 0.95); /* Semi-transparent green */
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: center; /* Better centered now */
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
  padding: 25px 20px;
  overflow-y: auto;
}
.container_bild:hover .textbox {
  opacity: 1;
  visibility: visible;
}

/* History items for Über uns */
.container_bild.gruen {
  background-color: var(--primary-color);
  color: white;
  display: flex;
  flex-direction: column;
  text-align: left;
}
.container_bild.gruen h4.grau {
  background-color: #444; /* Dark gray */
  color: white;
  padding: 8px 15px;
  margin: 0;
  display: inline-block;
  align-self: flex-start;
  position: relative;
  font-size: 0.9rem;
}
.container_bild.gruen h4.grau::after {
  content: "";
  position: absolute;
  top: 0; right: -20px;
  border-top: 18px solid transparent;
  border-bottom: 18px solid transparent;
  border-left: 20px solid #444;
}
.container_bild.gruen p {
  padding: 15px;
  margin-bottom: 0;
  color: white;
  font-size: 0.8125rem;
}
.container_bild.gruen img {
  width: 100%;
  margin-top: auto;
  border: none;
}
.container_bild:hover .textbox {
  opacity: 1;
}

.container_bild .text span { 
  color: white; 
  font-weight: bold; 
  font-size: 1.25rem; 
  display: block; 
  margin-bottom: 10px; 
}
.container_bild .text a { 
  color: white; 
  text-decoration: none; 
  font-size: 0.9rem;
  line-height: 1.8;
  display: inline-block;
}
.container_bild .text a:hover { text-decoration: underline; }

/* Footer */
footer {
  text-align: center;
  padding: 10px;
  margin-top: auto;
  font-size: 0.75rem;
}
footer a { color: #888; text-decoration: none; }
footer a:hover { color: #333; }

/* Media Queries */
@media (min-width: 768px) {
  .nav-toggle { display: none; }
  .menu { display: flex; flex-direction: row; justify-content: center; }
  .menu > li {
    border-right: 1px solid rgba(255,255,255,0.2);
  }
  .menu > li:last-child { border-right: none; }
  
  .submenu { position: absolute; top: 100%; left: 0; min-width: 200px; z-index: 1001; }
  /* Letztes Menü-Item: Submenu nach links ausrichten, damit es nicht über den Rand ragt */
  .menu > li:last-child .submenu { left: auto; right: 0; }
  
  .main-content { flex-direction: row; }
}

@media (max-width: 767px) {
  .header-top { flex-direction: column; align-items: center; text-align: center; }
  .logo-section { flex-direction: column; align-items: center; }
  .slogan p { margin-left: 0; margin-top: 10px; margin-bottom: 10px; }
  .services-list ul { text-align: center; }
  .leistungen-row { flex-direction: column; }
  .content-grid { flex-direction: column; }

  /* Mobile Navigation Fix */
  .main-nav { flex-direction: column; align-items: stretch; }
  .nav-toggle { width: 100%; }
  .menu > li { flex: none; width: 100%; border-bottom: 1px solid rgba(255,255,255,0.2); }
  .menu > li:last-child { border-bottom: none; }
  .submenu { position: static !important; width: 100%; display: none !important; }
  .submenu.open { display: flex !important; flex-direction: column; }

  /* Menüpunkte mit Untermenü: Titel + Pfeil nebeneinander */
  .menu > li > a {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  /* Pfeil als großer, deutlicher Tap-Bereich */
  .menu > li > a > em {
    padding: 0 14px;
    margin-right: -10px;
    align-self: stretch;
    display: flex;
    align-items: center;
    border-left: 1px solid rgba(255,255,255,0.25);
    cursor: pointer;
  }

  /* Sidebar: allow text to wrap on small screens */
  aside.sidebar span { white-space: normal !important; }
  .main-content { padding: 20px 15px; }

  /* Hero Slider: smaller on mobile */
  .hero-slider { height: 240px; }
  .hero-slider img { height: 240px !important; }
  .hero img { height: 240px; }
}

/* Extracted from HTML */
.hero-slider img { position: absolute; top:0; left:0; width: 100%; height: 380px; object-fit: cover; object-position: center 25%; opacity: 0; transition: opacity 1s; }
.hero-slider img.active { opacity: 1; z-index: 10; }
.slider-controls { position: absolute; top:50%; width: 100%; display: flex; justify-content: space-between; transform: translateY(-50%); z-index: 20; }
.slider-arrow { background: transparent; border: none; font-size: 2rem; color: white; cursor: pointer; padding: 0 20px; text-shadow: 1px 1px 3px rgba(0,0,0,0.5); }

/* Lightbox */
.lightbox-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.88);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}
.lightbox-overlay.active {
  display: flex;
}
.lightbox-overlay img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border: 3px solid white;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.6);
  cursor: default;
}
.lightbox-close {
  position: absolute;
  top: 15px;
  right: 25px;
  color: white;
  font-size: 2.5rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s;
}
.lightbox-close:hover {
  opacity: 1;
}
img.lightbox-trigger {
  cursor: zoom-in;
}

/* Sidebar Spacing & Wrapping fixes */
aside.sidebar p {
  display: flex;
  align-items: flex-start;
  margin-bottom: 25px;
  line-height: 1.6;
}
aside.sidebar span {
  white-space: nowrap; /* Prevents phone/fax from tearing apart */
}
aside.sidebar a[href^="mailto:"] {
  display: block;
  margin-top: 5px;
  white-space: normal; /* Emails can wrap if layout gets tight */
  word-break: break-all;
}
aside.sidebar .icon {
  width: 25px;
  margin-right: 15px;
  margin-top: 2px; /* Aligns visually with top of multi-line text */
  flex-shrink: 0;
}


