/* ==========================================================================
   TM GmbH — Homepage-only redesign (catalog / editorial style)
   Loaded ONLY on index.html (see <link> in index.html <head>) — every rule
   in this file is therefore automatically scoped to the homepage and can
   never affect about/services/markets/blog/contact or the /en pages.
   Reuses the exact color tokens defined in style.css — no new colors,
   no content changes. Only how those colors are distributed across the
   layout changes: full-bleed bands and seamless grids instead of
   floating, shadowed, heavily-rounded cards.
   ========================================================================== */

/* ---------- Hero: full-bleed two-tone split band ---------- */
.hero.hero-split {
  padding: 0;
  overflow: hidden;
}
.hero.hero-split .hero-bg { display: none; }

.hero-content.hero-content-split.hero-split-bleed {
  max-width: none;
  margin: 0;
  padding: 0;
  gap: 0;
  grid-template-columns: 1.15fr 0.85fr;
  align-items: stretch;
  background: var(--surface);
}
.hero-split-bleed .hero-text {
  max-width: 560px;
  padding: 150px clamp(24px, 5vw, 64px) 90px clamp(24px, 6vw, 96px);
}
.hero-split-bleed .btn-hero-cta { border-radius: 4px; }

.hero-split-bleed .hero-visual {
  position: relative;
  min-height: 480px;
  background: var(--bg-tint-blue);
  overflow: hidden;
}

/* ---------- Hero visual: two-column vertical brand gallery — one column
   drifts upward, the other downward, in parallel, looping endlessly.
   Each column's tile list is duplicated once so translateY(-50%) lines
   up perfectly with the start for a seamless loop. ---------- */
.hero-gallery {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  gap: 16px;
  padding: 36px 28px;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 72px, #000 calc(100% - 72px), transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 72px, #000 calc(100% - 72px), transparent 100%);
}
.hero-gallery-col { flex: 1; overflow: hidden; height: 100%; }
.hero-gallery-track { display: flex; flex-direction: column; gap: 16px; will-change: transform; }
.hero-gallery-col-up .hero-gallery-track { animation: heroGalleryScroll 36s linear infinite; }
.hero-gallery-col-down .hero-gallery-track { animation: heroGalleryScroll 36s linear infinite reverse; }
@keyframes heroGalleryScroll { from { transform: translateY(0); } to { transform: translateY(-50%); } }
/* Anhalten wie beim Laufband unten: solange der Zeiger ueber der Spalte
   steht, eine Kachel den Fokus hat, nach einem Tippen (Klasse aus
   main.js) oder solange das Marken-Fenster offen ist. Das Weiterlaufen
   danach passiert von selbst an derselben Stelle, weil nur der
   play-state wechselt und nicht die Animation neu startet. */
.hero-gallery-col:hover .hero-gallery-track,
.hero-gallery-col:focus-within .hero-gallery-track,
.hero-gallery-col.is-touch-paused .hero-gallery-track,
html.is-modal-open .hero-gallery-track { animation-play-state: paused; }

