/**
 * Haft volunteer team — small additions on top of Kindflow
 * (kindflow-template.webflow — .volunteer-section, .volunteer-post-area, etc.)
 */

/* ——— Transition: volunteer-cta-section (in .ck-content) → team grid ——— */
.haft-volunteers-from-cta-flow {
  position: relative;
  overflow: visible;
  /* Pull up into Kindflow’s .volunteer-cta-section padding-bottom (120px) */
  margin-top: -88px;
}

/* Tighter top on team block inside this flow only (Kindflow default is 120px) */
.haft-volunteers-from-cta-flow .volunteer-section.haft-volunteer-team-plugin {
  padding-top: 28px;
  padding-bottom: 96px;
}

.haft-volunteers-from-cta-flow .volunteer-post-area {
  margin-top: 28px;
}

.haft-volunteers-cta-bridge {
  position: relative;
  height: 28px;
  margin: 0 auto;
  max-width: 940px;
  pointer-events: none;
}

@media screen and (max-width: 767px) {
  .haft-volunteers-from-cta-flow {
    margin-top: -56px;
  }

  .haft-volunteers-from-cta-flow .volunteer-section.haft-volunteer-team-plugin {
    padding-top: 20px;
    padding-bottom: 80px;
  }

  .haft-volunteers-from-cta-flow .volunteer-post-area {
    margin-top: 22px;
  }
}

.haft-volunteers-cta-bridge__line {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(82%, 720px);
  height: 3px;
  margin-top: -1.5px;
  margin-left: 0;
  transform: translateX(-50%) scaleX(0);
  transform-origin: center;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(21, 65, 104, 0.15) 15%,
    var(--color--secondary-color, #154168) 50%,
    rgba(21, 65, 104, 0.15) 85%,
    transparent 100%
  );
  opacity: 0;
  transition:
    transform 1s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.55s ease;
}

.haft-volunteers-from-cta-flow.is-haft-flow-visible .haft-volunteers-cta-bridge__line {
  transform: translateX(-50%) scaleX(1);
  opacity: 1;
}

.haft-volunteers-cta-bridge__particles {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(90%, 800px);
  height: 24px;
  transform: translate(-50%, -50%);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 8%;
  opacity: 0;
  transition: opacity 0.6s ease 0.35s;
}

