/* ==========================================================================
   HAAS Maschinenteile GmbH – Stylesheet
   Aufbau: 1. Variablen  2. Basis  3. Layout  4. Header/Navigation
           5. Komponenten  6. Seitenbereiche  7. Footer  8. Responsive
   ========================================================================== */

/* 1. Variablen ------------------------------------------------------------ */
:root {
  --color-primary: #c72a41;      /* HAAS-Rot – rgb(199, 42, 65) */
  --color-primary-dark: #a32235; /* Hover-Variante */
  --color-text: #333;
  --color-muted: #6b6b6b;
  --color-dark: #222;
  --color-light: #f5f5f5;
  --color-border: #e2e2e2;
  --color-white: #fff;

  --font-base: "PT Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --container: 1180px;
  --gutter: 20px;
  --radius: 4px;
  --header-height: 100px;
  --shadow: 0 2px 12px rgba(0, 0, 0, .08);
}

/* 2. Basis ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: var(--header-height); }

body {
  margin: 0;
  font-family: var(--font-base);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--color-text);
  background: var(--color-white);
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--color-primary); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

h1, h2, h3, h4 { color: var(--color-dark); line-height: 1.25; margin: 0 0 .6em; font-weight: 700; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.1rem; }
.h3 { font-size: 1.3rem; }
p, ul, ol, dl { margin: 0 0 1em; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 1000;
  background: var(--color-primary); color: var(--color-white); padding: .6em 1em;
}
.skip-link:focus { left: var(--gutter); }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* 3. Layout --------------------------------------------------------------- */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }
.section { padding: clamp(48px, 7vw, 90px) 0; }
.section--light { background: var(--color-light); }
.section__title { text-align: center; margin-bottom: 1.5em; }
.section__title::after {
  content: ""; display: block; width: 60px; height: 3px;
  background: var(--color-primary); margin: .5em auto 0;
}
.grid { display: grid; gap: 30px; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

/* 4. Header / Navigation -------------------------------------------------- */
.topbar { background: var(--color-dark); color: #ccc; font-size: .9rem; }
.topbar .container { display: flex; gap: 24px; justify-content: flex-end; padding-top: 6px; padding-bottom: 6px; }
.topbar a { color: #ddd; display: inline-flex; align-items: center; gap: 6px; }
.topbar a:hover { color: var(--color-white); }

.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--color-white); box-shadow: var(--shadow);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; min-height: var(--header-height); }
.site-header .logo { display: block; padding: 12px 0; }
.site-header .logo img { width: 110px; height: auto; }

.main-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; }
.main-nav a {
  display: block; padding: 10px 14px; color: var(--color-dark);
  font-weight: 700; text-transform: uppercase; font-size: .9rem; letter-spacing: .03em;
  border-bottom: 2px solid transparent;
}
.main-nav a:hover, .main-nav a:focus-visible { color: var(--color-primary); text-decoration: none; }
.main-nav a[aria-current="page"] { color: var(--color-primary); border-bottom-color: var(--color-primary); }

.nav-toggle {
  display: none; background: none; border: 0; padding: 10px; cursor: pointer;
}
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after {
  display: block; width: 26px; height: 3px; background: var(--color-dark); position: relative; transition: .2s;
}
.nav-toggle span::before, .nav-toggle span::after { content: ""; position: absolute; left: 0; }
.nav-toggle span::before { top: -8px; }
.nav-toggle span::after { top: 8px; }
.nav-toggle[aria-expanded="true"] span { background: transparent; }
.nav-toggle[aria-expanded="true"] span::before { top: 0; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] span::after { top: 0; transform: rotate(-45deg); }

/* 5. Komponenten ---------------------------------------------------------- */
.icon { width: 1em; height: 1em; fill: currentColor; flex-shrink: 0; }

