/* ==========================================================================
   ICCA Leadership (v2) — Styles
   Section 1: .icca-ld-map  (heading + bubble map)
   Section 2: .icca-ld-grid (filter pills + member cards with badges)
   All selectors are .icca-ld-* so nothing here touches the original
   .icca-team-* widgets (and vice versa).
   ========================================================================== */

.icca-ld-map,
.icca-ld-grid {
  --ld-bg: #f7f9fb;
  --ld-navy: #18304d;
  --ld-card-fg: #333232;
  --ld-muted: #e8f1f1;
  --ld-accent: #d7f0f2;
  --ld-accent-hover: #c0e5e9;
  --ld-primary: #358526;
  --ld-primary-hover: #4aa832;
  --ld-popover: #c9e3c1;
  --ld-font: "Montserrat", sans-serif;
  background: var(--ld-bg);
  font-family: var(--ld-font);
}

/* ── Section 1: Bubble map ───────────────────────────────────────────────── */

.icca-ld-map {
  padding: 64px 0;
  /* Static circles intentionally bleed past the edges (Figma clips them at the frame) */
  overflow: hidden;
  overflow: clip;
}

.icca-ld-map__inner {
  max-width: 1248px;
  margin: 0 auto;
  container-type: inline-size;
}

.icca-ld-map .icca-ld-map__heading {
  /* 96px on the 1248px Figma canvas, scaling down with the stage */
  font-family: var(--ld-font) !important;
  font-weight: 700 !important;
  font-size: min(96px, 7.6923cqi) !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  color: var(--ld-navy) !important;
  text-align: center;
  width: 83.33%;
  max-width: 1040px;
  margin: 0 auto !important;
  padding: 0 !important;
  position: relative;
  z-index: 0;
}

/* Stage = Figma "brand-logos" frame (1248×347). Every circle is positioned in %
   of this box, so the whole composition scales together at any width. */
.icca-ld-map__stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1248 / 347;
  container-type: inline-size;
}

.icca-ld-bubble {
  position: absolute;
  left: var(--dl);
  top: var(--dt);
  width: var(--ds);
  height: auto;
  aspect-ratio: 1 / 1;
  border-radius: 9999px;
  box-sizing: border-box;
}

.icca-ld-bubble--static {
  background: var(--ld-muted);
  pointer-events: none;
}

.icca-ld-bubble.is-mobile-only {
  display: none;
}

/* Interactive bubbles */
button.icca-ld-bubble {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1.2821cqi, 16px);
  padding: clamp(12px, 1.9231cqi, 24px) clamp(8px, 0.9615cqi, 12px);
  margin: 0;
  border: 0;
  cursor: pointer;
  color: var(--ld-card-fg);
  font-family: var(--ld-font);
  text-align: center;
  z-index: 1;
  box-shadow: 0 0 0 rgba(24, 48, 77, 0);
  animation:
    icca-ld-bubble-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) both,
    icca-ld-float var(--ld-float, 4.4s) ease-in-out 0.7s infinite;
  animation-delay: var(--ld-delay, 0s), var(--ld-float-delay, 0.7s);
  transition:
    scale 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.45s ease,
    filter 0.45s ease;
}

button.icca-ld-bubble:hover,
button.icca-ld-bubble.is-active {
  scale: 1.06;
  box-shadow: 0 18px 34px rgba(24, 48, 77, 0.16);
  z-index: 2;
}

button.icca-ld-bubble:focus-visible {
  outline: 3px solid var(--ld-navy);
  outline-offset: 4px;
}

.icca-ld-map__stage:has(button.icca-ld-bubble:hover) button.icca-ld-bubble:not(:hover) {
  filter: saturate(0.35);
}

.icca-ld-bubble--board { --ld-delay: 0.05s; --ld-float: 4.6s; --ld-float-delay: 0.8s; }
.icca-ld-bubble--chapter { --ld-delay: 0.15s; --ld-float: 4s; --ld-float-delay: 1.4s; }
.icca-ld-bubble--regional { --ld-delay: 0.25s; --ld-float: 4.8s; --ld-float-delay: 2.1s; }
.icca-ld-bubble--sector { --ld-delay: 0.35s; --ld-float: 3.8s; --ld-float-delay: 1.1s; }
.icca-ld-bubble--future { --ld-delay: 0.45s; --ld-float: 4.2s; --ld-float-delay: 2.6s; }