.haft-volunteers-cta-bridge__particles span {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color--secondary-color, #154168);
  transform: scale(0);
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.haft-volunteers-cta-bridge__particles span:nth-child(1) {
  transition-delay: 0.5s;
}
.haft-volunteers-cta-bridge__particles span:nth-child(2) {
  transition-delay: 0.62s;
}
.haft-volunteers-cta-bridge__particles span:nth-child(3) {
  transition-delay: 0.74s;
}

.haft-volunteers-from-cta-flow.is-haft-flow-visible .haft-volunteers-cta-bridge__particles {
  opacity: 1;
}

.haft-volunteers-from-cta-flow.is-haft-flow-visible .haft-volunteers-cta-bridge__particles span {
  transform: scale(1);
}

/* Team block: reveal after CTA bridge (scroll) */
html.haft-vol-scroll-ok .haft-volunteers-from-cta-flow:not(.is-haft-flow-visible) .haft-volunteer-team-plugin {
  opacity: 0;
  transform: translateY(36px);
}

html.haft-vol-scroll-ok .haft-volunteers-from-cta-flow.is-haft-flow-visible .haft-volunteer-team-plugin {
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 0.9s ease 0.12s,
    transform 0.95s cubic-bezier(0.22, 1, 0.36, 1) 0.12s;
}

/* Stagger volunteer cards */
html.haft-vol-scroll-ok .haft-volunteers-from-cta-flow:not(.is-haft-flow-visible) .volunteer-post-item {
  opacity: 0;
  transform: translateY(20px);
}

html.haft-vol-scroll-ok .haft-volunteers-from-cta-flow.is-haft-flow-visible .volunteer-post-item {
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 0.55s ease,
    transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

html.haft-vol-scroll-ok .haft-volunteers-from-cta-flow.is-haft-flow-visible .volunteer-post-item:nth-child(1) {
  transition-delay: 0.2s;
}
html.haft-vol-scroll-ok .haft-volunteers-from-cta-flow.is-haft-flow-visible .volunteer-post-item:nth-child(2) {
  transition-delay: 0.28s;
}
html.haft-vol-scroll-ok .haft-volunteers-from-cta-flow.is-haft-flow-visible .volunteer-post-item:nth-child(3) {
  transition-delay: 0.36s;
}
html.haft-vol-scroll-ok .haft-volunteers-from-cta-flow.is-haft-flow-visible .volunteer-post-item:nth-child(4) {
  transition-delay: 0.44s;
}
html.haft-vol-scroll-ok .haft-volunteers-from-cta-flow.is-haft-flow-visible .volunteer-post-item:nth-child(5) {
  transition-delay: 0.52s;
}
html.haft-vol-scroll-ok .haft-volunteers-from-cta-flow.is-haft-flow-visible .volunteer-post-item:nth-child(6) {
  transition-delay: 0.6s;
}
html.haft-vol-scroll-ok .haft-volunteers-from-cta-flow.is-haft-flow-visible .volunteer-post-item:nth-child(7) {
  transition-delay: 0.68s;
}
html.haft-vol-scroll-ok .haft-volunteers-from-cta-flow.is-haft-flow-visible .volunteer-post-item:nth-child(8) {
  transition-delay: 0.76s;
}
html.haft-vol-scroll-ok .haft-volunteers-from-cta-flow.is-haft-flow-visible .volunteer-post-item:nth-child(9) {
  transition-delay: 0.84s;
}
html.haft-vol-scroll-ok .haft-volunteers-from-cta-flow.is-haft-flow-visible .volunteer-post-item:nth-child(10) {
  transition-delay: 0.92s;
}
html.haft-vol-scroll-ok .haft-volunteers-from-cta-flow.is-haft-flow-visible .volunteer-post-item:nth-child(n + 11) {
  transition-delay: 1s;
}

@media (prefers-reduced-motion: reduce) {
  html.haft-vol-scroll-ok .haft-volunteers-from-cta-flow:not(.is-haft-flow-visible) .haft-volunteer-team-plugin,
  html.haft-vol-scroll-ok .haft-volunteers-from-cta-flow:not(.is-haft-flow-visible) .volunteer-post-item {
    opacity: 1;
    transform: none;
  }

  .haft-volunteers-cta-bridge__line,
  .haft-volunteers-cta-bridge__particles,
  .haft-volunteers-cta-bridge__particles span {
    transition: none !important;
    transform: none !important;
    opacity: 1 !important;
  }

  .haft-volunteers-cta-bridge__line {
    transform: translateX(-50%) scaleX(1) !important;
  }

  .haft-volunteers-from-cta-flow .haft-volunteer-team-plugin,
  .haft-volunteers-from-cta-flow .volunteer-post-item {
    transition: none !important;
  }
}

/* Clickable cards (static template uses plain divs) */
.haft-volunteer-post-item {
  cursor: pointer;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.haft-volunteer-post-item:hover {
  box-shadow: 0 8px 32px rgba(21, 65, 104, 0.08);
}

.haft-volunteer-post-item:focus {
  outline: none;
}

.haft-volunteer-post-item:focus-visible {
  outline: 2px solid var(--color--secondary-color, #154168);
  outline-offset: 3px;
}

/* Fill card body so hint sits at bottom like a footer line */
.haft-volunteer-post-item .volunteer-post-content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.haft-volunteer-post-item .volunteer-post-content-wrap {
  flex: 1;
}

/* Photo placeholder when no image */
.haft-volunteer-post-item__placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 20px;
  background: linear-gradient(160deg, #edf2f8 0%, #f6f8fb 100%);
  border: 1px solid #e3e9f4;
  font-family: var(--font--heading, inherit);
  font-size: clamp(2rem, 8vw, 3rem);
  font-weight: 700;
  color: var(--color--secondary-color, #154168);
}

/* ——— Modal (portaled to body) ——— */
body.haft-volunteer-modal-open {
  overflow: hidden;
}

.haft-volunteer-modal[hidden] {
  display: none !important;
}

.haft-volunteer-modal:not([hidden]) {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 999999;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}

.haft-volunteer-modal__backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(12, 28, 48, 0.55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.haft-volunteer-modal__panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  width: min(calc(100vw - 1.75rem), 28rem);
  max-height: min(88vh, 40rem);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  border-radius: 1.35rem;
  box-shadow: 0 28px 90px rgba(10, 30, 50, 0.28);
  border: 1px solid #e3e9f4;
  padding: 1.65rem 1.5rem 1.5rem;
  outline: none;
  box-sizing: border-box;
}

.haft-volunteer-modal__close {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  z-index: 3;
  width: 2.65rem;
  height: 2.65rem;
  border: none;
  border-radius: 0.65rem;
  background: #f0f3f7;
  color: var(--color--heading-color, #1a1a1a);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease;
}

.haft-volunteer-modal__close:hover {
  background: var(--color--secondary-color, #154168);
  color: #fff;
}

.haft-volunteer-modal__layout {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  padding-top: 0.25rem;
}

@media screen and (min-width: 520px) {
  .haft-volunteer-modal__layout {
    flex-direction: row;
    align-items: flex-start;
    gap: 1.25rem;
  }

  .haft-volunteer-modal__photo {
    flex: 0 0 7.5rem;
    width: 7.5rem;
    max-width: none;
    margin: 0;
  }
}

.haft-volunteer-modal__photo {
  flex-shrink: 0;
  width: 100%;
  max-width: 11rem;
  margin: 0 auto;
  aspect-ratio: 1;
  border-radius: 1rem;
  overflow: hidden;
  background: linear-gradient(145deg, #e8eef6, #f3f6fa);
  border: 1px solid #e3e9f4;
}

.haft-volunteer-modal__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.haft-volunteer-modal__placeholder {
  width: 100%;
  height: 100%;
  min-height: 7.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font--heading, inherit);
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--color--secondary-color, #154168);
}

.haft-volunteer-modal__body {
  flex: 1;
  min-width: 0;
}

.haft-volunteer-modal__title {
  font-family: var(--font--heading, inherit);
  font-size: clamp(1.35rem, 4vw, 1.6rem);
  font-weight: 700;
  margin: 0 0 0.35rem;
  color: var(--color--heading-color, #1a1a1a);
  line-height: 1.2;
  padding-right: 2.75rem;
}

.haft-volunteer-modal__role {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color--secondary-color, #154168);
  margin: 0 0 0.85rem;
}

.haft-volunteer-modal__bio {
  font-size: 0.92rem;
  line-height: 1.62;
  color: var(--color--paragraph-color, #666);
  margin: 0 0 1.1rem;
}

.haft-volunteer-modal__contacts {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.haft-volunteer-modal__contacts[hidden],
.haft-volunteer-modal__row[hidden],
.haft-volunteer-modal__social[hidden],
.haft-volunteer-modal__social-link[hidden] {
  display: none !important;
}

.haft-volunteer-modal__row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-radius: 0.75rem;
  background: #f4f7fb;
  border: 1px solid #e3e9f4;
  text-decoration: none;
  color: var(--color--heading-color, #1a1a1a);
  font-size: 0.9rem;
  font-weight: 500;
  word-break: break-word;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.haft-volunteer-modal__row:hover {
  border-color: var(--color--secondary-color, #154168);
  background: rgba(21, 65, 104, 0.09);
}

.haft-volunteer-modal__row .haft-vol-svg {
  width: 1.6rem;
  height: 1.6rem;
  flex-shrink: 0;
  color: var(--color--secondary-color, #154168);
}

.haft-vol-svg {
  display: block;
}

.haft-volunteer-modal__social {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.haft-volunteer-modal__social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.15rem;
  height: 3.15rem;
  border-radius: 0.85rem;
  background: #fff;
  border: 1px solid #e3e9f4;
  color: var(--color--secondary-color, #154168);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.haft-volunteer-modal__social-link:hover {
  transform: translateY(-2px);
  border-color: var(--color--secondary-color, #154168);
  box-shadow: 0 6px 20px rgba(21, 65, 104, 0.12);
  background: rgba(21, 65, 104, 0.06);
}

.haft-volunteer-modal__social-link .haft-vol-svg--fb {
  width: 1.25rem;
  height: auto;
}

.haft-volunteer-modal__social-link .haft-vol-svg--ig,
.haft-volunteer-modal__social-link .haft-vol-svg--li {
  width: 1.5rem;
  height: 1.5rem;
}