.btn {
  display: inline-block; padding: .75em 1.6em; border-radius: var(--radius);
  background: var(--color-primary); color: var(--color-white); font-weight: 700;
  border: 2px solid var(--color-primary); transition: background .2s, color .2s;
}
.btn:hover, .btn:focus-visible { background: var(--color-primary-dark); border-color: var(--color-primary-dark); text-decoration: none; }
.btn--outline { background: transparent; color: var(--color-white); border-color: var(--color-white); }
.btn--outline:hover { background: var(--color-white); color: var(--color-dark); border-color: var(--color-white); }

.breadcrumb { background: var(--color-light); font-size: .9rem; }
.breadcrumb ol { list-style: none; margin: 0; padding: 12px 0; display: flex; flex-wrap: wrap; gap: 6px; }
.breadcrumb li + li::before { content: "›"; margin-right: 6px; color: var(--color-muted); }
.breadcrumb [aria-current] { color: var(--color-muted); }

.page-header { background: var(--color-dark) center/cover no-repeat; color: var(--color-white); padding: clamp(40px, 6vw, 70px) 0; position: relative; }
.page-header::before { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, .55); }
.page-header .container { position: relative; }
.page-header h1 { color: var(--color-white); margin: 0; }
.page-header p { margin: .4em 0 0; font-size: 1.15rem; color: #eee; }

.content { max-width: 860px; }
.content h2 { margin-top: 1.6em; }
.content h3 { margin-top: 1.4em; }

/* Feature-Boxen */
.feature { background: var(--color-white); padding: 36px 28px; text-align: center; border-top: 4px solid var(--color-primary); box-shadow: var(--shadow); display: flex; flex-direction: column; }
.feature .icon { width: 44px; height: 44px; color: var(--color-primary); margin: 0 auto 16px; }
.feature p { flex-grow: 1; }

/* Leistungs-Karten */
.card { background: var(--color-white); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.card__img { overflow: hidden; aspect-ratio: 2 / 1; }
.card__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.card:hover .card__img img { transform: scale(1.05); }
.card__body { padding: 20px 22px 24px; }
.card__body h3 { font-size: 1.15rem; margin-bottom: .4em; }
.card__body h3 a { color: var(--color-dark); }
.card__body h3 a:hover { color: var(--color-primary); }
.card__body p { margin: 0; color: var(--color-muted); font-size: .95rem; }

/* Leistungen (Detailseite) */
.service { display: grid; grid-template-columns: 1fr 1.3fr; gap: 40px; align-items: center; padding: 40px 0; border-bottom: 1px solid var(--color-border); }
.service:last-child { border-bottom: 0; }
.service:nth-child(even) .service__img { order: 2; }
.service h2 { font-size: 1.6rem; }

/* Hero-Slider */
.hero { position: relative; overflow: hidden; background: var(--color-dark); aspect-ratio: 1903 / 650; max-height: 650px; width: 100%; }
.hero__slide { position: absolute; inset: 0; opacity: 0; transition: opacity 1s ease; }
.hero__slide.is-active { opacity: 1; }
.hero__slide img { width: 100%; height: 100%; object-fit: cover; }
.hero__caption {
  position: absolute; inset: 0; display: flex; align-items: center; z-index: 2;
  background: linear-gradient(90deg, rgba(0, 0, 0, .65) 0%, rgba(0, 0, 0, .1) 70%);
}
.hero__caption h1 { color: var(--color-white); max-width: 640px; margin-bottom: .3em; }
.hero__caption p { color: #eee; font-size: clamp(1rem, 2vw, 1.3rem); margin-bottom: 1.2em; }
.hero__dots { position: absolute; bottom: 16px; left: 0; right: 0; display: flex; justify-content: center; gap: 10px; z-index: 3; }
.hero__dots button { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--color-white); background: transparent; padding: 0; cursor: pointer; }
.hero__dots button[aria-current="true"] { background: var(--color-white); }

/* Banner mit Hintergrundbild */
.banner { background: var(--color-dark) center/cover no-repeat fixed; color: var(--color-white); text-align: center; position: relative; }
.banner::before { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, .55); }
.banner .container { position: relative; }
.banner h2 { color: var(--color-white); }
.banner p { font-size: 1.2rem; }

/* Galerie */
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.gallery a { display: block; overflow: hidden; aspect-ratio: 1280 / 700; }
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s, opacity .4s; }
.gallery a:hover img { transform: scale(1.05); opacity: .9; }