.hero-gallery-tile {
  flex-shrink: 0;
  width: 100%;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-shadow: 0 10px 26px rgba(20,52,68,0.14);
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
/* Anfassbar machen: leichtes Anheben zeigt, dass die Kachel das
   Marken-Fenster oeffnet. */
.hero-gallery-tile:hover,
.hero-gallery-tile:focus-visible {
  transform: scale(1.03);
  box-shadow: 0 16px 34px rgba(20,52,68,0.22);
}
.hero-gallery-tile:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
.hero-gallery-tile img { max-width: 76%; max-height: 58%; width: auto; height: auto; object-fit: contain; }

/* Photo tiles: real product shots (already fully styled/lit) fill the
   whole card edge-to-edge instead of floating on a tint background. */
.hero-gallery-tile-photo { padding: 0; overflow: hidden; }
.hero-gallery-tile-photo img { width: 100%; height: 100%; max-width: 100%; max-height: 100%; object-fit: cover; }
.hero-gallery-tile:nth-child(5n+1) { height: 178px; }
.hero-gallery-tile:nth-child(5n+2) { height: 132px; }
.hero-gallery-tile:nth-child(5n+3) { height: 198px; }
.hero-gallery-tile:nth-child(5n+4) { height: 150px; }
.hero-gallery-tile:nth-child(5n+5) { height: 168px; }

.hero-gallery-tile[data-tint="rosental"],  .portfolio-marquee-tile[data-tint="rosental"]  { background: linear-gradient(135deg, #FCF4E3, #F4E7CE); }
.hero-gallery-tile[data-tint="kamill"],    .portfolio-marquee-tile[data-tint="kamill"]    { background: linear-gradient(135deg, #EAF3E1, #D9E9C7); }
.hero-gallery-tile[data-tint="simplicol"], .portfolio-marquee-tile[data-tint="simplicol"] { background: linear-gradient(135deg, #FDEAF0, #F7D9E2); }
.hero-gallery-tile[data-tint="poliboy"],   .portfolio-marquee-tile[data-tint="poliboy"]   { background: linear-gradient(135deg, #F6E7DE, #E9C9B7); }
.hero-gallery-tile[data-tint="meentzen"],  .portfolio-marquee-tile[data-tint="meentzen"]  { background: linear-gradient(135deg, #E9F0E4, #D3E3C9); }
.hero-gallery-tile[data-tint="burti"],     .portfolio-marquee-tile[data-tint="burti"]     { background: linear-gradient(135deg, #E8F0FB, #CFE0F5); }
.hero-gallery-tile[data-tint="gama"],      .portfolio-marquee-tile[data-tint="gama"]      { background: linear-gradient(135deg, #FDECE0, #F8D2B8); }
.hero-gallery-tile[data-tint="glysolid"],  .portfolio-marquee-tile[data-tint="glysolid"]  { background: linear-gradient(135deg, #E7F1F7, #CFE3EE); }
.hero-gallery-tile[data-tint="glysomed"],  .portfolio-marquee-tile[data-tint="glysomed"]  { background: linear-gradient(135deg, #F1ECF7, #DED0EC); }
.hero-gallery-tile[data-tint="heitmann"],  .portfolio-marquee-tile[data-tint="heitmann"]  { background: linear-gradient(135deg, #EAF5EE, #D3E9DA); }
.hero-gallery-tile[data-tint="milwa"],     .portfolio-marquee-tile[data-tint="milwa"]     { background: linear-gradient(135deg, #FBF3DE, #F3E4B8); }

@media (prefers-reduced-motion: reduce) {
  .hero-gallery-col-up .hero-gallery-track,
  .hero-gallery-col-down .hero-gallery-track { animation: none; }
}

@media (max-width: 900px) {
  .hero-content.hero-content-split.hero-split-bleed { grid-template-columns: 1fr; }
  .hero-split-bleed .hero-text { max-width: 100%; padding: 90px 24px 48px; }
  .hero-split-bleed .hero-visual { display: block; min-height: 340px; }
}
@media (max-width: 560px) {
  .hero-gallery-tile:nth-child(5n+1) { height: 148px; }
  .hero-gallery-tile:nth-child(5n+2) { height: 112px; }
  .hero-gallery-tile:nth-child(5n+3) { height: 164px; }
  .hero-gallery-tile:nth-child(5n+4) { height: 126px; }
  .hero-gallery-tile:nth-child(5n+5) { height: 140px; }
}

/* ---------- Support grid section: uses the base dark-panel styling from
   style.css as-is (hairline card grid) — no homepage-only override needed. ---------- */

/* ---------- Product category grid: four compact cards in one row.
   Deliberately the same card language as the about.html key-figure deck
   (.about-stat-card in style.css): white, 2px green hairline, 4px radius,
   hover lift. Only the hover differs — these keep their white ground
   instead of flipping to green, because each card's whole point is the
   coloured illustration sitting on it.

   Height comes from .category-media's aspect-ratio, not from a fixed
   pixel height: the media block then scales with the column width and
   the body absorbs the per-card difference in copy length, so all four
   cards stay exactly the same size at every viewport. ---------- */
.category-grid {
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  background: none;
  border-radius: 0;
  overflow: visible;
}
.category-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 2px solid var(--green);
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(20, 30, 20, 0.05);
  overflow: hidden;
}
.category-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
  border-color: var(--green);
  background: var(--surface);
}
.category-media {
  flex: none;
  height: auto;
  aspect-ratio: 1 / 0.62;
  background: var(--surface);
  padding: 16px 16px 2px;
  box-sizing: border-box;
}
.category-body {
  flex: 1 1 auto;
  padding: 0 20px 22px;
}
.category-card h3 { font-size: 17px; margin: 0 0 7px; }
.category-card p { font-size: 13.5px; line-height: 1.55; }

/* 1100px: 2×2 — matches the .about-stats breakpoint, same card deck idea */
@media (max-width: 1100px) {
  .category-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; }
}
@media (max-width: 640px) {
  .category-grid { grid-template-columns: 1fr; }
  .category-media { aspect-ratio: 1 / 0.44; }
}

/* ---------- Portfolio: two-row horizontal product gallery — top row
   drifts left, bottom row drifts right, in parallel, looping endlessly.
   Same seamless-loop technique as .hero-gallery above (each row's tile
   list is duplicated once so translateX(-50%) lines up with the start),
   just turned 90°: rows instead of columns, X instead of Y. ---------- */
.portfolio-marquee {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 8px;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 56px, #000 calc(100% - 56px), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 56px, #000 calc(100% - 56px), transparent 100%);
}
.portfolio-marquee-row { overflow: hidden; width: 100%; }
/* Driven by JS (main.js: initPortfolioMarquee) via rAF, not a CSS
   @keyframes animation — a CSS animation here was prone to silently
   stalling on one row after the tile images finished decoding (a
   compositor-layer quirk), while the JS version recomputes both rows'
   translateX from the same per-frame loop so neither can desync. */
.portfolio-marquee-track { display: flex; flex-direction: row; gap: 20px; width: max-content; }

.portfolio-marquee-tile {
  flex-shrink: 0;
  display: block;
  height: 210px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 10px 26px rgba(20,52,68,0.14);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.portfolio-marquee-tile { cursor: pointer; }
.portfolio-marquee-tile:hover,
.portfolio-marquee-tile:focus-visible { transform: scale(1.03) translateY(-4px); box-shadow: 0 16px 34px rgba(20,52,68,0.2); }
.portfolio-marquee-tile:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
.portfolio-marquee-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.portfolio-marquee-tile:nth-child(6n+1) { width: 260px; }
.portfolio-marquee-tile:nth-child(6n+2) { width: 190px; }
.portfolio-marquee-tile:nth-child(6n+3) { width: 230px; }
.portfolio-marquee-tile:nth-child(6n+4) { width: 200px; }
.portfolio-marquee-tile:nth-child(6n+5) { width: 250px; }
.portfolio-marquee-tile:nth-child(6n+6) { width: 210px; }

@media (max-width: 700px) {
  .portfolio-marquee { gap: 12px; }
  .portfolio-marquee-tile { height: 140px; }
}

/* ---------- Blog teaser: wide stacked horizontal bars, image left ---------- */
.blog-grid {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.blog-card {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  border-radius: 0;
  transition: background 0.25s ease;
}
.blog-card:hover {
  transform: none;
  box-shadow: none;
  background: var(--bg-subtle);
}
.blog-card-img {
  flex: 0 0 300px;
  border-radius: 0;
  align-self: stretch;
  height: auto;
}
.blog-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 32px 36px;
}
.blog-card-body h3 { font-size: 21px; }
.blog-card-body p { font-size: 15px; }
.blog-card-body .teaser-link {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
}
@media (max-width: 780px) {
  .blog-card { flex-direction: column; }
  .blog-card-img { flex: 0 0 auto; width: 100%; height: 170px; }
  .blog-card-body { padding: 24px; }
}

/* ---------- CTA band: warehouse photo (same shot as "Über uns") behind
   the brand gradient instead of a flat fill — homepage only. ---------- */
.cta-band-photo {
  background:
    linear-gradient(120deg, rgba(20,45,32,0.86) 0%, rgba(14,42,62,0.86) 100%),
    url('assets/cta-lagerhalle.jpg') center / cover no-repeat;
}
