/* Portfolio section heading, styled like the hero and the Kontakt page */

.hm-heading {
  position: relative;
  padding-top: 70px;
  overflow: hidden;
}

.hm-heading__ghost {
  position: absolute;
  top: 0;
  right: 0;
  font-family: "Bebas Neue", Arial, Helvetica, sans-serif;
  font-size: clamp(90px, 15vw, 210px);
  line-height: 0.8;
  letter-spacing: 2px;
  text-transform: uppercase;
  white-space: nowrap;
  color: transparent;
  -webkit-text-stroke: 1px rgba(192, 32, 42, 0.18);
  pointer-events: none;
  user-select: none;
}

.hm-heading__main {
  position: relative;
  z-index: 1;
}

.hm-heading__eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: #c0202a;
}

.hm-heading__eyebrow::before {
  content: "";
  width: 40px;
  height: 1px;
  background: #c0202a;
}

.hm-heading .hm-heading__title {
  margin: 0 !important;
  font-size: clamp(46px, 6vw, 84px) !important;
  line-height: 0.95 !important;
  letter-spacing: 1px;
  color: #121212 !important;
}

.hm-line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.04em;
}

.hm-line > span {
  display: inline-block;
}

.hm-outline {
  color: transparent;
  -webkit-text-stroke: 1.5px #121212;
}

.hm-heading__rule {
  display: block;
  width: 60px;
  height: 2px;
  margin-top: 22px;
  background: #c0202a;
  transform-origin: left center;
}

/* scroll-in reveal for the heading */
.hm-heading.hm-js .hm-heading__eyebrow {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.hm-heading.hm-js .hm-line > span {
  transform: translateY(105%);
  transition: transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.hm-heading.hm-js .hm-line:nth-child(2) > span { transition-delay: 0.12s; }

.hm-heading.hm-js .hm-heading__rule {
  transform: scaleX(0);
  transition: transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) 0.4s;
}

.hm-heading.hm-js .hm-heading__ghost {
  opacity: 0;
  transform: translateX(60px);
  transition: opacity 1.4s ease, transform 1.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.hm-heading.hm-js.is-visible .hm-heading__eyebrow,
.hm-heading.hm-js.is-visible .hm-line > span,
.hm-heading.hm-js.is-visible .hm-heading__rule,
.hm-heading.hm-js.is-visible .hm-heading__ghost {
  opacity: 1;
  transform: none;
}

/* on narrow screens the ghost word spans the full width, so push the
   heading below it instead of letting the two overlap */
@media (max-width: 991px) {
  .hm-heading { padding-top: calc(clamp(90px, 15vw, 210px) * 0.8 + 10px); }
}

/* Portfolio grid on the homepage: "camera viewfinder" tiles */

.hm-portfolio {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
  margin-top: 48px;
}

@media (max-width: 991px) {
  .hm-portfolio { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
}

@media (max-width: 599px) {
  .hm-portfolio { grid-template-columns: 1fr; gap: 16px; margin-top: 32px; }
}

.hm-tile,
.hm-tile:hover,
.hm-tile:focus {
  color: #fff;
  text-decoration: none;
}

.hm-tile {
  position: relative;
  display: block;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: #0d0d0d;
  isolation: isolate;
  container-type: inline-size;
}

.hm-tile:focus-visible {
  outline: 2px solid #c0202a;
  outline-offset: 4px;
}

/* scroll-in reveal (only hidden once JS confirms it can reveal them) */
.hm-portfolio.hm-js .hm-tile {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s cubic-bezier(0.2, 0.7, 0.2, 1), transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
  transition-delay: calc(var(--i) * 110ms);
}

.hm-portfolio.hm-js .hm-tile.is-visible {
  opacity: 1;
  transform: none;
}

.hm-tile__img {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transform: scale(1.02);
  filter: saturate(0.9);
  transition: transform 1.6s cubic-bezier(0.2, 0.7, 0.2, 1), filter 0.6s ease;
}

.hm-tile__shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(13, 13, 13, 0.9) 0%, rgba(13, 13, 13, 0.45) 45%, rgba(13, 13, 13, 0.05) 100%);
}

.hm-tile__shade::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(13, 13, 13, 0.45);
  opacity: 0;
  transition: opacity 0.5s ease;
}

/* viewfinder corners */
.hm-corner {
  position: absolute;
  width: 28px;
  height: 28px;
  border: 0 solid #fff;
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
  pointer-events: none;
}

