@layer components, helpers;

/** Inhaltselemente */
@layer components {
  .gridbox {
    margin: 0;
    padding: 0;
    list-style: none;
    justify-content: flex-start !important;
    
    .gridbox-item {
      position: relative;
      display: flex;
      align-items: center;
      gap: 1rem;
      margin: 0;

      @media (min-width: 768px) {
        &:first-child:after {
          content: '';
          display: inline-block;
          position: absolute;
          right: 0;
          top: 15%;
          height: 70%;
          width: 1px;
          border-right: 3px solid var(--color-muted);
        }
      }
      @media (min-width: 900px) {
        &::after {
          content: '';
          display: inline-block;
          position: absolute;
          right: 0;
          top: 15%;
          height: 70%;
          width: 1px;
          border-right: 3px solid var(--color-muted);
        }
    
        &:last-child::after {
          display: none;
        }
      }


      svg,
      .icon {
        color: var(--color-primary);
      }

      h4 {
        text-transform: uppercase;
        letter-spacing: 0.02em;
        margin: 2px 0;
      }

      p {
        margin: 0;
        font-size: 0.9rem;
      }

      .content {
        color: var(--color-text);
      }
    }

    &.valign .gridbox-item {
      flex-direction: column;
      text-align: center;
    }

    &.halign .gridbox-item {
    }
  }

  .boxes {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .box {
    font-weight: 400;
    
    @media (max-width: 767px) {
      width: 100%;
      align-self: center;
      justify-self: center;
    }

    p, h4 {
      margin: 10px 0;
    }
    ul li {
      display: flex;
    }
    svg {
      color: var(--color-primary);
    }
    .icon-wrapper {
      position: relative;
    }
    .box-num {
      position: absolute;
      left: 0;
      translate: -6px -13px;
      color: var(--color-primary);
    }

    .icon-underlined {
      display: flex;
      flex-direction: column;
      align-items: center;
      &::after {
        content: '';
        display: inline-block;
        gap: 10px;
        width: 40px;
        height: 2px;
        margin: 0.4rem auto 1.2rem;
        background: var(--color-primary);
      }
    }

    &.centered {
      text-align: center;
    }

  }

  .check-list {
    .icon {
      margin-right: 7px;
    }
  }

  .cta-banner {
    margin-top: 40px;
    display: flex;
    align-items: center;
    background-color: var(--color-bg);
    padding: 0 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--color-smoke);

    div:first-child {
      flex-grow: 1;
    }
  }

  .hero-headline {
    margin-bottom: 0;
  }

  .hero-content {
    p {
      margin-top: 0;
    }
  }

  .hero-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;

    /* Mobile: lange Button-Labels ("Mehr über unsere Leistungen") dürfen
       umbrechen. .btn ist global white-space:nowrap – das würde den Button
       (und damit hero-content) breiter als den Viewport machen. */
    @media (max-width: 767px) {
      .btn {
        white-space: normal;
      }
    }
  }

  .page-index {
    .hero-content {
      p {
        font-size: 1.3rem;
      }
    }
    .avatars, .percentage, .average {
      .box {
        width: auto;
        max-width: 300px;
        max-height: 212px;

        @media (max-width: 1199px) {
          max-height: unset;
        }

        @media (max-width: 767px) {
          max-width: unset;
          width: 100%;
        }
      }
    }
    .avatars .box {
      max-width: unset;
      
      @media (min-width: 1200px) {
        justify-self: center;
      }

      p, h4 {
        margin-top: 0;
        margin-bottom: 0;
      }
      img {
        padding: 10px;
        max-height: 70px;
        /* Breite/Höhe stehen als width/height-Attribute im HTML (gegen CLS).
           width:auto + height:auto lassen das Bild trotz max-height:70px sein
           Seitenverhältnis behalten – sonst würde die Attribut-Breite (1245px)
           erzwungen und das Bild verzerren. */
        width: auto;
        height: auto;
      }
    }
    .percentage, .average {
      .box {
        align-self: end;
        justify-self: end;

        p, h4 {
          margin-top: 0;
          margin-bottom: 0;
        }
      }
    }

    .average {
      @media (min-width: 1660px) {
        translate: 60px 0;
      }
    }

    .gridbox {
      .gridbox-item {
        padding: 1rem 1rem 1rem 6rem;
      
        @media (max-width: 1200px) {
          padding: 1rem;
        }
      }
    }

    .performance {
      a {
        padding-left: 0;
      }
    }
  }

  .page-fuer-unternehmen, .page-fuer-bewerber {
    .gridbox {
      .gridbox-item {
        padding: 1rem 1rem 1rem 1rem;
      
        @media (max-width: 1200px) {
          padding: 1rem;
        }
      }
    }

    @media (max-width: 1345px) {
      .gridbox-item:nth-child(2)::after {
        display: none !important;
      }
    }

    @media (max-width: 1199px) {
      .gridbox-item::after {
        display: none !important;
      }
    }
  }

  .title1, .title2 {
    align-self: self-start;
    margin-bottom: 0;
    
    strong {
      font-size: clamp(1.2rem, 2vw, 1.6rem);
      color: var(--color-primary);
      margin-bottom: 0;
    }
  }
  .wolfgang, .kaya {
    padding: 0 !important;
    align-self: stretch;

    img {
      aspect-ratio: 10/10;
      object-fit: cover;
      object-position: top;
    }
    .content {
      align-content: center;
      padding: 1rem;

      h4 {
        font-size: 2.1rem;
        line-height: 1;
      }
      p.role {
        font-size: 1.5rem;
        color: var(--color-primary);
      }
    }
  }

  .box.weg, .box.idee, .box.heute {
    align-self: stretch;
  }

  .address {
    li {
      display: flex;
      align-items: center;
      margin-bottom: 14px;
      padding-bottom: 14px;
      border-bottom: 1px solid var(--color-smoke);
      gap: 1rem;
    }
  }

  /** ANCHOR Footer */
  footer {
    background: var(--color-bg);
    color: var(--color-text);

    .container {
      max-width: var(--max-width);
      margin: 0 auto;
    }

    a {
      color: var(--color-muted);
      text-decoration: none;

      &:hover {
        color: var(--color-text);
      }
    }

    /** ANCHOR Partner Slider */
    .partner-band {
      background: var(--color-text);
      color: var(--color-bg);
      padding: 1.5rem var(--gap);

      .partner-slider {
        display: flex;
        align-items: center;
        gap: 2rem;
        max-width: var(--max-width);
        margin-inline: auto;

        /* Fixbereich (links): Eyebrow + Titel */
        .partner-fixed {
          flex: 0 0 auto;
          min-width: 170px;

          .partner-eyebrow {
            color: var(--color-primary);
            letter-spacing: 0.08em;
            text-transform: uppercase;
            margin: 0;
            font-size: 0.9rem;
          }

          .partner-title {
            font-size: 1.4rem;
            margin: 0;
            color: var(--color-bg);
          }
        }

        /* Sichtfenster (Mitte): schneidet überstehende Logos ab */
        .partner-viewport {
          flex: 1 1 auto;
          overflow: hidden;
          --gap: 3rem;
          touch-action: pan-y;
          /* Clipping des bewegten Tracks auf der GPU statt im Layout-Pfad. */
          transform: translateZ(0);

          /* Beim Hovern anhalten – aber NUR mit echtem Zeiger (Maus). Auf Touch
             bliebe der :hover-Zustand nach dem Antippen „kleben“ und das
             Karussell friert ein, bis man woanders hintippt. */
          @media (hover: hover) {
            &:hover .partner-track {
              animation-play-state: paused;
            }
          }

          .partner-track {
            display: flex;
            align-items: center;
            /* Abstand sitzt als margin an den Items (nicht als flex-gap),
               damit beide Hälften exakt gleich breit sind → -50% = nahtlos. */
            gap: 0;
            width: max-content;
            list-style: none;
            will-change: transform;
            backface-visibility: hidden;
            user-select: none;
            animation: partner-scroll 30s linear infinite;

            .partner-logo {
              flex: 0 0 auto;
              display: flex;
              align-items: center;
              gap: var(--gap);
              margin-inline-end: var(--gap);

              img {
                max-width: 170px;
                /* verhindert natives Bild-Dragging */
                pointer-events: none;
                -webkit-user-drag: none;
              }
            }
          }
        }

        /* Controls (rechts): Prev/Next-Buttons – vorerst ausgeblendet (Endlos-Karussell).
           Markup & Button-Styles bleiben erhalten; auf "flex" zurücksetzen = wieder aktiv. */
        .partner-controls {
          flex: 0 0 auto;
          display: none;
          gap: 0.5rem;

          .slider-btn {
            display: grid;
            place-items: center;
            margin: 0;
            padding: 0;
            width: 42px;
            height: 42px;
            border: none;
            border-radius: 50%;
            background: var(--color-primary);
            color: var(--color-bg);
            cursor: pointer;

            &:hover {
              opacity: 0.9;
            }

            &:disabled {
              opacity: 0.35;
              cursor: default;
            }
          }
        }

        /* Schmal: Band umbrechen, Fixbereich volle Breite */
        @media (max-width: 900px) {
          flex-wrap: wrap;
          justify-content: center;
          text-align: center;

          .partner-fixed {
            flex-basis: 100%;
          }
        }
      }
    }
  }
}

