/* =============================================================================
   Henkilo Archive Page
   Styles for the AJAX-filtered henkilo archive (archive-henkilo.php).
============================================================================= */

/* Page body background */
.henkilo-archive-body {
  background-color: var(--wp--preset--color--rosa);
}

.henkilo-archive-wrap {
  max-width: 1460px;
  margin: 0 auto;
  padding: var(--wp--preset--spacing--60) var(--wp--preset--spacing--50);
}

/* =============================================================================
   Filter bar
============================================================================= */

.henkilo-filters {
  display: flex;
  gap: 16px;
  margin-bottom: var(--wp--preset--spacing--60);
  flex-wrap: wrap;
}

.henkilo-filter-select,
.henkilo-filter-search {
  flex: 1 1 200px;
  position: relative;
  min-width: 0;
}

/* --- Select --- */

.henkilo-filter-select select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--wp--preset--color--rosa-light);
  border: 1px solid rgba(0, 0, 0, 0.4);
  border-radius: 8px;
  padding: 0 48px 0 18px;
  height: 52px;
  font-family: var(--wp--preset--font-family--manrope);
  font-size: 18px;
  color: var(--wp--preset--color--primary-dark);
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}

.henkilo-filter-select select:focus {
  border-color: var(--wp--preset--color--primary);
  box-shadow: 0 0 0 2px rgba(7, 72, 168, 0.15);
}

.henkilo-filter-chevron {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--wp--preset--color--primary-dark);
  display: flex;
  align-items: center;
}

/* --- Search input --- */

.henkilo-filter-search input[type="search"] {
  width: 100%;
  background-color: var(--wp--preset--color--rosa-light);
  border: 1px solid rgba(0, 0, 0, 0.4);
  border-radius: 8px;
  padding: 0 48px 0 18px;
  height: 52px;
  font-family: var(--wp--preset--font-family--manrope);
  font-size: 18px;
  color: var(--wp--preset--color--primary-dark);
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}

.henkilo-filter-search input[type="search"]:focus {
  border-color: var(--wp--preset--color--primary);
  box-shadow: 0 0 0 2px rgba(7, 72, 168, 0.15);
}

.henkilo-filter-search input[type="search"]::placeholder {
  color: var(--wp--preset--color--muted);
}

.henkilo-filter-search input[type="search"]::-webkit-search-cancel-button {
  display: none;
}

.henkilo-search-icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--wp--preset--color--black);
  display: flex;
  align-items: center;
}

/* =============================================================================
   Reset button
============================================================================= */

.henkilo-filters-reset-wrap[hidden] {
  display: none;
}

.henkilo-filters-reset-wrap {
  display: flex;
  justify-content: center;
  margin-top: -8px; /* tighten gap below filters row */
  margin-bottom: var(--wp--preset--spacing--50);
}

.henkilo-reset-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1.5px solid var(--wp--preset--color--primary, #0748a8);
  border-radius: 6px;
  padding: 8px 22px;
  font-family: var(--wp--preset--font-family--manrope);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--wp--preset--color--primary, #0748a8);
  cursor: pointer;
  transition:
    background-color 0.2s,
    color 0.2s;
}

.henkilo-reset-btn:hover,
.henkilo-reset-btn:focus-visible {
  background-color: var(--wp--preset--color--primary, #0748a8);
  color: #fff;
  outline: none;
}

/* =============================================================================
   Results area
============================================================================= */

.henkilo-results {
  position: relative;
  transition: opacity 0.2s;
}

.henkilo-results.is-loading {
  opacity: 0.45;
  pointer-events: none;
}

.henkilo-no-results {
  text-align: center;
  color: var(--wp--preset--color--muted);
  padding: var(--wp--preset--spacing--70) 0;
  font-size: var(--wp--preset--font-size--large);
}

/* =============================================================================
   Group sections
============================================================================= */

.henkilo-group {
  margin-bottom: var(--wp--preset--spacing--80);
}

.henkilo-group:last-child {
  margin-bottom: 0;
}

.henkilo-group__title {
  font-family: var(--wp--preset--font-family--ppwatch);
  font-weight: 900;
  font-size: clamp(2rem, 5vw, 3rem);
  color: var(--wp--preset--color--primary-dark);
  text-align: center;
  margin: 0 0 var(--wp--preset--spacing--60);
  line-height: 1.1;
  text-transform: capitalize;
}

/* =============================================================================
   Card grid
============================================================================= */

.henkilo-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: center;
}

