/* Automatische Skalierung fuer alle Geraeteklassen */
:root {
  --fluid-page-gap: clamp(10px, 2.2vw, 32px);
  --fluid-section-gap: clamp(52px, 7vw, 112px);
  --fluid-card-gap: clamp(12px, 1.6vw, 22px);
  --fluid-control-height: clamp(44px, 4vw, 52px);
}

html {
  font-size: clamp(14px, calc(13.2px + .16vw), 17px);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}

body,
main,
section,
article,
aside,
header,
footer,
form,
div {
  min-width: 0;
}

img,
picture,
video,
canvas,
svg {
  max-width: 100%;
  height: auto;
}

input,
select,
textarea,
button {
  max-width: 100%;
  font-size: max(16px, 1rem);
}

p,
h1,
h2,
h3,
h4,
label,
a,
button,
small,
strong,
span {
  overflow-wrap: anywhere;
}

.section,
.legal-content {
  padding-block: var(--fluid-section-gap);
}

.section-inner,
.quick-strip,
.conversion-band,
.legal-content,
.review-submit-shell {
  width: min(calc(100% - (var(--fluid-page-gap) * 2)), 1200px);
  margin-inline: auto;
}

.service-grid,
.references-grid,
.posts-grid,
.process-list,
.customer-grid,
.dashboard-grid {
  gap: var(--fluid-card-gap);
}

.section h2,
.legal-hero h1,
.review-submit-card h1 {
  font-size: clamp(2.15rem, 4.6vw, 5.15rem);
}

.site-header {
  width: min(calc(100% - (var(--fluid-page-gap) * 2)), 1540px);
}

.hero {
  width: min(calc(100% - (var(--fluid-page-gap) * 2)), 1540px) !important;
}

.quote-form input,
.quote-form select,
.quote-form textarea,
.review-submit-form input,
.review-submit-form select,
.review-submit-form textarea,
.login-panel input,
.customer-area input,
.customer-area select,
.customer-area textarea,
.portal-shell input,
.portal-shell select,
.portal-shell textarea {
  min-height: var(--fluid-control-height);
}

/* Grosse Monitore */
@media (min-width: 1800px) {
  :root {
    --max: 1320px;
  }

  .section-inner,
  .conversion-band,
  .quick-strip {
    max-width: 1320px;
  }

  html body .hero {
    max-width: 1680px;
  }

  .portal-main > .portal-view {
    max-width: 1760px !important;
  }
}

/* Laptop und kleine Desktop-Bildschirme */
@media (max-width: 1280px) {
  .desktop-nav a {
    padding-inline: 10px;
    font-size: .78rem;
  }

  .header-action {
    padding-inline: 16px;
  }

  .contact-rail {
    right: 8px;
    width: 58px;
  }

  .contact-rail a {
    grid-template-columns: 38px;
    justify-content: center;
    padding: 9px;
  }

  .contact-rail a strong,
  .contact-rail a small {
    display: none;
  }

  .portal-main {
    padding-inline: 14px !important;
  }
}

/* Tablet */
@media (max-width: 980px) {
  :root {
    --fluid-page-gap: clamp(9px, 2vw, 18px);
    --fluid-section-gap: clamp(50px, 8vw, 78px);
  }

  .site-header {
    width: calc(100% - 16px);
  }

  html body .hero {
    width: calc(100% - 16px) !important;
    min-height: clamp(560px, 74vw, 720px) !important;
    aspect-ratio: auto !important;
  }

  .service-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .references-grid,
  .posts-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .two-column,
  .contact-layout,
  .team-layout,
  .review-submit-card,
  .status-hero,
  .customer-grid {
    grid-template-columns: 1fr !important;
  }

  .portal-topbar {
    gap: 10px !important;
  }

  .portal-actions {
    gap: 5px !important;
  }
}

/* Smartphones */
@media (max-width: 680px) {
  :root {
    --fluid-page-gap: 8px;
    --fluid-section-gap: clamp(48px, 13vw, 68px);
    --fluid-card-gap: 12px;
  }

  html {
    font-size: 15px;
    scroll-padding-top: 88px;
  }

  .site-header {
    width: calc(100% - 12px);
    min-height: 64px;
  }

  html body .hero {
    width: calc(100% - 12px) !important;
    min-height: clamp(520px, 146vw, 640px) !important;
    margin-top: 80px !important;
  }

  .hero-content {
    padding-inline: 12px !important;
  }

  .quick-strip,
  .service-grid,
  .references-grid,
  .posts-grid,
  .process-list {
    grid-template-columns: 1fr !important;
  }

  .section-heading.split {
    grid-template-columns: 1fr !important;
  }

  .service-tabs,
  .reference-tabs {
    max-width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    scroll-snap-type: x proximity;
  }

  .service-tabs > *,
  .reference-tabs > * {
    flex: 0 0 auto;
    scroll-snap-align: start;
  }

  .quote-form,
  .review-submit-form,
  .login-panel,
  .panel,
  .status-hero {
    border-radius: 20px !important;
  }

  .form-half,
  .inquiry-main-grid,
  .inquiry-data-groups,
  .inquiry-workbench-tabs,
  .mail-status-grid,
  .dashboard-grid {
    grid-template-columns: 1fr !important;
  }

  .portal-main {
    padding-inline: 7px !important;
  }

  .portal-topbar h1 {
    font-size: 1.45rem !important;
  }

  .portal-actions .demo-badge,
  .portal-actions .user-pill,
  .portal-actions a.portal-link {
    display: none !important;
  }

  .contact-rail {
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    left: 8px;
    top: auto;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: auto;
  }

  .contact-rail a {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .contact-rail a strong {
    display: block;
  }
}

/* Sehr kleine Smartphones */
@media (max-width: 420px) {
  .brand-mark,
  .customer-brand span {
    max-width: 150px;
  }

  html body .hero {
    min-height: 540px !important;
  }

  .hero-actions {
    width: 100% !important;
  }

  .section h2,
  .legal-hero h1,
  .review-submit-card h1 {
    font-size: clamp(2rem, 11vw, 3rem);
  }

  .contact-rail a {
    padding-inline: 6px;
  }

  .contact-rail a strong {
    font-size: .66rem;
  }
}

/* Schmale Querformate */
@media (orientation: landscape) and (max-height: 620px) {
  .site-header {
    top: 5px;
    min-height: 58px;
  }

  html body .hero {
    min-height: calc(100svh - 76px) !important;
    margin-top: 70px !important;
  }

  .contact-rail {
    top: 78px;
    bottom: auto;
  }
}

/* Sichere Abstaende auf Geraeten mit Displayausschnitt */
@supports (padding: max(0px)) {
  .site-header,
  .portal-topbar,
  .customer-header {
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
  }
}