/* Endlos-Lauf des Partner-Karussells. Track ist doppelt befüllt → -50% schiebt
   exakt einen Logo-Satz weiter; danach springt die Animation nahtlos zurück. */
@keyframes partner-scroll {
  /* translate3d statt translateX → erzwingt GPU-Compositing (keine Main-Thread-
     Ruckler, kein Pixel-Snapping bei der langsamen Bewegung). */
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-50%, 0, 0); }
}

/* Barrierefreiheit: kein Dauerscrollen bei reduzierter Bewegung. */
@media (prefers-reduced-motion: reduce) {
  .partner-track { animation: none; }
}

/** Helperklassen */
@layer helpers {
  .smokybox {
    padding: 1rem;
    background-color: var(--color-smoke);
    border-left: 3px solid rgba(255,255,255,0.4);
    border-top: 2px solid rgba(255,255,255,0.25);
    border-right: 2px solid rgba(255,255,255,0.1);
    border-bottom: 2px solid rgba(255,255,255,0.06);
    border-radius: var(--radius);
    backdrop-filter: blur(6px);
  }

  .divider {
    width: 0px;
    height: 70px;
    border-right: 2px solid var(--color-gray);
  }

  /* Große Kennzahl (z. B. 800+, 570, 98%) */
  .size-lg {
    font-size: clamp(3rem, 4vw, 3rem);
    font-weight: 300;
    line-height: clamp(3rem, 4vw, 3rem);

    span {
      font-size: 0.5em;
    }
  }

  .stretch {
    align-self: stretch;
  }

  .start {
    justify-content: flex-start;
  }
}