.icca-ld-bubble__name {
  display: block;
  max-width: 100%;
  font-size: clamp(12px, 1.2821cqi, 16px);
  font-weight: 700;
  line-height: 1.5;
  overflow-wrap: break-word;
}

/* Figma wraps "Future Leaders Council" one word per line */
.icca-ld-bubble--narrow .icca-ld-bubble__name {
  width: min-content;
}

.icca-ld-bubble__arrow {
  display: block;
  flex-shrink: 0;
  width: clamp(18px, 1.9231cqi, 24px) !important;
  height: auto !important;
  margin: 0 !important;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

button.icca-ld-bubble:hover .icca-ld-bubble__arrow,
button.icca-ld-bubble.is-active .icca-ld-bubble__arrow {
  transform: translate(3px, -3px);
}

/* Opacity only — a filled `filter` keyframe would override the hover desaturate */
@keyframes icca-ld-bubble-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes icca-ld-float {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -8px;
  }
}

/* ── Section 2: Member grid ──────────────────────────────────────────────── */

.icca-ld-grid {
  padding: 64px 0;
}

.icca-ld-grid__inner {
  position: relative;
  max-width: 1248px;
  margin: 0 auto;
}

.icca-ld-grid__head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  margin-bottom: 64px;
}

.icca-ld-grid .icca-ld-grid__heading {
  font-family: var(--ld-font) !important;
  font-weight: 700 !important;
  font-size: 48px !important;
  line-height: 1.1 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  color: var(--ld-navy) !important;
  text-align: center;
  margin: 0 !important;
  padding: 0 !important;
}

.icca-ld-grid__filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
}

.icca-ld-grid__filters:empty {
  display: none;
}

.icca-ld-pill {
  flex-shrink: 0;
  margin: 0;
  padding: 8px 20px;
  border: 0;
  border-radius: 9999px;
  background: var(--ld-accent);
  color: var(--ld-navy);
  font-family: var(--ld-font);
  font-size: 14px;
  font-weight: 700;
  line-height: 24px;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}

.icca-ld-pill:hover:not(.is-active) {
  background: var(--ld-accent-hover);
}

.icca-ld-pill.is-active {
  background: var(--ld-navy);
  color: var(--ld-muted);
}

.icca-ld-pill:focus-visible,
.icca-ld-page:focus-visible,
.icca-ld-card a:focus-visible {
  outline: 3px solid var(--ld-navy);
  outline-offset: 2px;
}

.icca-ld-grid__cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 64px 24px;
  min-height: 180px;
}

.icca-ld-grid__empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 40px 0;
  text-align: center;
  color: var(--ld-navy);
}

/* ── Card ────────────────────────────────────────────────────────────────── */
/* Figma "serviceItem": white panel with 8px corners (rounded-lg), a notch
   cut into the bottom-right that holds the 48px email button, and a soft
   navy drop shadow that follows the notched outline. */

.icca-ld-card {
  --notch-w: 58px;
  --notch-h: 59px;
  --card-radius: 8px;
  position: relative;
  z-index: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 32px 32px 32px;
  filter: drop-shadow(0 0 12.5px rgba(24, 48, 77, 0.13));
  animation: icca-ld-card-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--i, 0) * 0.05s);
}

.icca-ld-card.has-action {
  padding-bottom: 0;
}

/* Phone + email side by side: widen the notch by one button + gap (48 + 8) */
.icca-ld-card.has-two-actions {
  --notch-w: 114px;
}

.icca-ld-card__shape,
.icca-ld-card__shape::before,
.icca-ld-card__shape::after {
  position: absolute;
  pointer-events: none;
}

/* Plain rounded panel when there's no email button (no notch to cut) */
.icca-ld-card__shape {
  inset: 0;
  z-index: -1;
  background: #ffffff;
  border-radius: var(--card-radius);
}

