/* ==========================================================================
   HEMFRY - Mehanizacija (page-specific; loaded after hemfry.css)
   ========================================================================== */

/* 01 Hero - full-bleed photo, machine kept in the upper band, copy on the ground */
.mech-hero {
  min-height: clamp(600px, 88svh, 880px);
  padding-bottom: clamp(40px, 5vw, 72px);
}
.mech-hero .page-hero__bg picture {
  height: 100%;
}
.mech-hero .page-hero__bg {
  --pos: 50% 100%;
}
.mech-hero .page-hero__bg::after {
  background:
    linear-gradient(
      0deg,
      rgba(17, 17, 17, 0.97) 0%,
      rgba(17, 17, 17, 0.9) 26%,
      rgba(17, 17, 17, 0.35) 50%,
      rgba(17, 17, 17, 0) 62%
    ),
    linear-gradient(180deg, rgba(17, 17, 17, 0.55) 0%, rgba(17, 17, 17, 0) 22%);
}
@media (min-width: 1600px) {
  .mech-hero .page-hero__bg {
    --pos: 50% 88%;
  }
}
@media (min-width: 1900px) {
  .mech-hero .page-hero__bg {
    --pos: 50% 78%;
  }
}

.mech-hero__top {
  position: absolute;
  top: calc(var(--header-h) + 24px);
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}
.page-hero--image .mech-hero__top .breadcrumb {
  position: static;
  margin-bottom: 0;
}
.mech-hero .breadcrumb a {
  color: rgba(245, 245, 242, 0.75);
}
.mech-hero__cap {
  color: rgba(245, 245, 242, 0.7);
}

.mech-hero .eyebrow {
  margin-bottom: 22px;
}
.mech-hero__title {
  font-size: clamp(2.5rem, 0.9rem + 5.4vw, 6.25rem);
}
.mech-hero__row {
  margin-top: clamp(28px, 3vw, 44px);
}
.mech-hero__lead {
  color: #d2d1ca;
  max-width: 36ch;
}

.mech-figures {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  row-gap: 20px;
}
.mech-figures > div + div {
  padding-left: 0;
  border-left: 0;
}
.mech-figures > div:nth-child(even) {
  padding-left: 20px;
  border-left: 1px solid var(--line);
}
.mech-figures .num {
  font-size: clamp(1.875rem, 1.2rem + 1.9vw, 3rem);
  white-space: nowrap;
}
.mech-figures .num sup {
  color: var(--accent);
}
@media (min-width: 700px) {
  .mech-figures {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .mech-figures > div + div {
    padding-left: 20px;
    border-left: 1px solid var(--line);
  }
}

/* Below desktop the photo becomes a block above the copy, so the machine is never covered */
@media (max-width: 1099px) {
  .mech-hero {
    min-height: 0;
    padding-top: 0;
  }
  .mech-hero .page-hero__bg {
    position: relative;
    inset: auto;
    z-index: 0;
    height: clamp(440px, 62vw, 640px);
    margin-bottom: -150px;
    --pos: 50% 18%;
  }
  .mech-hero__inner {
    position: relative;
    z-index: 1;
  }
}
@media (max-width: 699px) {
  .mech-hero .page-hero__bg {
    height: 440px;
    --pos: 78% 50%;
  }
  .mech-hero .page-hero__bg::after {
    background:
      linear-gradient(
        0deg,
        rgba(17, 17, 17, 1) 0%,
        rgba(17, 17, 17, 0.72) 22%,
        rgba(17, 17, 17, 0) 48%
      ),
      linear-gradient(180deg, rgba(17, 17, 17, 0.7) 0%, rgba(17, 17, 17, 0) 34%);
  }
  .mech-hero__top {
    top: calc(var(--header-h) + 14px);
  }
  .mech-hero__lead {
    font-size: 1.0625rem;
  }
}

/* 02 Filter bar */
.mech-filter {
  margin-bottom: clamp(32px, 4vw, 56px);
}

/* 03 Machine grid - 1 / 2 / 3 columns, feature cards span two */
.mgrid {
  container-type: inline-size;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 56px var(--gap);
}
.mgrid > [hidden] {
  display: none !important;
} /* .machine-card sets display:flex, which would beat [hidden] */
.mgrid .machine-card--feature {
  grid-column: auto;
}
@media (min-width: 700px) {
  .mgrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-flow: row dense;
    row-gap: 64px;
  }
  .mgrid .machine-card--feature {
    grid-column: span 2;
  }
}
@media (min-width: 1100px) {
  .mgrid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    row-gap: 80px;
  }
  /* In the full view, the portrait-friendly partner matches the feature photo height (16:9 across two columns) */
  .mgrid:not(:has(> [data-cat][hidden])) .machine-card--tall .media {
    aspect-ratio: auto;
    height: calc(((100cqw - 2 * var(--gap)) / 3 * 2 + var(--gap)) * 0.5625);
  }
  .mgrid .machine-card--feature .machine-card__specs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: var(--gap);
  }
  .mgrid .machine-card--feature .machine-card__name {
    font-size: clamp(1.5rem, 1.1rem + 0.8vw, 2rem);
  }
}
/* Filtered view: calm, uniform 4:3 catalogue */
.mgrid:has(> [data-cat][hidden]) .machine-card--feature {
  grid-column: auto;
}
.mgrid:has(> [data-cat][hidden]) .machine-card--feature .media {
  aspect-ratio: 4 / 3;
}
.mgrid:has(> [data-cat][hidden]) .machine-card--feature .machine-card__specs {
  display: block;
}
.mgrid:has(> [data-cat][hidden]) .machine-card--feature .machine-card__name {
  font-size: 1.375rem;
}