.lightbox { position: fixed; inset: 0; z-index: 1000; background: rgba(0, 0, 0, .9); display: flex; align-items: center; justify-content: center; padding: 40px; }
.lightbox[hidden] { display: none; }
.lightbox img { max-height: 90vh; width: auto; }
.lightbox button { position: absolute; background: none; border: 0; color: var(--color-white); font-size: 2.5rem; cursor: pointer; padding: 10px 18px; line-height: 1; }
.lightbox__close { top: 10px; right: 10px; }
.lightbox__prev { left: 10px; top: 50%; transform: translateY(-50%); }
.lightbox__next { right: 10px; top: 50%; transform: translateY(-50%); }

/* Zertifikate / Logos */
.logos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; align-items: center; }
.logos img { max-height: 90px; width: auto; margin: 0 auto; filter: grayscale(1); opacity: .85; }

/* Kontaktdaten */
.contact-list { list-style: none; padding: 0; }
.contact-list li { display: flex; gap: 12px; align-items: flex-start; margin-bottom: .7em; }
.contact-list .icon { color: var(--color-primary); width: 20px; height: 20px; margin-top: 3px; }

.notice { background: var(--color-light); border-left: 4px solid var(--color-primary); padding: 16px 20px; }

/* 7. Footer --------------------------------------------------------------- */
.site-footer { background: var(--color-dark); color: #bbb; font-size: .95rem; }
.site-footer .grid { padding: 50px 0 30px; }
.site-footer h2 { color: var(--color-white); font-size: 1.1rem; text-transform: uppercase; letter-spacing: .05em; }
.site-footer a { color: #ddd; }
.site-footer a:hover { color: var(--color-white); }
.site-footer ul { list-style: none; padding: 0; }
.site-footer .contact-list .icon { color: var(--color-primary); }
.footer-bottom { border-top: 1px solid #3a3a3a; padding: 16px 0; font-size: .85rem; }
.footer-bottom .container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; }
.footer-bottom ul { display: flex; gap: 18px; margin: 0; }

.to-top {
  position: fixed; right: 20px; bottom: 20px; z-index: 90; width: 44px; height: 44px;
  border-radius: 50%; background: var(--color-primary); color: var(--color-white);
  display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity .3s;
}
.to-top.is-visible { opacity: 1; pointer-events: auto; }
.to-top:hover { text-decoration: none; background: var(--color-primary-dark); }

/* 8. Responsive ----------------------------------------------------------- */
@media (max-width: 960px) {
  .grid--3, .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .service { grid-template-columns: 1fr; gap: 20px; }
  .service:nth-child(even) .service__img { order: 0; }
  .banner { background-attachment: scroll; }
}

@media (max-width: 860px) {
  :root { --header-height: 76px; }
  .site-header .logo { padding: 10px 0; }
  .site-header .logo img { width: 80px; }
  .nav-toggle { display: block; }
  .main-nav {
    position: absolute; top: 100%; left: 0; right: 0; background: var(--color-white);
    box-shadow: var(--shadow); display: none;
  }
  .main-nav.is-open { display: block; }
  .main-nav ul { flex-direction: column; padding: 10px var(--gutter) 16px; }
  .main-nav a { border-bottom: 1px solid var(--color-border); }
  .main-nav a[aria-current="page"] { border-bottom-color: var(--color-border); }
}

@media (max-width: 640px) {
  .grid--2, .grid--3, .grid--4, .logos { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: repeat(2, 1fr); }
  .topbar .container { justify-content: center; flex-wrap: wrap; gap: 4px 18px; }
  .hero { aspect-ratio: 4 / 3; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}

/* Qualität: Zitat, Checkliste, Zertifikat ---------------------------------- */
.quote { margin: 0 auto 50px; max-width: 860px; text-align: center; }
.quote p { font-size: clamp(1.6rem, 3.5vw, 2.4rem); font-weight: 700; color: var(--color-dark); line-height: 1.3; margin: 0; }
.quote span { display: block; font-size: .6em; font-weight: 400; font-style: italic; color: var(--color-primary); margin-top: .4em; }

.feature--left { text-align: left; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--color-border); }
.checklist li:last-child { border-bottom: 0; }
.checklist .icon { width: 22px; height: 22px; margin: 2px 0 0; color: var(--color-primary); }

.cert { display: grid; grid-template-columns: minmax(0, 380px) 1fr; gap: 50px; align-items: center; max-width: 1000px; margin: 0 auto; }
.cert__figure { margin: 0; }
.cert__figure a { display: block; background: var(--color-white); padding: 10px; box-shadow: 0 6px 30px rgba(0, 0, 0, .15); transition: transform .3s; }
.cert__figure a:hover { transform: translateY(-4px); }
.cert__figure figcaption { text-align: center; font-size: .85rem; color: var(--color-muted); margin-top: 12px; }

.facts { display: grid; grid-template-columns: max-content 1fr; margin: 0; background: var(--color-white); box-shadow: var(--shadow); border-top: 4px solid var(--color-primary); }
.facts dt, .facts dd { margin: 0; padding: 12px 18px; border-bottom: 1px solid var(--color-border); }
.facts dt { font-weight: 700; color: var(--color-dark); }
.facts dt:last-of-type, .facts dd:last-of-type { border-bottom: 0; }

@media (max-width: 760px) {
  .cert { grid-template-columns: 1fr; gap: 30px; }
  .cert__figure { max-width: 340px; margin: 0 auto; }
  .facts { grid-template-columns: 1fr; }
  .facts dt { padding-bottom: 0; border-bottom: 0; }
  .facts dd { padding-top: 2px; }
}

/* Referenzen: Einleitung und Branchen ---------------------------------------- */
.lead-block { margin: 0 auto; text-align: center; }
.lead { font-size: clamp(1.3rem, 2.6vw, 1.7rem); font-weight: 700; color: var(--color-dark); line-height: 1.4; }
.section__intro { text-align: center; max-width: 700px; margin: -1em auto 2em; color: var(--color-muted); }
.branches { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.branches li {
  display: flex; align-items: center; background: var(--color-white); padding: 18px 20px; min-height: 72px;
  hyphens: auto; overflow-wrap: break-word;
  box-shadow: var(--shadow); border-left: 4px solid var(--color-primary); font-weight: 700; color: var(--color-dark);
  transition: transform .2s;
}
.branches li:hover { transform: translateY(-3px); }

/* Maschinenliste: eingebettetes PDF ------------------------------------------ */
.section--compact { padding-top: 30px; }
.btn .icon { width: 1.1em; height: 1.1em; vertical-align: -.2em; margin-right: 4px; }
.btn--ghost { background: transparent; color: var(--color-primary); }
.btn--ghost:hover, .btn--ghost:focus-visible { color: var(--color-white); }
.pdf-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 30px; margin-bottom: 20px; }
.pdf-toolbar p { margin: 0; flex: 1 1 320px; color: var(--color-muted); }
.pdf-toolbar__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.pdf-viewer { background: #525659; box-shadow: var(--shadow); }
.pdf-viewer iframe { display: block; width: 100%; height: calc(100vh - var(--header-height) - 40px); min-height: 700px; border: 0; }
.pdf-fallback { display: none; }

@media (max-width: 760px) {
  .pdf-viewer { display: none; }
  .pdf-fallback { display: block; }
  .pdf-toolbar__actions, .pdf-toolbar__actions .btn { width: 100%; text-align: center; }
}
