/* Jobs tiles — replaces cvread-connect/assets/css/jobs_vignette.css.
   Renders a flex/grid of clickable tiles; in carousel mode the row scrolls
   horizontally with prev/next arrows added by jobs.js. */

.jobcontainer {
  position: relative;
  margin: 0 25px;
}

/* When the container hosts a carousel, reserve horizontal padding so the
   prev/next arrows can sit OUTSIDE the tile area. */
.jobcontainer:has(.jobs-mode-carousel) {
  padding: 0 60px;
}
@media (max-width: 890px) {
  .jobcontainer:has(.jobs-mode-carousel) {
    padding: 0 40px;
  }
}

.jobs-tiles {
  display: flex;
  flex-wrap: wrap;
  flex-direction: row;
  justify-content: flex-start;
  align-items: stretch;
  gap: 8px;
}

/* Carousel mode: single-row horizontal scroll, scroll-snap to tile width.
   Scrollbar is hidden — navigation happens via the prev/next arrows
   (still scrollable by touchpad / shift+wheel for accessibility). */
.jobs-tiles.jobs-mode-carousel {
  flex-wrap: nowrap;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;        /* Firefox */
  -ms-overflow-style: none;     /* IE / legacy Edge */
}

.jobs-tiles.jobs-mode-carousel::-webkit-scrollbar {
  display: none;                /* Chrome / Safari / new Edge */
}

/* Tile basic layout (matches the original .item from the WP plugin).
   We split sizing rules between modes: grid uses flex-basis (% works fine
   in a wrapping container), carousel uses explicit width because % on
   flex-basis inside an overflow-x:auto flex container is unreliable. */
.jobs-tiles .item {
  max-width: 535px;
  min-height: 500px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
  padding: 50px 0;
  color: #fff;
  font-family: "Roboto", -apple-system, "Segoe UI", Arial, sans-serif;
  cursor: pointer;
  overflow: hidden;
  text-decoration: none;
  scroll-snap-align: start;
  transition: background-size 0.2s linear;
}

/* Grid mode (careers page) — tiles wrap into rows */
.jobs-tiles.jobs-mode-grid .item {
  flex: 0 0 calc(33.333% - 6px);
}
@media (max-width: 1280px) {
  .jobs-tiles.jobs-mode-grid .item { flex-basis: calc(50% - 4px); }
}
@media (max-width: 890px) {
  .jobs-tiles.jobs-mode-grid .item {
    flex-basis: 100%;
    min-height: 380px;
  }
}

/* Carousel mode (home) — tiles in a single horizontally scrollable row.
   Using width + min-width keeps tiles sized predictably even when the
   container's scroll-width exceeds its visible width. */
.jobs-tiles.jobs-mode-carousel .item {
  flex: 0 0 auto;
  width: calc(33.333% - 6px);
  min-width: 300px;
}
@media (max-width: 1280px) {
  .jobs-tiles.jobs-mode-carousel .item { width: calc(50% - 4px); }
}
@media (max-width: 890px) {
  .jobs-tiles.jobs-mode-carousel .item {
    width: 86%;
    min-width: 260px;
    min-height: 380px;
  }
}

.jobs-tiles .item:hover { background-size: 130%; }

/* Top-down blue gradient (default state) */
.jobs-tiles .item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0, 76, 114, 0.5) 0%, rgba(0, 0, 0, 0) 100%);
  z-index: 1;
  transition: all 0.4s ease-in-out;
}

/* Hover: cyan tint */
.jobs-tiles .item::after {
  content: '';
  position: absolute;
  inset: 0;
  background-color: rgba(0, 144, 212, 0);
  z-index: 1;
  transition: all 0.4s ease-in-out;
}
.jobs-tiles .item:hover::after { background-color: rgba(0, 144, 212, 0.7); }
.jobs-tiles .item:hover::before { background-color: transparent; }

/* Per-tile gradient variants (cycled by JS via gradient-0/1/2 classes) */
.jobs-tiles .gradient-0::before {
  background: linear-gradient(to bottom, rgba(147, 207, 114, 0.55) 0%, rgba(0, 0, 0, 0) 100%);
}
.jobs-tiles .gradient-1::before {
  background: linear-gradient(to bottom, rgba(0, 76, 114, 0.55) 0%, rgba(0, 0, 0, 0) 100%);
}
.jobs-tiles .gradient-2::before {
  background: linear-gradient(to bottom, rgba(130, 70, 174, 0.55) 0%, rgba(0, 0, 0, 0) 100%);
}

.jobs-tiles .text-container {
  position: absolute;
  bottom: 30px;
  left: 30px;
  right: 30px;
  z-index: 2;
}

.jobs-tiles .text-container .jobtitle {
  font-size: 25px;
  font-weight: 300;
  color: #fff;
  margin-bottom: 14px;
  line-height: 1.2;
}

.jobs-tiles .text-container .country {
  display: inline-block;
  font-size: 16px;
  color: #fff;
  border: 1px solid #fff;
  border-radius: 999px;
  padding: 5px 22px;
  margin-top: 4px;
}

/* Loading / empty / error states */
.jobs-tiles .jobs-loading,
.jobs-tiles .jobs-empty,
.jobs-tiles .jobs-error {
  flex: 1 1 100%;
  text-align: center;
  padding: 40px 20px;
  font-family: "Roboto", sans-serif;
  color: #004C72;
}
.jobs-tiles .jobs-error { color: #a00; }

/* Carousel arrows (added at runtime by jobs.js) — positioned inside the
   horizontal padding reserved on .jobcontainer, so they never overlap a tile. */
.jobcontainer .jobs-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: rgba(255, 255, 255, 0.95);
  color: #0090d4;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  z-index: 10;
  transition: opacity 0.2s, background 0.2s, box-shadow 0.2s;
}
.jobcontainer .jobs-arrow:hover {
  background: #0090d4;
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.jobcontainer .jobs-arrow:disabled {
  opacity: 0.3;
  cursor: default;
  background: rgba(255, 255, 255, 0.6);
  color: #0090d4;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
.jobcontainer .jobs-arrow-prev { left: 8px; }
.jobcontainer .jobs-arrow-next { right: 8px; }
@media (max-width: 890px) {
  .jobcontainer .jobs-arrow {
    width: 36px;
    height: 36px;
    font-size: 26px;
  }
}