.hm-corner--tl { top: 16px; left: 16px; border-top-width: 2px; border-left-width: 2px; transform: translate(-12px, -12px); }
.hm-corner--tr { top: 16px; right: 16px; border-top-width: 2px; border-right-width: 2px; transform: translate(12px, -12px); }
.hm-corner--bl { bottom: 16px; left: 16px; border-bottom-width: 2px; border-left-width: 2px; transform: translate(-12px, 12px); }
.hm-corner--br { bottom: 16px; right: 16px; border-bottom-width: 2px; border-right-width: 2px; transform: translate(12px, 12px); }

.hm-rec,
.hm-tc {
  position: absolute;
  top: 26px;
  font-size: 11px;
  line-height: 1;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.9);
  opacity: 0;
  transition: opacity 0.4s ease 0.15s;
  pointer-events: none;
}

.hm-rec {
  left: 30px;
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: Arial, Helvetica, sans-serif;
}

.hm-rec i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c0202a;
  box-shadow: 0 0 8px rgba(192, 32, 42, 0.9);
  animation: hm-blink 1s steps(1) infinite;
}

.hm-tc {
  right: 30px;
  font-family: "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  letter-spacing: 1px;
}

@keyframes hm-blink {
  50% { opacity: 0; }
}

.hm-tile__content {
  position: absolute;
  left: 36px;
  right: 36px;
  bottom: 34px;
  display: block;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.55);
}

.hm-tile__num {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #fff;
}

.hm-tile__num::before {
  content: "";
  width: 16px;
  height: 2px;
  background: #c0202a;
}

.hm-portfolio .hm-tile__title {
  margin: 6px 0 0 !important;
  font-size: clamp(30px, 2.6vw, 44px) !important;
  font-size: clamp(24px, 11cqi, 44px) !important; /* scale with the tile, not the window */
  line-height: 1 !important;
  color: #fff !important;
  letter-spacing: 1px;
  transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.hm-tile__cta {
  display: inline-block;
  margin-top: 12px;
  padding-bottom: 4px;
  border-bottom: 1px solid #c0202a;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s ease 0.1s, transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) 0.1s;
}

/* hover / keyboard focus state */
@media (hover: hover) {
  .hm-tile:hover .hm-tile__img { transform: scale(1.1); filter: saturate(1.05); }
  .hm-tile:hover .hm-tile__shade::after { opacity: 1; }
  .hm-tile:hover .hm-corner { opacity: 1; transform: none; }
  .hm-tile:hover .hm-rec,
  .hm-tile:hover .hm-tc { opacity: 1; }
  .hm-tile:hover .hm-tile__title { transform: translateY(-4px); }
  .hm-tile:hover .hm-tile__cta { opacity: 1; transform: none; }
}

.hm-tile:focus-visible .hm-tile__shade::after { opacity: 1; }
.hm-tile:focus-visible .hm-corner { opacity: 1; transform: none; }
.hm-tile:focus-visible .hm-rec,
.hm-tile:focus-visible .hm-tc { opacity: 1; }
.hm-tile:focus-visible .hm-tile__cta { opacity: 1; transform: none; }

/* touch devices have no hover: show the viewfinder frame permanently */
@media (hover: none) {
  .hm-corner { opacity: 0.9; transform: none; }
  .hm-rec { opacity: 1; }
  .hm-tile__cta { opacity: 1; transform: none; }
}

/* tighter spacing on small tiles (phones and the 2-column tablet layout) */
@container (max-width: 350px) {
  .hm-tile__content { left: 28px; right: 28px; bottom: 34px; }
  .hm-tile__cta { letter-spacing: 2px; }
  .hm-rec { left: 22px; top: 22px; }
  .hm-tc { right: 22px; top: 22px; }
  .hm-corner--tl, .hm-corner--tr { top: 12px; }
  .hm-corner--bl, .hm-corner--br { bottom: 12px; }
  .hm-corner--tl, .hm-corner--bl { left: 12px; }
  .hm-corner--tr, .hm-corner--br { right: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .hm-tile,
  .hm-tile * {
    transition: none !important;
    animation: none !important;
  }
}

/* a quieter version above the customer logo carousel: no ghost word, no rule,
   one smaller line with a red accent like the about-section headings */
.hm-heading--kunden {
  padding-top: 64px !important;
  margin-bottom: 44px;
}

.hm-heading--kunden .hm-heading__title {
  font-size: clamp(28px, 2.8vw, 40px) !important;
  line-height: 1.05 !important;
}

.hm-heading--kunden .hm-heading__title em {
  font-style: normal;
  color: #c0202a;
}

@media (max-width: 599px) {
  .hm-heading--kunden { padding-top: 40px !important; margin-bottom: 28px; }
}
