/**
 * Study-abroad mirror: Unlimited Elements "Stacking Cards" — sticky stack + card layout
 * scoped to #living_in_italy, #study_in_germany (Study in Italy/Germany CPT). Emergency block inline <style> is
 * stripped server-side; emergency UI is fully styled here to match design reference.
 */

#living_in_italy,
#study_in_germany,
.elementor-widget-container:has(.ue_cards_wrapper) {
  overflow: visible;
}

#ke-wp-mirror-root .elementor-element:has(.ue_cards_wrapper) {
  overflow: visible;
}

[id^="uc_stacking_cards_elementor_"] {
  --ke-stack-top: clamp(72px, 11vh, 112px);
  --ke-card-accent: #e85d33;
  --ke-card-text: #1f2937;
  --ke-card-muted: #5b6472;
}

.ue_cards_wrapper {
  align-items: start;
  padding-bottom: calc(3 * var(--card-top-offset, 20px) + 4rem);
}

.ue_stacking_card_item {
  position: sticky;
  top: var(--ke-stack-top);
  align-self: start;
  width: 100%;
  max-width: min(1120px, 100%);
  margin-inline: auto;
  will-change: transform;
}

.ue_cards_wrapper > .ue_stacking_card_item:nth-child(1) {
  z-index: 1;
}
.ue_cards_wrapper > .ue_stacking_card_item:nth-child(2) {
  z-index: 2;
}
.ue_cards_wrapper > .ue_stacking_card_item:nth-child(3) {
  z-index: 3;
}
.ue_cards_wrapper > .ue_stacking_card_item:nth-child(4) {
  z-index: 4;
}
.ue_cards_wrapper > .ue_stacking_card_item:nth-child(5) {
  z-index: 5;
}
.ue_cards_wrapper > .ue_stacking_card_item:nth-child(6) {
  z-index: 6;
}

/* ----- All stacking cards: split layout + shell ----- */
.ue_card_content {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  overflow: hidden;
  border-radius: 22px;
  background: #fff;
  box-shadow:
    0 16px 48px rgba(15, 23, 42, 0.1),
    0 4px 14px rgba(15, 23, 42, 0.06);
}

.ue_content_left {
  flex: 1 1 52%;
  min-width: 0;
  padding: clamp(1.35rem, 3.2vw, 2.35rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.35rem;
}

/* Hide empty icon slot (widget outputs <i class=''></i>) */
.ue_sc_graphic_el:not(:has(i.fas)):not(:has(i.far)):not(:has(i.fab)):not(:has(svg)) {
  display: none;
}

.ue_sc_title {
  font-family: 'Montserrat', system-ui, -apple-system, sans-serif;
  font-size: clamp(1.45rem, 2.1vw, 1.95rem);
  font-weight: 700;
  color: var(--ke-card-accent);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 0.5rem;
}

.ueitem-3 .ue_sc_title {
  font-family: ui-serif, Georgia, Cambria, 'Times New Roman', serif;
  font-size: clamp(1.65rem, 2.4vw, 2.2rem);
}

.ue_sc_desc {
  font-family: 'Montserrat', system-ui, -apple-system, sans-serif;
  font-size: 0.95rem;
  line-height: 1.58;
  color: var(--ke-card-text);
  margin: 0;
}

.ue_sc_desc b {
  color: #111827;
  font-weight: 600;
}

.ue_card_content > figure {
  flex: 1 1 48%;
  margin: 0;
  padding: 0;
  min-height: 0;
  position: relative;
  background: #e5e7eb;
}

.ue_card_content > figure .ue_sc_img {
  width: 100%;
  height: 100%;
  min-height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* ----- Emergency Contacts (embedded list; head styles removed at render) ----- */
.ue_sc_desc .emergency-numbers-section-compact {
  background: transparent;
  padding: 0;
  margin: 0;
  width: 100%;
  box-sizing: border-box;
  font-family: 'Montserrat', system-ui, -apple-system, sans-serif;
}

.ue_sc_desc .emergency-container-compact {
  max-width: none;
  margin: 0;
  padding: 0;
}

.ue_sc_desc .emergency-intro-text-compact {
  text-align: left;
  color: var(--ke-card-muted);
  font-size: 0.98rem;
  line-height: 1.55;
  margin: 0 0 1.1rem;
}

.ue_sc_desc .emergency-list-container {
  list-style: none;
  padding: 0;
  margin: 0;
}

.ue_sc_desc .emergency-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  margin-bottom: 0.65rem;
  background: #fff;
  border: 1px solid #eceef2;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
  transition:
    background-color 0.2s ease,
    box-shadow 0.2s ease;
}

.ue_sc_desc .emergency-list-item:last-child {
  margin-bottom: 0;
}

.ue_sc_desc .emergency-list-item:hover {
  background: #fafafa;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
}

.ue_sc_desc .emergency-list-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.ue_sc_desc .emergency-list-icon {
  flex-shrink: 0;
  width: 28px;
  text-align: center;
  font-size: 1.15rem;
  color: var(--ke-card-accent);
}

.ue_sc_desc .emergency-list-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.ue_sc_desc .emergency-service-name-compact {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ke-card-text);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ue_sc_desc .emergency-number-compact {
  font-size: 1.2rem;
  font-weight: 700;
  color: #111827;
  line-height: 1.2;
}

.ue_sc_desc .copy-button-compact {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}

.ue_sc_desc .copy-button-compact:hover {
  background: #f1f5f9;
  color: #64748b;
}

.ue_sc_desc .copy-button-compact:focus-visible {
  outline: 2px solid var(--ke-card-accent);
  outline-offset: 2px;
}

.ue_sc_desc .copy-button-compact.copied {
  background: #24ae5e;
  color: #fff;
}

@media (max-width: 767px) {
  [id^="uc_stacking_cards_elementor_"] {
    --ke-stack-top: clamp(56px, 9vh, 88px);
  }

  .ue_card_content {
    flex-direction: column;
  }

  .ue_content_left {
    flex: 1 1 auto;
    order: 2;
    padding: clamp(1.1rem, 4vw, 1.5rem);
  }

  .ue_card_content > figure {
    flex: 0 0 auto;
    order: 1;
    width: 100%;
    min-height: 220px;
    max-height: 42vh;
  }

  .ue_sc_desc .emergency-service-name-compact {
    white-space: normal;
  }
}