.mc .machine-card__cat {
  margin-bottom: 10px;
}
@media (max-width: 699px) {
  .mgrid .machine-card--tall .media {
    aspect-ratio: 1;
  }
} /* portrait photos: keep boom / crane in frame */
.mc__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 22px;
}
.mc .machine-card__model {
  max-width: 40ch;
}
.mc .machine-card__specs {
  margin-top: auto;
} /* specs sit on a shared baseline across a row */
.mc .machine-card__specs div {
  align-items: baseline;
}

/* Text-only type plate (no photo yet) */
.mc-plate {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0 20px 18px;
  background: var(--ink);
  color: var(--paper);
}
.mc-plate .chevrons {
  display: block;
  margin: 0 -20px;
}
.mc-plate__label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  color: #a3a29b;
}
.mc-plate__num {
  font-family: var(--font-display);
  font-stretch: 112%;
  font-weight: 720;
  font-size: clamp(4.5rem, 3rem + 5vw, 8rem);
  letter-spacing: -0.05em;
  line-height: 0.86;
  display: flex;
  align-items: flex-start;
}
.mc-plate__num sup {
  font-size: 0.34em;
  line-height: 1;
  color: var(--accent);
  letter-spacing: -0.01em;
  margin: 0.12em 0 0 0.08em;
}
.mc-plate__foot {
  color: #6f6e68;
}
a:hover .mc-plate__num {
  color: #fff;
}

/* Closing tile inside the grid */
.mc-cta {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  padding: 32px clamp(20px, 2.4vw, 40px) clamp(24px, 2.4vw, 36px);
  border-radius: var(--r-xs);
  overflow: hidden;
}
.mc-cta {
  isolation: isolate;
}
.mc-cta .chevrons {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
}
.mc-cta__bg {
  position: absolute;
  inset: 0;
  z-index: -1;
}
.mc-cta__bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 40%;
  filter: grayscale(1) contrast(1.1);
  opacity: 0.3;
  transition: transform 1.4s var(--ease);
}
.mc-cta__bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(17, 17, 17, 0.96) 25%,
    rgba(17, 17, 17, 0.55) 100%
  );
}
.mc-cta:hover .mc-cta__bg img {
  transform: scale(1.04);
}
.mc-cta__title {
  margin-top: 14px;
  font-family: var(--font-display);
  font-stretch: 112%;
  font-weight: 680;
  font-size: clamp(1.5rem, 1.1rem + 1.2vw, 2.5rem);
  letter-spacing: -0.025em;
  line-height: 1.05;
  max-width: 28ch;
  text-wrap: balance;
}
.mc-cta__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px 32px;
}
.mc-cta__foot .small {
  max-width: 36ch;
}
@media (min-width: 1100px) {
  .mgrid:not(:has(> [data-cat][hidden])) .mc-cta {
    grid-column: span 2;
  }
}
.mgrid.is-empty .mc-cta {
  display: none;
}

/* Empty state */
.mgrid__empty {
  display: none;
  grid-column: 1 / -1;
  padding: 40px 0 8px;
  border-top: 1px solid var(--line);
  max-width: 640px;
}
.mgrid.is-empty .mgrid__empty {
  display: block;
}

/* 04 Machines ↔ services map */
.svc-map {
  border-top: 1px solid var(--ink);
}
@media (max-width: 1099px) {
  .svc-map {
    margin-top: 48px;
  }
}
.svc-map__row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 6px 16px;
  align-items: center;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
  transition: padding var(--t) var(--ease);
}
.svc-map__idx {
  color: var(--fg-faint);
  grid-row: 1 / span 2;
  align-self: start;
  padding-top: 6px;
}
.svc-map__name {
  font-family: var(--font-display);
  font-stretch: 112%;
  font-weight: 660;
  font-size: clamp(1.25rem, 1.05rem + 0.7vw, 1.75rem);
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.svc-map__machines {
  grid-column: 2;
  font-size: var(--fs-small);
  color: var(--fg-muted);
}
.svc-map .arrow-box {
  grid-column: 3;
  grid-row: 1 / span 2;
}
@media (min-width: 700px) {
  .svc-map__row {
    grid-template-columns: 48px minmax(0, 0.9fr) minmax(0, 1.1fr) auto;
    min-height: 96px;
  }
  .svc-map__idx {
    grid-row: auto;
    align-self: center;
    padding-top: 0;
  }
  .svc-map__machines {
    grid-column: 3;
  }
  .svc-map .arrow-box {
    grid-column: 4;
    grid-row: auto;
  }
  .svc-map__row:hover {
    padding-left: 12px;
  }
}