/* =============================================================================
   Henkilo card
============================================================================= */

.henkilo-card {
  background-color: var(--wp--preset--color--rosa-light);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 0 0 calc((100% - 48px) / 3);
  min-width: 0;
}

/* Image link wrapper */
.henkilo-card__img-wrap {
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background-color: var(--wp--preset--color--rosa);
  flex-shrink: 0;
  text-decoration: none;
}

.henkilo-card__img-wrap > a {
  display: block;
  width: 100%;
  height: 100%;
}

.henkilo-card__img-wrap img,
.henkilo-card__img-wrap .wp-post-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.henkilo-card:hover .henkilo-card__img-wrap img,
.henkilo-card:hover .henkilo-card__img-wrap .wp-post-image {
  transform: scale(1.03);
}

.henkilo-card__img-placeholder {
  width: 100%;
  height: 100%;
  background-color: var(--wp--preset--color--rosa);
}

/* Card text body */
.henkilo-card__body {
  font-family: var(--wp--preset--font-family--manrope);
  padding: 14px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

/* Name */
.henkilo-card__name {
  font-family: var(--wp--preset--font-family--manrope);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 2%;
  text-transform: uppercase;
  color: var(--wp--preset--color--primary-dark);
  margin: 0 0 3px;
  line-height: 1.5;
  transition: color 0.2s ease;
}

.henkilo-card__name a {
  color: inherit;
  text-decoration: none;
}

.henkilo-card__name a:hover {
  color: var(--wp--preset--color--primary);
}

/* Details: title, phone, email */
.henkilo-card__details {
  display: flex;
  flex-direction: column;
}

/* Title, phone, email */
.henkilo-card__title,
.henkilo-card__phone,
.henkilo-card__email {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 2%;
  color: var(--wp--preset--color--primary-dark);
}

.henkilo-card__phone a,
.henkilo-card__email a {
  color: var(--wp--preset--color--primary-dark);
  text-decoration: underline;
  transition: color 0.2s ease;
}

.henkilo-card__phone a:hover,
.henkilo-card__email a:hover {
  text-decoration: underline;
  color: var(--wp--preset--color--primary);
}

/* =============================================================================
   Responsive
============================================================================= */

@media (max-width: 960px) {
  .henkilo-card {
    flex: 0 0 calc(50% - 12px);
  }
}

@media (max-width: 768px) {
  .henkilo-archive-wrap {
    padding: var(--wp--preset--spacing--40) var(--wp--style--root--padding-right)
      var(--wp--preset--spacing--60) var(--wp--style--root--padding-left);
  }

  .henkilo-filters {
    flex-direction: column;
    gap: 12px;
    margin-bottom: var(--wp--preset--spacing--50);
  }

  .henkilo-filter-select,
  .henkilo-filter-search {
    flex: 1 1 auto;
  }

  .henkilo-grid {
    gap: 16px;
  }

  .henkilo-card {
    flex: 0 0 100%;
    flex-direction: row;
  }

  .henkilo-card__img-wrap {
    aspect-ratio: 1 / 1;
    max-width: 110px !important;
  }
}

/* Contact form */
#contact-form-group {
  opacity: 0;
  visibility: hidden;
  max-height: 0;
  overflow: hidden;
  transition:
    opacity 0.35s ease,
    max-height 0.35s ease,
    visibility 0s linear 0.35s;
}

#contact-form-group.is-open {
  opacity: 1;
  visibility: visible;
  max-height: 2000px;
  transition:
    opacity 0.35s ease,
    max-height 0.35s ease,
    visibility 0s linear 0s;
}