.icca-ld-card.has-action .icca-ld-card__shape {
  border-radius: 0;
  /* Concave fillet where the notch meets the panel (Figma notch curve, 16px) */
  background: radial-gradient(circle at 100% 100%, transparent 15.5px, #ffffff 16px) no-repeat;
  background-size: 16px 16px;
  background-position: right calc(var(--notch-w) - 16px) bottom calc(var(--notch-h) - 16px);
}

.icca-ld-card.has-action .icca-ld-card__shape::before,
.icca-ld-card.has-action .icca-ld-card__shape::after {
  content: "";
  background: #ffffff;
}

/* Upper panel: full width, stops where the notch starts */
.icca-ld-card.has-action .icca-ld-card__shape::before {
  top: 0;
  left: 0;
  right: 0;
  bottom: var(--notch-h);
  border-radius: var(--card-radius) var(--card-radius) var(--card-radius) 0;
}

/* Lower-left panel: runs beside the notch down to the card bottom */
.icca-ld-card.has-action .icca-ld-card__shape::after {
  left: 0;
  right: var(--notch-w);
  bottom: 0;
  height: calc(var(--notch-h) + var(--card-radius));
  border-radius: 0 0 var(--card-radius) var(--card-radius);
}

.icca-ld-card__photo {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 24px;
  overflow: hidden;
  background-color: #61bb46;
}

.icca-ld-card__img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  object-fit: cover;
  margin: 0 !important;
  border-radius: 24px;
}

.icca-ld-card__linkedin {
  position: absolute;
  left: 24px;
  bottom: 24px;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  background: var(--ld-navy);
  transition: opacity 0.2s ease;
}

.icca-ld-card__linkedin:hover {
  opacity: 0.8;
}

.icca-ld-card__linkedin svg {
  display: block;
  width: 20px;
  height: 20px;
}

.icca-ld-card__body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.icca-ld-card__text {
  display: flex;
  flex-direction: column;
  color: var(--ld-navy);
  overflow-wrap: break-word;
}

.icca-ld-grid .icca-ld-card__name {
  margin: 0 !important;
  padding: 0 !important;
  font-family: var(--ld-font) !important;
  font-size: 18px !important;
  font-weight: 700 !important;
  line-height: 28px !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  color: var(--ld-navy) !important;
}

.icca-ld-grid .icca-ld-card__subtitle {
  margin: 0 !important;
  padding: 0 !important;
  font-family: var(--ld-font) !important;
  font-size: 12px !important;
  font-weight: 400 !important;
  line-height: 20px !important;
  color: var(--ld-navy) !important;
}

/* ── Badges (label_one / label_two / label_three) ────────────────────────── */

