/**
 * Karriar archive card styling.
 *
 * DOM structure inside .wp-block-cover__inner-container:
 *   .wp-block-group.is-nowrap (OUTER info wrapper, has min-height:250px inline)
 *     .wp-block-group.is-vertical (INNER content group)
 *       h2.wp-block-post-title
 *       p.reachmee-card-location (injected via PHP filter)
 *       .wp-block-group.is-nowrap (deadline row — hide this one only)
 *     .wp-block-post-excerpt (hide)
 *
 * Cards: 3 per row desktop, 2 tablet, 1 mobile. Image (or logo fallback) is
 * 260px top; info fills the rest, centered.
 */

:root {
  --karriar-card-image-height: 260px;
  --karriar-card-min-height: 480px;
}

/* Hide excerpt */
.wp-block-post.type-karriar .wp-block-post-excerpt {
  display: none !important;
}

/* Hide deadline row — but ONLY the inner one (depth-2 nesting), not the
 * outer info wrapper which also has is-nowrap. */
.wp-block-post.type-karriar
  .wp-block-cover__inner-container
  > .wp-block-group
  > .wp-block-group
  > .wp-block-group.is-nowrap {
  display: none !important;
}

/* Card chrome */
.wp-block-post.type-karriar .wp-block-cover {
  padding: 0 !important;
  overflow: hidden;
  min-height: var(--karriar-card-min-height) !important;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Overlay link injected via PHP — covers the entire card */
.wp-block-post.type-karriar .reachmee-card-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: block;
  text-indent: -9999px;
  overflow: hidden;
}

/* Inner-container needs to be a positioning context for the overlay,
 * but the cover itself is already position:relative above. */
.wp-block-post.type-karriar .wp-block-cover__inner-container {
  position: relative;
}

/* Decorative bits don't need to receive clicks */
.wp-block-post.type-karriar:not(.has-post-thumbnail)
  .wp-block-cover__inner-container::before {
  pointer-events: none;
}

.wp-block-post.type-karriar .wp-block-cover__inner-container {
  display: flex !important;
  flex-direction: column;
  flex: 1 1 auto;
  padding: 0 !important;
  margin: 0 !important;
  max-width: none !important;
}

/* Featured image — fixed height to match fallback */
.wp-block-post.type-karriar .wp-block-post-featured-image {
  height: var(--karriar-card-image-height) !important;
  width: 100% !important;
  margin: 0 !important;
  aspect-ratio: auto !important;
  overflow: hidden;
  flex: 0 0 auto;
}

.wp-block-post.type-karriar .wp-block-post-featured-image a,
.wp-block-post.type-karriar .wp-block-post-featured-image img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border-radius: 0 !important;
}

/* Fallback header for cards without featured image */
.wp-block-post.type-karriar:not(.has-post-thumbnail)
  .wp-block-cover__inner-container::before {
  content: "";
  display: block;
  height: var(--karriar-card-image-height);
  width: 100%;
  flex: 0 0 auto;
  background-color: var(--wp--preset--color--primary-700, #2d5e8a);
  background-image: url("../../../themes/aroskapital/assets/src/images/patterns/aros-kapital-logo-white.svg");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 60% auto;
}

/* Outer info wrapper — kill its min-height:250px, center text block on Y.
 * Cards share the same height and location reserves consistent line-height,
 * so titles align across cards. */
.wp-block-post.type-karriar
  .wp-block-cover__inner-container
  > .wp-block-group {
  min-height: 0 !important;
  flex: 1 1 auto !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  text-align: center !important;
  padding: 1.5rem 1.25rem !important;
  width: 100%;
}

/* Inner content group */
.wp-block-post.type-karriar
  .wp-block-cover__inner-container
  > .wp-block-group
  > .wp-block-group {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  text-align: center !important;
  width: 100%;
  min-height: 0 !important;
}

/* Title */
.wp-block-post.type-karriar .wp-block-post-title {
  text-align: center !important;
  margin: 0 0 0.5rem 0 !important;
  font-weight: 600;
}

.wp-block-post.type-karriar .wp-block-post-title a {
  text-decoration: none;
  color: inherit;
}

/* Location — reserve height even when empty so cards align consistently */
.wp-block-post.type-karriar .reachmee-card-location {
  text-align: center !important;
  color: #666;
  font-size: 0.95rem;
  margin: 0 !important;
  min-height: 1.4em;
}

.wp-block-post.type-karriar .reachmee-card-location:empty::before {
  content: "\00a0"; /* non-breaking space to preserve line height */
}

/* Grid: 3 / 2 / 1 columns */
ul.wp-block-post-template:has(> li.wp-block-post.type-karriar) {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  list-style: none;
  padding: 0;
}

@media (max-width: 900px) {
  ul.wp-block-post-template:has(> li.wp-block-post.type-karriar) {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  ul.wp-block-post-template:has(> li.wp-block-post.type-karriar) {
    grid-template-columns: 1fr;
  }
}