.icca-ld-grid .icca-ld-card__badges {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Single line like Figma (whitespace-nowrap). May use part of the card's 32px
   side padding; only a label wider than that gets an ellipsis. */
.icca-ld-grid .icca-ld-badge {
  max-width: calc(100% + 24px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0 !important;
  padding: 4px 16px !important;
  border-radius: 99px;
  font-family: var(--ld-font) !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  line-height: 20px !important;
  list-style: none;
}

.icca-ld-grid .icca-ld-badge::before,
.icca-ld-grid .icca-ld-badge::marker {
  content: none;
}

.icca-ld-badge--one {
  background: var(--ld-primary);
  color: var(--ld-muted);
}

.icca-ld-badge--two {
  background: var(--ld-popover);
  color: var(--ld-navy);
}

.icca-ld-badge--three {
  background: var(--ld-accent);
  color: var(--ld-navy);
}

/* ── Email button (sits in the notch) ────────────────────────────────────── */

.icca-ld-card__footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-right: -32px;
}

.icca-ld-card__email {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 9999px;
  background: var(--ld-primary);
  transition: background-color 0.2s ease;
}

.icca-ld-card__email:hover {
  background: var(--ld-primary-hover);
}

.icca-ld-card__email svg {
  display: block;
  width: 24px;
  height: 24px;
}

.icca-ld-card__phone img {
  display: block;
  width: 20px !important;
  height: 20px !important;
  margin: 0 !important;
}

@keyframes icca-ld-card-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ── Pagination ──────────────────────────────────────────────────────────── */

.icca-ld-grid__pagination {
  display: flex;
  justify-content: center;
  margin-top: 48px;
}

.icca-ld-grid__pagination:empty {
  display: none;
}

.icca-ld-pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.icca-ld-page {
  min-width: 44px;
  margin: 0;
  padding: 10px 16px;
  border: 0;
  border-radius: 9999px;
  background: var(--ld-accent);
  color: var(--ld-navy);
  font-family: var(--ld-font);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    opacity 0.2s ease;
}

.icca-ld-page:hover:not(:disabled):not(.is-active) {
  background: var(--ld-accent-hover);
}

.icca-ld-page.is-active {
  background: var(--ld-navy);
  color: var(--ld-muted);
}

.icca-ld-page:disabled {
  cursor: default;
  opacity: 0.45;
}

.icca-ld-page--nav {
  min-width: 90px;
}

/* ── Loading overlay ─────────────────────────────────────────────────────── */

.icca-ld-grid__loading {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(247, 249, 251, 0.82);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.icca-ld-grid.is-loading .icca-ld-grid__loading {
  opacity: 1;
  pointer-events: auto;
}

.icca-ld-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid var(--ld-accent);
  border-top-color: var(--ld-navy);
  border-radius: 50%;
  animation: icca-ld-spin 0.75s linear infinite;
}

@keyframes icca-ld-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Tablet + mobile (≤1024px): Figma mobile bubble layout ───────────────── */

@media (max-width: 1024px) {
  .icca-ld-map {
    padding: 32px 16px;
  }

  .icca-ld-map__inner {
    max-width: 520px;
    display: flex;
    flex-direction: column;
    gap: 40px;
  }

  .icca-ld-map .icca-ld-map__heading {
    width: 100%;
    font-size: clamp(40px, 12.2cqi, 64px) !important;
  }

  /* Figma mobile canvas: 361×420 (393 frame − 16px gutters) */
  .icca-ld-map__stage {
    aspect-ratio: 361 / 420;
  }

  .icca-ld-bubble {
    left: var(--ml);
    top: var(--mt);
    width: var(--ms);
  }

  .icca-ld-bubble.is-desktop-only {
    display: none;
  }

  .icca-ld-bubble.is-mobile-only {
    display: block;
  }

  button.icca-ld-bubble {
    gap: clamp(8px, 4.4321cqi, 16px);
    padding: 12px;
  }

  button.icca-ld-bubble.icca-ld-bubble--tight {
    gap: 1px;
  }

  .icca-ld-bubble__name {
    font-size: clamp(13px, 4.4321cqi, 16px);
  }

  .icca-ld-bubble__arrow {
    width: clamp(18px, 6.6482cqi, 24px) !important;
  }

  .icca-ld-grid {
    padding: 48px 16px;
  }

  .icca-ld-grid__cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
  }

  /* Pills scroll sideways instead of wrapping */
  .icca-ld-grid__head {
    align-items: stretch;
  }

  .icca-ld-grid__filters {
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 8px;
    margin: 0 -16px;
    padding: 0 16px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    cursor: grab;
  }

  .icca-ld-grid__filters::-webkit-scrollbar {
    display: none;
  }

  .icca-ld-grid__filters.is-dragging {
    cursor: grabbing;
    user-select: none;
  }

  .icca-ld-grid__pagination {
    margin-top: 32px;
  }

  .icca-ld-pagination {
    gap: 8px;
  }
}

@media (max-width: 600px) {
  .icca-ld-grid {
    padding: 56px 16px 72px;
  }

  .icca-ld-grid__cards {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Figma mobile card: notch is 63×62 */
  .icca-ld-card {
    --notch-w: 63px;
    --notch-h: 62px;
  }

  .icca-ld-page {
    min-width: 40px;
    padding: 10px 14px;
  }

  .icca-ld-page--nav {
    min-width: 78px;
  }
}

@media (prefers-reduced-motion: reduce) {
  button.icca-ld-bubble,
  .icca-ld-card {
    animation: none;
  }

  button.icca-ld-bubble,
  .icca-ld-bubble__arrow {
    transition: none;
  }
}
